jrunx.resource
Class ResourceService

jrunx.kernel.ServiceAdapter
  |
  +--jrunx.kernel.ServicePartition
        |
        +--jrunx.kernel.ConfigurableServicePartition
              |
              +--jrunx.resource.ResourceService
All Implemented Interfaces:
ConfigurableServicePartitionMBean, javax.naming.Referenceable, ResourceServiceInterface, ResourceServiceMBean, java.io.Serializable, Service, ServiceMBean, ServicePartitionMBean

public class ResourceService
extends ConfigurableServicePartition
implements ResourceServiceInterface

JRun Resource Service. This service serves as a factory for creating ResourceManager's that are responsible for the management of resources at a given document root directory.

Author:
Karl Moss
See Also:
Serialized Form

Fields inherited from class jrunx.kernel.ServicePartition
sortedServices
 
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.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
ResourceService()
           
 
Method Summary
 ResourceManager createResourceManager(java.lang.String docRoot)
          Factory method for creating a new ResourceManager.
 ResourceManager createResourceManager(java.lang.String docRoot, ServiceAdapter context)
          Factory method for creating a new ResourceManager.
 java.io.InputStream formatDirectory(ServiceAdapter context, java.lang.String path, java.util.List members)
          Formats the directory listing.
 int getResourceCacheSize()
          Returns the size of the internal buffer used to cache static resources.
 long getResourceCheckInterval()
          Gets the resource check interval
 void setResourceCacheSize(int size)
          Sets the size of the internal buffer used to cache static resources.
 void setResourceCheckInterval(long ms)
          The number of milliseconds between checking for a change in a cached resource.
 
Methods inherited from class jrunx.kernel.ConfigurableServicePartition
destroy, destroyServices, init, initServices, loadAndInit, loadChildren, setChildElements, start, startServices, stop, stopServices
 
Methods inherited from class jrunx.kernel.ServicePartition
addService, addService, getServices, invokeChain, iterator, removeService, removeService
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, toString, unbind, unscheduleRunnable, updateStatus
 
Methods inherited from interface jrunx.kernel.ConfigurableServicePartitionMBean
setChildElements
 
Methods inherited from interface jrunx.kernel.ServicePartitionMBean
addService, addService, iterator, removeService, removeService
 
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

ResourceService

public ResourceService()
Method Detail

setResourceCheckInterval

public void setResourceCheckInterval(long ms)
Description copied from interface: ResourceServiceMBean
The number of milliseconds between checking for a change in a cached resource. A setting of -1 will result in disabling the refreshing of resource caches
Specified by:
setResourceCheckInterval in interface ResourceServiceMBean
Following copied from interface: jrunx.resource.ResourceServiceMBean
Parameters:
interval - Number of ms before checking for a new resource

getResourceCheckInterval

public long getResourceCheckInterval()
Description copied from interface: ResourceServiceMBean
Gets the resource check interval
Specified by:
getResourceCheckInterval in interface ResourceServiceMBean
Following copied from interface: jrunx.resource.ResourceServiceMBean
Returns:
The number of ms before checking for a new resource

setResourceCacheSize

public void setResourceCacheSize(int size)
Description copied from interface: ResourceServiceMBean
Sets the size of the internal buffer used to cache static resources. The default is 8096 bytes. Increasing this size may improve performance at the cost of additional server memory
Specified by:
setResourceCacheSize in interface ResourceServiceMBean
Following copied from interface: jrunx.resource.ResourceServiceMBean
Parameters:
size - The size of the internal cache buffer in bytes

getResourceCacheSize

public int getResourceCacheSize()
Description copied from interface: ResourceServiceMBean
Returns the size of the internal buffer used to cache static resources.
Specified by:
getResourceCacheSize in interface ResourceServiceMBean
Following copied from interface: jrunx.resource.ResourceServiceMBean
Returns:
The size of the internal cache buffer in bytes

createResourceManager

public ResourceManager createResourceManager(java.lang.String docRoot)
Description copied from interface: ResourceServiceMBean
Factory method for creating a new ResourceManager. A ResourceManager is responsible for delivering Resource entries from the given document root directory.
Specified by:
createResourceManager in interface ResourceServiceMBean
Following copied from interface: jrunx.resource.ResourceServiceMBean
Parameters:
docRoot - The document root directory
Returns:
The new ResourceManager for handling resources out of the root directory
Throws:
java.lang.IllegalArgumentException - if the root directory does not exist, or is not a directory

createResourceManager

public ResourceManager createResourceManager(java.lang.String docRoot,
                                             ServiceAdapter context)
Description copied from interface: ResourceServiceMBean
Factory method for creating a new ResourceManager. A ResourceManager is responsible for delivering Resource entries from the given document root directory.
Specified by:
createResourceManager in interface ResourceServiceMBean
Following copied from interface: jrunx.resource.ResourceServiceMBean
Parameters:
docRoot - The document root directory
context - The calling ServiceAdapter
Returns:
The new ResourceManager for handling resources out of the root directory
Throws:
java.lang.IllegalArgumentException - if the root directory does not exist, or is not a directory

formatDirectory

public java.io.InputStream formatDirectory(ServiceAdapter context,
                                           java.lang.String path,
                                           java.util.List members)
Description copied from interface: ResourceServiceInterface
Formats the directory listing. Uses the registered DirectoryFormatterService to perform the actual work. Returns null if the directory cannot be formatted.
Specified by:
formatDirectory in interface ResourceServiceInterface
Following copied from interface: jrunx.resource.ResourceServiceInterface
Parameters:
context - The context from which this resource request is being made
path - The directory path
list - The members of the directory
Returns:
The InputStream used for reading the directory listing


Copyright � 2002 Macromedia Corporation. All Rights Reserved.