Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The getAllArgumentsAsNameValueMap() method provides a map of all argument values.
  • The getAllArguments() method provides a map of argument objects.
  • The OrderProcessStep object is here typed by MyJobArguments that is a class with job-specific declared arguments.
    • A class with job specific declared arguments extends com.sos.js7.job.JobArguments 

      Code Block
      languagejava
      titleExample of a class of the job-specific declared arguments
      import java.util.List;
      
      import com.sos.js7.job.JobArgument;
      import com.sos.js7.job.JobArguments;
      
      public class MyJobArguments extends JobArguments {
      	
      	private JobArgument<String> myString = new JobArgument<String>("myString", false);
          private JobArgument<List<String>> myList = new JobArgument<>("myList", false);
          private JobArgument<Boolean> myBool = new JobArgument<>("test", false, true);
      
          public JobArgument<String> getMyString() {
              return myString;
          }
      
          public JobArgument<List<String>> getMyList() {
              return myList;
          }
      
          public JobArgument<Boolean> getMyBool() {
              return myBool;
          }
      }
  • For further methods to access arguments see JS7 - Job API

Creating a Maven project in the development environment

Die Klassen com.sos.js7.job.Job, com.sos.js7.job.JobArguments etc. sind nicht in einem öffentlichen Maven Repository verfügbar, daher ist in dem Maven Projekt ein lokales Repository anzulegen.

  • Die Verzeichnisse sos und lib müssen angelegt werden
    Image Added
  • Das lib Verzeichnis wird das lokale Repository.
  • Folgende JAR-Dateien müssen aus einer Agenten Installation ./lib/sos in des sos Verzeichnis des Maven Projekt kopiert werden (hier am Beispiel Release 2.6.1).
    • com.sos-berlin.js7.engine.js7-base-2.6.1.jar
    • com.sos-berlin.js7.engine.js7-data-for-java-2.6.1.jar
    • com.sos-berlin.js7.engine.js7-launcher-for-java-2.6.1.jar
    • sos-commons-exception-2.6.1.jar
    • sos-commons-util-2.6.1.jar
    • sos-js7-job-2.6.1.jar
  • Folgende pom-xml sollte als Basis im Maven Projekt genutzt werden

    Code Block
    languagexml
    titlepom.xml
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>com.sos-berlin</groupId>
    	<artifactId>my-js7-jobs</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    
    	<properties>
    		<!-- release version of js7 jars -->
      		<sos.js7.version>2.6.1</sos.js7.version>
      		<!-- 3rd party versions -->
      		<scala.library.version>2.13.11</scala.library.version>
      		<slf4j.version>1.7.36</slf4j.version>
      		<io.vavr.version>0.10.4</io.vavr.version>
      		
      		<!-- groupId and artifactIds of js7 jars -->
      		<sos.js7.groupId>com.sos-berlin</sos.js7.groupId>
      		<sos.js7.job.artifactId>sos-js7-job</sos.js7.job.artifactId>
      		<sos.js7.commons.util.artifactId>sos-commons-util</sos.js7.commons.util.artifactId>
      		<sos.js7.commons.exception.artifactId>sos-commons-exception</sos.js7.commons.exception.artifactId>
      		
      		<sos.js7.engine.groupId>com.sos-berlin.js7.engine</sos.js7.engine.groupId>
      		<sos.js7.launcher.artifactId>js7-launcher-for-java</sos.js7.launcher.artifactId>
      		<sos.js7.data.artifactId>js7-data-for-java</sos.js7.data.artifactId>
      		<sos.js7.base.artifactId>js7-base</sos.js7.base.artifactId>
      		
      		<!-- directories with js7 jars to install the local project repository -->
      		<sos.js7.external.srcdir>${project.basedir}/sos</sos.js7.external.srcdir>
      		<!-- directory of local project repository  -->
      		<sos.js7.external.repodir>${project.basedir}/lib</sos.js7.external.repodir>
    	</properties>
    	
    	<repositories>
    		<!-- local project repository for external js7 jars -->
    		<repository>
    			<id>js7-jars</id>
    			<name>Local Repository with JS7 Jars</name>
    			<url>file://${sos.js7.external.repodir}</url>
    		</repository>
    		<!-- public repository for 3rd party jars -->
    		<repository>
    			<id>central</id>
    			<name>Central Repository</name>
    			<url>https://repo1.maven.org/maven2</url>
    			<snapshots>
    				<enabled>false</enabled>
    				<updatePolicy>never</updatePolicy>
    			</snapshots>
    		</repository>
    	</repositories>
    	
    	<dependencies>
      		<dependency>
    			<groupId>${sos.js7.engine.groupId}</groupId>
    			<artifactId>${sos.js7.launcher.artifactId}</artifactId>
    			<version>${sos.js7.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>${sos.js7.engine.groupId}</groupId>
    			<artifactId>${sos.js7.data.artifactId}</artifactId>
    			<version>${sos.js7.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>${sos.js7.engine.groupId}</groupId>
    			<artifactId>${sos.js7.base.artifactId}</artifactId>
    			<version>${sos.js7.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		
    		<dependency>
    			<groupId>${sos.js7.groupId}</groupId>
    			<artifactId>${sos.js7.job.artifactId}</artifactId>
    			<version>${sos.js7.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>${sos.js7.groupId}</groupId>
    			<artifactId>${sos.js7.commons.util.artifactId}</artifactId>
    			<version>${sos.js7.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>${sos.js7.groupId}</groupId>
    			<artifactId>${sos.js7.commons.exception.artifactId}</artifactId>
    			<version>${sos.js7.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		
    		<!-- 3rd Party -->
    		<dependency>
    			<groupId>org.scala-lang</groupId>
    			<artifactId>scala-library</artifactId>
    			<version>${scala.library.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>io.vavr</groupId>
    			<artifactId>vavr</artifactId>
            	<version>${io.vavr.version}</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>org.slf4j</groupId>
    			<artifactId>slf4j-api</artifactId>
    			<version>${slf4j.version}</version>
    			<scope>provided</scope>
    		</dependency>
    	</dependencies>
    	
    	<profiles>
    		<profile>
    			<id>create-local-repo</id>
    			<build>
    				<plugins>
    					<plugin>
    	                	<artifactId>maven-install-plugin</artifactId>
    	                	<version>2.5.2</version>
    	                	<executions>
    	                    	<execution>
    	                        	<id>install-${sos.js7.launcher.artifactId}</id>
    	                        	<goals>
    	                            	<goal>install-file</goal>
    	                        	</goals>
    	                        	<phase>initialize</phase>
    	                        	<configuration>
    	                            	<file>${sos.js7.external.srcdir}/${sos.js7.engine.groupId}.${sos.js7.launcher.artifactId}-${sos.js7.version}.jar</file>
    	                            	<groupId>${sos.js7.engine.groupId}</groupId>
    									<artifactId>${sos.js7.launcher.artifactId}</artifactId>
    	                            	<version>${sos.js7.version}</version>
    	                            	<packaging>jar</packaging>
    	                            	<localRepositoryPath>${sos.js7.external.repodir}</localRepositoryPath>
    	                            	<createChecksum>true</createChecksum>
    	                        	</configuration>
    	                    	</execution>
    	                    	<execution>
    	                        	<id>install-${sos.js7.data.artifactId}</id>
    	                        	<goals>
    	                            	<goal>install-file</goal>
    	                        	</goals>
    	                        	<phase>initialize</phase>
    	                        	<configuration>
    	                            	<file>${sos.js7.external.srcdir}/${sos.js7.engine.groupId}.${sos.js7.data.artifactId}-${sos.js7.version}.jar</file>
    	                            	<groupId>${sos.js7.engine.groupId}</groupId>
    									<artifactId>${sos.js7.data.artifactId}</artifactId>
    	                            	<version>${sos.js7.version}</version>
    	                            	<packaging>jar</packaging>
    	                            	<localRepositoryPath>${sos.js7.external.repodir}</localRepositoryPath>
    	                            	<createChecksum>true</createChecksum>
    	                        	</configuration>
    	                    	</execution>
    	                    	<execution>
    	                        	<id>install-${sos.js7.base.artifactId}</id>
    	                        	<goals>
    	                            	<goal>install-file</goal>
    	                        	</goals>
    	                        	<phase>initialize</phase>
    	                        	<configuration>
    	                            	<file>${sos.js7.external.srcdir}/${sos.js7.engine.groupId}.${sos.js7.base.artifactId}-${sos.js7.version}.jar</file>
    	                            	<groupId>${sos.js7.engine.groupId}</groupId>
    									<artifactId>${sos.js7.base.artifactId}</artifactId>
    	                            	<version>${sos.js7.version}</version>
    	                            	<packaging>jar</packaging>
    	                            	<localRepositoryPath>${sos.js7.external.repodir}</localRepositoryPath>
    	                            	<createChecksum>true</createChecksum>
    	                        	</configuration>
    	                    	</execution>
    	                    	
    	                    	<execution>
    	                        	<id>install-${sos.js7.job.artifactId}</id>
    	                        	<goals>
    	                            	<goal>install-file</goal>
    	                        	</goals>
    	                        	<phase>initialize</phase>
    	                        	<configuration>
    	                            	<file>${sos.js7.external.srcdir}/${sos.js7.job.artifactId}-${sos.js7.version}.jar</file>
    	                            	<groupId>${sos.js7.groupId}</groupId>
    									<artifactId>${sos.js7.job.artifactId}</artifactId>
    	                            	<version>${sos.js7.version}</version>
    	                            	<packaging>jar</packaging>
    	                            	<localRepositoryPath>${sos.js7.external.repodir}</localRepositoryPath>
    	                            	<createChecksum>true</createChecksum>
    	                        	</configuration>
    	                    	</execution>
    	                    	<execution>
    	                        	<id>install-${sos.js7.commons.util.artifactId}</id>
    	                        	<goals>
    	                            	<goal>install-file</goal>
    	                        	</goals>
    	                        	<phase>initialize</phase>
    	                        	<configuration>
    	                            	<file>${sos.js7.external.srcdir}/${sos.js7.commons.util.artifactId}-${sos.js7.version}.jar</file>
    	                            	<groupId>${sos.js7.groupId}</groupId>
    									<artifactId>${sos.js7.commons.util.artifactId}</artifactId>
    	                            	<version>${sos.js7.version}</version>
    	                            	<packaging>jar</packaging>
    	                            	<localRepositoryPath>${sos.js7.external.repodir}</localRepositoryPath>
    	                            	<createChecksum>true</createChecksum>
    	                        	</configuration>
    	                    	</execution>
    	                    	<execution>
    	                        	<id>install-${sos.js7.commons.exception.artifactId}</id>
    	                        	<goals>
    	                            	<goal>install-file</goal>
    	                        	</goals>
    	                        	<phase>initialize</phase>
    	                        	<configuration>
    	                            	<file>${sos.js7.external.srcdir}/${sos.js7.commons.exception.artifactId}-${sos.js7.version}.jar</file>
    	                            	<groupId>${sos.js7.groupId}</groupId>
    									<artifactId>${sos.js7.commons.exception.artifactId}</artifactId>
    	                            	<version>${sos.js7.version}</version>
    	                            	<packaging>jar</packaging>
    	                            	<localRepositoryPath>${sos.js7.external.repodir}</localRepositoryPath>
    	                            	<createChecksum>true</createChecksum>
    	                        	</configuration>
    	                    	</execution>
                    		</executions>
                		</plugin>
    				</plugins>
    			</build>
    		</profile>
    	</profiles>
    	
    	<build>
    		<pluginManagement>
    			<plugins>
    				<plugin>
    					<artifactId>maven-compiler-plugin</artifactId>
    					<version>3.10.1</version>
    					<configuration>
    						<source>1.8</source>
    						<target>1.8</target>
    						<optimize>true</optimize>
    						<showDeprecation>true</showDeprecation>
    						<showWarnings>true</showWarnings>
    					</configuration>
    				</plugin>
    			</plugins>
    		</pluginManagement>
    	</build>
    </project>
  • groupId, artifactId und version sollten angepassst werden.
  • In dieser pom.xml ist ein Profil create-local-repo enthalten, dass nach dem Kopieren der Jar Files einmalig ausgeführt werden muss. Es erzeugt das lokale Repository im lib Verzeichnis

    Code Block
    languagepowershell
    > mvn initialize -Pcreate-local-repo -U

Further Resources

Features

...