edu.cmu.cs.able.AcmeStudioBridge
Class Bridge

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--edu.cmu.cs.able.AcmeStudioBridge.Bridge
All Implemented Interfaces:
BridgeControl, GaugeConsumer, java.rmi.Remote, java.lang.Runnable, java.io.Serializable

public class Bridge
extends java.rmi.server.UnicastRemoteObject
implements java.rmi.Remote, BridgeControl, GaugeConsumer, java.lang.Runnable

Unicast remote object implementing java.rmi.Remote interface.

See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
Bridge()
          Constructs Bridge object and exports it on default port.
Bridge(int port)
          Constructs Bridge object and exports it on specified port.
 
Method Summary
 void beginChanges()
           
 void createGauge(GaugeID gaugeID, StringPairVector setupParams, StringPairVector mappings)
          Tells the bridge to create a gauge and start listening to it.
 void deleteGauge(GaugeID gauge)
          Tells the bridge to remove a gauge (delete it and stop listening to it).
 void endChanges()
           
 void loadAcmeFile(java.lang.String filename)
          Loads a particular Acme description into the bridge.
 void loadIntoAcmeStudio(boolean load)
           
static void main(java.lang.String[] args)
          Main method.
 void onReportConfigured(GaugeControl gauge, StringPairVector configParams)
          The callback invoked when a gauge has been configured.
 void onReportCreated(GaugeControl gauge)
          The callback invoked when a gauge is created.
 void onReportDeleted(GaugeControl gauge)
          The callback invoked when a gauge is deleted by (another) consumer.
 void onReportMultipleValues(GaugeControl gauge, GaugeValueVector values)
          The callback invoked when a gauge reports multiple values in a single reporting action.
 void onReportValue(GaugeControl gauge, java.lang.String valueName, java.lang.String propertyName, java.lang.String value)
          The callback invoked when a gauge reports a single value.
static void registerToRegistry(java.lang.String name, java.rmi.Remote obj, boolean create)
          Register Bridge object with the RMI registry.
 void run()
           
 
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
 

Constructor Detail

Bridge

public Bridge()
       throws java.rmi.RemoteException
Constructs Bridge object and exports it on default port.

Bridge

public Bridge(int port)
       throws java.rmi.RemoteException
Constructs Bridge object and exports it on specified port.
Parameters:
port - The port for exporting
Method Detail

registerToRegistry

public static void registerToRegistry(java.lang.String name,
                                      java.rmi.Remote obj,
                                      boolean create)
                               throws java.rmi.RemoteException,
                                      java.net.MalformedURLException
Register Bridge object with the RMI registry.
Parameters:
name - - name identifying the service in the RMI registry
create - - create local registry if necessary

onReportConfigured

public void onReportConfigured(GaugeControl gauge,
                               StringPairVector configParams)
The callback invoked when a gauge has been configured. Because a gauge can have multiple consumers, all consumers must know when a gauge has been reconfigured. The gauge announces this when any consumer configures it.
Specified by:
onReportConfigured in interface GaugeConsumer
Parameters:
gauge - The gauge that was configured.
configParams - The new configuration parameters for the gauge.

onReportMultipleValues

public void onReportMultipleValues(GaugeControl gauge,
                                   GaugeValueVector values)
The callback invoked when a gauge reports multiple values in a single reporting action.
Specified by:
onReportMultipleValues in interface GaugeConsumer
Parameters:
gauge - Theg gauge reporting the value
values - The values reported. Each element of the vector is a (valueName, propertyName, value) tuple.

onReportDeleted

public void onReportDeleted(GaugeControl gauge)
The callback invoked when a gauge is deleted by (another) consumer. After this callback is invoked, the gauge consumer can expect no more events (or callbacks) from this particular gauge.
Specified by:
onReportDeleted in interface GaugeConsumer
Parameters:
gauge - The gauge that was deleted.

onReportCreated

public void onReportCreated(GaugeControl gauge)
The callback invoked when a gauge is created.
Specified by:
onReportCreated in interface GaugeConsumer
Parameters:
gauge - The gauge that was created.

deleteGauge

public void deleteGauge(GaugeID gauge)
Tells the bridge to remove a gauge (delete it and stop listening to it).
Specified by:
deleteGauge in interface BridgeControl
Parameters:
gauge - The ID of the gauge to delete.

loadAcmeFile

public void loadAcmeFile(java.lang.String filename)
Loads a particular Acme description into the bridge.
Specified by:
loadAcmeFile in interface BridgeControl
Parameters:
filename - The full path of the file containing the Acme description.

onReportValue

public void onReportValue(GaugeControl gauge,
                          java.lang.String valueName,
                          java.lang.String propertyName,
                          java.lang.String value)
The callback invoked when a gauge reports a single value.
Specified by:
onReportValue in interface GaugeConsumer
Parameters:
gauge - The Gauge that reported the value.
valueName - The name of the value (according to the gauge)
propertyName - The property name that the value is associated with. The property is the interpretation of the value according to a high level model. This association is established when the gauge is created.
value - The value reported by the gauge.

createGauge

public void createGauge(GaugeID gaugeID,
                        StringPairVector setupParams,
                        StringPairVector mappings)
Tells the bridge to create a gauge and start listening to it. This gauge should be attached to the description that was loaded into the file.
Specified by:
createGauge in interface BridgeControl
Parameters:
gaugeID - The ID of the gauge to create.
setupParams - The parameters to set up the gauge.
mappings - The mappings to connect the gauge to the model.

main

public static void main(java.lang.String[] args)
Main method.

loadIntoAcmeStudio

public void loadIntoAcmeStudio(boolean load)
                        throws java.rmi.RemoteException
Specified by:
loadIntoAcmeStudio in interface BridgeControl

beginChanges

public void beginChanges()
                  throws java.rmi.RemoteException
Specified by:
beginChanges in interface BridgeControl

endChanges

public void endChanges()
                throws java.rmi.RemoteException
Specified by:
endChanges in interface BridgeControl

run

public void run()
Specified by:
run in interface java.lang.Runnable