org.opentox.toxotis.core.component
Class RestOperation

java.lang.Object
  extended by org.opentox.toxotis.core.OTComponent<RestOperation>
      extended by org.opentox.toxotis.core.component.RestOperation
All Implemented Interfaces:
Serializable, IOTComponent, IRestOperation, IStAXWritable

public class RestOperation
extends OTComponent<RestOperation>
implements IRestOperation

An implementation of IRestOperation

Author:
Pantelis Sopasakis, Charalampos Chomenides
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.opentox.toxotis.core.OTComponent
meta, RDF_ABOUT, RDF_RDF, RDF_RESOURCE, RDF_TYPE
 
Constructor Summary
RestOperation()
          Dummy constructor for the class RestOperation that creates an empty instance of it.
RestOperation(VRI uri)
           
 
Method Summary
 RestOperation addHttpParameters(HttpParameter... httpParameters)
           
 RestOperation addHttpStatusCodes(HttpStatus... httpStatusCodes)
           
 IRestOperation addMediaTypes(HttpMediatype... mediaTypes)
           
 RestOperation addRestClasses(OntologicalClass... restClasses)
           
 IRestOperation addSimpleHeader(String headerName, boolean optional, com.hp.hpl.jena.datatypes.xsd.XSDDatatype xsdType)
           
 IRestOperation addSimpleHeader(String headerName, boolean optional, com.hp.hpl.jena.datatypes.xsd.XSDDatatype xsdType, MetaInfo meta)
           
 IRestOperation addUrlParameter(String urlParameterName, boolean optional, com.hp.hpl.jena.datatypes.xsd.XSDDatatype type)
           
 IRestOperation addUrlParameter(String urlParameterName, boolean optional, com.hp.hpl.jena.datatypes.xsd.XSDDatatype type, MetaInfo meta)
           
 com.hp.hpl.jena.ontology.Individual asIndividual(com.hp.hpl.jena.ontology.OntModel model)
          The OpenTox component as an individual.
 boolean equals(Object obj)
           
 Set<HttpParameter> getHttpParameters()
          Set of input parameters which are expected by the client on POST.
 Set<HttpStatus> getHttpStatusCodes()
          A set of the status codes that might occur when invoking the service, including all redirection, error and success status codes.
 Set<HttpMediatype> getMediaTypes()
           
 HttpMethod getMethod()
          The HTTP method which are supported by the web service.
 Set<OntologicalClass> getRestClasses()
          Return the set of ontological classes that describe the underlying resource and define its REST interface available operations choosing from the collection OTRestClasses.
 int hashCode()
           
 RestOperation setHttpParameters(Set<HttpParameter> httpParameters)
           
 RestOperation setHttpStatusCodes(Set<HttpStatus> httpStatusCodes)
           
 IRestOperation setMediaTypes(Set<HttpMediatype> mediaTypes)
           
 RestOperation setMethod(HttpMethod httpMethod)
          Update the REST Operation automatic documentation setting the corresponding method to which the specifications refer.
 RestOperation setMethod(HttpMethods.MethodsEnum httpMethod)
           
 IRestOperation setProtectedResource(boolean protectedResource)
           
 RestOperation setRestClasses(Set<OntologicalClass> restClasses)
           
 void writeRdf(XMLStreamWriter writer)
          Due to the large size of some objects like datasets, it is advisable to use this method for serializing large objects to RDF/XML rather than the method OntModel#write(OutputStream).
 
Methods inherited from class org.opentox.toxotis.core.OTComponent
addOntologicalClasses, asOntModel, endRdfWriter, getMeta, getOntologicalClasses, getUri, initRdfWriter, isEnabled, setEnabled, setMeta, setOntologicalClasses, setUri, writeAnnotationProperty, writeClass, writeDatatypeProperty, writeMetaDataProperties, writeObjectProperty, writeRdf, writeRdf, writeSuperClassRelationships
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opentox.toxotis.core.IOTComponent
addOntologicalClasses, asOntModel, getMeta, getOntologicalClasses, getUri, isEnabled, setEnabled, setMeta, setOntologicalClasses
 

Constructor Detail

RestOperation

public RestOperation()
Dummy constructor for the class RestOperation that creates an empty instance of it. The methods getMethod() and getRestClasses() will return null if invoked right afterwards.


RestOperation

public RestOperation(VRI uri)
Method Detail

getRestClasses

public Set<OntologicalClass> getRestClasses()
Return the set of ontological classes that describe the underlying resource and define its REST interface available operations choosing from the collection OTRestClasses.

Specified by:
getRestClasses in interface IRestOperation
Returns:
Set of ontological classes

setRestClasses

public RestOperation setRestClasses(Set<OntologicalClass> restClasses)
Specified by:
setRestClasses in interface IRestOperation

addRestClasses

public RestOperation addRestClasses(OntologicalClass... restClasses)
Specified by:
addRestClasses in interface IRestOperation

getMethod

