rendsite.tools
Class SystemInterfaceStub

java.lang.Object
  extended by rendsite.tools.SystemInterfaceStubBase
      extended by rendsite.tools.SystemInterfaceStub
All Implemented Interfaces:
things.thinger.SystemInterface, things.thinger.SystemSuperInterface

public class SystemInterfaceStub
extends SystemInterfaceStubBase

Stub out the system interface (like the test.things does). This is for stand-alone rendering tools.

Author:
erich Version History
 10NOV09 - EPG - First package release.
 

Field Summary
 things.data.ThingsPropertyView configProperties
          Config properties.
 RendsiteConfiguration configuration
           
 things.common.WhoAmI myId
           
 java.util.HashMap<java.lang.String,RendsiteLogger> namedLoggers
           
 things.data.ThingsPropertyView properties
          Given as shared and local properties.
 java.lang.String root
           
 RendsiteLogger rootLogger
          System stuff.
 RendsiteLogger systemLogger
           
 
Fields inherited from interface things.thinger.SystemInterface
DEFAULT_REPORTING_THRESHOLD
 
Constructor Summary
SystemInterfaceStub(java.lang.String root, things.data.ThingsPropertyView properties, things.data.ThingsPropertyView configProperties, RendsiteConfiguration configuration, things.common.WhoAmI systemId)
          Create the stub using a real properties file.
 
Method Summary
 things.common.WhoAmI getCallingProcessId()
          Get process ID for the calling prosess.
 things.data.ThingsPropertyViewReader getConfigProperties()
          Get the read only properties for this for the caller only.
 things.data.ThingsPropertyView getLocalProperties()
          Get local property view for the caller only.
 things.data.ThingsPropertyTree getLocalPropertiesImplementation()
          Get an empty tree using the preferred, non-persistent implementation for the local host.
 things.thinger.io.FileSystemLocator getLogLocal(java.lang.String id)
          Get a local reference to the log if possible.
 things.thinger.ExpressionInterface getNamedExpressor(java.lang.String name)
          Forge a new named expressor.
 things.thinger.io.Logger getNamedLogger(java.lang.String name)
          Forge a new named logger.
 things.thinger.kernel.ProcessInterface getProcessInterface(java.lang.String id)
          Get a process interface.
 things.data.tables.Table<java.lang.String> getProcessList()
          Get the process list.
 things.thinger.kernel.ThingsState getProcessState(java.lang.String id)
          Get the state of a specific process.
 things.data.ThingsPropertyView getSharedProperties()
          Get shared property view for this server.
static SystemInterfaceStub getStub()
          Get the global stub.
static SystemInterfaceStub getStub(java.lang.String root, things.data.ThingsPropertyView properties, things.data.ThingsPropertyView configProperties, RendsiteConfiguration configuration, things.common.WhoAmI systemId)
          Get the global stub.
 things.thinger.io.conduits.ConduitController getSystemConduits()
          Get the system conduit controller.
 things.thinger.io.Logger getSystemLogger()
          Get a system logger for the process.
This is implemented with the numbered call GET_SYSTEM_LOGGER.
 things.universe.Universe getUniverse(java.lang.String name)
          Get a universe by the local name.
 things.thing.MODULE loadModule(java.lang.String name)
          Load a module but don't do anything with it.
 things.thing.THING loadThing(java.lang.String name)
          Load a thing but don't run it.
 things.thinger.SystemSuperInterface requestSuperSystemInterface()
          Ask the kernel for a SuperSystemInterface.
 java.lang.String runThing(java.lang.String name)
          Load and run a thing in a new process.
 java.lang.String runThing(java.lang.String name, things.thinger.ExpressionInterface parentExpressor)
          Load and run a thing in a new process, giving an expression parent.
 java.lang.String runThing(java.lang.String name, things.thinger.ExpressionInterface parentExpressor, things.data.ThingsPropertyView properties)
          Load and run a thing in a new process, giving an expression parent.
 void waitProcessDone(java.lang.String id)
          Wait until the named process if done (meaning any state that satisfies ProcessInterface.ThingsState.isDeadOrDying()==true).
 
Methods inherited from class rendsite.tools.SystemInterfaceStubBase
deathNotice, flingException, getConfigPropertiesWritable, getGlobalProperties, getLocalProperties, getUserGlobalProperties, registerProcess, requestQuit, startProcess, startProcess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

public things.data.ThingsPropertyView properties
Given as shared and local properties. They will appear to be local to every caller.


configProperties

public things.data.ThingsPropertyView configProperties
Config properties. They would normally root under user.config. in the main server. berzerq2_install_root will be automatically set (and possibly overriden) by the stub.


rootLogger

public RendsiteLogger rootLogger
System stuff.


systemLogger

public RendsiteLogger systemLogger

namedLoggers

public java.util.HashMap<java.lang.String,RendsiteLogger> namedLoggers

myId

public things.common.WhoAmI myId

root

public java.lang.String root

configuration

public RendsiteConfiguration configuration
Constructor Detail

SystemInterfaceStub

