kaos.core.service
Class KAoSServiceRootImpl

java.lang.Object
  extended by kaos.core.service.KAoSServiceRootImpl
All Implemented Interfaces:
KAoSServiceRoot
Direct Known Subclasses:
CorbaKAoSServiceRootImpl, GridKAoSServiceRootImpl, TCPKAoSServiceRootImpl

public abstract class KAoSServiceRootImpl
extends java.lang.Object
implements KAoSServiceRoot


Field Summary
 
Fields inherited from interface kaos.core.service.KAoSServiceRoot
DIRECTORY_SERVICE_ROOT, ENTITY_ROOT
 
Constructor Summary
KAoSServiceRootImpl()
           
 
Method Summary
 AgentDirectoryService getAgentDirectoryService()
           
 AgentNamingService getAgentNamingService()
           
abstract  MessageTransportService getPreferredMessageTransportService()
          Obtain the preferred MessageTransportService.
 java.lang.String getRootType()
           
 Service getService(java.lang.String type)
           
 TransportSystem getTransportSystem()
           
 KAoSEntityDescription setLocatorForDescription(KAoSEntityDescription desc, Locator locator)
          This method is defined to avoid the java.io.NotSerializableException while serializing the KAoSEntityDescription in the kaos.core.util.Msg.
 void setRootType(java.lang.String type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KAoSServiceRootImpl

public KAoSServiceRootImpl()
                    throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getTransportSystem

public TransportSystem getTransportSystem()

getAgentNamingService

public AgentNamingService getAgentNamingService()

getAgentDirectoryService

public AgentDirectoryService getAgentDirectoryService()

getService

public Service getService(java.lang.String type)

getRootType

public java.lang.String getRootType()
Specified by:
getRootType in interface KAoSServiceRoot

setRootType

public void setRootType(java.lang.String type)
Specified by:
setRootType in interface KAoSServiceRoot

getPreferredMessageTransportService

public abstract MessageTransportService getPreferredMessageTransportService()
Obtain the preferred MessageTransportService. There could be several MessageTransportServices loaded into the TransportSystem, however, the TransportSystem uses only one to send/receive messages, so to avoid exceptions, it is useful to specify the one that the TransportSystem uses.

Specified by:
getPreferredMessageTransportService in interface KAoSServiceRoot
Returns:
MessageTransportService, which is the preferred one for the platform this ServiceRoot supports.

setLocatorForDescription

public KAoSEntityDescription setLocatorForDescription(KAoSEntityDescription desc,
                                                      Locator locator)
This method is defined to avoid the java.io.NotSerializableException while serializing the KAoSEntityDescription in the kaos.core.util.Msg. It will have to be looked into why the NotSerializableException is thrown, but now the Locator set in the KAoSEntityDescription must be a concrete class (not interface 'Locator'), otherwise the KAoSEntityDescription cannot be sierialized. If this implementation works, then nothing has to be done. If not, then do the following using your app's transport locator (the example is taken from the CoABS Grid transport): 1. Cast the argument locator to the transport-specific locator class: KAoSGridLocator glctr = (KAoSGridLocator) locator; 2. Create a new instance of the transport-specific locator: KAoSGridLocator gridLocator = new KAoSGridLocator(); 3. Copy all vars (whatever your locator needs) from the received argument into the new Locator. gridLocator.setId(glctr.getId()); gridLocator.setName(glctr.getName()); gridLocator.setTransportType(glctr.getTransportType()); gridLocator.setAddress( glctr.getAddress()); 4. Set the locator in the KAoSEntitydescription. desc.addLocator(gridLocator);

Specified by:
setLocatorForDescription in interface KAoSServiceRoot
Parameters:
KAoSEntityDescription - the description that needs a concrete Locator to be set in.
Locator - to use to instantiate its concrete class.
Returns:
KAoSEntityDescription containing created instance of the concrete transport Locator.