The description of several Ant tasks created for SevenHats project
BundleCompile
Classname - org.sevenhats.util.ant.BundleCompileTask
bundleCompile task serves for the bundle(s) compilation and packing into JAR. Each bundle will be packed into a JAR named after its symbolic name specified in MANIFEST.MF file. Before the compilation verifies all the bundle dependencies can be successfully found among the already compiled bundles specified.
| Attribute | Description |
|---|---|
| bundlesFolderPath | The name of path describing the locations of all the folders containing the bundle sources. Sample value - "sourceBundles" with the following path to be declared somewhere in the build file:
<path id="sourceBundles"> <dirset dir="${root.folder.containing.bundle.source.folders}"> <include name="*"/> </dirset> </path> |
| platformFolderPath | The name of path describing the locations of already compiled bundles, which may be required as bundle dependencies. Sample value - "compiledBundles" with the following path to be declared somewhere in the build file:
<path id="compiledBundles"> <fileset dir="${folder.containing.jarred.bundles}"> <include name="*.jar"/> </fileset> </path> |
| destFolder | The destination folder. Bundles will be compiled, jarred and put into this location |
| staticResources | The pattern, defining the static resources to be copied from the bundle sources to destination. Sample value - "images.pattern" with the following pattern to be described somewhere in the build file:
<patternset id="images.pattern"> <include name="**/*.gif"/> <include name="**/*.png"/> <include name="**/*.jpeg"/> <include name="**/*.jpg"/> </patternset> |
| fork | Determines whether to execute javac using the JDK compiler internally (todo: specify the default value) |
| target | Generate class files for specific VM version (e.g., 1.1 or 1.2). Note that the default value depends on the JVM that is running Ant. In particular, if you use JDK 1.4+ the generated classes will not be usable for a 1.1 Java VM unless you explicitly set this attribute to the value 1.1 (which is the default value for JDK 1.1 to 1.3). |
| debug | Indicates whether source should be compiled with debug information; defaults to off. If set to off, -g:none will be passed on the command line for compilers that support it (for other compilers, no command line argument will be used). If set to true, the value of the debuglevel attribute determines the command line argument. (todo: specify the default value) |
ProjectValidate
Classname - org.sevenhats.util.ant.ProjectValidateTask
Checks the source code if it is created in accordance with SevenHats guidelines. For now, it checks whether the Javadoc and '@author' tag are present in the .java file.
| Attribute | Description |
|---|---|
| projectsRootDir | The path, containing the bundles to check |
| generateReport | Defines, whether to generate a report basing on the source code analysis. Possible values are 'true' and 'false'. If the report generation is enabled, the report is generated as 'validation-report.txt' file in the current folder |
| failBuildOnValidationError | Defines whether the build should be failed in case of invalid source code. Possible values are 'true' and 'false' |
CreateConfig
Classname - org.sevenhats.util.ant.CreateConfigIniTask
Creates an Equinox configuration file needed to launch the OSGi application based on SevenHats.
| Attribute | Description |
|---|---|
| bundlesFolderPath | The name of path describing the locations of all the jarred bundles to be launched. |
| platformFolderPath | The name of path describing the locations of already compiled bundles, which may be required as bundle dependencies. Sample value - "compiledBundles" with the following path to be declared somewhere in the build file:
<path id="compiledBundles"> <fileset dir="${folder.containing.jarred.bundles}"> <include name="*.jar"/> </fileset> </path> |
| platformFolder | The path to the folder containing the Equinox platform |
| dest | The destination file path |
| defaultStartLevel | Default start level for bundles |
| framework | Path to org.eclipse.osgi_xxx.jar |
CreateConfigForTomcat
Classname - org.sevenhats.util.ant.CreateTomcatConfigIniTask
Creates an Equinox configuration file needed to launch the OSGi application based on SevenHats inside of Tomcat servlet container.
All the attributes are equivalent to the attributes of 'createConfig' ant task. This task has also one additional attribute:
| Attribute | Description |
|---|---|
| additionalBundles | The description of additional bundles needed to be included into the application. The value of this attribute should be defined according to Equinox config.ini format. For example: additionalBundles="org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@start"
Here the additional bundle named 'org.eclipse.equinox.common' will be started using the bundle start level set to 2. Also, the bundle 'org.eclipse.update.configurator' will be started using the default start level. |
Please note: to run the following tasks org.sevenhats.deployment and org.sevenhats.deployment.config bundles should be present and have the ACTIVE state in the target OSGi application. Please use compileDeploymentBundles ant target in <SevenHats_home>/Build/scripts/build.xml in order to build these deployment-related bundles.
The following tasks use JMX technology and require JDK 6.
Jar containing the following tasks is located at <SevenHats_home>/Build/tasks/lib/org.sevenhats.deployment.jar
ListBundles
Classname - org.sevenhats.util.ant.jmx.ListBundlesTask
Connects to the running OSGi application and prints the list of available bundles. For each bundle the following information is printed: bundle ID, bundle symbolic name and bundle state.
| Attribute | Description |
|---|---|
| url | the URL pointing to the JMX service published by org.sevenhats.deployment bundle. Default value to be used is
service:jmx:rmi:///jndi/rmi://localhost:4444/deploymentService
|
| objectName | the unique ID of the JMX service. Default value is
org.sevenhats.deployment:name=deploymentService |
| username | the username. Predefined value is deploymentAdmin |
| password | the password. Predefined value is deployment |
StartBundle
Classname - org.sevenhats.util.ant.jmx.StartBundleTask
Puts the target bundle in ACTIVE state. Target bundle can be either in RESOLVED or in ACTIVE state.
This task attributes include the same attributes as listBundles task has. Target bundle can be specified either by bundle ID or by symbolic name and version. You can specify only bundle symbolic name if there is only one matching bundle in the OSGi platform.
| Attribute | Description |
|---|---|
| bundleId | the bundle ID of target bundle |
| symbolicName | the symbolic name of target bundle |
| version | the version of target bundle |
StopBundle
Classname - org.sevenhats.util.ant.jmx.StopBundleTask
Puts the target bundle in RESOLVED state. Target bundle can be either in RESOLVED or in ACTIVE state.
This task's behavior is similar to startBundle task.
DeployBundle
Classname - org.sevenhats.util.ant.jmx.DeployBundleTask
Deploys the file from the local filesystem (i.e. local for ant task executer) to the running OSGi framework instance. Bundle needs to be started after deployment in order to be in ACTIVE state. Please use startBundle task for such purpose.
Note: framework instance should be configured with bundle.dest.folder. This attribute is specified in deployment.properties (see org.sevenhats.deployment.config bundle) and determines where the downloaded bundle file should be placed to at the server side.
This task attributes include the same attributes as listBundles task has. In addition there is a way to specify the bundle to be deployed:
| Attribute | Description |
|---|---|
| filename | path to the bundle at the local filesystem |