Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.miamm.soapmmil
Class MIAMMService  view MIAMMService download MIAMMService.java

java.lang.Object
  extended byorg.miamm.soapmmil.MIAMMService
All Implemented Interfaces:
SoapMMILConstants
Direct Known Subclasses:
MIAMMServiceTemplate

public abstract class MIAMMService
extends java.lang.Object
implements SoapMMILConstants

Any module in the MIAMM architecture must extend this class.

NOTE: the reason this is an abstract class and not an interface is because of that receiveMessage function below... maybe i can just prescribe that there be one?

Version:
$Revision: 1.28 $
$Date: 2003/05/04 21:00:42 $

Nested Class Summary
private  class MIAMMService.MIAMMServiceInstance
           
 
Field Summary
private  MIAMMService.MIAMMServiceInstance _instance
           
(package private) static java.util.Map _instanceMap
           
(package private) static org.apache.log4j.Logger _logger
           
private static MIAMMServiceTable _serviceTable
           
 
Fields inherited from interface org.miamm.soapmmil.SoapMMILConstants
ELEMENT_MISOH_BLOCK, LOG4J_PROPERTY, misohDescriptor, NAMESPACE_PREFIX_MIAMM, NAMESPACE_URI_MIAMM, PROPERTY_MIAMM_SMART_RECEIVER, PROPERTY_MIAMM_URLFILE
 
Constructor Summary
MIAMMService()
           
 
Method Summary
 java.lang.String getDebuggingId()
          Returns some string to uniquely identify your service in debugging and log messages.
 java.net.URL getDumbOutgoingURL(org.miamm.castor.headerblock.MiammSoapHeaderBlock misoh)
          Returns the hardwired URL for the service that will receive an outgoing message, depending on the nature of the outgoing message.
 java.lang.String getServiceName()
          Returns the name of your service.
protected  MIAMMServiceTable getServiceTable()
           
 java.net.URL getSmartOutgoingURL()
          Returns the URL for any intemediary service that might receive all the messages from this service.
 void receiveMessage(org.apache.axis.message.SOAPEnvelope requestEnvelope, org.apache.axis.message.SOAPEnvelope responseEnvelope)
           Interface between Axis and the SoapMMIL.
 void recogniseEvent(org.miamm.castor.headerblock.MiammSoapHeaderBlock misoh, java.io.Reader message)
          Deprecated. implement recogniseEvent(SoapmmilMessage) instead
 void recogniseEvent(SoapmmilMessage message)
          Do the main work of this service.
abstract  void restart()
          Reinitialise the service.
 MIAMMServiceEngine soapmmil()
          Return the SoapMMIL engine for this service.
abstract  void start()
          Initialise the service.
abstract  void stop()
          Stops the service and does any cleanup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

static org.apache.log4j.Logger _logger

_serviceTable

private static MIAMMServiceTable _serviceTable

_instance

private MIAMMService.MIAMMServiceInstance _instance

_instanceMap

static java.util.Map _instanceMap
Constructor Detail

MIAMMService

public MIAMMService()
             throws MIAMMException
Method Detail

start

public abstract void start()
                    throws MIAMMException
Initialise the service. This is called only once in the life-cycle of the service. This would also be the right time to register the types of messages we are interested in receiving. This does not guarantee that all messages of these types will come to the service, but that the only messages received by the service will be of these types.


restart

public abstract void restart()
                      throws MIAMMException
Reinitialise the service. I don't see why you wouldn't just call stop and then call start again, but who knows. FIXME: decide whether or not to keep this function


stop

public abstract void stop()
                   throws MIAMMException
Stops the service and does any cleanup. This would be a good time to save stuff to disk, for example


recogniseEvent

public void recogniseEvent(SoapmmilMessage message)
                    throws MIAMMException
Do the main work of this service. This function is only called when the SoapMMIL detects an incoming message of a type that we explicitly allow.


recogniseEvent

public void recogniseEvent(org.miamm.castor.headerblock.MiammSoapHeaderBlock misoh,
                           java.io.Reader message)
                    throws MIAMMException
Deprecated. implement recogniseEvent(SoapmmilMessage) instead


getDumbOutgoingURL

public java.net.URL getDumbOutgoingURL(org.miamm.castor.headerblock.MiammSoapHeaderBlock misoh)
                                throws java.net.MalformedURLException,
                                       MIAMMException
Returns the hardwired URL for the service that will receive an outgoing message, depending on the nature of the outgoing message.

This function allows us to survive in case the MIAMM architecture does not prove to be sufficiently intelligent, or in case we want to hardwire things for debugging. Our goal in developing the MIAMM architecture would be to NOT make use of this function. Don't worry about when it gets called; just assume that SoapMMIL will be smart enough to call it when it realises it needs to.

Note, the default implementation is to look up values in the MIAMMServiceTable, which in turn, reads some property file somewhere that you should have edited to suit your needs. Please see the README or the technical report for more details


getSmartOutgoingURL

public java.net.URL getSmartOutgoingURL()
                                 throws java.net.MalformedURLException
Returns the URL for any intemediary service that might receive all the messages from this service. This is to provide flexibility in the case of architectural change. It is possible that there is no such intemediary service, in which case this function will return null. FIXME: maybe not a fixme, but right now, this checks for a system property; if that property is unset, then we are hardwired


getServiceName

public java.lang.String getServiceName()
Returns the name of your service. For now, you can hard code this to a String. As such, there is no guarantee that the names of all the services within an architecture will be unique. Later on, we'll be looking into Soapcaster and the JAS to do this properly, perhaps even to delegate naming to some external service.


getServiceTable

protected MIAMMServiceTable getServiceTable()

soapmmil

public MIAMMServiceEngine soapmmil()
Return the SoapMMIL engine for this service. You should expect to be using this function rather frequently.


receiveMessage

public void receiveMessage(org.apache.axis.message.SOAPEnvelope requestEnvelope,
                           org.apache.axis.message.SOAPEnvelope responseEnvelope)
                    throws javax.xml.soap.SOAPException

Interface between Axis and the SoapMMIL. Whenever AXIS receives a message to one of the interesting URNs, it will call this function

NOTE: In order to get my job done, i'm just going to assume that we're using axis versions of the SOAPEnvelope (SOAPElement) etc classes, rather than the generic SAAJ API... This means that the stuff will break if you are not using Axis or if Axis changes drastically beneath our feet. Oops.

FIXME: it'd be nice to change this into a JAXM onMessage


getDebuggingId

public java.lang.String getDebuggingId()
Returns some string to uniquely identify your service in debugging and log messages.