Examples of CloudEnvironment


Examples of org.cloudfoundry.runtime.env.CloudEnvironment

public class EnvironmentContextListener implements ServletContextListener {

  private static Log log = LogFactory.getLog(EnvironmentContextListener.class);

  public void contextInitialized(ServletContextEvent sce) {
    CloudEnvironment environment = new CloudEnvironment();
    if (environment.getInstanceInfo() != null) {
      log.info("VCAP_SERVICES: " + environment.getServices());
      System.setProperty("PROFILE", "cloud");
    } else {
      System.setProperty("PROFILE", "default");
    }
    try {
      if (!CollectionUtils.isEmpty(environment.getServiceInfos(RedisServiceInfo.class))) {
        log.info("Redis service detected");
        System.setProperty("REDIS", "true");
      }
    }
    catch (Exception e) {
View Full Code Here

Examples of org.cloudfoundry.runtime.env.CloudEnvironment

@Configuration
public abstract class AbstractConfiguration {
 
  @Bean
  public ConnectionFactory connectionFactory() {
    CloudEnvironment environment = new CloudEnvironment();
    if (environment.getInstanceInfo() != null) {
      return new RabbitServiceCreator(new CloudEnvironment()).createSingletonService().service;
    } else {
      CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
      connectionFactory.setUsername("guest");
      connectionFactory.setPassword("guest");
      return connectionFactory;
View Full Code Here

Examples of org.cloudfoundry.runtime.env.CloudEnvironment

@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
public class ServicesConfiguration {

    @Bean
    public CloudEnvironment cloudEnvironment() {
        return new CloudEnvironment();
    }
View Full Code Here

Examples of org.cloudfoundry.runtime.env.CloudEnvironment

public class CloudApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

  @Override
  public void initialize(ConfigurableApplicationContext applicationContext) {
    CloudEnvironment env = new CloudEnvironment();
    if (env.getInstanceInfo() != null) {
      System.out.println("cloud API: " + env.getCloudApiUri());
      applicationContext.getEnvironment().setActiveProfiles("cloud");
    }
    else {
      applicationContext.getEnvironment().setActiveProfiles("default");
    }
View Full Code Here

Examples of org.cloudfoundry.runtime.env.CloudEnvironment

@Configuration
public abstract class AbstractConfiguration {
 
  @Bean
  public ConnectionFactory connectionFactory() {
    CloudEnvironment environment = new CloudEnvironment();   
    if (environment.getInstanceInfo() != null) {
      return new RabbitServiceCreator(new CloudEnvironment()).createSingletonService().service;
    } else {
      CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
      connectionFactory.setUsername("guest");
      connectionFactory.setPassword("guest");
      return connectionFactory;
View Full Code Here

Examples of org.cloudfoundry.runtime.env.CloudEnvironment

public class WorkerHandler {

  private static final Logger logger = LoggerFactory.getLogger(WorkerHandler.class);
  private int instanceIndex = -1;
  public WorkerHandler() {
    CloudEnvironment environment = new CloudEnvironment();
    if (environment.getInstanceInfo() != null) {
      instanceIndex = environment.getInstanceInfo().getInstanceIndex();
    }
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.