samples.appMan
Class AppManComponent

java.lang.Object
  |
  +--samples.appMan.AppManComponent
All Implemented Interfaces:
xcat.framework.ccacore.Component

public class AppManComponent
extends java.lang.Object
implements xcat.framework.ccacore.Component

The AppManComponent is an application manager component that lets a user download a Jython script into it, to manage other applications.

Version:
$Revision: 1.12 $ $Author: srikrish $ $Date: 2001/12/30 00:10:14 $ (GMT)
Author:
Sriram Krishnan [mailto:srikrish@extreme.indiana.edu]

Field Summary
private  xcat.framework.ccacore.Services appManCore
           
private  ProvidesControl control
           
private static soaprmi.util.logging.Logger logger
           
private  ProvidesMesgPort mesgPort
           
private  java.util.Vector messageList
           
private  java.lang.Object[] params
           
private  ProvidesScriptPort scriptPort
           
 
Constructor Summary
AppManComponent()
          An empty constructor for the component is required as reflection is used to instantiated an instance of this class using this constructor, and then the setServices methods is called on it.
 
Method Summary
 void addMessageToList(java.lang.String xmlMessage)
          A method to accepts an XML message, converts it to a Message.
 int addProvidesPort(java.lang.String name, java.lang.String type, java.lang.String interfaceName, java.lang.String className)
          This method adds a provides port dynamically to the application manager.
 int addUsesPort(java.lang.String name, java.lang.String type, java.lang.String interfaceName)
          This method adds a uses port dynamically to the application manager.
 Message getMessage()
          A blocking call to receive a message sent to it.
 java.lang.Object[] getParams()
          For the script to get hold of the parameters.
 xcat.framework.ccacore.ProvidesPort getProvidesPort(java.lang.String portName)
          This method returns a handle to the provides port of the component.
 xcat.framework.ccacore.UsesPort getUsesPort(java.lang.String portName)
          This method returns a handle to the uses port of the component.
 void initialize(java.lang.Object[] paramList)
          Need an initialize, since we are using an empty constructor.
static void main(java.lang.String[] args)
          The main method will be called if it is instantiated standalone.
 void runScript(java.io.InputStream scriptFile)
          This method executes the JPython script input to it.
 void runScript(java.lang.String script)
          This method executes the Jython script input to it.
 int sendEvent(java.lang.String url, java.lang.String text)
          A simple method to send events to a URL.
 int sendMessage(Message message)
          A method to accepts a Message Object, converts it to XML.
 void setServices(xcat.framework.ccacore.Services cc)
          The usual CCA setServices to conform to the spec.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

appManCore

private xcat.framework.ccacore.Services appManCore

control

private ProvidesControl control

scriptPort

private ProvidesScriptPort scriptPort

mesgPort

private ProvidesMesgPort mesgPort

logger

private static soaprmi.util.logging.Logger logger

messageList

private java.util.Vector messageList

params

private java.lang.Object[] params
Constructor Detail

AppManComponent

public AppManComponent()
An empty constructor for the component is required as reflection is used to instantiated an instance of this class using this constructor, and then the setServices methods is called on it. This is done in SoapComponentInstantiator.java.
Method Detail

initialize

public void initialize(java.lang.Object[] paramList)
Need an initialize, since we are using an empty constructor. The interpretation of the params is up to the script.
Parameters:
paramList - The array of parameters

setServices

public void setServices(xcat.framework.ccacore.Services cc)
The usual CCA setServices to conform to the spec.
Specified by:
setServices in interface xcat.framework.ccacore.Component
Parameters:
cc - The Services Object for the Component

runScript

public void runScript(java.lang.String script)
This method executes the Jython script input to it.
Parameters:
script - The string containing the Jython Script

runScript

public void runScript(java.io.InputStream scriptFile)
This method executes the JPython script input to it.
Parameters:
scriptFile - The InputStream to receive the Jython Script

addProvidesPort

public int addProvidesPort(java.lang.String name,
                           java.lang.String type,
                           java.lang.String interfaceName,
                           java.lang.String className)
This method adds a provides port dynamically to the application manager. A non zero return value means failure.
Parameters:
name - The name by which the port is registered
type - The uri of the wsdl description
interfaceName - The fully qualified name of the provides port interface
className - The fully qualified class name of the provides port impl

addUsesPort

public int addUsesPort(java.lang.String name,
                       java.lang.String type,
                       java.lang.String interfaceName)
This method adds a uses port dynamically to the application manager. A non-zero return value means failure.
Parameters:
name - The name by which the port is registered
type - The uri of the wsdl description
interfaceName - The fully qualified name of the uses port interface

getProvidesPort

public xcat.framework.ccacore.ProvidesPort getProvidesPort(java.lang.String portName)
                                                    throws xcat.framework.exceptions.XCATException
This method returns a handle to the provides port of the component.
Parameters:
portName - The name by which the provides port is registered

getUsesPort

public xcat.framework.ccacore.UsesPort getUsesPort(java.lang.String portName)
                                            throws xcat.framework.exceptions.XCATException
This method returns a handle to the uses port of the component.
Parameters:
portName - The name by which the uses port is registered

sendEvent

public int sendEvent(java.lang.String url,
                     java.lang.String text)
A simple method to send events to a URL.
Parameters:
url - The URL where the Event Channel is running
text - The Text Message inside the Event

sendMessage

public int sendMessage(Message message)
A method to accepts a Message Object, converts it to XML. It then does an RMI call to send the message.
Parameters:
Message - The Message Object to be sent to the other component

addMessageToList

public void addMessageToList(java.lang.String xmlMessage)
A method to accepts an XML message, converts it to a Message. It then adds it to the list of outstanding messages.
Parameters:
xmlMessage - The XML message received from the other component

getMessage

public Message getMessage()
                   throws java.lang.InterruptedException
A blocking call to receive a message sent to it.

getParams

public java.lang.Object[] getParams()
For the script to get hold of the parameters.

main

public static void main(java.lang.String[] args)
The main method will be called if it is instantiated standalone.
args[0] = Registry Host.
args[1] = Registry Port.
args[2] = Local Host.
args[3] = Component Identifier.
args[4] = Path for Python Script.
args[5..N] = Component Args.