@Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (cloudFactory == null) { try { cloudFactory = beanFactory.getBean(CloudFactory.class); } catch (NoSuchBeanDefinitionException ex) { cloudFactory = new CloudFactory(); ((SingletonBeanRegistry)beanFactory).registerSingleton(CLOUD_FACTORY_BEAN_NAME, cloudFactory); } } this.cloud = cloudFactory.getCloud(); this.connectionFactory = new ServiceConnectionFactory(); }
/** * Get the {@link RedisConnectionFactory} object for the specified Redis service. * * This is equivalent to the <cloud:redis-connection-factory service-id="serviceId"> element. * * @param serviceId the name of the service * @return redis connection factory * @throws CloudException if the specified service doesn't exist */ public RedisConnectionFactory redisConnectionFactory(String serviceId) { return redisConnectionFactory(serviceId, null); }
/** * Get the {@link RedisConnectionFactory} object associated with the only Redis service bound to the app. * * This is equivalent to the <cloud:redis-connection-factory/> element * * @return redis connection factory * @throws CloudException if there are either 0 or more than 1 redis services. */ public RedisConnectionFactory redisConnectionFactory() { return redisConnectionFactory((PooledServiceConnectorConfig)null); }
/** * Get the service connector object for the specified service. * * This is equivalent to the <cloud:service service-id="serviceId"/> element. * * @return service connector object * @throws CloudException if the specified service doesn't exist */ public Object service(String serviceId) { return service(serviceId, Object.class); }
/** * Get the {@link MongoDbFactory} object for the specified MongoDB service. * * This is equivalent to the <cloud:mongo-db-factory service-id="serviceId"> element. * * @param serviceId the name of the service * @return mongo db factory * @throws CloudException if the specified service doesn't exist */ public MongoDbFactory mongoDbFactory(String serviceId) { return mongoDbFactory(serviceId, null); }
/** * Get the {@link DataSource} object associated with the only relational database service bound to the app. * * This is equivalent to the <cloud:data-source/> element. * * @return data source * @throws CloudException if there are either 0 or more than 1 relational database services. */ public DataSource dataSource() { return dataSource((DataSourceConfig)null); }
/** * Get the {@link ConnectionFactory} object for the specified RabbitMQ service. * * This is equivalent to the <cloud:rabbit-connection-factory service-id="serviceId"> element. * * @param serviceId the name of the service * @return rabbit connection factory * @throws CloudException if the specified service doesn't exist */ public ConnectionFactory rabbitConnectionFactory(String serviceId) { return rabbitConnectionFactory(serviceId, null); }
/** * Get the {@link ConnectionFactory} object associated with the only RabbitMQ service bound to the app. * * This is equivalent to the <cloud:rabbit-connection-factory> element. * * @return rabbit connection factory * @throws CloudException if there are either 0 or more than 1 RabbitMQ services. */ public ConnectionFactory rabbitConnectionFactory() { return rabbitConnectionFactory((RabbitConnectionFactoryConfig)null); }
/** * Get the service connector object associated with the only service bound to the app. * * This is equivalent to the <cloud:service/> element. * * @return service connector object * @throws CloudException if there are either 0 or more than 1 services. */ public Object service() { return service(Object.class); }
/** * Get the {@link DataSource} object for the specified relational database service. * * This is equivalent to the <cloud:data-source service-id="serviceId"/> * * @param serviceId the name of the service * @return data source * @throws CloudException if the specified service doesn't exist */ public DataSource dataSource(String serviceId) { return dataSource(serviceId, null); }
/** * Get the {@link MongoDbFactory} object associated with the only MongoDB service bound to the app. * * This is equivalent to the <cloud:mongo-db-factory/> element. * * @return mongo db factory * @throws CloudException if there are either 0 or more than 1 mongodb services. */ public MongoDbFactory mongoDbFactory() { return mongoDbFactory((MongoDbFactoryConfig)null); }