jrunx.kernel.agents
Class JRunAdminService

jrunx.kernel.ServiceAdapter
  |
  +--jrunx.kernel.agents.JRunAdminService
All Implemented Interfaces:
JRunAdminServiceMBean, javax.naming.Referenceable, java.io.Serializable, Service, ServiceMBean

public class JRunAdminService
extends ServiceAdapter
implements JRunAdminServiceMBean

This service is capable of calling MBeanServer methods on the server using delegation to the local MBeanServer. Instead of invoking it directly on the server, which is not available to remote administrator code, remote code can invoke the MBeanServer method on this remotable service, which will then delegate the invocation to its local MBeanServer.

Author:
PS Neville, Daiji Takamori
See Also:
Serialized Form

Fields inherited from class jrunx.kernel.ServiceAdapter
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER
 
Fields inherited from interface jrunx.kernel.agents.JRunAdminServiceMBean
OBJECT_NAME
 
Fields inherited from interface jrunx.kernel.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
JRunAdminService()
           
 
Method Summary
 void addOfflineServicePropertyValue(java.lang.String serverName, java.lang.String servicePath, java.lang.String attribute, java.lang.String value)
          Allow adding a new offline property value for .xml files for properties which have more than one value
 void addServer(java.lang.String serverName, java.lang.String serverPath)
          Adds a pre-existing server directory
 void createServer(java.lang.String serverName, java.lang.String serverPath, java.lang.String templatePath)
          Creates a new server directory
 void createService(java.lang.String parentServicePath, java.lang.String className, java.lang.String name, java.util.HashMap attributes)
          Allow creation of service metadata directly upon the file for the current server
 void deleteServer(java.lang.String serverName, boolean removeDirectory)
          Deletes a server directory
 long fileLength(java.lang.String serverName, java.lang.String path)
          Returns the size of the file refered to by the specified path
 java.net.URL fileToURL(java.lang.String path)
          Returns the URL for this server for the specified file path
 java.lang.String getAbsolutePath(java.lang.String serverName, java.lang.String path)
          Returns the absolute path to the specified path string, with all variables resolved
 java.lang.Object getAttribute(javax.management.ObjectName objectName, java.lang.String attributeName)
          Follow the standard JMX API for getting MBean attributes
 java.util.List getAttributes(javax.management.ObjectName objectName, java.lang.String[] attributeNames)
          Follow the standard JMX API for getting MBean attributes
 java.lang.String getFileName(java.lang.String serverName, java.lang.String path)
          Returns the actual name of the file referenced by the path
 long getFreeMemory()
           
 java.lang.String getJVMConfigProperty(java.lang.String property)
           
 javax.management.MBeanInfo getMBeanInfo(javax.management.ObjectName objectName)
          Follow the standard JMX API for getting MBeanInfo
 java.lang.String getOfflineJNDIProperty(java.lang.String serverName, java.lang.String property)
          Allow retrieval of offline property values for .properties files
 java.lang.String getOfflineServiceProperty(java.lang.String serverName, java.lang.String servicePath, java.lang.String attribute)
          Allow retrieval of offline property values for .xml files for properties which have only one value
 java.util.List getOfflineServicePropertyValues(java.lang.String serverName, java.lang.String servicePath, java.lang.String attribute)
          Allow retrieving all offline property values for .xml files for properties which have more than one value
 java.util.List getOfflineServices(java.lang.String serverName, java.lang.String servicePath, java.lang.String classname, boolean recurseServices)
          Retrieves the services in jrun.xml under the specified path that specify the given classname.
 java.lang.String getParentFile(java.lang.String serverName, java.lang.String path)
          Returns the path to the parent of the specified path
 java.lang.String getServerMetadataAttribute(java.lang.String serverName, java.lang.String property)
           
 java.lang.String getServerPath(java.lang.String serverName)
          Returns the server directory for a given server
 long getTotalMemory()
          Get free/total memory of the Server VM.
 java.lang.Object invoke(javax.management.ObjectName objectName, java.lang.String methodName, java.lang.Object[] args, java.lang.String[] argTypes)
          Follow the standard JMX API for invoking MBean methods
 boolean isDirectory(java.lang.String serverName, java.lang.String path)
          Indicates whether a path refers to a directory
 boolean isRegistered(javax.management.ObjectName objectName)
          Follow the standard JMX API for checking whether an MBean is registered
 long lastModified(java.lang.String serverName, java.lang.String path)
          Returns the last modified timestamp of the specified path
 java.lang.String[] listFiles(java.lang.String serverName, java.lang.String path)
          Returns a list of files located at the given path
 java.lang.String[] listReadOnlyFiles(java.lang.String serverName, java.lang.String path)
          Recursively lists all read-only files of a given directory
 java.lang.String[] listRoots()
          List the available drives for this JVM.
 java.lang.String[] listRoots(long millisTimeout)
           
 int[] listServerPortsUsed(java.lang.String serverName)
           
 java.util.List listServers()
          Returns a list of the servers defined for this machine
 boolean pathExists(java.lang.String serverName, java.lang.String path)
          Indicates whether a directory exists
 java.util.Set queryMBeans(javax.management.ObjectName objectName, jrunx.kernel.agents.QueryExp query)
          Follow the standard JMX API for querying MBean instances
 FileView readFile(java.lang.String serverName, java.lang.String path, FileView viewer)
          Reads the specified file using the specified viewer, and returns the results in the viewer data structure.
 void removeAllOfflineServicePropertyValues(java.lang.String serverName, java.lang.String servicePath, java.lang.String attribute)
          Allow removing all offline property values for .xml files for properties which have more than one value
 void removeOfflineServicePropertyValue(java.lang.String serverName, java.lang.String servicePath, java.lang.String attribute, java.lang.String value)
          Allow removing an offline property value for .xml files for properties which have more than one value
 void removeService(java.lang.String servicePath)
          Allow removal of service metadata directly upon the file for the current server
 void restartServer(java.lang.String serverName)
          Tells the Launcher to restart a server
 int serverStatus()
           
 java.lang.Boolean serverStatus(java.lang.String serverName)
          Check if server is running
 void setAttribute(javax.management.ObjectName objectName, javax.management.Attribute attribute)
          Follow the standard JMX API for setting MBean attributes
 void setAttributes(javax.management.ObjectName objectName, jrunx.kernel.agents.AttributeList attributes)
          Follow the standard JMX API for setting MBean attributes
 void setJVMConfigProperty(java.lang.String property, java.lang.String value)
           
 void setOfflineJNDIProperty(java.lang.String serverName, java.lang.String property, java.lang.String value)
          Allow offline property value modification for .properties files
 void setOfflineServiceProperty(java.lang.String serverName, java.lang.String servicePath, java.lang.String attribute, java.lang.String value)
          Allow offline property value modification for .xml files for properties which have only one value
 void setServerMetadataAttribute(java.lang.String serverName, java.lang.String property, java.lang.String value)
           
 void startServer(java.lang.String serverName)
          Tells the Launcher to start a server
 void stopServer(java.lang.String serverName)
          Tells the Launcher to stop a server
 void testDataSource(java.lang.String dataSourceName)
          Verify whether the connection to a data source is still open
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, destroy, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, init, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, start, stop, toString, unbind, unscheduleRunnable, updateStatus
 
