org.gcube.contentmanagement.contentmanager.stubs.calls
Class FactoryCall

java.lang.Object
  extended by WSCall
      extended by org.gcube.contentmanagement.contentmanager.stubs.calls.BaseCall
          extended by org.gcube.contentmanagement.contentmanager.stubs.calls.FactoryCall

public class FactoryCall
extends BaseCall

Models a call to the Factory port-type of the Content Manager service.

A FactoryCall call may target known service instances or else do its best to find and talk with those which have the required properties. It may be used repeatedly and it will remember the service instance it last used successfully.

Author:
Fabio Simeoni (University of Strathclyde)

Constructor Summary
FactoryCall(GCUBEScope scope, GCUBESecurityManager... securityManager)
          Creates an instance to use in a given scope and, optionally, with a given a security manager.
 
Method Summary
 java.util.List<CollectionReference> create(FactoryParameters parameters)
          Creates one ore more collection managers.
 void createAsync(FactoryParameters parameters, FactoryConsumer consumer)
          Creates one ore more collection managers asynchronously.
 void resetQuery()
          Resets the default query used by the call.
 void setEndpoint(java.lang.String hostname, java.lang.String port)
          Convenience method to set the target endpoint from host name and port.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryCall

public FactoryCall(GCUBEScope scope,
                   GCUBESecurityManager... securityManager)
            throws java.lang.Exception
Creates an instance to use in a given scope and, optionally, with a given a security manager.

Parameters:
scope - the scope.
securityManager - (optional) the security manager.
Throws:
java.lang.Exception - if the instance could not be created.
Method Detail

setEndpoint

public void setEndpoint(java.lang.String hostname,
                        java.lang.String port)
                 throws java.lang.Exception
Convenience method to set the target endpoint from host name and port.

Parameters:
hostname - the host name.
port - the port.
Throws:
java.lang.Exception - if a reference to the endpoint could not be built from its hostname and port.

resetQuery

public void resetQuery()
                throws java.lang.Exception
Resets the default query used by the call.

Overrides:
resetQuery in class BaseCall
Throws:
java.lang.Exception - if the query could not be reset.

create

public java.util.List<CollectionReference> create(FactoryParameters parameters)
                                           throws java.lang.Exception,
                                                  org.apache.commons.discovery.DiscoveryException,
                                                  GCUBEException
Creates one ore more collection managers.

Parameters:
parameters - the creation parameters.
Returns:
references to the managers' endpoints, grouped by their bound collection.
Throws:
java.lang.Exception - if the managers could not be created for a local error.
org.apache.commons.discovery.DiscoveryException - if a factory that can create the managers cannot be found.
GCUBEException - if the managers could not be created for a remote error.

createAsync

public void createAsync(FactoryParameters parameters,
                        FactoryConsumer consumer)
                 throws java.lang.Exception,
                        org.apache.commons.discovery.DiscoveryException,
                        GCUBEException
Creates one ore more collection managers asynchronously.

Parameters:
parameters - the creation parameters.
consumer - a consumer for the asynchronous delivery of responses.
Throws:
java.lang.Exception - if the manager could not be created for a local error.
org.apache.commons.discovery.DiscoveryException - if a factory that can create the managers cannot be found.
GCUBEException - if the manager could not be created for a remote error.