org.gcube.common.clients.builders
Class AbstractStatefulBuilder<A,S,P>

java.lang.Object
  extended by org.gcube.common.clients.builders.AbstractBuilder<A,S,P>
      extended by org.gcube.common.clients.builders.AbstractStatefulBuilder<A,S,P>
Type Parameters:
A - the type of service addresses
S - the type of service stubs
P - the type of service proxies
All Implemented Interfaces:
StatefulBuilderAPI.Builder<A,P>, StatefulBuilderAPI.FinalClause<P>, StatefulBuilderAPI.SecondClause<P>

public abstract class AbstractStatefulBuilder<A,S,P>
extends AbstractBuilder<A,S,P>
implements StatefulBuilderAPI.Builder<A,P>, StatefulBuilderAPI.SecondClause<P>, StatefulBuilderAPI.FinalClause<P>

Partial implementation of proxy builders for stateful services.

Author:
Fabio Simeoni

Field Summary
 
Fields inherited from class org.gcube.common.clients.builders.AbstractBuilder
defaultTimeout
 
Constructor Summary
protected AbstractStatefulBuilder(ProxyPlugin<A,S,P> plugin, EndpointCache<A> cache, Property<?>... properties)
          Constructs an instance with a given ProxyPlugin, and EndpointCache, and zero or more default Propertys.
 
Method Summary
 StatefulBuilderAPI.SecondClause<P> at(String key, String host, int port)
          Configures the address of a given service instance.
 StatefulBuilderAPI.SecondClause<P> at(String key, URI address)
          Configures the address of a given service instance.
 StatefulBuilderAPI.SecondClause<P> at(String key, URL address)
          Configures the address of a given service instance.
 StatefulBuilderAPI.SecondClause<P> at(W3CEndpointReference address)
          Configures the address of a given service instance.
 StatefulBuilderAPI.SecondClause<P> matching(Query<A> query)
          Configures a query for service instances.
 StatefulBuilderAPI.SecondClause<P> with(Property<?> property)
          Set a configuration property for the proxy.
<T> StatefulBuilderAPI.SecondClause<P>
with(String name, T value)
          Set a configuration property for the proxy.
 StatefulBuilderAPI.FinalClause<P> withTimeout(int duration, TimeUnit unit)
          Configures the timeout for the proxy.
 
Methods inherited from class org.gcube.common.clients.builders.AbstractBuilder
addProperty, build, contextPath, convertAddress, plugin, setAddress, setQuery, setTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gcube.common.clients.builders.StatefulBuilderAPI.SecondClause
build
 
Methods inherited from interface org.gcube.common.clients.builders.StatefulBuilderAPI.FinalClause
build
 

Constructor Detail

AbstractStatefulBuilder

protected AbstractStatefulBuilder(ProxyPlugin<A,S,P> plugin,
                                  EndpointCache<A> cache,
                                  Property<?>... properties)
Constructs an instance with a given ProxyPlugin, and EndpointCache, and zero or more default Propertys.

Parameters:
plugin - the plugin
plugin - the cache
properties - the properties
Method Detail

matching

public StatefulBuilderAPI.SecondClause<P> matching(Query<A> query)
Description copied from interface: StatefulBuilderAPI.Builder
Configures a query for service instances.

Specified by:
matching in interface StatefulBuilderAPI.Builder<A,P>
Parameters:
query - the query
Returns:
further configuration options

at

public StatefulBuilderAPI.SecondClause<P> at(W3CEndpointReference address)
Description copied from interface: StatefulBuilderAPI.Builder
Configures the address of a given service instance.

Specified by:
at in interface StatefulBuilderAPI.Builder<A,P>
Parameters:
address - the address
Returns:
further configuration options

at

public StatefulBuilderAPI.SecondClause<P> at(String key,
                                             String host,
                                             int port)
Description copied from interface: StatefulBuilderAPI.Builder
Configures the address of a given service instance.

Specified by:
at in interface StatefulBuilderAPI.Builder<A,P>
host - the host of the corresponding service endpoint
port - the port of the corresponding service endpoint
Returns:
further configuration options

at

public StatefulBuilderAPI.SecondClause<P> at(String key,
                                             URL address)
Description copied from interface: StatefulBuilderAPI.Builder
Configures the address of a given service instance.

Specified by:
at in interface StatefulBuilderAPI.Builder<A,P>
Returns:
further configuration options

at

public StatefulBuilderAPI.SecondClause<P> at(String key,
                                             URI address)
Description copied from interface: StatefulBuilderAPI.Builder
Configures the address of a given service instance.

Specified by:
at in interface StatefulBuilderAPI.Builder<A,P>
Returns:
further configuration options

withTimeout

public StatefulBuilderAPI.FinalClause<P> withTimeout(int duration,
                                                     TimeUnit unit)
Description copied from interface: StatefulBuilderAPI.SecondClause
Configures the timeout for the proxy.

Specified by:
withTimeout in interface StatefulBuilderAPI.SecondClause<P>
Parameters:
duration - the duration of the timeout
unit - the time unit of the timeout
Returns:
further configuration options

with

public StatefulBuilderAPI.SecondClause<P> with(Property<?> property)
Description copied from interface: StatefulBuilderAPI.SecondClause
Set a configuration property for the proxy.

Specified by:
with in interface StatefulBuilderAPI.SecondClause<P>
Returns:
further configuration options

with

public <T> StatefulBuilderAPI.SecondClause<P> with(String name,
                                                   T value)
Description copied from interface: StatefulBuilderAPI.SecondClause
Set a configuration property for the proxy.

Specified by:
with in interface StatefulBuilderAPI.SecondClause<P>
Type Parameters:
T - the type of the property value
Parameters:
name - the name of the property
value - the value of the property
Returns:
further configuration options


Copyright © 2012. All Rights Reserved.