Bootstrapping

Classes in com.hammurapi.config.bootstrap package, which are packaged into com.hammurapi.config.bootstrap.jar allow to decouple service/component consumer from service/component implementation libraries and configurator libraries. The client classpath shall only contain the bootstrap jar and service/component interface classes.

com.hammurapi.config.bootstrap.jar is executable, and also contains an Ant task.

Examples

API

Bootstrapper<MyService> factory = new Bootstrapper<Object>(codebase);
FactoryClosure<MyService> factoryClosure = factory.create(configUrl, tokens, profile, services, bindings);
MyService service = factoryClosure.create();
try {
	... use service ...
} finally {
	Destroyable toDestroy=factoryClosure.getDestroyable();
	if (toDestroy!=null) {
		toDestroy.destroy();
	}
}

Command line

java -jar com.hammurapi.config.bootstrap.jar --codebase http://myserver/myservicedefinition.hgconfig
Command line parameters:
  --help Prints help and exits.
  --codebase <url>[;<url>] Semicolon separated list of boot class path URL's.
  --interactive If this option is provided, unresolved token substitutions are requested from the user.
  --properties URL to load token substitutions from. Loaded properties are backed by system properties.
  --profile Slash-separated profile path.
  --threads Thread pool size.

Ant task

<taskdef name="hgbootstrap" classname="com.hammurapi.config.bootstrap.BootstrapTask">
	<classpath>
    		<fileset dir="..." includes="com.hammurapi.config.bootstrap.jar"/>
    	</classpath>
</taskdef>
 
<hgbootstrap configUrl="..." codebase="...">
	<property name="..." value="..."/>
</hgbootstrap>

Parameters:

  • codebase - semicolon separated list of bootstrap codebase url's.
  • configUrl - url of configuration resource.
  • inheritAll - if true, all project properties are passed to the factory as bindings.
  • profile - profile path, slash separated.
  • threads - if set, the task creates a thread pool for the service to use.

Nested element:

  • property - binding property.
Last modified: 2009/12/15 00:03 by Pavel Vlasov
   
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Hammurapi Group