Package de.smartics.properties.api.config

Provides an API to use properties.

See:
          Description

Package de.smartics.properties.api.config Description

Provides an API to use properties.

This API falls in two major parts:

  1. Create an instance of configuration properties that provides access to properties keys and values: de.smartics.properties.api.config.app
  2. Domain objects like configuration keys or ConfigurationProperties: de.smartics.properties.api.config.domain and its sub packages.

In the following sections you find information how to get started using properties with this API.

Using Factory and Application ID Defaults

The simplest way of creating a configuration properties instance is to rely on the application configuration found in the Manifest file of the current archive and only provide the environment identifier (test in this example) like this:

final ConfigurationPropertiesFactory factory = InfinispanCacheManagerFactory.createDefaultFactory();
final EnvironmentId environmentId = new EnvironmentId("test");
final ConfigurationProperties propertiesConfiguration = factory.get(environmentId);

Using a specific Implementation of the Properties Configuration Factory

Instead of using the ConfigurationPropertiesFactoryFactory.createDefaultFactory() you may pass in the type of factory you want to create.

final ConfigurationPropertiesFactory factory =
InfinispanCacheManagerFactory.create(MyConfigurationPropertiesFactory.class);
...

Explicit Configuration Key

If you do not want to rely on the automatic application ID detection of the group ID, application ID and version from the manifest file (for details on this please refer to ApplicationIdLoader).

final ConfigurationKey key =
  new EnvAppConfigurationKeyBuilder()
    .withEnvironmentName(environmentId)
    .withGroupId(myGroup)
    .withArtifactId(myArtifact)
    .withVersion(myVersion)
    .build();
final ConfigurationPropertiesFactory factory = ... (see above)
final ConfigurationProperties propertiesConfiguration = factory.get(key);

See Also:
ConfigurationPropertiesFactoryFactory, ConfigurationPropertiesFactory, ConfigurationKey, ConfigurationProperties, EnvAppConfigurationKeyBuilder
Since:
1.0


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.