input
stringlengths
10
828
output
stringlengths
5
107
public void redeploy url url throws deployment exception deployment info sdi get deployment url if sdi null redeploy sdi else deploy url end of else
describe code redeploy code method here
public void set num times to attempt mbean reregister int num times to attempt mbean reregister m num times to attempt mbean reregister math min num times to attempt mbean reregister max num times to attempt mbean reregister
sets the number of times to attempt mbean reregister
public void redeploy deployment info sdi throws deployment exception try undeploy sdi catch throwable t log info throwable from undeployment attempt t end of try catch deploy sdi
describe code redeploy code method here
public void set num times to attempt agent restart int num times to attempt agent restart m num times to attempt agent restart math min num times to attempt agent restart max num times to attempt agent restart
sets the number of times to attempt agent restart
private properties get constructor parameter properties return m constructor parameter properties
gets the constructor parameters properties
public void undeploy url url throws deployment exception deployment info sdi get deployment url if sdi null undeploy sdi
the code undeploy code method undeploys a package identified by a url
public void set num times to attempt machine restart int num times to attempt machine restart m num times to attempt machine restart math min num times to attempt machine restart max num times to attempt machine restart
sets the number of times to attempt machine restart
private activation group id get current activation group id return m current activation group id
gets the current activation group id
private string get node value node node if node null return null string val node get node value if val null return null if val val trim length 0 return null return val
extract a string from a node
public int get max num times to attempt mbean restart return max num times to attempt mbean restart
gets the maximum number of times to attempt an mbean restart
public void undeploy deployment info di undeploy di false
the code undeploy code method undeploys a package represented by a
private url to url string value throws malformed urlexception try return new url value catch malformed urlexception e file file new file value if file is absolute file new file server home value try file file get canonical file catch ioexception ioe throw new malformed urlexception can not obtain file ioe return file to url
convert a string to a node
protected url make url string urlspec throws malformed urlexception first replace url with appropriate properties urlspec org elba util strings replace properties urlspec return new url server home url urlspec
a helper to make a url from a full url or a filespec
private list get marshalled object constructor parameters return m marshalled object constructor parameters
gets the constructor parameters of the marshalled object
public int get max num times to attempt mbean reregister return max num times to attempt mbean reregister
gets the maximum number of times to attempt an mbean reregister
protected http lister get default http directory lister if default http lister null default http lister new http lister get default http directory download url get default http directory lister url return this default http lister
default lister object when no other lister is specified in the urls
private list get marshalled object constructor signature return m marshalled object constructor signature
gets the constructor signature of the marshalled object
public int get max num times to attempt agent restart return max num times to attempt agent restart
gets the maximum number of times to attempt an agent restart
private void stop deployment info di first stop this deployment itself try tell the respective deployer to undeploy this one if di deployer null di deployer stop di catch throwable t log error undeployment failed di url t then stop all sub deployments array list reverse sorted subs new array list di sub deployments collections sort reverse sorted subs info sorter collections reverse reverse sorted subs for iterator subs reverse sorted subs iterator subs has next deployment info sub deployment info subs next log debug stopping sub deployment sub url stop sub
the code stop code method is the first internal step of undeployment
protected void deploy final deployed url du if the deployer is null simply ignore the request if deployer null return if log is trace enabled log trace deploying du try deployer deploy du url catch incomplete deployment exception e last incomplete deployment exception e catch exception e log error failed to deploy du e end of try catch du deployed if deployed set contains du deployed set add du
a helper to deploy the given url with the deployer
protected void undeploy final deployed url du try if log is trace enabled log trace undeploying du deployer undeploy du url deployed set remove du catch exception e log error failed to undeploy du e
a helper to undeploy the given url from the deployer
public void scan if get log is trace enabled get log trace scanning url url check time stamps if last modified get last modified if exists url needs deploy redeploy try get log debug deploying modified or new url url deploy catch deployment exception e get log error failed to re deploy url url e else url does not exist undeploy try get log debug undeploying url url undeploy catch deployment exception e get log error failed to undeploy url url e
check the url for modification and deploy redeploy undeploy
public int get max num times to attempt machine restart return max num times to attempt machine restart
gets the maximum number of times to attempt a machine restart
protected boolean is deployed final url url deployed url du new deployed url url return deployed set contains du
checks if the url is in the deployed set
private marshalled object get current marshalled object return m current marshalled object
gets the current marshalled object
private boolean exists try if url get protocol equals file file file new file url get path return file exists else url open stream close return true catch ioexception e return false
return true if the url exists false otherwise
private long get last modified try url lm url watch url null url watch url return lm url open connection get last modified catch ioexception e return 0 l
return the modification date of watch url
public void set scan period final long period if period 0 throw new illegal argument exception scan period must be 0 have period this scan period set period
period must be 0
private void undeploy throws deployment exception if deployed return get deployer obj undeploy url reset the other fields deployed false last modified 0 l watch url null
undeploy the url if deployed
public void deploy url url throws deployment exception deployment info sdi get deployment url if it does not exist create a new deployment if sdi null sdi new deployment info url null get server deploy sdi if sdi state deployment state started check incomplete deployments
the code deploy code method deploys a package identified by a url
public int compare object o1 object o2 int comp get prefix value url o1 get prefix value url o2 return comp 0 sorter compare o1 o2 comp
as described in
public object name pre register mbean server server object name name m server server try m server add notification listener new object name com sun management jmx service name delegate this null local catch instance not found exception infe catch malformed object name exception mone m object name name return name
pre registers this mbean
public file get directory return this dir
returns the local directory where cache data is stored
public void set directory name string dirname throws ioexception if dirname null throw new null argument exception dirname set directory new file dirname
set the name of the local directory where cache data will be stored
public string get directory name return dir get absolute path
get the name of the local directory where cache data is stored
protected void start service throws exception register with the main deployer main deployer add deployer this
performs sub deployer registration
protected void copy url final url source final file dest throws ioexception input stream is new buffered input stream source open connection get input stream output stream os new buffered output stream new file output stream dest try streams copy is os os flush finally os close is close
copy the data at the given source url to the given file
protected map read map throws class not found exception ioexception if map file exists map map input stream is new buffered input stream new file input stream map file object input stream ois new object input stream is try map map ois read object finally ois close return map else log debug map file not found creating new map return new hash map
read the url map from serialized state
public collection get mbeans waiting for classes return mbeans waiting for classes
get the mbeans waiting for classes value
protected void stop service throws exception unregister with the main deployer main deployer remove deployer this
performs sub deployer deregistration
public collection get mbeans waiting for depends return mbeans waiting for depends
get the mbeans waiting for depends value
protected void write map throws ioexception output stream os new buffered output stream new file output stream map file object output stream oos new object output stream os try oos write object url map oos flush finally oos close
write the url map to serialized state
public collection get incomplete packages return incomplete packages
get the incomplete packages value
public collection get waiting for deployer return waiting for deployer
get the waiting for deployer value
private object read resolve throws object stream exception object identity get deployment state state return identity
resolve objects on deserialization to one of the identity objects
protected void create service throws exception if dir null throw new configuration exception missing attribute directory read the map if there is one url map read map
setup the url map
public input source resolve entity string public id string system id has dtd false string dtd null if public id null dtd string dtds get public id if dtd null has dtd true try class loader loader thread current thread get context class loader the dtds are expected to be in the org elba metadata package string dtd resource org elba metadata dtd input stream dtd stream loader get resource as stream dtd resource input source a input source new input source dtd stream return a input source catch exception ignore return null
returns dtd input source
public string get name todo check if this gets called often if so cache this or remove if not used use the logger so we can better be used as a delegate instead of sub class return org elba util classes strip package name log get name
use the short class name as the default for the service name
public void init deployment info di throws deployment exception process nested deployments di issue the sub deployer init notification notification msg new notification sub deployer init notification this get next notification sequence number msg set user data di send notification msg
sub classes should override this method to provide
public void create deployment info di throws deployment exception issue the sub deployer create notification notification msg new notification sub deployer create notification this get next notification sequence number msg set user data di send notification msg
sub classes should override this method to provide
public void init final properties props throws illegal state exception exception if props null throw new illegal argument exception props is null if config null throw new illegal state exception already initialized class loader old cl thread current thread get context class loader try thread current thread set context class loader get class get class loader do init props finally thread current thread set context class loader old cl
initialize the server instance
public void start deployment info di throws deployment exception issue the sub deployer start notification notification msg new notification sub deployer start notification this get next notification sequence number msg set user data di send notification msg
sub classes should override this method to provide
public void stop deployment info di throws deployment exception issue the sub deployer start notification notification msg new notification sub deployer stop notification this get next notification sequence number msg set user data di send notification msg
sub classes should override this method to provide
public void destroy deployment info di throws deployment exception issue the sub deployer destroy notification notification msg new notification sub deployer destroy notification this get next notification sequence number msg set user data di send notification msg
sub classes should override this method to provide
private void init urlhandlers if config get require elba urlstream handler factory internal init urlhandlers end of if else try internal init urlhandlers catch security exception e log warn you do not have permissions to set urlstream handler factory e end of try catch catch error e log warn urlstream handler factory already set e end of catch end of else
the code init urlhandlers code method calls
private void internal init urlhandlers install a urlstream handler factory that uses the tcl url set urlstream handler factory new urlstream handler factory preload elba url handlers urlstream handler factory preload include the default elba protocol handler package string handler pkgs system get property java protocol handler pkgs if handler pkgs null handler pkgs org elba net protocol else handler pkgs org elba net protocol system set property java protocol handler pkgs handler pkgs
set up our only urlstream handler factory
protected boolean is deployable string name url url return name ends with jar name ends with sar name ends with ear name ends with rar name ends with zip name ends with wsr name ends with war name ends with bsh name ends with ds xml name ends with last name ends with service xml url get path index of meta inf 1 name ends with native suffix name starts with native prefix
this method returns true if the name is a recognized archive file
protected long get next notification sequence number return sequence number increment
the code get next notification sequence number code method returns
public server config get config throws illegal state exception if config null throw new illegal state exception not initialized return config
get the typed server configuration object which the
public void dispatch event watchdog event watchdog event if m watchdog event manager remote interface null try m watchdog event manager remote interface publish event watchdog event catch remote exception re
dispatch a watchdgo event to all watchdog listener listening
protected void create service throws exception
sub classes should override this method to provide
protected void start service throws exception
sub classes should override this method to provide
protected void stop service throws exception
sub classes should override this method to provide
protected void destroy service throws exception
sub classes should override this method to provide
public void add library final string filename throws malformed urlexception if filename null throw new illegal argument exception filename is null extra classpath add new url library url filename
add an extra library to the end of list of libraries
public void add libraries final string filenames throws malformed urlexception if filenames null throw new illegal argument exception filenames is null string tokenizer stok new string tokenizer filenames while stok has more elements add library stok next token trim
add a list of comma seperated library file names
public file get home dir return home dir
get the local home directory which the server is running from
public void add url final url url if url null throw new illegal argument exception url is null extra classpath add url
add an extra url to the classpath used to load the server
protected url get url final string name throws malformed urlexception string value props get property name null if value null if value ends with value return new url value return null
get a url from configuration or system properties
public url get library url if library url null try library url get url server config library url if library url null library url new url home url server config library url suffix system set property server config library url library url to string catch malformed urlexception e throw new nested runtime exception e return library url
get the home url which the server is running from
protected server create server final string typename final class loader class loader throws exception load the class first class type class loader load class typename and then create a new instance server server server type new instance here ya go return server
construct a new instance of server loading all required classes from
public url get patch url if patch url null try patch url get url server config patch url if patch url null patch url null value else system set property server config patch url patch url to string catch malformed urlexception e throw new nested runtime exception e if patch url null value return null return url patch url
get the patch url for the server
public string get server name if server name null server name props get property server config server name server config default server name system set property server config server name server name return server name
get the name of the server
public file get server base dir if server base dir null server base dir get file server config server base dir if server base dir null server base dir new file home dir server config server base dir suffix system set property server config server base dir server base dir to string return server base dir
get the base directory for calculating server home directories
public file get server home dir if server home dir null server home dir get file server config server home dir if server home dir null server home dir new file get server base dir get server name system set property server config server home dir server home dir to string return server home dir
get the server home directory
public boolean is deployed url url deployment info di get deployment url if di null return false end of if return di state deployment state started
the code is deployed code method tells you if a packaged identified by
public file get server temp dir if server temp dir null server temp dir get file server config server temp dir if server temp dir null server temp dir new file get server home dir server config server temp dir suffix system set property server config server temp dir server temp dir to string return server temp dir
get the directory where temporary files will be stored
public list list deployed return new array list installed services
lists the service contexts of deployed mbeans
public file get server data dir if server data dir null server data dir get file server config server data dir if server data dir null server data dir new file get server home dir server config server data dir suffix system set property server config server data dir server data dir to string return server data dir
get the directory where local data will be stored
public url get server base url if server base url null try server base url get url server config server base url if server base url null server base url new url home url server config server base url suffix system set property server config server base url server base url to string catch malformed urlexception e throw new nested runtime exception e return server base url
get the base directory for calculating server home urls
public url get server home url if server home url null try server home url get url server config server home url if server home url null server home url new url get server base url get server name system set property server config server home url server home url to string catch malformed urlexception e throw new nested runtime exception e return server home url
get the server home url
private void start watching throws remote exception jmexception naming exception log debug start watching synchronized m watching start stop lock if is watching start mirroring update time started watching initialise corrective actions set is watching true set watching thread new thread new runnable public void run do watching m object name to string get watching thread start log debug start watching done
start watching the jmx agent
public list list incompletely deployed list id new array list for iterator i installed services iterator i has next service context sc service context i next if sc state service context running id add sc end of if end of for return id
the code list incompletely deployed code method returns the service contexts for
public url get server library url if server library url null try server library url get url server config server library url if server library url null server library url new url get server home url server config library url suffix system set property server config server library url server library url to string catch malformed urlexception e throw new nested runtime exception e return server library url
get the server library url
public deployment info get deployment url url synchronized deployment list return deployment info deployment map get url
the code get deployment code method returns the deployment info
public url get server config url if server config url null try server config url get url server config server config url if server config url null server config url new url get server home url server config server config url suffix system set property server config server config url server config url to string catch malformed urlexception e throw new nested runtime exception e return server config url
get the server configuration url
public void set exit on shutdown final boolean flag if exit on shutdown null exit on shutdown new mu boolean flag else exit on shutdown set flag
enable or disable exiting the jvm when
public list list deployed names list names new array list installed services size for iterator i installed services iterator i has next service context ctx service context i next names add ctx object name end of for return names
lists object names of deployed mbeans deployed through service controller
public boolean get exit on shutdown if exit on shutdown null string value props get property server config exit on shutdown null if value null exit on shutdown new mu boolean server config default exit on shutdown else exit on shutdown new mu boolean value return exit on shutdown get
get the current value of the exit on shutdown flag
public void set blocking shutdown final boolean flag if blocking shutdown null blocking shutdown new mu boolean flag else blocking shutdown set flag
enable or disable blocking when
public string list configuration object name object names throws exception return configurator get configuration object names
gets the configuration attribute of the service controller object
public long get max memory if java is compatible java version 1 4 uncomment when jdk 1 4 is the base jvm return new long runtime get runtime max memory until then use reflection to do the job try runtime rt runtime get runtime method m rt get class get method max memory new class 0 return long m invoke rt new object 0 catch exception e log error operation failed e return new long 1
returns tt runtime
public url get watch url url url deployment info info get deployment url return info null null info watch
the code get watch url code method returns the url that when modified
public boolean get blocking shutdown if blocking shutdown null string value props get property server config blocking shutdown null if value null blocking shutdown new mu boolean server config default blocking shutdown else blocking shutdown new mu boolean value return blocking shutdown get
get the current value of the blocking shutdown flag
public void exit final int exitcode start in new thread so that we might have a chance to give positive feed back to requesting client of success new thread public void run log info shutting down the jvm now runtime get runtime exit exitcode start
shutdown the server the jvm and run shutdown hooks
public void set require elba urlstream handler factory final boolean flag if require elba urlstream handler factory null require elba urlstream handler factory new mu boolean flag else require elba urlstream handler factory set flag
set the require elba urlstream handler factory flag
public integer get available processors if java is compatible java version 1 4 uncomment when jdk 1 4 is the base jvm return new integer runtime get runtime available processors until then use reflection to do the job try runtime rt runtime get runtime method m rt get class get method available processors new class 0 return integer m invoke rt new object 0 catch exception e log error operation failed e return new integer 1
returns tt runtime
public list list waiting mbeans throws exception return new array list waiting configs key set
the code list waiting mbeans code method returns a list
public boolean get require elba urlstream handler factory if require elba urlstream handler factory null string value props get property server config require elba url stream handler factory null if value null require elba urlstream handler factory new mu boolean server config default require elba url stream handler factory else require elba urlstream handler factory new mu boolean value return require elba urlstream handler factory get
get the current value of the require elba urlstream handler factory flag
public string get host name if host name null try host name java net inet address get local host get host name catch java net unknown host exception e log error error looking up local hostname e host name unknown return host name
returns inet address