Methods inherited from interface jrunx.kernel.ServiceMBean
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind
 
Methods inherited from interface jrunx.kernel.Service
destroy, getStatus, init, start, stop, updateStatus
 

Constructor Detail

JRunAdminService

public JRunAdminService()
Method Detail

getTotalMemory

public long getTotalMemory()
Description copied from interface: JRunAdminServiceMBean
Get free/total memory of the Server VM.
Specified by:
getTotalMemory in interface JRunAdminServiceMBean

getFreeMemory

public long getFreeMemory()
Specified by:
getFreeMemory in interface JRunAdminServiceMBean

invoke

public java.lang.Object invoke(javax.management.ObjectName objectName,
                               java.lang.String methodName,
                               java.lang.Object[] args,
                               java.lang.String[] argTypes)
                        throws java.lang.Exception
Follow the standard JMX API for invoking MBean methods
Specified by:
invoke in interface JRunAdminServiceMBean

getAttribute

public java.lang.Object getAttribute(javax.management.ObjectName objectName,
                                     java.lang.String attributeName)
                              throws java.lang.Exception
Follow the standard JMX API for getting MBean attributes
Specified by:
getAttribute in interface JRunAdminServiceMBean

getAttributes

public java.util.List getAttributes(javax.management.ObjectName objectName,
                                    java.lang.String[] attributeNames)
                             throws java.lang.Exception
