Exemplo n.º 1
0
 /**
  * Return object representation of the VCAP_SERIVCES environment variable
  *
  * <p>Returns a map whose key is the label (for example "redis-2.2") of the service and value is a
  * list of services for that label. Each list element is a map with service attributes.
  *
  * @return
  */
 @SuppressWarnings("unchecked")
 private Map<String, List<Map<String, Object>>> getRawServices() {
   String servicesString = getValue("VCAP_SERVICES");
   if (servicesString == null || servicesString.length() == 0) {
     return new HashMap<String, List<Map<String, Object>>>();
   }
   try {
     return objectMapper.readValue(servicesString, Map.class);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 2
0
 @SuppressWarnings("unchecked")
 public ApplicationInstanceInfo getInstanceInfo() {
   String instanceInfoString = getValue("VCAP_APPLICATION");
   if (instanceInfoString == null || instanceInfoString.trim().isEmpty()) {
     return null;
   }
   try {
     Map<String, Object> infoMap = objectMapper.readValue(instanceInfoString, Map.class);
     return new ApplicationInstanceInfo(infoMap);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }