infosapient.server
Class InfoSapientServiceImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--infosapient.server.InfoSapientServiceImpl

public class InfoSapientServiceImpl
extends java.rmi.server.UnicastRemoteObject
implements InfoSapientService

Creation date: (04/06/01 1:23:59 PM)

Version:
$Revision: 1.1.1.1 $
See Also:
Serialized Form

Field Summary
private static java.util.Properties CONNECTION
           
private static java.util.Properties KBASES
           
private static java.io.PrintWriter LOGFile
           
private static int MAXWORKERS
          max # BlackMesaKnowledgeWorker threads
private static int NWORKERS
          default # BlackMesaKnowledgeWorker threads
private static int PORT
          port for listening
private  java.util.Hashtable registry
          The registry of BlackMesaClients
private static java.io.File root
          The BlackMesaServer's root
private static java.util.Properties SERVER_PROPERTIES
           
private static int timeout
          Timeout on client connections
private static java.util.Hashtable Worker_POOLS_Table
          Dictionary of idle BlackMesaKnowledgeWorker threads -- the type of knowledgebase is the key to each worker thread pool.
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname, serialVersionUID
 
Fields inherited from class java.rmi.server.RemoteObject
ref, serialVersionUID
 
Constructor Summary
protected InfoSapientServiceImpl()
          BlackMesaRulesServerImpl constructor comment.
protected InfoSapientServiceImpl(int port)
          BlackMesaRulesServerImpl constructor comment.
protected InfoSapientServiceImpl(int port, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf)
          BlackMesaRulesServerImpl constructor comment.
 
Method Summary
 boolean broadcast(java.rmi.server.ObjID from, java.lang.String mtag, java.lang.Object data)
          Broadcast a message to all known clients.
 java.rmi.server.ObjID execute(InfoSapientClient interestedClient, java.util.Properties goalProperties)
          Used by a InfoSapientClient to initiate a knowledgebase session by starting a new thread.
static java.util.Properties getCONNECTION()
          Insert the method's description here.
static java.util.Properties getKBASES()
          return properties file of knowledgebases Creation date: (04/06/01 1:29:02 PM)
static java.io.PrintWriter getLOGFile()
          return the logfile stream Creation date: (04/06/01 1:29:02 PM)
static int getMAXWORKERS()
          return the maximum permitted number of threads within the worker pool.
static int getNWORKERS()
          Return actual number of workers.
static int getPORT()
          Insert the method's description here.
protected  java.util.Hashtable getRegistry()
          Return the registry of BlackMesaClients (ObjID-->BlackMesaClient) Creation date: (04/07/01 7:35:41 PM)
static java.io.File getRoot()
          Insert the method's description here.
static java.util.Properties getSERVER_PROPERTIES()
          Insert the method's description here.
static int getTimeout()
          Insert the method's description here.
static java.util.Hashtable getWorker_POOLS_Table()
          Insert the method's description here.
private static void Initialize()
           
private static void LoadServerProperties()
          load SmoothRulesServer.properties from java.home
static void main(java.lang.String[] args)
          Assign a security manager, in the event that dynamic classes are loaded.
static void p(java.lang.String p)
          Log the message to output file Creation date: (04/06/01 1:39:44 PM)
 boolean register(java.rmi.server.ObjID i, InfoSapientClient c)
          Register this InfoSapientClient to recieve and transmit msgs.
 boolean remove(InfoSapientClient c)
          Remove this InfoSapientClient from the registry.
 boolean send(java.rmi.server.ObjID to, java.rmi.server.ObjID from, java.lang.String mtag, java.lang.Object data)
          Send a message from a client, to another client.
protected static void setCONNECTION(java.util.Properties newCONNECTION)
          Insert the method's description here.
private static void setKBASES(java.util.Properties newKBASES)
          Insert the method's description here.
private static void setLOGFile(java.io.PrintWriter newLOGFile)
          Insert the method's description here.
private static void setNWORKERS(int newNWORKERS)
          Insert the method's description here.
private static void setPORT(int newPORT)
          Insert the method's description here.
protected  void setRegistry(java.util.Hashtable newRegistry)
          Set a new Registry object Creation date: (04/07/01 7:35:41 PM)
private static void setRoot(java.io.File newRoot)
          Insert the method's description here.
private static void setSERVER_PROPERTIES(java.util.Properties newSERVER_PROPERTIES)
          Insert the method's description here.
private static void setTimeout(int newTimeout)
          Insert the method's description here.
private static void setWorker_POOLS_Table(java.util.Hashtable newWorker_POOLS_Table)
          Creation date: (04/06/01 1:29:02 PM)
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
, clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

