jason.core
Class Domain

java.lang.Object
  |
  +--jason.core.Domain

public class Domain
extends java.lang.Object

Created Wed Mar 27 10:34:40 2002

This class describes a domain content.


Constructor Summary
Domain(java.lang.String name, boolean verbose, JasonEnv env)
           
 
Method Summary
 void addDoor(java.lang.String name, java.lang.String location, java.lang.String _class)
          Add a door for further services intergration.
 void addService(java.io.File location)
          Add a single service location.
 ServiceContainer addService(java.lang.String location)
          Add a single service location.
 void addService(java.lang.String location, boolean start)
           
 void addService(java.lang.String fileName, byte[] service)
          Add a service in its binary form
 void addServices(java.lang.String location)
          Deprecated. Add a services location. This is typically another xml file
 java.lang.String getAdminPassword()
           
 int getAdminPort()
           
 java.lang.String getAdminUser()
           
 java.lang.String getConfigurationFilePath()
           
 DoorDataModel getDoorModel()
           
 java.lang.String getLocation()
           
 java.lang.String getLogLocation()
           
 MessageHandler getMessageHandler()
           
 ServiceContainerDataModel getModel()
           
 java.lang.String getName()
           
 ServiceContainer[] getServiceContainer()
           
 Service[] getServices()
           
 ServicesManager getServicesManager()
           
 ThreadCapsule getThreadCapsule()
          Return a thread capsule
 void init()
           
 void initDefaultService()
          Add default service as a part of the Domain
 boolean isLogAutoClean()
           
 boolean isVerbose()
           
 void overrideServiceProperty(java.lang.String location, org.w3c.dom.Element service)
          This method is used for overriding a set of property defined both in an external xml file and in the domain definition.
 void replaceServiceContainer(ServiceContainer oldSc, ServiceContainer newSc)
          Replace the old service container with the new one
 void run()
          Start the domain and all tied services
 void sendErrorMessage(java.lang.String content)
           
 void sendInformationMessage(java.lang.String content)
           
 void sendWarningMessage(java.lang.String content)
           
 int serviceContainerCount()
           
 void setAdminPort(int adminPort)
          set the port for administration of JAson, by default 8085
 void setDoorModel(DoorDataModel model)
          Reset the model for available door
 void setLocation(java.lang.String location)
          Set the location of the configuration file
 void setLogAutoClean(boolean autoClean)
          Set the log strategy.
 void setLogLocation(java.lang.String location)
          Set the log location.
 void setMessageHandler(MessageHandler mh)
           
 void setMessageHandler(java.lang.String cl)
          Set the message handler.
 void setModel(ServiceContainerDataModel model)
          Set the dataModel for available ServiceContainer object
 void stop()
          Save the current domain state for the next running
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Domain

public Domain(java.lang.String name,
              boolean verbose,
              JasonEnv env)
Parameters:
name - Domain name
Method Detail

getAdminUser

public java.lang.String getAdminUser()
Returns:
admin name

getAdminPassword

public java.lang.String getAdminPassword()
Returns:
admin password

setAdminPort

public void setAdminPort(int adminPort)
set the port for administration of JAson, by default 8085


getAdminPort

public int getAdminPort()
Returns:
the administration port of JASon, by default 8085

setModel

public void setModel(ServiceContainerDataModel model)
Set the dataModel for available ServiceContainer object


getModel

public ServiceContainerDataModel getModel()
Returns:
the dataModel with available ServiceContainer object

setDoorModel

public void setDoorModel(DoorDataModel model)
Reset the model for available door


getDoorModel

public DoorDataModel getDoorModel()
Returns:
the model for available door

initDefaultService

public void initDefaultService()
Add default service as a part of the Domain


isLogAutoClean

public boolean isLogAutoClean()
Returns:
true if the log is deleted when starting JASon

getLogLocation

public java.lang.String getLogLocation()
Returns:
the log location

setLogAutoClean

public void setLogAutoClean(boolean autoClean)
Set the log strategy. This is for service that supports the Log.TYPE type

Parameters:
autoClean - if true, it will delete when starting the log

setLogLocation

public void setLogLocation(java.lang.String location)
Set the log location. This is for service that supports the Log.TYPE type

Parameters:
location - a path for the log location

setLocation

public void setLocation(java.lang.String location)
Set the location of the configuration file


getLocation

public java.lang.String getLocation()
Returns:
the location of the file

getConfigurationFilePath

public java.lang.String getConfigurationFilePath()
Returns:
the path containing the configuration file

isVerbose

public boolean isVerbose()

init

public void init()

getThreadCapsule

public ThreadCapsule getThreadCapsule()
Return a thread capsule


run

public void run()
Start the domain and all tied services


stop

public void stop()
Save the current domain state for the next running


setMessageHandler

public void setMessageHandler(java.lang.String cl)
                       throws JasonException
Set the message handler. This class name must implement the MessageHandler interface.

Parameters:
cl - a Class name
JasonException

addServices

public void addServices(java.lang.String location)
                 throws JasonException
Deprecated. Add a services location. This is typically another xml file

JasonException

addService

public void addService(java.io.File location)
                throws JasonException
Add a single service location. This is another xml file

JasonException

addService

public void addService(java.lang.String fileName,
                       byte[] service)
                throws JasonException
Add a service in its binary form

JasonException

addService

public ServiceContainer addService(java.lang.String location)
                            throws JasonException
Add a single service location. This is another xml file

JasonException

addService

public void addService(java.lang.String location,
                       boolean start)
                throws JasonException
JasonException

replaceServiceContainer

public void replaceServiceContainer(ServiceContainer oldSc,
                                    ServiceContainer newSc)
Replace the old service container with the new one


addDoor

public void addDoor(java.lang.String name,
                    java.lang.String location,
                    java.lang.String _class)
             throws JasonException
Add a door for further services intergration.

Parameters:
name - name of the door
location - location of the services
_class - can be equals to "", contains a Door class implementation
JasonException

overrideServiceProperty

public void overrideServiceProperty(java.lang.String location,
                                    org.w3c.dom.Element service)
                             throws JasonException
This method is used for overriding a set of property defined both in an external xml file and in the domain definition. This properties help to redefine default property

Parameters:
service - this is a service node with a location from a domain definition
JasonException

getServicesManager

public ServicesManager getServicesManager()

setMessageHandler

public void setMessageHandler(MessageHandler mh)

getServices

public Service[] getServices()
Returns:
available service

getServiceContainer

public ServiceContainer[] getServiceContainer()
Returns:
available service container

serviceContainerCount

public int serviceContainerCount()
Returns:
the number of service container

getName

public java.lang.String getName()
Returns:
the current domain name

getMessageHandler

public MessageHandler getMessageHandler()
Returns:
the current messageHandler

sendErrorMessage

public void sendErrorMessage(java.lang.String content)

sendWarningMessage

public void sendWarningMessage(java.lang.String content)

sendInformationMessage

public void sendInformationMessage(java.lang.String content)