org.apache.jcs.auxiliary.remote.server
Class RemoteCacheServerFactory

java.lang.Object
  extended by org.apache.jcs.auxiliary.remote.server.RemoteCacheServerFactory
All Implemented Interfaces:
IRemoteCacheConstants

public class RemoteCacheServerFactory
extends java.lang.Object
implements IRemoteCacheConstants

Provides remote cache services. This creates remote cache servers and can proxy command line requests to a running server.


Field Summary
 
Fields inherited from interface org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheConstants
CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX, CACHE_SERVER_PREFIX, CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, PROPERTY_PREFIX, REMOTE_ALLOW_CLUSTER_GET, REMOTE_CACHE_SERVICE_NAME, REMOTE_CACHE_SERVICE_PORT, REMOTE_CACHE_SERVICE_VAL, REMOTE_LOCAL_CLUSTER_CONSISTENCY, SOCKET_TIMEOUT_MILLIS, TOMCAT_ON, TOMCAT_XML
 
Method Summary
protected static ICacheEventLogger configureCacheEventLogger(java.util.Properties props)
          Tries to get the event logger by new and old config styles.
protected static java.rmi.server.RMISocketFactory configureObjectSpecificCustomFactory(java.util.Properties props)
          This configures an object specific custom factory.
protected static RemoteCacheServerAttributes configureRemoteCacheServerAttributes(java.util.Properties prop)
          Configure.
protected static RemoteCacheServerAttributes configureServerAttributes(java.lang.String propFile)
          Configures the RemoteCacheServerAttributes from the props file.
static org.apache.jcs.auxiliary.remote.server.RemoteCacheServer getRemoteCacheServer()
          This will allow you to get stats from the server, etc.
protected static java.lang.String getServiceName()
           
static void main(java.lang.String[] args)
          Creates an local RMI registry on the default port, starts up the remote cache server, and binds it to the registry.
protected static void registerServer(java.lang.String host, int port, java.lang.String serviceName)
          Registers the server with the registry.
protected static void setServiceName(java.lang.String serviceName)
           
static void startup(java.lang.String host, int port, java.lang.String propFile)
          Starts up the remote cache server on this JVM, and binds it to the registry on the given host and port.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRemoteCacheServer

public static org.apache.jcs.auxiliary.remote.server.RemoteCacheServer getRemoteCacheServer()
This will allow you to get stats from the server, etc. Perhaps we should provide methods on the factory to do this instead.

A remote cache is either a local cache or a cluster cache.

Returns:
Returns the remoteCacheServer.

startup

public static void startup(java.lang.String host,
                           int port,
                           java.lang.String propFile)
                    throws java.io.IOException
Starts up the remote cache server on this JVM, and binds it to the registry on the given host and port.

A remote cache is either a local cache or a cluster cache.

Parameters:
host -
port -
propFile -
Throws:
java.io.IOException

configureCacheEventLogger

protected static ICacheEventLogger configureCacheEventLogger(java.util.Properties props)
Tries to get the event logger by new and old config styles.

Parameters:
props -
Returns:
ICacheEventLogger

configureObjectSpecificCustomFactory

protected static java.rmi.server.RMISocketFactory configureObjectSpecificCustomFactory(java.util.Properties props)
This configures an object specific custom factory. This will be configured for just this object in the registry. This can be null.

Parameters:
props -
Returns:
RMISocketFactory

registerServer

protected static void registerServer(java.lang.String host,
                                     int port,
                                     java.lang.String serviceName)
                              throws java.rmi.RemoteException
Registers the server with the registry. I broke this off because we might want to have code that will restart a dead registry. It will need to rebind the server.

Parameters:
host -
port -
serviceName -
Throws:
java.rmi.RemoteException

configureServerAttributes

protected static RemoteCacheServerAttributes configureServerAttributes(java.lang.String propFile)
                                                                throws java.io.IOException
Configures the RemoteCacheServerAttributes from the props file.

Parameters:
propFile -
Returns:
RemoteCacheServerAttributes
Throws:
java.io.IOException

configureRemoteCacheServerAttributes

protected static RemoteCacheServerAttributes configureRemoteCacheServerAttributes(java.util.Properties prop)
Configure.

jcs.remotecache.serverattributes.ATTRIBUTENAME=ATTRIBUTEVALUE

Parameters:
prop -
Returns:
RemoteCacheServerAttributesconfigureRemoteCacheServerAttributes

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Creates an local RMI registry on the default port, starts up the remote cache server, and binds it to the registry.

A remote cache is either a local cache or a cluster cache.

Parameters:
args - The command line arguments
Throws:
java.lang.Exception

setServiceName

protected static void setServiceName(java.lang.String serviceName)
Parameters:
serviceName - the serviceName to set

getServiceName

protected static java.lang.String getServiceName()
Returns:
the serviceName


Copyright © 2002-2010 Apache Software Foundation. All Rights Reserved.