Rio Project 4.2 API Documentation



org.rioproject.cybernode
Class StaticCybernode

java.lang.Object
  extended by org.rioproject.cybernode.StaticCybernode

public class StaticCybernode
extends Object

A simple container for instantiating service beans. This utility can be used to create a service bean either from a classname, or from an OperationalString document. If the latter is used, the service bean is created using the attributes contained within the OperationalString document.

The StaticCybernode returns the implementation (back-end) object for the service bean(s) that have been created. This allows direct manipulation of the implementation, allowing debugging and unit testing to occur easily.

Notes:

Author:
Dennis Reedy

Constructor Summary
StaticCybernode()
           
 
Method Summary
 Map<String,Object> activate(File opstring, String... beans)
          Activate service beans defined in an OperationalString document, scoping the beans to be activated by providing the bean names.
 Map<String,Object> activate(OperationalString opstring)
          Activate all service beans defined in an OperationalString
 Map<String,Object> activate(OperationalString opstring, String... beans)
          Activate service beans defined in an OperationalString, scoping the beans to be activated by providing the bean names.
 Object activate(String classname)
          Activate a service bean.
 void destroy()
          Shutdown & terminate the StaticCybernode
 Object getServiceProxy(Object impl)
          Get the proxy for a service implementation created by the StaticCybernode
static void main(String... args)
          The StaticCybernode can be invoked directly from the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticCybernode

public StaticCybernode()
Method Detail

destroy

public void destroy()
Shutdown & terminate the StaticCybernode


activate

public Object activate(String classname)
                throws JSBInstantiationException
Activate a service bean.

Parameters:
classname - The service bean class to create.
Returns:
The service bean implementation, initialized by the Cybernode. The service bean will have been instantiated with an empty configuration.
Throws:
JSBInstantiationException - If the service bean cannot be created

activate

public Map<String,Object> activate(File opstring,
                                   String... beans)
                            throws Exception
Activate service beans defined in an OperationalString document, scoping the beans to be activated by providing the bean names.

Parameters:
opstring - The OperationalString document
beans - The bean names to create. If not provided all services in the opstring will be created
Returns:
A map of bean name keys and service implementation object values
Throws:
Exception - If the OperationalString document results in parsing errors or the bean(s) cannot be created.

activate

public Map<String,Object> activate(OperationalString opstring,
                                   String... beans)
                            throws JSBInstantiationException
Activate service beans defined in an OperationalString, scoping the beans to be activated by providing the bean names.

Parameters:
opstring - The OperationalString document
beans - The bean names to create. If not provided all services in the opstring will be created
Returns:
A map of bean name keys and service implementation object values
Throws:
JSBInstantiationException - If the bean(s) cannot be created.

activate

public Map<String,Object> activate(OperationalString opstring)
                            throws JSBInstantiationException
Activate all service beans defined in an OperationalString

Parameters:
opstring - The OperationalString document
Returns:
A map of bean name keys and service implementation object values
Throws:
JSBInstantiationException - If the bean(s) cannot be created.

getServiceProxy

public Object getServiceProxy(Object impl)
Get the proxy for a service implementation created by the StaticCybernode

Parameters:
impl - The service implementation, obtained through the activate method
Returns:
The proxy for the service, or null if the service implementation has not been created by the StaticCybernode
Throws:
IllegalArgumentException - if the impl parameter is null

main

public static void main(String... args)
The StaticCybernode can be invoked directly from the command line. The StaticCybernode expects that all necessary classes are in the classpath of the JVM in order to activate the service bean(s). This includes the Rio, River (Jini) and Groovy jars, as well as any specific application classes.

Invoking the StaticCybernode is done as follows:

  Usage:
      org.rioproject.cybernode.StaticCybernode service-class-name | opstring-file [bean-names]
 

The StaticCybernode takes either a

Argument
Description
service-class-name
The fully qualified class name of the service bean to instantiate. The service bean will be created with an empty configuration
opstring-file
The OperationalString document (either .xml or .groovy) declaring service beans and service bean attributes.
bean-names
Optional comma-separated list of beans to create within the provided opstring-file

Parameters:
args - Either a service-class-name or the location of an opstring-file with optional bean-names

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.