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

java.lang.Object
  extended by org.gcube.common.clients.builders.AbstractBuilder<A,S,P>
      extended by org.gcube.common.clients.builders.AbstractStatelessBuilder<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:
StatelessBuilderAPI.Builder<P>, StatelessBuilderAPI.FinalClause<P>, StatelessBuilderAPI.SecondClause<P>

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

Partial implementation of proxy builders for stateless services.

Author:
Fabio Simeoni

Field Summary
 
Fields inherited from class org.gcube.common.clients.builders.AbstractBuilder
defaultTimeout
 
Constructor Summary
protected AbstractStatelessBuilder(ProxyPlugin<A,S,P> plugin, EndpointCache<A> cache, Query<A> query, Property<?>... properties)
          Constructs an instance with a given ProxyPlugin, an EndpointCache, a Query, and zero or more default Propertys.
 
Method Summary
 StatelessBuilderAPI.SecondClause<P> at(String host, int port)
          Configures the address of a given service instance.
 StatelessBuilderAPI.SecondClause<P> at(URI address)
          Configures the address of a given service endpoint.
 StatelessBuilderAPI.SecondClause<P> at(URL address)
          Configures the address of a given service endpoint.
 StatelessBuilderAPI.Builder<P> with(Property<?> property)
          Set a configuration property for the proxy.
<T> StatelessBuilderAPI.Builder<P>
with(String name, T value)
          Set a configuration property for the proxy.
 StatelessBuilderAPI.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.StatelessBuilderAPI.Builder
build
 
Methods inherited from interface org.gcube.common.clients.builders.StatelessBuilderAPI.SecondClause
build
 
Methods inherited from interface org.gcube.common.clients.builders.StatelessBuilderAPI.FinalClause
build
 

Constructor Detail

AbstractStatelessBuilder

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

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

at

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

Specified by:
at in interface StatelessBuilderAPI.Builder<P>
Returns:
further configuration options

at

public StatelessBuilderAPI.SecondClause<P> at(URL address)
Description copied from interface: StatelessBuilderAPI.Builder
Configures the address of a given service endpoint.

Specified by:
at in interface StatelessBuilderAPI.Builder<P>
Parameters:
address - the address of the endpoint
Returns:
further configuration options

at

public StatelessBuilderAPI.SecondClause<P> at(URI address)
Description copied from interface: StatelessBuilderAPI.Builder
Configures the address of a given service endpoint.

Specified by:
at in interface StatelessBuilderAPI.Builder<P>
Parameters:
address - the address of the endpoint
Returns:
further configuration options

withTimeout

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

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

with

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

Specified by:
with in interface StatelessBuilderAPI.Builder<P>
Returns:
further configuration options

with

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

Specified by:
with in interface StatelessBuilderAPI.Builder<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 © 2013. All Rights Reserved.