Follow the standard JMX API for getting MBean attributes
Specified by:
getAttributes in interface JRunAdminServiceMBean

setAttributes

public void setAttributes(javax.management.ObjectName objectName,
                          jrunx.kernel.agents.AttributeList attributes)
                   throws java.lang.Exception
Follow the standard JMX API for setting MBean attributes
Specified by:
setAttributes in interface JRunAdminServiceMBean

setAttribute

public void setAttribute(javax.management.ObjectName objectName,
                         javax.management.Attribute attribute)
                  throws java.lang.Exception
Follow the standard JMX API for setting MBean attributes
Specified by:
setAttribute in interface JRunAdminServiceMBean

queryMBeans

public java.util.Set queryMBeans(javax.management.ObjectName objectName,
                                 jrunx.kernel.agents.QueryExp query)
                          throws java.lang.Exception
Follow the standard JMX API for querying MBean instances
Specified by:
queryMBeans in interface JRunAdminServiceMBean

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo(javax.management.ObjectName objectName)
                                        throws java.lang.Exception
Follow the standard JMX API for getting MBeanInfo
Specified by:
getMBeanInfo in interface JRunAdminServiceMBean

isRegistered

public boolean isRegistered(javax.management.ObjectName objectName)
                     throws javax.management.RuntimeOperationsException
Follow the standard JMX API for checking whether an MBean is registered
Specified by:
isRegistered in interface JRunAdminServiceMBean

listRoots

public java.lang.String[] listRoots()
List the available drives for this JVM. This method is an abstraction for listing the available filesystem drives. JDK 1.2 provides the listRoots method, but we're not using that and using the 1.1 algorithm of searching through all drives (C: - Z:) instead. Note: This method will not return any disk drives
Specified by:
listRoots in interface JRunAdminServiceMBean

listRoots

public java.lang.String[] listRoots(long millisTimeout)
Specified by:
listRoots in interface JRunAdminServiceMBean

getAbsolutePath

public java.lang.String getAbsolutePath(java.lang.String serverName,
                                        java.lang.String path)
Returns the absolute path to the specified path string, with all variables resolved
Specified by:
getAbsolutePath in interface JRunAdminServiceMBean

pathExists

public boolean pathExists(java.lang.String serverName,
                          java.lang.String path)
Indicates whether a directory exists
Specified by:
pathExists in interface JRunAdminServiceMBean

isDirectory

public boolean isDirectory(java.lang.String serverName,
                           java.lang.String path)
Indicates whether a path refers to a directory
Specified by:
isDirectory in interface JRunAdminServiceMBean

getFileName

public java.lang.String getFileName(java.lang.String serverName,
                                    java.lang.String path)
Returns the actual name of the file referenced by the path
Specified by:
getFileName in interface JRunAdminServiceMBean

getParentFile

public java.lang.String getParentFile(java.lang.String serverName,
                                      java.lang.String path)
Returns the path to the parent of the specified path
Specified by:
getParentFile in interface JRunAdminServiceMBean

listFiles

public java.lang.String[] listFiles(java.lang.String serverName,
                                    java.lang.String path)
Returns a list of files located at the given path
Specified by:
listFiles in interface JRunAdminServiceMBean

lastModified

public long lastModified(java.lang.String serverName,
                         java.lang.String path)
Returns the last modified timestamp of the specified path
Specified by:
lastModified in interface JRunAdminServiceMBean

fileLength

public long fileLength(java.lang.String serverName,
                       java.lang.String path)
Returns the size of the file refered to by the specified path
Specified by:
fileLength in interface JRunAdminServiceMBean

listReadOnlyFiles

public java.lang.String[] listReadOnlyFiles(java.lang.String serverName,
                                            java.lang.String path)
Recursively lists all read-only files of a given directory
Specified by:
listReadOnlyFiles in interface JRunAdminServiceMBean

fileToURL

public java.net.URL fileToURL(java.lang.String path)
                       throws java.net.MalformedURLException
Returns the URL for this server for the specified file path
Specified by:
fileToURL in interface JRunAdminServiceMBean

listServers

public java.util.List listServers()
                           throws java.lang.Exception
Returns a list of the servers defined for this machine
Specified by:
listServers in interface JRunAdminServiceMBean

