Version 13 (modified by mmamonski, 12 years ago) (diff)

--

Binary distribution

Download the QCG-Computing Java SDK from the downloads section. You will find all needed jars in the lib directory.

Compiling from sources

In order to get the newest version of the QCG-Computing SDK we recommend you to compile it using sources checkouted directly from SVN. You will need to perform the following steps (beforehand make sure that  maven is installed in your system)

mkdir sdk
cd sdk
#at first compile and install the QCG-Core SDK (a dependency for QCG-Computing SDK)
svn co https://apps.man.poznan.pl/svn/qcg-core/trunk/java/WSIT/QCGCoreSDK
cd QCGCoreSDK/endorsed
./install-endorsed.sh
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Dec 08 14:38:03 CET 2011
[INFO] Final Memory: 6M/219M
[INFO] ------------------------------------------------------------------------
cd ..
mvn install
[INFO] Installing /home/qcg-dev/sdk/QCGCoreSDK/target/QCGCoreSDK-2.1.1.jar to /home/qcg-dev/.m2/repository/org/qcg/QCGCoreSDK/2.1.1/QCGCoreSDK-2.1.1.jar
[INFO] Installing /home/qcg-dev/sdk/QCGCoreSDK/target/QCGCoreSDK-2.1.1-jar-with-dependencies.jar to /home/qcg-dev/.m2/repository/org/qcg/QCGCoreSDK/2.1.1/QCGCoreSDK-2.1.1-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40 seconds
[INFO] Finished at: Thu Dec 08 15:01:36 CET 2011
[INFO] Final Memory: 44M/492M
[INFO] ------------------------------------------------------------------------

cd ..
#finally checkout and build the QCG-Computing SDK
svn co https://apps.man.poznan.pl/svn/qcg-computing/trunk
cd trunk/java/WSIT/QCGComputingSDK
mvn install:install-file -DgroupId=org.metastatic.rsync -DartifactId=JarSync -Dpackaging=jar -Dversion=0.3 -Dfile=lib/jarsync.jar
mvn -Dmaven.test.skip=true package


Example Usage

Job Management

The below example shows how to submit a simple job and wait until it finishes using the QCG BES interface (deployed over plain http, for other security mechanisms consult the next section)

public class QCGCompExample 
    extends TestCase
{
	public static final String QCG_COMPUTING_HOST = "grass1.man.poznan.pl";
	public static final int QCG_COMPUTING_PORT = 19001;
	
	public void testSubmit() throws Exception {
		QCGFactory besFactory =  new QCGFactory(QCG_COMPUTING_HOST, QCG_COMPUTING_PORT, new AnonymousAuthentication(), true);
		
		/* create an JSDL document */
		JSDL dateJSDL = new JSDL("SimpleJob");
		
		dateJSDL.setExecutable("/bin/date");
		dateJSDL.getArguments().add("-R");
		dateJSDL.getEnvironment().put("TZ", "Pacific/Honolulu");
		
		/* submit a job */
		ActivityEndpointReference jobEpr = besFactory.createActivity(dateJSDL);
		
		/* wait for termination */
		while (!besFactory.getActivityStatus(jobEpr).isFinalState()) { 
			Thread.sleep(2000);
		}
		
		/* get final status */
		QCGActivityStatus status =  besFactory.getActivityStatus(jobEpr);
		
		if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FINISHED)) {
			System.out.println("Job " + status.getActivityIdentifier() + " finished with exit status: " + status.getEndStatus().getExitStatus() );
		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_FAILED)){
			System.err.println("Job " + status.getActivityIdentifier() + " failed");
		} else if (status.getBESStateName().equals(QCGActivityStatus.QCG_ACTIVITY_STATE_CANCELLED)){
			System.err.println("Job " + status.getActivityIdentifier() + " was cancelled");
		}
		
	}
	
	public static void main(String args[]) throws Exception {
		(new QCGCompExample()).testSubmit();
	}
}

Other authentication mechanisms

SSL (https)

/* mutual authentication - PEM files */
SSLAuthentication(String CAFile, String CAPath, String userCertKey, String keyPassphrase, String trustedDN) throws IOException
/* server only authentication - PEM files */
SSLAuthentication(String CAFile, String CAPath, String trustedDN)  throws IOException, GeneralSecurityException
/* mutual authentication - certs loaded from streams */
SSLAuthentication(List<InputStream> caList, InputStream userCertKey, String keyPassphrase, String trustedDN) throws IOException, GeneralSecurityException

GSI (httpg)

GSIAuthentication(String trustedDN) throws IOException

GSIAuthentication(String   userProxy, String trustedDN) throws IOException

GSIAuthentication(InputStream  userProxy, String trustedDN) throws IOException