LOGFile

private static java.io.PrintWriter LOGFile

SERVER_PROPERTIES

private static java.util.Properties SERVER_PROPERTIES

KBASES

private static java.util.Properties KBASES

CONNECTION

private static java.util.Properties CONNECTION

root

private static java.io.File root
The BlackMesaServer's root

registry

private java.util.Hashtable registry
The registry of BlackMesaClients

timeout

private static int timeout
Timeout on client connections

MAXWORKERS

private static final int MAXWORKERS
max # BlackMesaKnowledgeWorker threads

NWORKERS

private static int NWORKERS
default # BlackMesaKnowledgeWorker threads

PORT

private static int PORT
port for listening

Worker_POOLS_Table

private static java.util.Hashtable Worker_POOLS_Table
Dictionary of idle BlackMesaKnowledgeWorker threads -- the type of knowledgebase is the key to each worker thread pool.
Constructor Detail

InfoSapientServiceImpl

protected InfoSapientServiceImpl()
                          throws java.rmi.RemoteException
BlackMesaRulesServerImpl constructor comment.
Throws:
java.rmi.RemoteException - The exception description.

InfoSapientServiceImpl

protected InfoSapientServiceImpl(int port)
                          throws java.rmi.RemoteException
BlackMesaRulesServerImpl constructor comment.
Parameters:
port - int
Throws:
java.rmi.RemoteException - The exception description.

InfoSapientServiceImpl

protected InfoSapientServiceImpl(int port,
                                 java.rmi.server.RMIClientSocketFactory csf,
                                 java.rmi.server.RMIServerSocketFactory ssf)
                          throws java.rmi.RemoteException
BlackMesaRulesServerImpl constructor comment.
Parameters:
port - int
csf - java.rmi.server.RMIClientSocketFactory
ssf - java.rmi.server.RMIServerSocketFactory
Throws:
java.rmi.RemoteException - The exception description.
Method Detail

broadcast

public boolean broadcast(java.rmi.server.ObjID from,
                         java.lang.String mtag,
                         java.lang.Object data)
                  throws java.io.IOException,
                         java.rmi.RemoteException
Description copied from interface: InfoSapientService
Broadcast a message to all known clients.
Specified by:
broadcast in interface InfoSapientService
Tags copied from interface: InfoSapientService
Parameters:
from - - ObjID - unique identifier from whom the message is from
mtag - - String - arbitrary message identifier (implementation dependent)
data - - Object - message object.
Returns:
- boolean - true if broadcast successful.
Throws:
- - IOException
- - RemoteException

execute

public java.rmi.server.ObjID execute(InfoSapientClient interestedClient,
                                     java.util.Properties goalProperties)
                              throws java.rmi.RemoteException
Description copied from interface: InfoSapientService
Used by a InfoSapientClient to initiate a knowledgebase session by starting a new thread. Register the client with the BlackMesaService. Return the ObjID of the BlackMesaKnowledgeWorker actually performing the work.
Specified by:
execute in interface InfoSapientService
Parameters:
infosapient.client.InfoSapientClient - - the client requesting a kb session
java.util.Properties - -
    As a minimum the properties object should contain:
  • KBTYPE - the knowledgebase key
  • goal - the goal to be solved.
  • all necessary supporting attributes
Returns:
java.rmi.server.ObjID - the unique identifier of the thread running the kb session (used for conversation with the client).
Throws:
java.rmi.RemoteException - - (session properties are (null | empty)) || (knowledgebase not found) || (no worker threads initialized).

getCONNECTION

public static java.util.Properties getCONNECTION()
Insert the method's description here. Creation date: (04/09/01 8:58:20 AM)
Returns:
java.util.Properties

getKBASES

public static java.util.Properties getKBASES()
return properties file of knowledgebases Creation date: (04/06/01 1:29:02 PM)
Returns:
java.util.Properties

getLOGFile

public static java.io.PrintWriter getLOGFile()
return the logfile stream Creation date: (04/06/01 1:29:02 PM)
Returns:
java.io.PrintStream

getMAXWORKERS

public static int getMAXWORKERS()
return the maximum permitted number of threads within the worker pool. (MAY BE LESS THAN ACTUAL NUMBER OF WORKER THREADS RUNNING.) Creation date: (04/06/01 1:29:02 PM)
Returns:
int

getNWORKERS

public static int getNWORKERS()
Return actual number of workers.
Returns:
int

getPORT

public static int getPORT()
Insert the method's description here. Creation date: (04/06/01 1:35:15 PM)
Returns:
int

