S
- The service typepublic abstract class AbstractCloudServiceConnectorFactory<S> extends 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 String |
serviceId |
logger
Constructor and Description |
---|
AbstractCloudServiceConnectorFactory(Class<S> serviceConnectorType,
ServiceConnectorConfig serviceConnectorConfiguration) |
AbstractCloudServiceConnectorFactory(String serviceId,
Class<S> serviceConnectorType,
ServiceConnectorConfig serviceConnectorConfiguration) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected S |
createInstance() |
S |
createService() |
Class<?> |
getObjectType() |
String |
getServiceId() |
void |
setCloud(Cloud cloud)
Set the cloud, for internal testing purpose only.
|
void |
setServiceConnectorType(Class<? extends S> serviceConnectorType) |
destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
protected String serviceId
public AbstractCloudServiceConnectorFactory(String serviceId, 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(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 Exception
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class AbstractFactoryBean<S>
Exception
protected S createInstance() throws Exception
createInstance
in class AbstractFactoryBean<S>
Exception
public S createService()
createService
in interface CloudServiceConnectorFactory<S>
public Class<?> getObjectType()
getObjectType
in interface FactoryBean<S>
getObjectType
in class AbstractFactoryBean<S>
public String getServiceId()
getServiceId
in interface CloudServiceConnectorFactory<S>