Beispiel #1
0
  /**
   * Create Properties object with settings from the service object, if found on the given service.
   * The supported settings are: com.gs.application.dependsOn com.gs.service.type
   * com.gs.service.icon com.gs.service.network.protocolDescription
   *
   * @param service The service object the read the settings from
   * @return Properties object populated with the above properties, if found on the given service.
   */
  private Properties createServiceContextProperties(final Service service) {
    final Properties contextProperties = new Properties();

    // contextProperties.setProperty("com.gs.application.services",
    // serviceNamesString);
    if (service.getDependsOn() != null) {
      contextProperties.setProperty(
          CloudifyConstants.CONTEXT_PROPERTY_DEPENDS_ON, service.getDependsOn().toString());
    }
    if (service.getType() != null) {
      contextProperties.setProperty(
          CloudifyConstants.CONTEXT_PROPERTY_SERVICE_TYPE, service.getType());
    }
    if (service.getIcon() != null) {
      contextProperties.setProperty(
          CloudifyConstants.CONTEXT_PROPERTY_SERVICE_ICON,
          CloudifyConstants.SERVICE_EXTERNAL_FOLDER + service.getIcon());
    }
    if (service.getNetwork() != null) {
      if (service.getNetwork().getProtocolDescription() != null) {
        contextProperties.setProperty(
            CloudifyConstants.CONTEXT_PROPERTY_NETWORK_PROTOCOL_DESCRIPTION,
            service.getNetwork().getProtocolDescription());
      }
    }

    contextProperties.setProperty(
        CloudifyConstants.CONTEXT_PROPERTY_ELASTIC, Boolean.toString(service.isElastic()));

    return contextProperties;
  }