Class AbstractSingletonBuilder<A,S,P>
- java.lang.Object
-
- org.gcube.common.clients.builders.AbstractBuilder<A,S,P>
-
- org.gcube.common.clients.builders.AbstractSingletonBuilder<A,S,P>
-
- Type Parameters:
A- the type of service addressesS- the type of service stubsP- the type of service proxies
- All Implemented Interfaces:
SingletonBuilderAPI.Builder<A,P>,SingletonBuilderAPI.FinalClause<P>,SingletonBuilderAPI.SecondClause<P>
public abstract class AbstractSingletonBuilder<A,S,P> extends AbstractBuilder<A,S,P> implements SingletonBuilderAPI.Builder<A,P>, SingletonBuilderAPI.SecondClause<P>, SingletonBuilderAPI.FinalClause<P>
Partial implementation of proxy builders for singleton services, i.e. stateful services with a known single instance.- Author:
- Fabio Simeoni
-
-
Field Summary
-
Fields inherited from class org.gcube.common.clients.builders.AbstractBuilder
defaultTimeout
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSingletonBuilder(ProxyPlugin<A,S,P> plugin, EndpointCache<A> cache, Property<?>... properties)Constructs an instance with a givenProxyPlugin, andEndpointCache, and zero or more defaultPropertys.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SingletonBuilderAPI.SecondClause<P>at(String host, int port)Configures the address of a given service instance.SingletonBuilderAPI.SecondClause<P>at(URI address)Configures the address of a given service endpoint.SingletonBuilderAPI.SecondClause<P>at(URL address)Configures the address of a given service endpoint.SingletonBuilderAPI.SecondClause<P>matching(Query<A> query)Configures a query for service instances.<T> SingletonBuilderAPI.SecondClause<P>with(String name, T value)Set a configuration property for the proxy.SingletonBuilderAPI.SecondClause<P>with(Property<?> property)Set a configuration property for the proxy.SingletonBuilderAPI.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.SingletonBuilderAPI.FinalClause
build
-
Methods inherited from interface org.gcube.common.clients.builders.SingletonBuilderAPI.SecondClause
build
-
-
-
-
Constructor Detail
-
AbstractSingletonBuilder
protected AbstractSingletonBuilder(ProxyPlugin<A,S,P> plugin, EndpointCache<A> cache, Property<?>... properties)
Constructs an instance with a givenProxyPlugin, andEndpointCache, and zero or more defaultPropertys.- Parameters:
plugin- the pluginplugin- the cacheproperties- the properties
-
-
Method Detail
-
matching
public SingletonBuilderAPI.SecondClause<P> matching(Query<A> query)
Description copied from interface:SingletonBuilderAPI.BuilderConfigures a query for service instances.- Specified by:
matchingin interfaceSingletonBuilderAPI.Builder<A,S>- Parameters:
query- the query- Returns:
- further configuration options
-
at
public SingletonBuilderAPI.SecondClause<P> at(String host, int port)
Description copied from interface:SingletonBuilderAPI.BuilderConfigures the address of a given service instance.- Specified by:
atin interfaceSingletonBuilderAPI.Builder<A,S>- Returns:
- further configuration options
-
at
public SingletonBuilderAPI.SecondClause<P> at(URL address)
Description copied from interface:SingletonBuilderAPI.BuilderConfigures the address of a given service endpoint.- Specified by:
atin interfaceSingletonBuilderAPI.Builder<A,S>- Parameters:
address- the address of the endpoint- Returns:
- further configuration options
-
at
public SingletonBuilderAPI.SecondClause<P> at(URI address)
Description copied from interface:SingletonBuilderAPI.BuilderConfigures the address of a given service endpoint.- Specified by:
atin interfaceSingletonBuilderAPI.Builder<A,S>- Parameters:
address- the address of the endpoint- Returns:
- further configuration options
-
withTimeout
public SingletonBuilderAPI.FinalClause<P> withTimeout(int duration, TimeUnit unit)
Description copied from interface:SingletonBuilderAPI.SecondClauseConfigures the timeout for the proxy.- Specified by:
withTimeoutin interfaceSingletonBuilderAPI.SecondClause<A>- Parameters:
duration- the duration of the timeoutunit- the time unit of the timeout- Returns:
- further configuration options
-
with
public SingletonBuilderAPI.SecondClause<P> with(Property<?> property)
Description copied from interface:SingletonBuilderAPI.SecondClauseSet a configuration property for the proxy.- Specified by:
within interfaceSingletonBuilderAPI.SecondClause<A>- Returns:
- further configuration options
-
with
public <T> SingletonBuilderAPI.SecondClause<P> with(String name, T value)
Description copied from interface:SingletonBuilderAPI.SecondClauseSet a configuration property for the proxy.- Specified by:
within interfaceSingletonBuilderAPI.SecondClause<A>- Type Parameters:
T- the type of the property value- Parameters:
name- the name of the propertyvalue- the value of the property- Returns:
- further configuration options
-
-