public SystemInterfaceStub(java.lang.String root,
                           things.data.ThingsPropertyView properties,
                           things.data.ThingsPropertyView configProperties,
                           RendsiteConfiguration configuration,
                           things.common.WhoAmI systemId)
                    throws java.lang.Throwable
Create the stub using a real properties file.

Parameters:
root - the root of all the action.
properties - used as local and global properties.
configProperties - used as config properties, normally rooted at user.config. for the main server.
configuration - the configuration. It must have the root logger set!
systemId - the system id.
Throws:
java.lang.Throwable
Method Detail

getStub

public static SystemInterfaceStub getStub(java.lang.String root,
                                          things.data.ThingsPropertyView properties,
                                          things.data.ThingsPropertyView configProperties,
                                          RendsiteConfiguration configuration,
                                          things.common.WhoAmI systemId)
                                   throws java.lang.Throwable
Get the global stub.

Parameters:
root - the root of all the action.
properties - used as local and global properties.
configProperties - used as config properties, normally rooted at user.config. for the main server.
configuration - The RendSite configuration.
systemId - the imposed system id.
Returns:
the stub.
Throws:
java.lang.Throwable

getStub

public static SystemInterfaceStub getStub()
                                   throws java.lang.Throwable
Get the global stub. This assumes it has already been built.

Returns:
the global stub.
Throws:
java.lang.Throwable

getSystemConduits

public things.thinger.io.conduits.ConduitController getSystemConduits()
                                                               throws things.thinger.SystemException
Get the system conduit controller. These are for conduits between privileged services.

Returns:
a ConduitController
Throws:
things.thinger.SystemException
See Also:
ConduitController

getSystemLogger

public things.thinger.io.Logger getSystemLogger()
                                         throws things.thinger.SystemException
Get a system logger for the process.
This is implemented with the numbered call GET_SYSTEM_LOGGER.

Returns:
A logger.
Throws:
things.thinger.SystemException
See Also:
Logger

getNamedLogger

public things.thinger.io.Logger getNamedLogger(java.lang.String name)
                                        throws things.thinger.SystemException
Forge a new named logger. If a logger already exists for that name, it may cause an exception, depending on how it resolves.

Parameters:
name - the name. It will be unique. It's up to kernel on how the name is resolved.
Returns:
A logger.
Throws:
things.thinger.SystemException
See Also:
Logger

getNamedExpressor

public things.thinger.ExpressionInterface getNamedExpressor(java.lang.String name)
                                                     throws things.common.ThingsException
Forge a new named expressor.

Parameters:
name - the name. Generally, it should be unique. It's up to kernel on how the name is resolved and if name reuse is allowed.
Returns:
an expression interface.
Throws:
things.common.ThingsException
See Also:
ExpressionInterface

getLocalProperties

public things.data.ThingsPropertyView getLocalProperties()
                                                  throws things.thinger.SystemException
Get local property view for the caller only.

Returns:
a property view
Throws:
things.thinger.SystemException

getConfigProperties

public things.data.ThingsPropertyViewReader getConfigProperties()
                                                         throws things.thinger.SystemException
Get the read only properties for this for the caller only.

Returns:
a property view reader
Throws:
things.thinger.SystemException

getSharedProperties

public things.data.ThingsPropertyView getSharedProperties()
                                                   throws things.thinger.SystemException
Get shared property view for this server. Anyone can read and write to them.

Returns:
a property view
Throws:
things.thinger.SystemException

getProcessList

public things.data.tables.Table<java.lang.String> getProcessList()
                                                          throws things.thinger.SystemException
Get the process list.

The process list will be a Table.

Returns:
A table representing the process list.
Throws:
things.thinger.SystemException
See Also:
Table

getProcessState

public things.thinger.kernel.ThingsState getProcessState(java.lang.String id)
                                                  throws things.thinger.SystemException
Get the state of a specific process.

If the process is not found, the state is ProcessInterface.ThingsState.STATE_INVALID.

NO CLEARANCE REQUIRED.

Specified by:
getProcessState in interface things.thinger.SystemInterface
Overrides:
getProcessState in class SystemInterfaceStubBase
Parameters:
id - String id of the process.
Returns:
The state.
Throws:
things.thinger.SystemException
See Also:
ProcessInterface

getProcessInterface

public things.thinger.kernel.ProcessInterface getProcessInterface(java.lang.String id)
                                                           throws things.thinger.SystemException
Get a process interface. You can only get a process of equal or less clearance.

Specified by:
getProcessInterface in interface things.thinger.SystemInterface
Overrides:
getProcessInterface in class SystemInterfaceStubBase
Parameters:
id - String id of the process.
Returns:
The interface
Throws:
things.thinger.SystemException
See Also:
ProcessInterface

waitProcessDone

public void waitProcessDone(java.lang.String id)
                     throws things.thinger.SystemException,
                            java.lang.InterruptedException
Wait until the named process if done (meaning any state that satisfies ProcessInterface.ThingsState.isDeadOrDying()==true).

If the process is not found, it will quietly return.

NO CLEARANCE REQUIRED.

