org.opentox.toxotis.core
Class OTPublishable<T extends OTPublishable>

java.lang.Object
  extended by org.opentox.toxotis.core.OTComponent<T>
      extended by org.opentox.toxotis.core.OTOnlineResource<T>
          extended by org.opentox.toxotis.core.OTPublishable<T>
All Implemented Interfaces:
Serializable, IOnlineResource, IOTComponent, IStAXWritable
Direct Known Subclasses:
BibTeX, Dataset, DescriptorCaclulation, Feature, QprfReport

public abstract class OTPublishable<T extends OTPublishable>
extends OTOnlineResource<T>

An OpenTox component is OTPublishable if it is a class of online resources that can be created by clients, i.e. a client can perform a POST request on a service and obtain a URI for its resource. Then it will be available online on the corresponding server to which it was posted.

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

Field Summary
 
Fields inherited from class org.opentox.toxotis.core.OTOnlineResource
XSD_DATATYPE_LINKS
 
Fields inherited from class org.opentox.toxotis.core.OTComponent
meta, RDF_ABOUT, RDF_RDF, RDF_RESOURCE, RDF_TYPE
 
Constructor Summary
OTPublishable()
          Create a new empty publishable object
OTPublishable(VRI uri)
          Create a new publishable object providing its URI
 
Method Summary
 Future<VRI> publish(VRI vri, AuthenticationToken token)
           
 Future<VRI> publish(VRI vri, AuthenticationToken token, ExecutorService executor)
           
abstract  Task publishOnline(AuthenticationToken token)
          Publish the component to a standard (default) server.
abstract  Task publishOnline(VRI vri, AuthenticationToken token)
          Publish the component to a proper server identified by the uri of the publishing service provided in this method.
 
Methods inherited from class org.opentox.toxotis.core.OTOnlineResource
download, download, download, download, downloadImage, loadFromRemote, loadFromRemote, loadFromRemote
 
Methods inherited from class org.opentox.toxotis.core.OTComponent
addOntologicalClasses, asOntModel, endRdfWriter, equals, getMeta, getOntologicalClasses, getUri, hashCode, 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, asIndividual, asOntModel, getMeta, getOntologicalClasses, getUri, isEnabled, setEnabled, setMeta, setOntologicalClasses
 
Methods inherited from interface org.opentox.toxotis.core.IStAXWritable
writeRdf
 

Constructor Detail

OTPublishable

public OTPublishable()
Create a new empty publishable object


OTPublishable

public OTPublishable(VRI uri)
Create a new publishable object providing its URI

Parameters:
uri - URI of the publishable object
Method Detail

publishOnline

public abstract Task publishOnline(VRI vri,
                                   AuthenticationToken token)
                            throws ServiceInvocationException
Publish the component to a proper server identified by the uri of the publishing service provided in this method. The resource will be posted to the server in RDF format (application/rdf+xml).

Parameters:
vri - URI of the service that is responsible for the publication of this kind of resources.
token - Provide an authentication token. If you think that the service does not require auhtentication/authorization, you can leave this field null or you can provide an empty authentication token. If the provided URI already contains an authentication token (as the URL parameter tokenid) it will be replaced by the new token provided to this method.
Returns:
A Task for monitoring the progress of your request. If the service returns the URI of the resource right away and does not return a task, then the object you will receive from this method will now have an identifier, its status will be set to Completed, its progress will be set to 100% and the URI of the created resource will be available applying the method Task.getResultUri() on the returned task. In any case, the service's response will be wrapped in a Task object.
Throws:
ToxOtisException - In case of invalid credentials, if the POSTed resource is not acceptable by the remote service (returns a status code 400), communication error occur with the remote server or other connection problems or the access to the service was denied (401 or 403).
InactiveTokenException - In case the provided token is invalidated (user has logged out), or has expired.
ServiceInvocationException

publish

public Future<VRI> publish(VRI vri,
                           AuthenticationToken token,
                           ExecutorService executor)
                    throws ServiceInvocationException
Throws:
ServiceInvocationException

publish

public Future<VRI> publish(VRI vri,
                           AuthenticationToken token)
                    throws ServiceInvocationException
Throws:
ServiceInvocationException

publishOnline

public abstract Task publishOnline(AuthenticationToken token)
                            throws ServiceInvocationException
Publish the component to a standard (default) server. The resource will be posted to the server in RDF format (application/rdf+xml). If you want to specify at which server the resource should be posted, use the other method.

Parameters:
token - Provide an authentication token. If you think that the service does not require auhtentication/authorization, you can leave this field null or you can provide an empty authentication token.If the provided URI already contains an authentication token (as the URL parameter tokenid) it will be replaced by the new token provided to this method.
Returns:
A Task for monitoring the progress of your request. If the service returns the URI of the resource right away and does not return a task, then the object you will receive from this method will now have an identifier, its status will be set to Completed, its progress will be set to 100% and the URI of the created resource will be available applying the method Task.getResultUri() on the returned task. In any case, the service's response will be wrapped in a Task object.
Throws:
ServiceInvocationException - In case of invalid credentials, if the POSTed resource is not acceptable by the remote service (returns a status code 400), communication error occur with the remote server or other connection problems or the access to the service was denied (401 or 403).
See Also:
alternative method


Copyright © 2011-2012 OpenTox. All Rights Reserved.