org.iids.aos.negotiation
Class Service

java.lang.Object
  extended by org.iids.aos.negotiation.Service
All Implemented Interfaces:
java.lang.Cloneable

public class Service
extends java.lang.Object
implements java.lang.Cloneable


Constructor Summary
Service(Template template, ServiceDescriptionTerm sdt)
           
Service(Template template, ServiceDescriptionTerm sdt, boolean readonly)
           
 
Method Summary
 boolean canGetField(java.lang.String name)
          See if a field can be set (case insensitive).
 boolean canSetField(java.lang.String name)
          See if a field can be set (case insensitive).
 Service copy()
          Try to copy a Service and all of the contents.
 java.lang.Object get(java.lang.String field)
          Get value from Object contained within SDT.
 java.lang.Class<? extends java.lang.Object> getContentType()
          Returns the Class type of the Objects that this service accepts.
 java.util.List<java.lang.String> getFields()
          List all of the fields that can be set in this Object.
 java.lang.Class<? extends java.lang.Object> getFieldType(java.lang.String fieldName)
          Find the Class type belonging to this field
 java.lang.Class<? extends java.lang.Object> getGetFieldType(java.lang.String fieldName)
           
 java.util.List<java.lang.String> getGettableFields()
          List all of the fields that can be set in this Object.
 java.util.List<Restriction> getRestrictions()
           
 java.util.List<Restriction> getRestrictions(java.lang.String fieldName)
          Get all the restrictions for the field name of this service.
 ServiceDescriptionTerm getSDT()
          Obtain the underlying SDT.
 java.lang.String getServiceName()
          Returns the name of the service that is provided.
 java.lang.Class<? extends java.lang.Object> getSetFieldType(java.lang.String fieldName)
          Get the parameter class type for the set method of this field.
 java.util.List<java.lang.String> getSettableFields()
          List all of the fields that can be set in this Object.
 boolean isReadOnly()
          Check if the Service properties can be modified.
 void set(java.lang.String field, java.lang.Object value)
          Set value in Object contained within SDT.
 void setReadonly()
          Make service non-mutable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Service

public Service(Template template,
               ServiceDescriptionTerm sdt)

Service

public Service(Template template,
               ServiceDescriptionTerm sdt,
               boolean readonly)
Method Detail

copy

public Service copy()
Try to copy a Service and all of the contents. This will always return a new Service instance with identical service name, but the contents may not have been copied if this proved to be impossible.

The only difference between the original and the copy is that isReadOnly() for the copy initially returns false.


setReadonly

public void setReadonly()
Make service non-mutable. This is usually done for service descriptions that are part of a template. These service descriptions should not be modified in the template, but in a Request based on the template.

There is no way to make a readonly template writable again. It can, however, be copied


isReadOnly

public boolean isReadOnly()
Check if the Service properties can be modified.


getServiceName

public java.lang.String getServiceName()
Returns the name of the service that is provided.


getSDT

public ServiceDescriptionTerm getSDT()
Obtain the underlying SDT.

Returns:
The SDT this Service was based on.

getContentType

public java.lang.Class<? extends java.lang.Object> getContentType()
Returns the Class type of the Objects that this service accepts.


set

public void set(java.lang.String field,
                java.lang.Object value)
         throws ServiceException,
                RestrictionException
Set value in Object contained within SDT.

TODO this should check all of the Restrictions that are specified in the template for this service name (if any). We should also try to auto-enforce that the restrictions are set correctly.

Parameters:
field - The property name of the service to set the value for.
value - The value to set the service property to. If possible, and if there are restrictions to the values of the service property, these will be checked before actually setting the value of the property.
Throws:
ServiceException - If the property field cannot be set. This can happen if the field does not exist in the service, or if the Service is readonly.
RestrictionException - If value is not in the allowed range for field.

get

public java.lang.Object get(java.lang.String field)
                     throws ServiceException
Get value from Object contained within SDT.

Throws:
ServiceException

getRestrictions

public java.util.List<Restriction> getRestrictions(java.lang.String fieldName)
Get all the restrictions for the field name of this service.


getRestrictions

public java.util.List<Restriction> getRestrictions()

canSetField

public boolean canSetField(java.lang.String name)
See if a field can be set (case insensitive).


canGetField

public boolean canGetField(java.lang.String name)
See if a field can be set (case insensitive).


getFields

public java.util.List<java.lang.String> getFields()
List all of the fields that can be set in this Object.


getSettableFields

public java.util.List<java.lang.String> getSettableFields()
List all of the fields that can be set in this Object.


getGettableFields

public java.util.List<java.lang.String> getGettableFields()
List all of the fields that can be set in this Object.


getFieldType

public java.lang.Class<? extends java.lang.Object> getFieldType(java.lang.String fieldName)
Find the Class type belonging to this field


getSetFieldType

public java.lang.Class<? extends java.lang.Object> getSetFieldType(java.lang.String fieldName)
Get the parameter class type for the set method of this field.


getGetFieldType

public java.lang.Class<? extends java.lang.Object> getGetFieldType(java.lang.String fieldName)


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.