Skip to content

Deployment

stockiNail edited this page Oct 12, 2015 · 3 revisions

Deploying artifacts

JEM provides an utility based on Apache Ant to deploy artifacts and files on the global file system of JEM, to be executed from jobs on JEM.

The Apache Ant task uses a REST JEM API to load files on JEM.

UPLOAD ANT task

The task has been implemented in org.pepstock.jem.ant.tasks.utilities.Upload.

Here is an example how to add the Apache Ant task in your build file, remembering to link to JEM jars:

<taskdef name="upload" classname="org.pepstock.jem.ant.tasks.utilities.Upload">
	<classpath>
		<pathelement location="../../../classes" />
		<fileset dir="../../../lib">
			<filename name="**/*.jar"/>
		</fileset>
	</classpath>
</taskdef>

The task is composed by 2 main elements.

The first, upload, configures the REST connection to upload the artifacts. It needs url REST application and userid} & password to connect JEM by REST. Of course, you can use variables, defined inside of ANT.

Here is the example:

<property name="userid" value="root"/>

<target name="main">
	<upload  url="https://localhost:8888/rest" userid="${userid}" password="sss">
        ....
	</upload>
</target>

The inner elements of upload is destination element which configures on which file system and folder to load the artifacts or files.

The elements uses the fileset feature, provided by Apache Ant, to specify which files must be uploaded.

destination element has got 2 attributes to be set:

  • type is a string that specifies on which file system the files must be loaded. It can contains one of following values:
    • Data, where all datasets are stored
    • Library, where all libraries (i.e. jars, so) are stored
    • Source, where all sources (i.e. xml to be included, scripts) are stored
    • Class, where all classes, not in jars, are stored
    • Binary, where all binaries (i.e. native commands of OS, cobol or C modules), are stored
  • path is a string which represents the additional path to add to file systems where to put the files

Here is the example:

<property name="userid" value="root"/>

<taskdef name="upload" classname="org.pepstock.jem.ant.tasks.utilities.Upload">
	<classpath>
		<pathelement location="../../../classes" />
		<fileset dir="../../../lib">
			<filename name="**/*.jar"/>
		</fileset>
	</classpath>
</taskdef>

<target name="main">
	<upload  url="https://localhost:8888/rest" userid="${userid}" password="sss">
		<destination type="source" path="/stock/">
			<fileset dir="../../../lib">
					<filename name="**/jem*.jar"/>
			</fileset>
		</destination>	
	</upload>
</target>

This example will upload all jars files, with JEM as prefix on name, to the source file system, in a specific folder, named stock. All uploaded files are stored in ${jem.source}/stock/jem*.jar.

Pay attention that the upload task will always override existing files and creates new folders if not existing.

Clone this wiki locally