Java Code Examples for org.apache.brooklyn.util.core.config.ConfigBag#getAllConfigRaw()

The following examples show how to use org.apache.brooklyn.util.core.config.ConfigBag#getAllConfigRaw() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JcloudsPropertiesFromBrooklynProperties.java    From brooklyn-server with Apache License 2.0 6 votes vote down vote up
/**
 * @see LocationPropertiesFromBrooklynProperties#getLocationProperties(String, String, Map)
 */
public Map<String, Object> getJcloudsProperties(String providerOrApi, String regionOrEndpoint, String namedLocation, Map<String, ?> properties) {
    if(Strings.isNullOrEmpty(namedLocation) && Strings.isNullOrEmpty(providerOrApi)) {
        throw new IllegalArgumentException("Neither cloud provider/API nor location name have been specified correctly");
    }

    ConfigBag jcloudsProperties = ConfigBag.newInstance();
    String provider = getProviderName(providerOrApi, namedLocation, properties);
    
    // named properties are preferred over providerOrApi properties
    jcloudsProperties.put(LocationConfigKeys.CLOUD_PROVIDER, provider);
    jcloudsProperties.putAll(transformDeprecated(getGenericLocationSingleWordProperties(properties)));
    jcloudsProperties.putAll(transformDeprecated(getGenericLocationKnownProperties(properties)));
    jcloudsProperties.putAll(transformDeprecated(getGenericJcloudsSingleWordProperties(providerOrApi, properties)));
    jcloudsProperties.putAll(transformDeprecated(getGenericJcloudsKnownProperties(properties)));
    jcloudsProperties.putAll(transformDeprecated(getGenericJcloudsPropertiesPrefixedJclouds(providerOrApi, properties)));
    jcloudsProperties.putAll(transformDeprecated(getProviderOrApiJcloudsProperties(providerOrApi, properties)));
    jcloudsProperties.putAll(transformDeprecated(getRegionJcloudsProperties(providerOrApi, regionOrEndpoint, properties)));
    if (!Strings.isNullOrEmpty(namedLocation)) jcloudsProperties.putAll(transformDeprecated(getNamedJcloudsProperties(namedLocation, properties)));
    setLocalTempDir(properties, jcloudsProperties);

    return jcloudsProperties.getAllConfigRaw();
}
 
Example 2
Source File: LocalhostPropertiesFromBrooklynProperties.java    From brooklyn-server with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Object> getLocationProperties(String provider, String namedLocation, Map<String, ?> properties) {
    if (Strings.isNullOrEmpty(namedLocation) && Strings.isNullOrEmpty(provider)) {
        throw new IllegalArgumentException("Neither cloud provider/API nor location name have been specified correctly");
    }

    ConfigBag result = ConfigBag.newInstance();
    
    result.putAll(transformDeprecated(getGenericLocationSingleWordProperties(properties)));
    result.putAll(transformDeprecated(getMatchingSingleWordProperties("brooklyn.location.", properties)));
    result.putAll(transformDeprecated(getMatchingProperties("brooklyn.location.localhost.", "brooklyn.localhost.", properties)));
    if (!Strings.isNullOrEmpty(namedLocation)) result.putAll(transformDeprecated(getNamedLocationProperties(namedLocation, properties)));
    setLocalTempDir(properties, result);
    
    return result.getAllConfigRaw();
}
 
Example 3
Source File: BrooklynComponentTemplateResolver.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
private static BrooklynComponentTemplateResolver newInstance(BrooklynClassLoadingContext context, ConfigBag attrs, AbstractResource optionalTemplate) {
    String type = getDeclaredType(null, optionalTemplate, attrs);
    if (Strings.isBlank(type)) {
        String msg = "No type defined " 
                + (attrs == null ? ", no attributes supplied" : "in " + "[" + attrs.getAllConfigRaw() + "]")
                + (optionalTemplate == null ? "" : ", template " + optionalTemplate);
        throw new IllegalArgumentException(msg);
    }
    return new BrooklynComponentTemplateResolver(context, attrs, optionalTemplate, type);
}
 
Example 4
Source File: LocationPropertiesFromBrooklynProperties.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
/**
 * Finds the properties that apply to location, stripping off the prefixes.
 * 
 * Order of preference (in ascending order) is:
 * <ol>
 * <li>brooklyn.location.*
 * <li>brooklyn.location.provider.*
 * <li>brooklyn.location.named.namedlocation.*
 * </ol>
 * <p>
 * Converts deprecated hyphenated properties to the non-deprecated camelCase format. 
 */
public Map<String, Object> getLocationProperties(String provider, String namedLocation, Map<String, ?> properties) {
    ConfigBag result = ConfigBag.newInstance();
    
    if (!Strings.isNullOrEmpty(provider)) 
        result.put(LocationConfigKeys.CLOUD_PROVIDER, provider);
    // named properties are preferred over providerOrApi properties
    result.putAll(transformDeprecated(getGenericLocationSingleWordProperties(properties)));
    if (!Strings.isNullOrEmpty(provider)) result.putAll(transformDeprecated(getScopedLocationProperties(provider, properties)));
    if (!Strings.isNullOrEmpty(namedLocation)) result.putAll(transformDeprecated(getNamedLocationProperties(namedLocation, properties)));
    
    setLocalTempDir(properties, result);
    
    return result.getAllConfigRaw();
}
 
Example 5
Source File: ElectPrimaryTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@Override
public String call(ConfigBag args) {
    String result = message+" "+entity()+" args="+args.getAllConfigRaw();
    promoteDemoteEffectorMessages.add(result);
    return result;
}