getServerPath

public java.lang.String getServerPath(java.lang.String serverName)
Returns the server directory for a given server
Specified by:
getServerPath in interface JRunAdminServiceMBean

createServer

public void createServer(java.lang.String serverName,
                         java.lang.String serverPath,
                         java.lang.String templatePath)
                  throws java.lang.Exception
Creates a new server directory
Specified by:
createServer in interface JRunAdminServiceMBean
Parameters:
serverName - the name of the server
serverPath - the path of the new server directory
templatePath - the path of a template server

addServer

public void addServer(java.lang.String serverName,
                      java.lang.String serverPath)
               throws java.lang.Exception
Adds a pre-existing server directory
Specified by:
addServer in interface JRunAdminServiceMBean
Parameters:
serverName - the name of the server
serverPath - the path of the server directory

deleteServer

public void deleteServer(java.lang.String serverName,
                         boolean removeDirectory)
                  throws java.lang.Exception
Deletes a server directory
Specified by:
deleteServer in interface JRunAdminServiceMBean

getServerMetadataAttribute

public java.lang.String getServerMetadataAttribute(java.lang.String serverName,
                                                   java.lang.String property)
                                            throws java.lang.Exception
Specified by:
getServerMetadataAttribute in interface JRunAdminServiceMBean

setServerMetadataAttribute

public void setServerMetadataAttribute(java.lang.String serverName,
                                       java.lang.String property,
                                       java.lang.String value)
                                throws java.lang.Exception
Specified by:
setServerMetadataAttribute in interface JRunAdminServiceMBean

getJVMConfigProperty

public java.lang.String getJVMConfigProperty(java.lang.String property)
                                      throws java.lang.Exception
Specified by:
getJVMConfigProperty in interface JRunAdminServiceMBean

setJVMConfigProperty

public void setJVMConfigProperty(java.lang.String property,
                                 java.lang.String value)
                          throws java.lang.Exception
Specified by:
setJVMConfigProperty in interface JRunAdminServiceMBean

getOfflineJNDIProperty

public java.lang.String getOfflineJNDIProperty(java.lang.String serverName,
                                               java.lang.String property)
                                        throws java.lang.Exception
Allow retrieval of offline property values for .properties files
Specified by:
getOfflineJNDIProperty in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
property - the property to read
Returns:
the property value, or null if it is not specified

setOfflineJNDIProperty

public void setOfflineJNDIProperty(java.lang.String serverName,
                                   java.lang.String property,
                                   java.lang.String value)
                            throws java.lang.Exception
Allow offline property value modification for .properties files
Specified by:
setOfflineJNDIProperty in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
property - the property to change
value - the value to store

listServerPortsUsed

public int[] listServerPortsUsed(java.lang.String serverName)
                          throws java.lang.Exception
Specified by:
listServerPortsUsed in interface JRunAdminServiceMBean

getOfflineServices

public java.util.List getOfflineServices(java.lang.String serverName,
                                         java.lang.String servicePath,
                                         java.lang.String classname,
                                         boolean recurseServices)
                                  throws java.lang.Exception
Retrieves the services in jrun.xml under the specified path that specify the given classname.
Specified by:
getOfflineServices in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
servicePath - a period-delimited path using the service names, which must exist
classname - a class against which to match the service
recurseServices - if true, then search for services recursively
Returns:
a list of service paths which can then be used by the other offline service methods.

getOfflineServiceProperty

public java.lang.String getOfflineServiceProperty(java.lang.String serverName,
                                                  java.lang.String servicePath,
                                                  java.lang.String attribute)
                                           throws java.lang.Exception
Allow retrieval of offline property values for .xml files for properties which have only one value
Specified by:
getOfflineServiceProperty in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
servicePath - a period-delimited path using the service names, which must exist
Returns:
the attribute value, or null if it is not specified for that service

setOfflineServiceProperty

public void setOfflineServiceProperty(java.lang.String serverName,
                                      java.lang.String servicePath,
                                      java.lang.String attribute,
                                      java.lang.String value)
                               throws java.lang.Exception
Allow offline property value modification for .xml files for properties which have only one value
Specified by:
setOfflineServiceProperty in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
servicePath - a period-delimited path using the service names, which must exist
attribute - the attribute to set
value - the value to set for the attribute

