public class CloudServiceConnectionFactory extends Object implements ServiceConnectionFactory
Constructor and Description |
---|
CloudServiceConnectionFactory(Cloud cloud) |
Modifier and Type | Method and Description |
---|---|
com.datastax.driver.core.Cluster |
cluster()
Get the
Cluster object associated with the only Cassandra service bound to
the app. |
com.datastax.driver.core.Cluster |
cluster(CassandraClusterConfig config)
Get the
Cluster object associated with the only Cassandra service bound to
the app configured as specified. |
com.datastax.driver.core.Cluster |
cluster(String serviceId)
Get the
Cluster object associated with the Cassandra serviceId
bound to the app. |
com.datastax.driver.core.Cluster |
cluster(String serviceId,
CassandraClusterConfig config)
Get the
Cluster object associated with the Cassandra serviceId
bound to the app configured as specified. |
DataSource |
dataSource()
Get the
DataSource object associated with the only relational database service bound to the app. |
DataSource |
dataSource(DataSourceConfig dataSourceConfig)
Get the
DataSource object associated with the only relational database service bound to the app
configured as specified. |
DataSource |
dataSource(String serviceId)
Get the
DataSource object for the specified relational database service. |
DataSource |
dataSource(String serviceId,
DataSourceConfig dataSourceConfig)
Get the
DataSource object for the specified relational database service configured as specified. |
MongoDbFactory |
mongoDbFactory()
Get the
MongoDbFactory object associated with the only MongoDB service bound to the app. |
MongoDbFactory |
mongoDbFactory(MongoDbFactoryConfig mongoDbFactoryConfig)
Get the
MongoDbFactory object associated with the only MongoDB service bound to the app
configured as specified. |
MongoDbFactory |
mongoDbFactory(String serviceId)
Get the
MongoDbFactory object for the specified MongoDB service. |
MongoDbFactory |
mongoDbFactory(String serviceId,
MongoDbFactoryConfig mongoDbFactoryConfig)
Get the
MongoDbFactory object for the specified MongoDB service configured as specified. |
ConnectionFactory |
rabbitConnectionFactory()
Get the
ConnectionFactory object associated with the only RabbitMQ service bound to the app. |
ConnectionFactory |
rabbitConnectionFactory(RabbitConnectionFactoryConfig rabbitConnectionFactoryConfig)
Get the
ConnectionFactory object associated with the only RabbitMQ service bound to the app
configured as specified. |
ConnectionFactory |
rabbitConnectionFactory(String serviceId)
Get the
ConnectionFactory object for the specified RabbitMQ service. |
ConnectionFactory |
rabbitConnectionFactory(String serviceId,
RabbitConnectionFactoryConfig rabbitConnectionFactoryConfig)
Get the
ConnectionFactory object for the specified RabbitMQ service configured as specified. |
RedisConnectionFactory |
redisConnectionFactory()
Get the
RedisConnectionFactory object associated with the only Redis service bound to the app. |
RedisConnectionFactory |
redisConnectionFactory(PooledServiceConnectorConfig redisConnectionFactoryConfig)
Get the
RedisConnectionFactory object associated with the only Redis service bound to the app
configured as specified. |
RedisConnectionFactory |
redisConnectionFactory(String serviceId)
Get the
RedisConnectionFactory object for the specified Redis service. |
RedisConnectionFactory |
redisConnectionFactory(String serviceId,
PooledServiceConnectorConfig redisConnectionFactoryConfig)
Get the
RedisConnectionFactory object for the specified Redis service configured as specified. |
Object |
service()
Get the service connector object associated with the only service bound to the app.
|
<T> T |
service(Class<T> serviceConnectorType)
Get the service connector object of the specified type if there is only one such candidate service
This is equivalent to the
<cloud:service connector-type="T.class"/> element. |
Object |
service(String serviceId)
Get the service connector object for the specified service.
|
<T> T |
service(String serviceId,
Class<T> serviceConnectorType)
Get the service connector object of the specified type and service ID
This is equivalent to the
<cloud:service service-id="serviceId" connector-type="T.class"/> element. |
<T> T |
service(String serviceId,
Class<T> serviceConnectorType,
ServiceConnectorConfig serviceConnectorConfig) |
protected final Cloud cloud
public CloudServiceConnectionFactory(Cloud cloud)
public DataSource dataSource()
DataSource
object associated with the only relational database service bound to the app.
This is equivalent to the <cloud:data-source/>
element.dataSource
in interface ServiceConnectionFactory
CloudException
- if there are either 0 or more than 1 relational database services.public DataSource dataSource(DataSourceConfig dataSourceConfig)
DataSource
object associated with the only relational database service bound to the app
configured as specified.
This is equivalent to the <cloud:data-source>
element with nested <cloud:connection>
and/or
<cloud:pool>
elements.dataSource
in interface ServiceConnectionFactory
dataSourceConfig
- configuration for the data source createdCloudException
- if there are either 0 or more than 1 relational database services.public DataSource dataSource(String serviceId)
DataSource
object for the specified relational database service.
This is equivalent to the <cloud:data-source service-id="serviceId"/>
dataSource
in interface ServiceConnectionFactory
serviceId
- the name of the serviceCloudException
- if the specified service doesn't existpublic DataSource dataSource(String serviceId, DataSourceConfig dataSourceConfig)
DataSource
object for the specified relational database service configured as specified.
This is equivalent to the <cloud:data-source service-id="serviceId"/>
element with
nested <cloud:connection>
and/or <cloud:pool>
elements.dataSource
in interface ServiceConnectionFactory
serviceId
- the name of the servicedataSourceConfig
- configuration for the data source createdCloudException
- if the specified service doesn't existpublic MongoDbFactory mongoDbFactory()
MongoDbFactory
object associated with the only MongoDB service bound to the app.
This is equivalent to the <cloud:mongo-db-factory/>
element.mongoDbFactory
in interface ServiceConnectionFactory
CloudException
- if there are either 0 or more than 1 mongodb services.public MongoDbFactory mongoDbFactory(MongoDbFactoryConfig mongoDbFactoryConfig)
MongoDbFactory
object associated with the only MongoDB service bound to the app
configured as specified.
This is equivalent to the <cloud:mongo-db-factory>
element with a nested <cloud:mongo-options>
element.mongoDbFactory
in interface ServiceConnectionFactory
mongoDbFactoryConfig
- configuration for the mondo db factory createdCloudException
- if there are either 0 or more than 1 mongodb services.public MongoDbFactory mongoDbFactory(String serviceId)
MongoDbFactory
object for the specified MongoDB service.
This is equivalent to the <cloud:mongo-db-factory service-id="serviceId">
element.mongoDbFactory
in interface ServiceConnectionFactory
serviceId
- the name of the serviceCloudException
- if the specified service doesn't existpublic MongoDbFactory mongoDbFactory(String serviceId, MongoDbFactoryConfig mongoDbFactoryConfig)
MongoDbFactory
object for the specified MongoDB service configured as specified.
This is equivalent to the <cloud:mongo-db-factory service-id="serviceId">
element
with a nested <cloud:mongo-options>
element.mongoDbFactory
in interface ServiceConnectionFactory
serviceId
- the name of the servicemongoDbFactoryConfig
- configuration for the mongo db factory createdCloudException
- if the specified service doesn't existpublic ConnectionFactory rabbitConnectionFactory()
ConnectionFactory
object associated with the only RabbitMQ service bound to the app.
This is equivalent to the <cloud:rabbit-connection-factory>
element.rabbitConnectionFactory
in interface ServiceConnectionFactory
CloudException
- if there are either 0 or more than 1 RabbitMQ services.public ConnectionFactory rabbitConnectionFactory(RabbitConnectionFactoryConfig rabbitConnectionFactoryConfig)
ConnectionFactory
object associated with the only RabbitMQ service bound to the app
configured as specified.
This is equivalent to the <cloud:rabbit-connection-factory>
element
with a nested <cloud:rabbit-options>
element.rabbitConnectionFactory
in interface ServiceConnectionFactory
rabbitConnectionFactoryConfig
- configuration for the rabbit connection factory createdCloudException
- if there are either 0 or more than 1 RabbitMQ services.public ConnectionFactory rabbitConnectionFactory(String serviceId)
ConnectionFactory
object for the specified RabbitMQ service.
This is equivalent to the <cloud:rabbit-connection-factory service-id="serviceId">
element.rabbitConnectionFactory
in interface ServiceConnectionFactory
serviceId
- the name of the serviceCloudException
- if the specified service doesn't existpublic ConnectionFactory rabbitConnectionFactory(String serviceId, RabbitConnectionFactoryConfig rabbitConnectionFactoryConfig)
ConnectionFactory
object for the specified RabbitMQ service configured as specified.
This is equivalent to the <cloud:rabbit-connection-factory service-id="serviceId">
element
with a nested <cloud:rabbit-options>
element.rabbitConnectionFactory
in interface ServiceConnectionFactory
serviceId
- the name of the servicerabbitConnectionFactoryConfig
- configuration for the ConnectionFactory
createdCloudException
- if the specified service doesn't existpublic RedisConnectionFactory redisConnectionFactory()
RedisConnectionFactory
object associated with the only Redis service bound to the app.
This is equivalent to the <cloud:redis-connection-factory/>
elementredisConnectionFactory
in interface ServiceConnectionFactory
CloudException
- if there are either 0 or more than 1 redis services.public RedisConnectionFactory redisConnectionFactory(PooledServiceConnectorConfig redisConnectionFactoryConfig)
RedisConnectionFactory
object associated with the only Redis service bound to the app
configured as specified.
This is equivalent to the <cloud:redis-connection-factory service-id="serviceId">
element
with a nested <cloud:pool>
element.redisConnectionFactory
in interface ServiceConnectionFactory
redisConnectionFactoryConfig
- configuration for the RedisConnectionFactory
createdCloudException
- if there are either 0 or more than 1 redis services.public RedisConnectionFactory redisConnectionFactory(String serviceId)
RedisConnectionFactory
object for the specified Redis service.
This is equivalent to the <cloud:redis-connection-factory service-id="serviceId">
element.redisConnectionFactory
in interface ServiceConnectionFactory
serviceId
- the name of the serviceCloudException
- if the specified service doesn't existpublic RedisConnectionFactory redisConnectionFactory(String serviceId, PooledServiceConnectorConfig redisConnectionFactoryConfig)
RedisConnectionFactory
object for the specified Redis service configured as specified.
This is equivalent to the <cloud:redis-connection-factory service-id="serviceId">
element
with a nested <cloud:pool>
element.redisConnectionFactory
in interface ServiceConnectionFactory
serviceId
- the name of the serviceredisConnectionFactoryConfig
- configuration for the RedisConnectionFactory
createdCloudException
- if the specified service doesn't existpublic com.datastax.driver.core.Cluster cluster()
Cluster
object associated with the only Cassandra service bound to
the app.cluster
in interface ServiceConnectionFactory
Cluster
CloudException
- if there are either 0 or more than
1 Cassandra database services.public com.datastax.driver.core.Cluster cluster(CassandraClusterConfig config)
Cluster
object associated with the only Cassandra service bound to
the app configured as specified.cluster
in interface ServiceConnectionFactory
config
- configuration for the Cluster createdCluster
CloudException
- if there are either 0 or more than
1 Cassandra database services.public com.datastax.driver.core.Cluster cluster(String serviceId)
Cluster
object associated with the Cassandra serviceId
bound to the app.cluster
in interface ServiceConnectionFactory
serviceId
- the Cassandra serviceIdCluster
CloudException
- if there is no service bound with
the serviceId
public com.datastax.driver.core.Cluster cluster(String serviceId, CassandraClusterConfig config)
Cluster
object associated with the Cassandra serviceId
bound to the app configured as specified.cluster
in interface ServiceConnectionFactory
serviceId
- the Cassandra serviceIdconfig
- configuration for the Cluster createdCluster
CloudException
- if there is no service bound with
the serviceId
public Object service()
<cloud:service/>
element.service
in interface ServiceConnectionFactory
CloudException
- if there are either 0 or more than 1 services.public <T> T service(Class<T> serviceConnectorType)
<cloud:service connector-type="T.class"/>
element.service
in interface ServiceConnectionFactory
T
- the type of the service connector to be returnedserviceConnectorType
- the class of the service connector to be returnedCloudException
- if there are either 0 or more than 1 candidate services.public Object service(String serviceId)
<cloud:service service-id="serviceId"/>
element.service
in interface ServiceConnectionFactory
serviceId
- the service ID of the service to be returnedCloudException
- if the specified service doesn't existpublic <T> T service(String serviceId, Class<T> serviceConnectorType)
<cloud:service service-id="serviceId" connector-type="T.class"/>
element.service
in interface ServiceConnectionFactory
T
- the type of the service connector to be returnedserviceId
- the service ID of the service to be returnedserviceConnectorType
- the class of the service connector to be returnedCloudException
- if the specified service doesn't existpublic <T> T service(String serviceId, Class<T> serviceConnectorType, ServiceConnectorConfig serviceConnectorConfig)
service
in interface ServiceConnectionFactory