edu.cmu.cs.able.gaugeInfrastructure.RMI
Class RMIEventBus

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--edu.cmu.cs.able.gaugeInfrastructure.RMI.RMIEventBus
All Implemented Interfaces:
java.rmi.Remote, RMIEventBusHandle, java.io.Serializable

public class RMIEventBus
extends java.rmi.server.UnicastRemoteObject
implements RMIEventBusHandle, java.io.Serializable

The simulator of RMI event bus. This marshals and unmarshals events, provides an announcement interface, as well as a request/response interface.

Since:
JDK1.3.1
See Also:
Serialized Form

Field Summary
 int busPort
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RMIEventBus(int port)
          Creates a new event bus
 
Method Summary
 void configureGauge(GaugeID theGaugeID, StringPairVector configParams)
          Configures a gauge
 java.rmi.Remote connectTo(java.lang.String host, java.lang.String service)
          Connects to a RMI service
 void createGauge(GaugeID theGaugeID, StringPairVector setupParams, StringPairVector mappings)
          Creates a gauge
 void deleteGauge(GaugeID theGaugeID)
          Deletes a gauge
 java.lang.String getGaugeHost(GaugeID gid)
          Gets the host of a gauge
 java.lang.String getGaugeMgr(java.lang.String gaugeMgrType)
          Get a gauge manager
 StringPairVector queryConfigMetaInfo(java.lang.String gaugeType)
           
 StringPairVector queryValueMetaInfo(java.lang.String gaugeType)
           
 void registerGauge(GaugeID theGaugeID, StringPairVector setupParams, java.lang.String gaugeHost)
          Registers a gauge
 void registerGaugeConsumer(java.lang.String gaugeConsumerUID, java.lang.String gaugeConsumerHost)
          Registers a gauge consumer
 void registerGaugeMgr(java.lang.String gaugeMgrHost, java.lang.String gaugeMgrUID, java.lang.String gaugeMgrType)
          Registers a gauge manager
 boolean reportConfigured(GaugeID gauge, StringPairVector configParams)
          Reports a configured event
 boolean reportCreated(GaugeID gauge)
          Reports a created event
 boolean reportDeleted(GaugeID gauge)
          Reports a deleted event
 boolean reportMultipleValues(GaugeID gauge, GaugeValueVector values)
           
 boolean reportValue(GaugeID gauge, java.lang.String valueName, java.lang.String propertyName, java.lang.String value)
          Reports a value
 void subscribeInterest(java.lang.String gaugeConsumerUID, GaugeID theGaugeID, GaugeEventType gaugeEvent)
          Subscribes interest
 void subscribeToGaugeEvent(GaugeEvent event, Subscriber subscriber)
           
 void unsubscribeToGaugeEvent(GaugeEvent event, Subscriber subscriber)
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, 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
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

busPort

public int busPort
Constructor Detail

RMIEventBus

public RMIEventBus(int port)
            throws java.rmi.RemoteException
Creates a new event bus
Method Detail

configureGauge

public void configureGauge(GaugeID theGaugeID,
                           StringPairVector configParams)
                    throws java.rmi.RemoteException
Configures a gauge
Specified by:
configureGauge in interface RMIEventBusHandle
Parameters:
theGaugeID - The GaugeID of the gauge to be configured
configParams - The configuration parameters

createGauge

public void createGauge(GaugeID theGaugeID,
                        StringPairVector setupParams,
                        StringPairVector mappings)
                 throws java.rmi.RemoteException
Creates a gauge
Specified by:
createGauge in interface RMIEventBusHandle
Parameters:
theGaugeID - The GaugeID of the gauge to be created
setupParams - The setup parameters

deleteGauge

public void deleteGauge(GaugeID theGaugeID)
                 throws java.rmi.RemoteException
Deletes a gauge
Specified by:
deleteGauge in interface RMIEventBusHandle
Parameters:
theGaugeID - The GaugeID of the gauge to be deleted

subscribeInterest

public void subscribeInterest(java.lang.String gaugeConsumerUID,
                              GaugeID theGaugeID,
                              GaugeEventType gaugeEvent)
                       throws java.rmi.RemoteException
Subscribes interest
Specified by:
subscribeInterest in interface RMIEventBusHandle
Parameters:
gaugeConsumerUID - The UID of the gauge consumer subscribing interest
theGaugeID - The GaugeID of the gauge to be observed
gaugeEvent - The gauge event in which the gauge consumer is interested

getGaugeHost

public java.lang.String getGaugeHost(GaugeID gid)
                              throws java.rmi.RemoteException