addOfflineServicePropertyValue

public void addOfflineServicePropertyValue(java.lang.String serverName,
                                           java.lang.String servicePath,
                                           java.lang.String attribute,
                                           java.lang.String value)
                                    throws java.lang.Exception
Allow adding a new offline property value for .xml files for properties which have more than one value
Specified by:
addOfflineServicePropertyValue in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
servicePath - a period-delimited path using the service names, which must exist
attribute - the attribute to set
value - the value to add for the attribute

removeOfflineServicePropertyValue

public void removeOfflineServicePropertyValue(java.lang.String serverName,
                                              java.lang.String servicePath,
                                              java.lang.String attribute,
                                              java.lang.String value)
                                       throws java.lang.Exception
Allow removing an offline property value for .xml files for properties which have more than one value
Specified by:
removeOfflineServicePropertyValue in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
servicePath - a period-delimited path using the service names, which must exist
attribute - the attribute to change
value - the value to match against for the attribute

removeAllOfflineServicePropertyValues

public void removeAllOfflineServicePropertyValues(java.lang.String serverName,
                                                  java.lang.String servicePath,
                                                  java.lang.String attribute)
                                           throws java.lang.Exception
Allow removing all offline property values for .xml files for properties which have more than one value
Specified by:
removeAllOfflineServicePropertyValues in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
servicePath - a period-delimited path using the service names, which must exist
attribute - the attribute to remove

getOfflineServicePropertyValues

public java.util.List getOfflineServicePropertyValues(java.lang.String serverName,
                                                      java.lang.String servicePath,
                                                      java.lang.String attribute)
                                               throws java.lang.Exception
Allow retrieving all offline property values for .xml files for properties which have more than one value
Specified by:
getOfflineServicePropertyValues in interface JRunAdminServiceMBean
Parameters:
serverName - the server to look at, which must exist
servicePath - a period-delimited path using the service names, which must exist
attribute - the attribute to retrieve

createService

public void createService(java.lang.String parentServicePath,
                          java.lang.String className,
                          java.lang.String name,
                          java.util.HashMap attributes)
                   throws java.lang.Exception
Allow creation of service metadata directly upon the file for the current server
Specified by:
createService in interface JRunAdminServiceMBean
Parameters:
parentServicePath - a period-delimited path using the service names, which must exist
className - the class that implements the service
name - the name of the service
attributes - the attributes for the service

removeService

public void removeService(java.lang.String servicePath)
                   throws java.lang.Exception
Allow removal of service metadata directly upon the file for the current server
Specified by:
removeService in interface JRunAdminServiceMBean
Parameters:
servicePath - a period-delimited path using the service names, which must exist

startServer

public void startServer(java.lang.String serverName)
                 throws java.lang.Exception
Tells the Launcher to start a server
Specified by:
startServer in interface JRunAdminServiceMBean

stopServer

public void stopServer(java.lang.String serverName)
                throws java.lang.Exception
Tells the Launcher to stop a server
Specified by:
stopServer in interface JRunAdminServiceMBean

restartServer

public void restartServer(java.lang.String serverName)
                   throws java.lang.Exception
Tells the Launcher to restart a server
Specified by:
restartServer in interface JRunAdminServiceMBean

serverStatus

public java.lang.Boolean serverStatus(java.lang.String serverName)
                               throws java.lang.Exception
Check if server is running
Specified by:
serverStatus in interface JRunAdminServiceMBean

serverStatus

public int serverStatus()
Specified by:
serverStatus in interface JRunAdminServiceMBean

readFile

public FileView readFile(java.lang.String serverName,
                         java.lang.String path,
                         FileView viewer)
                  throws java.lang.Exception
Reads the specified file using the specified viewer, and returns the results in the viewer data structure. Only the return value should be used viewing the results, especially if the object is serialized and deserialized during the call. The passed-in viewer value is neither guaranteed to be modified nor guaranteed to be unmodified. The passed-in viewer class must be available to the server classloader.
Specified by:
readFile in interface JRunAdminServiceMBean

testDataSource

public void testDataSource(java.lang.String dataSourceName)
                    throws java.lang.Exception
Verify whether the connection to a data source is still open
Specified by:
testDataSource in interface JRunAdminServiceMBean


Copyright � 2002 Macromedia Corporation. All Rights Reserved.