ScopeThis documents describes various aspects of abeans configuration. Table of Contents1. Overview2. Configuration location3. AbeansStartup.txt4. Component configuration5. Configuring applications6. Code ExamplesDocument History1. OverviewAbeans offer very open and flexible configuration for both dynamic configuration of deployed applications as well as powerful mechanism for implementing these designs in code. 2. Configuration locationCentral configuration parameter for all abeans applications is AbeansStartup.txt file. Location of this file is defined as Abeans home location. To define specific location, pass the abeans.home variable to the JVM using the -D parameter. Otherwise, the following locations will be searched:
After AbeansStartup.txt has been located its location will be put in abeans.home, if it has not been defined specifically. 3. AbeansStartup.txtThis file defines location of various abeans resources. Each location can reside either in local filesystem or on a remote server defined by URL. Abeans access these locations through loader mechanism, where actual physical location of resource is not predefined. These loaders could be extended to read data from SQL database, web server or some other location. Typical AbeansStartup will look something like this:
Each resource entry defines a single Resource location. Unlike local file access, this location is not bound to a single type of access and can be changed without affecting the application. Each entry has two required parameters, NAME and LOADER. Name will uniquely identify this resource location within an application, Loader defines actual implementation that will access the data. Additionally, each resource location can specify additional parameters that will be passed to the Loader implementation. This data could, for example, include username and password for remote server. Configuration and Home are special and should in most cases be configured in the same way as shown above. Data location is used for application state storage and most common user defined data accessed from application. There are two most commonly used loaders: abeans.core.defaults.FileLoader and abeans.core.defaults.URLLoader. Each of them accepts single parameter with name root.path which defines resource location. This can be either absolute path (/home/user) or relative ($config.root$/files) for FileLoader and absolute only (http://config.server.org/localconfig) for URLLoader. Any text enclosed within $ will be considered to be a variable, similar to environment variable. These variables can be changed or defined within an application or by passing them via JVM -D parameter. Such approach ensures that any resource location can be changed at any time without recompiling any code. 4. Component configurationApart from global configuration, each component that implements abeans.core.defaults.Configurable can be configured individually. These include most services and by default all applications. For a comprehensive list of all policy and configuration values see Abeans Services Configuration One aspect of configuration is defined by Configurable interface. Such configuration class based configuration and serves to define configuration defaults. This means if object B extends A, where each object has its own configuration in B.txt and A.txt respectively, object B will receive configuration from A.txt as well as B.txt. Additionally, any parameters for B will override same parameters for A. These files are stored in abeans.home/Default location and indexed in index.txt file in the same directory. Index file contains class - configuration file pairs, defining which file contains configuration for which class. Other aspect is instance configuration. This configuration is bound to the Identifiable interface, meaning it can be used to configure only classes implementing abeans.core.Identifiable interface. Each such objects defines a name independant from class, that can be changed during runtime. In contrast to type based configuration, this approach allows different instances of same class to have differenct configurations. On example for this would be abeans.models.Abean class. Type based configuration from Abean.txt would define parameters common to all Abean objects. Assuming that each Abean representing device is Identifiable which declares name of the device, specific configuration could be provided for each device. Any configuration obtained in such way will be merged with type based configuration. Example: Devices are implemented using abeans.models.Abean class which implements abeans.core.Identifiable interface. Each device will have unique name (DEV_01, DEV_02, ...) that will be reflected in Identifiable.getIdentifier().getName(). Individual configurations could now be provided using DEV_01.txt, DEV_02.txt configuration files. These configuration files are stored at abeans.home location. Third way is using specific named configuration. In this case, an object requests a specific configuration with a name indepenant from above methods. 5. Configuring applicationsThis section describes some of the common abeans application configuration files along with their default locations. abeans.home/AbeansStartup.txt - Contains information about resource location and loaders. Resource elements defines unique name of the resource location and loader that will be used to access it. Each such resource can have have a list of property elements, that define name-value pair resource location parameters. Example:
abeans.home/PolicyManager.txt - Defines global policies that affect global application behaviour. Each line defines a policy and its value. Following is the list of most common policies:
These policies may be reconfigured in abeans.home/Default/ApplicationContext.txt or in default application configuration files. Example:
abeans.home/AbeansConfig.txt - Defines model and plugs used by application. This file defines which model applications use and which plugs will be made available to applications. Only a single model may be defined, but an arbitrary number of plugs. This file merely declares this information, each application must still select which plug it will use and whether it relies on model. This is configured in abeans.home/Default/ApplicationContext.txt Example:
In most cases it is not neccessary to modify this configuration. abeans.home/Default/ApplicationContext.txt - Defines default policies for all applications. Each abeans application will extend this class, so any policy set here will affect all applications. These settings also allow overriding of abeans core policies as defined in abeans.home/PolicyManager.txt. Example: if PolicyManager defines ConsoleLogPolicy to OFF and ApplicationContext to ALL, then no logs produced by abeans core will be displayed, but all by application. This file must also contain declaration of plugs the application wishes to use, by reffering to plug declarations in abeans.home/AbeansConfig.txt Plugs used by application are separated by spaces and refer to names declared in AbeansConfig.txt, not actual class names. These names are also used within application to identify plugs and should be equal to Plug.getName() Example:
This example shows declaration of plugs and overriding ConsoleLoggingPolicy for application. Two plugs are made available to all applications (Simulator and ACS) and sets that all logs produced by application should be displayed in console. abeans.home/Default/index.txt - defines default configuration files for individual classes. Each line contains class name - configuration file pair. Note that configuration names are specified without extension. Example:
6. Code ExamplesLoading configuration from an identifiable class.
Loading files from resource location.
Document History
| |||||||||||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||||||||||