Gets the host of a gauge
Specified by:
getGaugeHost in interface RMIEventBusHandle
Parameters:
gid - The GaugeID of the gauge to be queried for host address
Returns:
The host of the gauge in the form of address:port

registerGaugeMgr

public void registerGaugeMgr(java.lang.String gaugeMgrHost,
                             java.lang.String gaugeMgrUID,
                             java.lang.String gaugeMgrType)
                      throws java.rmi.RemoteException
Registers a gauge manager
Specified by:
registerGaugeMgr in interface RMIEventBusHandle
Parameters:
gaugeMgrHost - The host of the gauge manager to be registered
gaugeMgrUID - The UID of the gauge manager to be registered
gaugeMgrUID - The type of the gauge manager to be registered

getGaugeMgr

public java.lang.String getGaugeMgr(java.lang.String gaugeMgrType)
                             throws java.rmi.RemoteException
Get a gauge manager
Specified by:
getGaugeMgr in interface RMIEventBusHandle
Parameters:
gaugeMgrType - The type of the gauge manager
Returns:
The UID of the gauge manager

queryConfigMetaInfo

public StringPairVector queryConfigMetaInfo(java.lang.String gaugeType)
                                     throws java.rmi.RemoteException
Specified by:
queryConfigMetaInfo in interface RMIEventBusHandle

queryValueMetaInfo

public StringPairVector queryValueMetaInfo(java.lang.String gaugeType)
                                    throws java.rmi.RemoteException
Specified by:
queryValueMetaInfo in interface RMIEventBusHandle

registerGauge

public void registerGauge(GaugeID theGaugeID,
                          StringPairVector setupParams,
                          java.lang.String gaugeHost)
                   throws java.rmi.RemoteException
Registers a gauge
Specified by:
registerGauge in interface RMIEventBusHandle
Parameters:
theGaugeID - The GaugeID of the gauge to be registered
setupParams - The setup parameters of the gauge to be registered
gaugeHost - The host of the gauge to be registered in the form of address:port

registerGaugeConsumer

public void registerGaugeConsumer(java.lang.String gaugeConsumerUID,
                                  java.lang.String gaugeConsumerHost)
                           throws java.rmi.RemoteException
Registers a gauge consumer
Specified by:
registerGaugeConsumer in interface RMIEventBusHandle
Parameters:
gaugeConsumerUID - The UID of the gauge consumer to be registered
gaugeConsumerHost - The host of the gauge consumer to be registered in the form of address:port

connectTo

public java.rmi.Remote connectTo(java.lang.String host,
                                 java.lang.String service)
Connects to a RMI service
Parameters:
host - The host of the service
service - The name of the service

reportValue

public boolean reportValue(GaugeID gauge,
                           java.lang.String valueName,
                           java.lang.String propertyName,
                           java.lang.String value)
                    throws java.rmi.RemoteException
Reports a value
Specified by:
reportValue in interface RMIEventBusHandle
Parameters:
gauge - The GaugeID of the gauge reporting the value
valueName - The name of the value
propertyName - The property name of the value
value - The content of the value

reportMultipleValues

public boolean reportMultipleValues(GaugeID gauge,
                                    GaugeValueVector values)
                             throws java.rmi.RemoteException
Specified by:
reportMultipleValues in interface RMIEventBusHandle

reportConfigured

public boolean reportConfigured(GaugeID gauge,
                                StringPairVector configParams)
                         throws java.rmi.RemoteException
Reports a configured event
Specified by:
reportConfigured in interface RMIEventBusHandle
Parameters:
gauge - The GaugeID of the gauge reporting the event
configParams - The configuration parameters in the report

reportDeleted

public boolean reportDeleted(GaugeID gauge)
                      throws java.rmi.RemoteException
Reports a deleted event
Specified by:
reportDeleted in interface RMIEventBusHandle
Parameters:
gauge - The GaugeID of the gauge reporting the event

reportCreated

public boolean reportCreated(GaugeID gauge)
                      throws java.rmi.RemoteException
Reports a created event
Specified by:
reportCreated in interface RMIEventBusHandle
Parameters:
gauge - The GaugeID of the gauge reporting the event

subscribeToGaugeEvent

public void subscribeToGaugeEvent(GaugeEvent event,
                                  Subscriber subscriber)
                           throws java.rmi.RemoteException
Specified by:
subscribeToGaugeEvent in interface RMIEventBusHandle

unsubscribeToGaugeEvent

public void unsubscribeToGaugeEvent(GaugeEvent event,
                                    Subscriber subscriber)
                             throws java.rmi.RemoteException
Specified by:
unsubscribeToGaugeEvent in interface RMIEventBusHandle