jason.core
Class ServiceType

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

public class ServiceType
extends java.lang.Object

Created Sat Apr 20 15:44:42 2002

This class represent the type tied to a service. This is an important role for service cooperation. Look at Service and AbstractService for usage.

A ServiceType is a kind of MIME Type for Jason services. As example : You can declare a service Type as Web with a subService HTTP/1.0 for a HTTP server. For helping JASon to find your service you may choose a WEB_SERVICE, CUSTOM_SERVICE or JASON_SERVICE constant.

Author:
Alexandre Brillant (abrillant@wanadoo.fr)

Field Summary
static java.lang.String CUSTOM_SERVICE
           
static java.lang.String JASON_SERVICE
           
static java.lang.String WEB_SERVICE
           
 
Constructor Summary
ServiceType(java.lang.String name)
           
ServiceType(java.lang.String name, java.lang.String subService)
           
ServiceType(java.lang.String name, java.lang.String[] subServices)
           
 
Method Summary
 void addSubServiceType(ServiceType subServiceType)
          Add a sub service type
 boolean checkForServiceTypeName(java.lang.String name)
          Check if the major type name is supported scanning sub service type name
 boolean equals(java.lang.Object obj)
          The parameter object is equals to the current instance of their share the same name and the same children
 java.lang.String getName()
           
 ServiceType getRootServiceType()
           
 ServiceType getSubServiceType(int index)
           
 int getSubServiceTypeCount()
           
 boolean isDefault()
          return true for default service
 void removeSubServiceType(ServiceType subServiceType)
          Remove a sub service type
 void setRootServiceType(ServiceType root)
          Set a service type reference
 java.lang.String toString()
          This function will format the ServiceType name and sub services
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WEB_SERVICE

public static java.lang.String WEB_SERVICE

CUSTOM_SERVICE

public static java.lang.String CUSTOM_SERVICE

JASON_SERVICE

public static java.lang.String JASON_SERVICE
Constructor Detail

ServiceType

public ServiceType(java.lang.String name)
            throws ServiceException
Parameters:
name - Major service type name, you can use WEB_SERVICE, CUSTOM_SERVICE, or JASON_SERVICE
Throws:
ServiceException - if the name is null or empty

ServiceType

public ServiceType(java.lang.String name,
                   java.lang.String subService)
            throws ServiceException
Parameters:
name - Major service type name

ServiceType

public ServiceType(java.lang.String name,
                   java.lang.String[] subServices)
            throws ServiceException
Parameters:
name - Major service type name
subServices - list of synonymous sub service type like http/1.0, ...
Method Detail

isDefault

public boolean isDefault()
return true for default service


getName

public java.lang.String getName()
Returns:
the major name of the ServiceType

equals

public boolean equals(java.lang.Object obj)
The parameter object is equals to the current instance of their share the same name and the same children

Overrides:
equals in class java.lang.Object

checkForServiceTypeName

public boolean checkForServiceTypeName(java.lang.String name)
Check if the major type name is supported scanning sub service type name

Parameters:
name - the name to match
Returns:
true if the name is found

setRootServiceType

public void setRootServiceType(ServiceType root)
Set a service type reference

Parameters:
root - a service type

getRootServiceType

public ServiceType getRootServiceType()
Returns:
a ServiceType root node

addSubServiceType

public void addSubServiceType(ServiceType subServiceType)
Add a sub service type

Parameters:
subServiceType - a sub service type

removeSubServiceType

public void removeSubServiceType(ServiceType subServiceType)
Remove a sub service type


getSubServiceTypeCount

public int getSubServiceTypeCount()
Returns:
the sub ServiceType count

getSubServiceType

public ServiceType getSubServiceType(int index)
Returns:
a sub ServiceType at the index location starting by 0

toString

public java.lang.String toString()
This function will format the ServiceType name and sub services

Overrides:
toString in class java.lang.Object