getRegistry

protected java.util.Hashtable getRegistry()
Return the registry of BlackMesaClients (ObjID-->BlackMesaClient) Creation date: (04/07/01 7:35:41 PM)
Returns:
java.util.Hashtable

getRoot

public static java.io.File getRoot()
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Returns:
java.io.File

getSERVER_PROPERTIES

public static java.util.Properties getSERVER_PROPERTIES()
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Returns:
java.util.Properties

getTimeout

public static int getTimeout()
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Returns:
int

getWorker_POOLS_Table

public static java.util.Hashtable getWorker_POOLS_Table()
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Returns:
java.util.Hashtable

Initialize

private static void Initialize()

LoadServerProperties

private static void LoadServerProperties()
                                  throws java.io.IOException
load SmoothRulesServer.properties from java.home

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Assign a security manager, in the event that dynamic classes are loaded. Create an instance of our rules server ... bind it with the RMI Registry, and then initialize all worker threads. Creation date: (04/06/01 1:42:17 PM)
Parameters:
args - java.lang.String[]

p

public static void p(java.lang.String p)
Log the message to output file Creation date: (04/06/01 1:39:44 PM)

register

public boolean register(java.rmi.server.ObjID i,
                        InfoSapientClient c)
                 throws java.rmi.RemoteException
Register this InfoSapientClient to recieve and transmit msgs.
Specified by:
register in interface InfoSapientService
Parameters:
id - - java.rmi.server.ObjID the identifier
client - - infosapient.client.InfoSapientClient the client to be registered.
Throws:
java.rmi.RemoteException -  

remove

public boolean remove(InfoSapientClient c)
               throws java.rmi.RemoteException
Remove this InfoSapientClient from the registry.
Specified by:
remove in interface InfoSapientService
Parameters:
id - - java.rmi.server.ObjID the id of the InfoSapientClient to be removed.
Returns:
success - boolean whether successfully removed
Throws:
java.rmi.RemoteException -  

send

public boolean send(java.rmi.server.ObjID to,
                    java.rmi.server.ObjID from,
                    java.lang.String mtag,
                    java.lang.Object data)
             throws java.io.IOException,
                    java.rmi.RemoteException
Description copied from interface: InfoSapientService
Send a message from a client, to another client.
Specified by:
send in interface InfoSapientService
Tags copied from interface: InfoSapientService
Parameters:
java.rmi.server.ObjID - to - the recipient client
java.rmi.server.ObjID - from - the sending client
String - - mtag - the arbitrary message tag.
Object - - data - the message object. (Implementations decide what that object is.)
Returns:
boolean - true if successful.
Throws:
java.io.IOException -  
java.rmi.RemoteException -  

setCONNECTION

protected static void setCONNECTION(java.util.Properties newCONNECTION)
Insert the method's description here. Creation date: (04/09/01 8:58:20 AM)
Parameters:
newCONNECTION - java.util.Properties

setKBASES

private static void setKBASES(java.util.Properties newKBASES)
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Parameters:
newKBASES - java.util.Properties

setLOGFile

private static void setLOGFile(java.io.PrintWriter newLOGFile)
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Parameters:
newLOGFile - java.io.PrintStream

setNWORKERS

private static void setNWORKERS(int newNWORKERS)
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Parameters:
newNWORKERS - int

setPORT

private static void setPORT(int newPORT)
Insert the method's description here. Creation date: (04/06/01 1:35:15 PM)
Parameters:
newPORT - int

setRegistry

protected void setRegistry(java.util.Hashtable newRegistry)
Set a new Registry object Creation date: (04/07/01 7:35:41 PM)
Parameters:
newRegistry - java.util.Hashtable

setRoot

private static void setRoot(java.io.File newRoot)
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Parameters:
newRoot - java.io.File

setSERVER_PROPERTIES

private static void setSERVER_PROPERTIES(java.util.Properties newSERVER_PROPERTIES)
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Parameters:
newSERVER_PROPERTIES - java.util.Properties

setTimeout

private static void setTimeout(int newTimeout)
Insert the method's description here. Creation date: (04/06/01 1:29:02 PM)
Parameters:
newTimeout - int

setWorker_POOLS_Table

private static void setWorker_POOLS_Table(java.util.Hashtable newWorker_POOLS_Table)
Creation date: (04/06/01 1:29:02 PM)
Parameters:
newWorker_POOLS_Table - java.util.Hashtable

License to use this program is provided under the TERMS OF THE COMMON PUBLIC LICENSE 0.5. ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

Copyright (c) 2001, Workplace Performance Tools, All Rights Reserved