org.opentox.toxotis.factory
Class CompoundFactory

java.lang.Object
  extended by org.opentox.toxotis.factory.CompoundFactory

public final class CompoundFactory
extends Object

CompoundFactory provides methods for creating new compounds and publishing them to remote compound services. You can create a new compound using an SDF, MOL or SMILES representation of it provided as a file.

Author:
Pantelis Sopasakis, Charalampos Chomenides

Method Summary
static CompoundFactory getInstance()
          Returns the CompoundFactory object associated with the current Java application.
 Set<VRI> lookUpComponent(VRI lookUpService, String keyword)
           
 Task publishFromFile(File sourceFile, Media fileType, AuthenticationToken token)
          POSTs a file to a default compound service using a specified Content-type header in order to create a new Compound.
 Task publishFromFile(File sourceFile, Media fileType, AuthenticationToken token, String service)
          POSTs a file to a specified compound service using a specified Content-type header in order to create a new Compound.
 Task publishFromFile(File sourceFile, String fileType, AuthenticationToken token)
          POSTs a file to a default compound service using a specified Content-type header in order to create a new Compound.
 Task publishFromFile(File sourceFile, String fileType, AuthenticationToken token, String service)
          POSTs a file to a specified compound service using a specified Content-type header in order to create a new Compound.
 Task publishFromStream(InputStream source, Media fileType, AuthenticationToken token)
           
 Task publishFromStream(InputStream source, Media fileType, AuthenticationToken token, String service)
           
 Task publishFromStream(InputStream source, String fileType, AuthenticationToken token)
           
 Task publishFromStream(InputStream source, String fileType, AuthenticationToken token, String service)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CompoundFactory getInstance()
Returns the CompoundFactory object associated with the current Java application. All factories in ToxOtis are singletons and have a single access point.

Returns:
The CompoundFactory object associated with the current Java application.

publishFromFile

public Task publishFromFile(File sourceFile,
                            String fileType,
                            AuthenticationToken token)
                     throws ServiceInvocationException
POSTs a file to a default compound service using a specified Content-type header in order to create a new Compound. The created compound is returned to the user.

Parameters:
sourceFile - File where information about the compound are stored. Can be a mol file, a CML one, an SD file or other file format that is accepted by the compound service.
token - Token used for authenticating the client against the remote compound service (You can set it to null).
fileType - The Content-type of the file to be posted.
Returns:
The compound created by the Service.
Throws:
ServiceInvocationException - In case an authentication error occurs or the remote service responds with an error code like 500 or 503 or the submitted representation is syntactically or semantically wrong (status 400).

publishFromFile

public Task publishFromFile(File sourceFile,
                            Media fileType,
                            AuthenticationToken token)
                     throws ServiceInvocationException
POSTs a file to a default compound service using a specified Content-type header in order to create a new Compound. The created compound is returned to the user.

Parameters:
sourceFile - File where information about the compound are stored. Can be a mol file, a CML one, an SD file or other file format that is accepted by the compound service.
token - Token used for authenticating the client against the remote compound service (You can set it to null).
fileType - The Content-type of the file to be posted.
Returns:
The compound created by the Service.
Throws:
ServiceInvocationException - In case an authentication error occurs or the remote service responds with an error code like 500 or 503 or the submitted representation is syntactically or semantically wrong (status 400).

publishFromFile

public Task publishFromFile(File sourceFile,
                            String fileType,
                            AuthenticationToken token,
                            String service)
                     throws ServiceInvocationException
POSTs a file to a specified compound service using a specified Content-type header in order to create a new Compound. The created compound is returned to the user.

Parameters:
sourceFile - File where information about the compound are stored. Can be a mol file, a CML one, an SD file or other file format that is accepted by the compound service.
token - Token used for authenticating the client against the remote compound service (You can set it to null).
fileType - The Content-type of the file to be posted.
service - The URI of the service on which the new Compound will be posted.
Returns:
The compound created by the Service.
Throws:
ServiceInvocationException - In case an authentication error occurs or the remote service responds with an error code like 500 or 503 or the submitted representation is syntactically or semantically wrong (status 400).

publishFromFile

public Task publishFromFile(File sourceFile,
                            Media fileType,
                            AuthenticationToken token,
                            String service)
                     throws ServiceInvocationException
POSTs a file to a specified compound service using a specified Content-type header in order to create a new Compound. The created compound is returned to the user.

Parameters:
sourceFile - File where information about the compound are stored. Can be a mol file, a CML one, an SD file or other file format that is accepted by the compound service.
token - Token used for authenticating the client against the remote compound service (You can set it to null).
fileType - The Content-type of the file to be posted as an element from Media.
service - The URI of the service on which the new Compound will be posted.
Returns:
The compound created by the Service.
Throws:
ServiceInvocationException - In case an authentication error occurs or the remote service responds with an error code like 500 or 503 or the submitted representation is syntactically or semantically wrong (status 400).

lookUpComponent

public Set<VRI> lookUpComponent(VRI lookUpService,
                                String keyword)

publishFromStream

public Task publishFromStream(InputStream source,
                              String fileType,
                              AuthenticationToken token,
                              String service)
                       throws ServiceInvocationException
Throws:
ServiceInvocationException

publishFromStream

public Task publishFromStream(InputStream source,
                              Media fileType,
                              AuthenticationToken token,
                              String service)
                       throws ServiceInvocationException
Throws:
ServiceInvocationException

publishFromStream

public Task publishFromStream(InputStream source,
                              Media fileType,
                              AuthenticationToken token)
                       throws ServiceInvocationException
Throws:
ServiceInvocationException

publishFromStream

public Task publishFromStream(InputStream source,
                              String fileType,
                              AuthenticationToken token)
                       throws ServiceInvocationException
Throws:
ServiceInvocationException


Copyright © 2011-2012 OpenTox. All Rights Reserved.