public HttpMethod getMethod()
The HTTP method which are supported by the web service.

Specified by:
getMethod in interface IRestOperation
Returns:
Http Method as element of the enumeration HttpMethods.MethodsEnum.

setMethod

public RestOperation setMethod(HttpMethod httpMethod)
Update the REST Operation automatic documentation setting the corresponding method to which the specifications refer.

Specified by:
setMethod in interface IRestOperation
Parameters:
httpMethod - HTTP Method object
Returns:
The updated modifiable instance of REST operation documentation.

setMethod

public RestOperation setMethod(HttpMethods.MethodsEnum httpMethod)
Specified by:
setMethod in interface IRestOperation

getHttpParameters

public Set<HttpParameter> getHttpParameters()
Set of input parameters which are expected by the client on POST. These are either posted as a form or included in the URL as URL parameters.

Specified by:
getHttpParameters in interface IRestOperation
Returns:
Specifications for the input parameters expected by the client.

setHttpParameters

public RestOperation setHttpParameters(Set<HttpParameter> httpParameters)
Specified by:
setHttpParameters in interface IRestOperation

addHttpParameters

public RestOperation addHttpParameters(HttpParameter... httpParameters)
Specified by:
addHttpParameters in interface IRestOperation

getMediaTypes

public Set<HttpMediatype> getMediaTypes()
Specified by:
getMediaTypes in interface IRestOperation

setMediaTypes

public IRestOperation setMediaTypes(Set<HttpMediatype> mediaTypes)
Specified by:
setMediaTypes in interface IRestOperation

addMediaTypes

public IRestOperation addMediaTypes(HttpMediatype... mediaTypes)
Specified by:
addMediaTypes in interface IRestOperation

getHttpStatusCodes

public Set<HttpStatus> getHttpStatusCodes()
A set of the status codes that might occur when invoking the service, including all redirection, error and success status codes. As ontological classes, status codes are found in the colleciton OTRestClasses, and subclass OTRestClasses#HTTPStatus() such as OTRestClasses#STATUS_200() .

Specified by:
getHttpStatusCodes in interface IRestOperation
Returns:
Set of ontological classes that describe the available status codes.

setHttpStatusCodes

public RestOperation setHttpStatusCodes(Set<HttpStatus> httpStatusCodes)
Specified by:
setHttpStatusCodes in interface IRestOperation

addHttpStatusCodes

public RestOperation addHttpStatusCodes(HttpStatus... httpStatusCodes)
Specified by:
addHttpStatusCodes in interface IRestOperation

asIndividual

public com.hp.hpl.jena.ontology.Individual asIndividual(com.hp.hpl.jena.ontology.OntModel model)
Description copied from interface: IOTComponent
The OpenTox component as an individual.

Specified by:
asIndividual in interface IOTComponent
Parameters:
model - The ontological model to which the individual belongs.
Returns:
The OpenTox component as an individual of a data model.

writeRdf

public void writeRdf(XMLStreamWriter writer)
              throws XMLStreamException
Description copied from interface: IStAXWritable
Due to the large size of some objects like datasets, it is advisable to use this method for serializing large objects to RDF/XML rather than the method OntModel#write(OutputStream). In the case of Datasets, it has been shown that this method performs much faster (about 7,5 times faster on a dataset of 21 features and 1000 compounds).

Specified by:
writeRdf in interface IStAXWritable
Parameters:
writer - XML Stream Writer used for the serialization of the dataset object.
Throws:
XMLStreamException - In case the serialization is not possible due to syntax errors.

addUrlParameter

public IRestOperation addUrlParameter(String urlParameterName,
                                      boolean optional,
                                      com.hp.hpl.jena.datatypes.xsd.XSDDatatype type)
Specified by:
addUrlParameter in interface IRestOperation

addSimpleHeader

public IRestOperation addSimpleHeader(String headerName,
                                      boolean optional,
                                      com.hp.hpl.jena.datatypes.xsd.XSDDatatype xsdType)
Specified by:
addSimpleHeader in interface IRestOperation

setProtectedResource

public IRestOperation setProtectedResource(boolean protectedResource)
Specified by:
setProtectedResource in interface IRestOperation

equals

public boolean equals(Object obj)
Overrides:
equals in class OTComponent<RestOperation>

hashCode

public int hashCode()
Overrides:
hashCode in class OTComponent<RestOperation>

addUrlParameter

public IRestOperation addUrlParameter(String urlParameterName,
                                      boolean optional,
                                      com.hp.hpl.jena.datatypes.xsd.XSDDatatype type,
                                      MetaInfo meta)
Specified by:
addUrlParameter in interface IRestOperation

addSimpleHeader

public IRestOperation addSimpleHeader(String headerName,
                                      boolean optional,
                                      com.hp.hpl.jena.datatypes.xsd.XSDDatatype xsdType,
                                      MetaInfo meta)
Specified by:
addSimpleHeader in interface IRestOperation


Copyright © 2011-2012 OpenTox. All Rights Reserved.