Specified by:
waitProcessDone in interface things.thinger.SystemInterface
Overrides:
waitProcessDone in class SystemInterfaceStubBase
Parameters:
id - String id of the process.
Throws:
things.thinger.SystemException - for general errors or InterruptedException for thread control. Always let the InterruptedException out.
java.lang.InterruptedException
See Also:
ProcessInterface

getLogLocal

public things.thinger.io.FileSystemLocator getLogLocal(java.lang.String id)
                                                throws things.thinger.SystemException,
                                                       java.lang.InterruptedException
Get a local reference to the log if possible. This is totally up to the implementation. It may be the whole log, a snippet, or null (no log at all).

NO CLEARANCE REQUIRED.

Specified by:
getLogLocal in interface things.thinger.SystemInterface
Overrides:
getLogLocal in class SystemInterfaceStubBase
Parameters:
id - String id of the process.
Returns:
log file locator or null
Throws:
things.thinger.SystemException - for general errors or InterruptedException for thread control. Always let the InterruptedException out.
java.lang.InterruptedException
See Also:
ProcessInterface, FileSystemLocator

loadThing

public things.thing.THING loadThing(java.lang.String name)
                             throws things.thinger.SystemException
Load a thing but don't run it. It will only construct. It's up to initialize and call it. Typically, the user should call .init() and then .call_chain(). This is mostly so that THINGs can calll other THINGs, so perhaps it is best to just use THING.CALL instead--if you can.

Specified by:
loadThing in interface things.thinger.SystemInterface
Overrides:
loadThing in class SystemInterfaceStubBase
Returns:
The constructed thing.
Throws:
things.thinger.SystemException

loadModule

public things.thing.MODULE loadModule(java.lang.String name)
                               throws things.thinger.SystemException
Load a module but don't do anything with it. It will only construct. It's up to the user to initialize it.

Specified by:
loadModule in interface things.thinger.SystemInterface
Overrides:
loadModule in class SystemInterfaceStubBase
Parameters:
name - the name that the loader can use to find it. Typically, the full class name.
Returns:
The constructed MODUKE
Throws:
things.thinger.SystemException

runThing

public java.lang.String runThing(java.lang.String name)
                          throws things.thinger.SystemException
Load and run a thing in a new process.

Specified by:
runThing in interface things.thinger.SystemInterface
Overrides:
runThing in class SystemInterfaceStubBase
Returns:
The name of the thing.
Throws:
things.thinger.SystemException

runThing

public java.lang.String runThing(java.lang.String name,
                                 things.thinger.ExpressionInterface parentExpressor)
                          throws things.thinger.SystemException
Load and run a thing in a new process, giving an expression parent. All expressions will go to the parent, plus whatever local mechanism the kernel decides.

Specified by:
runThing in interface things.thinger.SystemInterface
Overrides:
runThing in class SystemInterfaceStubBase
Parameters:
name - the resolvable name of the thing.
parentExpressor - the parent expressor.
Returns:
The name of the thing.
Throws:
things.thinger.SystemException

runThing

public java.lang.String runThing(java.lang.String name,
                                 things.thinger.ExpressionInterface parentExpressor,
                                 things.data.ThingsPropertyView properties)
                          throws things.thinger.SystemException
Load and run a thing in a new process, giving an expression parent. All expressions will go to the parent, plus whatever local mechanism the kernel decides. This will let you add properties to the THING's view before it starts.

Specified by:
runThing in interface things.thinger.SystemInterface
Overrides:
runThing in class SystemInterfaceStubBase
Parameters:
name - the resolvable name of the thing.
parentExpressor - the parent expressor. Set to null if there is no parent.
properties - properties to add to the THING processes specific view.
Returns:
The name of the thing.
Throws:
things.thinger.SystemException

requestSuperSystemInterface

public things.thinger.SystemSuperInterface requestSuperSystemInterface()
                                                                throws things.thinger.SystemException
Ask the kernel for a SuperSystemInterface. If you can't have it, you'll get a SystemException. Generally, only services are allowed to have it.

Specified by:
requestSuperSystemInterface in interface things.thinger.SystemInterface
Overrides:
requestSuperSystemInterface in class SystemInterfaceStubBase
Returns:
The super system interface.
Throws:
things.thinger.SystemException

getUniverse

public things.universe.Universe getUniverse(java.lang.String name)
                                     throws things.thinger.SystemException
Get a universe by the local name.

The stub version will only yield universe_testing. ever.

Specified by:
getUniverse in interface things.thinger.SystemInterface
Overrides:
getUniverse in class SystemInterfaceStubBase
Parameters:
name - the local name for the universe
Returns:
The universe.
Throws:
things.thinger.SystemException
See Also:
Universe

getCallingProcessId

public things.common.WhoAmI getCallingProcessId()
                                         throws things.thinger.SystemException
Get process ID for the calling prosess.

Returns:
The ID.
Throws:
things.thinger.SystemException

getLocalPropertiesImplementation

public things.data.ThingsPropertyTree getLocalPropertiesImplementation()
                                                                throws things.common.ThingsException
Get an empty tree using the preferred, non-persistent implementation for the local host.

Returns:
a new property tree.
Throws:
things.common.ThingsException


rendsite.