S
- The service typepublic abstract class AbstractCloudServiceConnectorFactory<S> extends org.springframework.beans.factory.config.AbstractFactoryBean<S> implements CloudServiceConnectorFactory<S>
This factory uses the service creator provided through the constructor to create services. If the service name is provided it creates a service object based on the service bound to that name. Otherwise, it creates a singleton service and fails if it doesn't find a unique service of the expected type.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
serviceId |
Constructor and Description |
---|
AbstractCloudServiceConnectorFactory(java.lang.Class<S> serviceConnectorType,
ServiceConnectorConfig serviceConnectorConfiguration) |
AbstractCloudServiceConnectorFactory(java.lang.String serviceId,
java.lang.Class<S> serviceConnectorType,
ServiceConnectorConfig serviceConnectorConfiguration) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected S |
createInstance() |
S |
createService() |
java.lang.Class<?> |
getObjectType() |
java.lang.String |
getServiceId() |
void |
setCloud(Cloud cloud)
Set the cloud, for internal testing purpose only.
|
void |
setServiceConnectorType(java.lang.Class<? extends S> serviceConnectorType) |
public AbstractCloudServiceConnectorFactory(java.lang.String serviceId, java.lang.Class<S> serviceConnectorType, ServiceConnectorConfig serviceConnectorConfiguration)
serviceId
- Optional service name property. If this property is null, a unique service of the expected type
(redis, for example) needs to be bound to the application.serviceConnectorType
- the class of the service connector that will be returnedserviceConnectorConfiguration
- configuration to be applied to the service connectorpublic AbstractCloudServiceConnectorFactory(java.lang.Class<S> serviceConnectorType, ServiceConnectorConfig serviceConnectorConfiguration)
public void setCloud(Cloud cloud)
For normal usage, the InitializingBean
approach will create (if needed) a CloudFactory
and obtain a
Cloud
from it.
cloud
- the Cloud
instance describing the discovered runtime environmentpublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class org.springframework.beans.factory.config.AbstractFactoryBean<S>
java.lang.Exception
protected S createInstance() throws java.lang.Exception
createInstance
in class org.springframework.beans.factory.config.AbstractFactoryBean<S>
java.lang.Exception
public S createService()
createService
in interface CloudServiceConnectorFactory<S>
public java.lang.Class<?> getObjectType()
public java.lang.String getServiceId()
getServiceId
in interface CloudServiceConnectorFactory<S>
public void setServiceConnectorType(java.lang.Class<? extends S> serviceConnectorType)