updated credential store with the latest oa4mp-client libs, versioned 1.1.3 (still it needs a quick review by the component developers) - excluded the use of bc-prov-146 on all places - adjusted some code for the sake of compilation
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9ae7c6ec Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9ae7c6ec Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9ae7c6ec Branch: refs/heads/master Commit: 9ae7c6ec3930f55b4de5214b80bd7ebb0d0b2836 Parents: 9e750d8 Author: msmemon <[email protected]> Authored: Thu Oct 23 17:32:30 2014 +0200 Committer: msmemon <[email protected]> Committed: Thu Oct 23 17:32:30 2014 +0200 ---------------------------------------------------------------------- .../client/samples/CreateLaunchExperiment.java | 7 +- modules/commons/utils/pom.xml | 8 +- .../credential-store-webapp/pom.xml | 4 +- .../credential-store/pom.xml | 233 +-- .../servlet/CredentialStoreCallbackServlet.java | 4 +- modules/distribution/server/pom.xml | 2 +- .../server/src/main/assembly/bin-assembly.xml | 25 +- modules/gfac/gfac-bes/pom.xml | 20 - .../gfac/bes/provider/impl/BESProvider.java | 647 ++++---- .../gfac/bes/utils/DataTransferrer.java | 25 +- .../airavata/gfac/bes/utils/JSDLGenerator.java | 6 +- .../airavata/gfac/bes/utils/SecurityUtils.java | 11 +- .../gfac/bes/utils/UASDataStagingProcessor.java | 11 +- modules/gfac/gfac-ec2/pom.xml | 238 +-- .../airavata/gfac/ec2/util/EC2ProviderUtil.java | 3 +- modules/gfac/gfac-gram/pom.xml | 10 - modules/test-suite/pom.xml | 2 +- .../workflow-model/workflow-model-core/pom.xml | 6 + pom.xml | 1506 ++++++++---------- 19 files changed, 1385 insertions(+), 1383 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java index 0130f14..c40ac35 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java @@ -53,7 +53,7 @@ public class CreateLaunchExperiment { private static final String DEFAULT_GATEWAY = "default.registry.gateway"; private static Airavata.Client airavataClient; - private static String echoAppId = "Echo_afb090d6-392f-493f-80a6-929bc848ad5d"; + private static String echoAppId = "Echo_6281480a-9887-4a0f-8311-59bbaf738e54"; private static String wrfAppId = "WRF_5f097c9c-7066-49ec-aed7-4e39607b3adc"; private static String amberAppId = "Amber_89906be6-5678-49a6-9d04-a0604fbdef2e"; @@ -78,11 +78,12 @@ public class CreateLaunchExperiment { - public static void createAndLaunchExp() { + public static void createAndLaunchExp() throws TException { + final String expId = createEchoExperimentForFSD(airavataClient); try { for (int i = 0; i < 2; i++) { // final String expId = createExperimentForSSHHost(airavata); - final String expId = createEchoExperimentForFSD(airavataClient); +// final String expId = createEchoExperimentForFSD(airavataClient); // final String expId = createEchoExperimentForStampede(airavataClient); // final String expId = createExperimentEchoForLocalHost(airavataClient); // final String expId = createExperimentWRFTrestles(airavataClient); http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/commons/utils/pom.xml ---------------------------------------------------------------------- diff --git a/modules/commons/utils/pom.xml b/modules/commons/utils/pom.xml index 5b93732..934ba6c 100644 --- a/modules/commons/utils/pom.xml +++ b/modules/commons/utils/pom.xml @@ -48,12 +48,18 @@ <groupId>org.ogce</groupId> <artifactId>xsul</artifactId> <version>${xsul.version}</version> + <exclusions> + <exclusion> + <groupId>org.bouncycastle</groupId> + <artifactId>bcprov-jdk16</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.ogce</groupId> <artifactId>xsul5</artifactId> <version>${xsul5.version}</version> - </dependency> + </dependency> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-kernel</artifactId> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/credential-store-service/credential-store-webapp/pom.xml ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store-webapp/pom.xml b/modules/credential-store-service/credential-store-webapp/pom.xml index 9c8ca71..796e3c3 100644 --- a/modules/credential-store-service/credential-store-webapp/pom.xml +++ b/modules/credential-store-service/credential-store-webapp/pom.xml @@ -104,7 +104,7 @@ <artifactId>commons-codec</artifactId> <version>1.6</version> </dependency> - <dependency> + <!-- <dependency> <groupId>edu.uiuc.ncsa.myproxy</groupId> <artifactId>oa4mp-client-oauth1</artifactId> <version>${oa4mp.version}</version> @@ -118,7 +118,7 @@ <artifactId>postgresql</artifactId> </exclusion> </exclusions> - </dependency> + </dependency> --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/credential-store-service/credential-store/pom.xml ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/pom.xml b/modules/credential-store-service/credential-store/pom.xml index e3c8a4a..ba36222 100644 --- a/modules/credential-store-service/credential-store/pom.xml +++ b/modules/credential-store-service/credential-store/pom.xml @@ -1,36 +1,39 @@ <?xml version="1.0" encoding="UTF-8"?> -<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file - distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under - the Apache License, Version 2.0 (theà "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to - in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF - ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under - the License. --> +<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (theà "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY ~ KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> -<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata</artifactId> - <version>0.14-SNAPSHOT</version> - <relativePath>../../../pom.xml</relativePath> - </parent> +<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata</artifactId> + <version>0.14-SNAPSHOT</version> + <relativePath>../../../pom.xml</relativePath> + </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>airavata-credential-store</artifactId> - <name>Airavata Credential Store</name> - <description>Module to manage credentials</description> + <modelVersion>4.0.0</modelVersion> + <artifactId>airavata-credential-store</artifactId> + <name>Airavata Credential Store</name> + <description>Module to manage credentials</description> - <dependencies> - - <dependency> - <groupId>edu.uiuc.ncsa.myproxy</groupId> - <artifactId>oa4mp-client-api</artifactId> - <version>${oa4mp.version}</version> - </dependency> - <dependency> + <dependencies> + <dependency> + <groupId>edu.uiuc.ncsa.myproxy</groupId> + <artifactId>oa4mp-client-api</artifactId> + <version>${oa4mp.version}</version> + </dependency> + <dependency> <groupId>edu.uiuc.ncsa.myproxy</groupId> - <artifactId>oa4mp-client-oauth1</artifactId> + <artifactId>oa4mp-client-loader-oauth1</artifactId> <version>${oa4mp.version}</version> <exclusions> <exclusion> @@ -51,97 +54,97 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.7</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbyclient</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbynet</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derbytools</artifactId> - <version>${derby.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.4</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-common-utils</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.7</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>${derby.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derbyclient</artifactId> + <version>${derby.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derbynet</artifactId> + <version>${derby.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derbytools</artifactId> + <version>${derby.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.4</version> + </dependency> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-common-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.50</version> </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-email</artifactId> - <version>1.3.2</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <inherited>true</inherited> - <configuration> - <systemPropertyVariables> - <credential.module.directory>${basedir}</credential.module.directory> - </systemPropertyVariables> - <excludes> - <exclude>**/DAOBaseTestCase.java</exclude> - <exclude>**/MappingDAOTest.java</exclude> - </excludes> - <testSourceDirectory>${basedir}\src\test\java\</testSourceDirectory> - </configuration> - </plugin> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-email</artifactId> + <version>1.3.2</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <inherited>true</inherited> + <configuration> + <systemPropertyVariables> + <credential.module.directory>${basedir}</credential.module.directory> + </systemPropertyVariables> + <excludes> + <exclude>**/DAOBaseTestCase.java</exclude> + <exclude>**/MappingDAOTest.java</exclude> + </excludes> + <testSourceDirectory>${basedir}\src\test\java\</testSourceDirectory> + </configuration> + </plugin> - </plugins> - <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> - <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory> - <testResources> - <testResource> - <directory>${project.basedir}/src/test/resources</directory> - </testResource> - </testResources> - </build> + </plugins> + <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> + <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory> + <testResources> + <testResource> + <directory>${project.basedir}/src/test/resources</directory> + </testResource> + </testResources> + </build> </project> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java index f232a00..cf6eac8 100644 --- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java +++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java @@ -147,8 +147,8 @@ public class CredentialStoreCallbackServlet extends ClientServlet { info("Token id presented " + portalTokenId); info("2.a. Getting token and verifier."); - String token = request.getParameter(TOKEN_KEY); - String verifier = request.getParameter(VERIFIER_KEY); + String token = request.getParameter(CONST(ClientEnvironment.TOKEN)); + String verifier = request.getParameter(CONST(ClientEnvironment.VERIFIER)); if (token == null || verifier == null) { warn("2.a. The token is " + (token == null ? "null" : token) + " and the verifier is " + (verifier == null ? "null" : verifier)); http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/distribution/server/pom.xml ---------------------------------------------------------------------- diff --git a/modules/distribution/server/pom.xml b/modules/distribution/server/pom.xml index 7e41d1c..0cefe36 100644 --- a/modules/distribution/server/pom.xml +++ b/modules/distribution/server/pom.xml @@ -397,7 +397,7 @@ </dependency--> <dependency> <groupId>org.bouncycastle</groupId> - <artifactId>bcprov-jdk16</artifactId> + <artifactId>bcprov-jdk15on</artifactId> </dependency> <dependency> <groupId>org.apache.openjpa</groupId> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/distribution/server/src/main/assembly/bin-assembly.xml ---------------------------------------------------------------------- diff --git a/modules/distribution/server/src/main/assembly/bin-assembly.xml b/modules/distribution/server/src/main/assembly/bin-assembly.xml index 33e0270..32cb5e7 100644 --- a/modules/distribution/server/src/main/assembly/bin-assembly.xml +++ b/modules/distribution/server/src/main/assembly/bin-assembly.xml @@ -255,8 +255,8 @@ <include>net.schmizz:sshj</include> <include>j2ssh:j2ssh-core</include> <include>j2ssh:j2ssh-common</include> - <include>org.apache.httpcomponents:httpcore:jar:4.1</include> - <include>org.apache.httpcomponents:httpclient:jar:4.1</include> + <include>org.apache.httpcomponents:httpcore:jar:4.2.4</include> + <include>org.apache.httpcomponents:httpclient:jar:4.2.4</include> <include>de.odysseus.staxon:staxon:jar:1.2</include> <include>de.odysseus.staxon:staxon-jackson:jar:1.2</include> <include>org.ebaysf.web:cors-filter:jar:1.0.0</include> @@ -274,9 +274,6 @@ <!-- UNICORE Dependencies Start --> <include>eu.unicore:unicore-client-wrapper</include> <include>org.apache.xmlbeans:xmlbeans-xpath</include> - <include>net.sf.saxon:saxon</include> - <include>net.sf.saxon:saxon-dom</include> - <include>net.sf.saxon:saxon-xpath</include> <include>log4j:apache-log4j-extras</include> <include>eu.eu-emi.security:canl</include> <include>org.bouncycastle:bcpkix-jdk15on</include> @@ -301,7 +298,23 @@ <include>org.apache.cxf:cxf-rt-ws-policy</include> <include>org.apache.cxf:cxf-rt-transports-http</include> <include>org.apache.cxf:cxf-rt-features-clustering</include> - <!-- UNICORE Dependencies End --> + <include>org.apache.neethi:neethi</include> + <include>org.apache.cxf:cxf-rt-frontend-jaxws</include> + <include>xml-resolver:xml-resolver</include> + <include>org.eclipse.jetty:jetty-servlet</include> + <include>org.eclipse.jetty:jetty-security</include> + <include>org.eclipse.jetty:jetty-server</include> + <include>org.eclipse.jetty.orbit:javax.servlet</include> + <include>org.eclipse.jetty:jetty-servlets</include> + <include>org.eclipse.jetty:jetty-continuation</include> + <include>org.eclipse.jetty:jetty-client</include> + <include>org.eclipse.jetty:jetty-http</include> + <include>org.eclipse.jetty:jetty-io</include> + <include>org.eclipse.jetty:jetty-util</include> + <include>wsdl4j:wsdl4j</include> + <include>org.apache.santuario:xmlsec</include> + <include>commons-httpclient:commons-httpclient</include> + <include>commons-codec:commons-codec</include> </includes> </dependencySet> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-bes/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/pom.xml b/modules/gfac/gfac-bes/pom.xml index e0c1df8..f14c9f5 100644 --- a/modules/gfac/gfac-bes/pom.xml +++ b/modules/gfac/gfac-bes/pom.xml @@ -89,26 +89,6 @@ <!-- gsi-ssh api dependencies --> <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>gsissh</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-data-models</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.jcraft</groupId> - <artifactId>jsch</artifactId> - <version>0.1.50</version> - </dependency> - <dependency> - <groupId>org.ogce</groupId> - <artifactId>bcgss</artifactId> - <version>146</version> - </dependency> - <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>${xmlbeans.version}</version> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java index f321c5e..7ed038a 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/provider/impl/BESProvider.java @@ -17,7 +17,7 @@ * specific language governing permissions and limitations * under the License. * -*/ + */ package org.apache.airavata.gfac.bes.provider.impl; import java.util.Calendar; @@ -27,11 +27,15 @@ import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.gfac.GFacException; import org.apache.airavata.gfac.bes.security.UNICORESecurityContext; import org.apache.airavata.gfac.bes.security.X509SecurityContext; -import org.apache.airavata.gfac.bes.utils.ActivityInfo; import org.apache.airavata.gfac.bes.utils.BESConstants; -import org.apache.airavata.gfac.bes.utils.DataServiceInfo; +import org.apache.airavata.gfac.bes.utils.DataTransferrer; import org.apache.airavata.gfac.bes.utils.JSDLGenerator; +import org.apache.airavata.gfac.bes.utils.SecurityUtils; +import org.apache.airavata.gfac.bes.utils.StorageCreator; import org.apache.airavata.gfac.core.context.JobExecutionContext; +import org.apache.airavata.gfac.core.notification.events.StartExecutionEvent; +import org.apache.airavata.gfac.core.notification.events.StatusChangeEvent; +import org.apache.airavata.gfac.core.notification.events.UnicoreJobIDEvent; import org.apache.airavata.gfac.core.provider.AbstractProvider; import org.apache.airavata.gfac.core.provider.GFacProvider; import org.apache.airavata.gfac.core.provider.GFacProviderException; @@ -54,305 +58,412 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3.x2005.x08.addressing.EndpointReferenceType; +import de.fzj.unicore.bes.client.ActivityClient; import de.fzj.unicore.bes.client.FactoryClient; import de.fzj.unicore.bes.faults.UnknownActivityIdentifierFault; +import de.fzj.unicore.uas.client.StorageClient; import de.fzj.unicore.wsrflite.xmlbeans.WSUtilities; import eu.emi.security.authn.x509.impl.X500NameUtils; import eu.unicore.util.httpclient.DefaultClientConfiguration; +public class BESProvider extends AbstractProvider implements GFacProvider, + BESConstants { + protected final Logger log = LoggerFactory.getLogger(this.getClass()); + private DefaultClientConfiguration secProperties; -public class BESProvider extends AbstractProvider implements GFacProvider, BESConstants{ - protected final Logger log = LoggerFactory.getLogger(this.getClass()); + private String jobId; - private DefaultClientConfiguration secProperties; - - private String jobId; - public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { log.info("Initializing UNICORE Provider.."); super.initialize(jobExecutionContext); - secProperties = (DefaultClientConfiguration)jobExecutionContext.getProperty(PROP_CLIENT_CONF); - if (secProperties != null) { - secProperties = secProperties.clone(); - return; - } - - UNICORESecurityContext unicoreContext = (UNICORESecurityContext) jobExecutionContext.getSecurityContext(X509SecurityContext.X509_SECURITY_CONTEXT); - if(log.isDebugEnabled()) { - log.debug("Generating default configuration."); - } - //TODO: check what credential mode should be used - try { + secProperties = (DefaultClientConfiguration) jobExecutionContext.getProperty(PROP_CLIENT_CONF); + if (secProperties != null) { + secProperties = secProperties.clone(); + return; + } + SecurityUtils.addSecurityContext(jobExecutionContext); + UNICORESecurityContext unicoreContext = (UNICORESecurityContext) jobExecutionContext.getSecurityContext(X509SecurityContext.X509_SECURITY_CONTEXT); + if (log.isDebugEnabled()) { + log.debug("Generating default configuration."); + } + // TODO: check what credential mode should be used + try { secProperties = unicoreContext.getDefaultConfiguration(); } catch (ApplicationSettingsException e) { throw new GFacProviderException(e.getMessage(), e); } - if(log.isDebugEnabled()) { - log.debug("Security properties initialized."); - } - } - - - public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { - UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription() - .getType(); - - String factoryUrl = host.getUnicoreBESEndPointArray()[0]; - - EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance(); - eprt.addNewAddress().setStringValue(factoryUrl); - -// WSUtilities.addServerIdentity(eprt, serverDN); - - - String userDN = getUserName(jobExecutionContext); - - //TODO: to be removed - if (userDN == null || userDN.equalsIgnoreCase("admin")) { - userDN = "CN=zdv575, O=Ultrascan Gateway, C=DE"; - } - - try { - - DataServiceInfo dsInfo = new DataServiceInfo(jobExecutionContext); - - CreateActivityDocument cad = CreateActivityDocument.Factory.newInstance(); - JobDefinitionDocument jobDefDoc = JobDefinitionDocument.Factory.newInstance(); - - JobDefinitionType jobDefinition = jobDefDoc.addNewJobDefinition(); - try { - jobDefinition = JSDLGenerator.buildJSDLInstance(jobExecutionContext, dsInfo).getJobDefinition(); - cad.addNewCreateActivity().addNewActivityDocument().setJobDefinition(jobDefinition); - log.info("JSDL" + jobDefDoc.toString()); - } catch (Exception e1) { - throw new GFacProviderException("Cannot generate JSDL instance from the JobExecutionContext.", e1); - } - - FactoryClient factory = null; - JobDetails jobDetails = new JobDetails(); - - try { - factory = new FactoryClient(eprt, secProperties); - } catch (Exception e) { - throw new GFacProviderException(e.getLocalizedMessage(), e); - } - CreateActivityResponseDocument response = null; - try { - log.info(String.format("Activity Submitting to %s ... \n", factoryUrl)); - response = factory.createActivity(cad); - - log.info(String.format("Activity Submitted to %s \n", factoryUrl)); - } catch (Exception e) { - throw new GFacProviderException("Cannot create activity.", e); - } - EndpointReferenceType activityEpr = response.getCreateActivityResponse().getActivityIdentifier(); - - - log.info("Activity : " + activityEpr.getAddress().getStringValue() + " Submitted."); - - // factory.waitWhileActivityIsDone(activityEpr, 1000); - jobId = WSUtilities.extractResourceID(activityEpr); - if (jobId == null) { - jobId = new Long(Calendar.getInstance().getTimeInMillis()).toString(); - } - log.info("JobID: " + jobId); -// jobExecutionContext.getNotifier().publish(new UnicoreJobIDEvent(jobId)); - //TODO: not working -// saveApplicationJob(jobExecutionContext, jobDefinition, activityEpr.toString()); - jobDetails.setJobID(activityEpr.toString()); - jobDetails.setJobDescription(activityEpr.toString()); - - jobExecutionContext.setJobDetails(jobDetails); - - log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), - factory.getActivityStatus(activityEpr).toString())); - - // TODO publish the status messages to the message bus - ActivityStatusType activityStatus = null; - ActivityInfo activityInfo; - activityInfo = new ActivityInfo(); - activityInfo.setActivityEPR(activityEpr); - activityInfo.setActivityStatusDoc(activityStatus); - jobExecutionContext.setProperty(PROP_ACTIVITY_INFO, activityInfo); - } catch (UnknownActivityIdentifierFault e1) { - throw new GFacProviderException(e1.getLocalizedMessage(), e1); - } - } - - - private JobState getApplicationJobStatus(ActivityStatusType activityStatus){ - if (activityStatus == null) { - return JobState.UNKNOWN; - } - Enum state = activityStatus.getState(); - String status = null; - XmlCursor acursor = activityStatus.newCursor(); - try { - if (acursor.toFirstChild()) { - if (acursor.getName().getNamespaceURI().equals("http://schemas.ogf.org/hpcp/2007/01/fs")) { - status = acursor.getName().getLocalPart(); - } - } - if (status != null) { - if (status.equalsIgnoreCase("Queued") || status.equalsIgnoreCase("Starting") - || status.equalsIgnoreCase("Ready")) { - return JobState.QUEUED; - } else if (status.equalsIgnoreCase("Staging-In")) { - return JobState.SUBMITTED; - } else if (status.equalsIgnoreCase("Staging-Out") || status.equalsIgnoreCase("FINISHED")) { - return JobState.COMPLETE; - } else if (status.equalsIgnoreCase("Executing")) { - return JobState.ACTIVE; - } else if (status.equalsIgnoreCase("FAILED")) { - return JobState.FAILED; - } else if (status.equalsIgnoreCase("CANCELLED")) { - return JobState.CANCELED; - } - } else { - if (ActivityStateEnumeration.CANCELLED.equals(state)) { - return JobState.CANCELED; - } else if (ActivityStateEnumeration.FAILED.equals(state)) { - return JobState.FAILED; - } else if (ActivityStateEnumeration.FINISHED.equals(state)) { - return JobState.COMPLETE; - } else if (ActivityStateEnumeration.RUNNING.equals(state)) { - return JobState.ACTIVE; - } - } - } finally { - if (acursor != null) - acursor.dispose(); - } - return JobState.UNKNOWN; - } - - private void saveApplicationJob(JobExecutionContext jobExecutionContext, JobDefinitionType jobDefinition, - String metadata) throws GFacException { - - -// ApplicationJob appJob = GFacUtils.createApplicationJob(jobExecutionContext); -// appJob.setJobId(jobId); -// appJob.setJobData(jobDefinition.toString()); -// appJob.setSubmittedTime(Calendar.getInstance().getTime()); -// appJob.setStatus(ApplicationJobStatus.SUBMITTED); -// appJob.setStatusUpdateTime(appJob.getSubmittedTime()); -// appJob.setMetadata(metadata); -// GFacUtils.recordApplicationJob(jobExecutionContext, appJob); - - details.setJobID(jobId); - GFacUtils.saveJobStatus(jobExecutionContext, details, JobState.SUBMITTED); - - } - - /** - * EndpointReference need to be saved to make cancel work. - * - * @param activityEpr - * @param jobExecutionContext - * @throws GFacProviderException - */ - public void cancelJob(String activityEpr, JobExecutionContext jobExecutionContext) throws GFacProviderException { - try { -// initSecurityProperties(jobExecutionContext); - EndpointReferenceType eprt = EndpointReferenceType.Factory.parse(activityEpr); - UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription() - .getType(); - - String factoryUrl = host.getUnicoreBESEndPointArray()[0]; - EndpointReferenceType epr = EndpointReferenceType.Factory.newInstance(); - epr.addNewAddress().setStringValue(factoryUrl); - - FactoryClient factory = new FactoryClient(epr, secProperties); - factory.terminateActivity(eprt); - } catch (Exception e) { - throw new GFacProviderException(e.getLocalizedMessage(),e); - } - - } - - - //FIXME: Get user details - private String getUserName(JobExecutionContext context) { -// if (context.getConfigurationData()!= null) { -// return context.getConfigurationData().getBasicMetadata().getUserName(); -// } else { - return ""; -// } - } - - protected ActivityStatusType getStatus(FactoryClient fc, EndpointReferenceType activityEpr) - throws UnknownActivityIdentifierFault { - - GetActivityStatusesDocument stats = GetActivityStatusesDocument.Factory.newInstance(); - - stats.addNewGetActivityStatuses().setActivityIdentifierArray(new EndpointReferenceType[] { activityEpr }); - - GetActivityStatusesResponseDocument resDoc = fc.getActivityStatuses(stats); - - ActivityStatusType activityStatus = resDoc.getGetActivityStatusesResponse().getResponseArray()[0] - .getActivityStatus(); - return activityStatus; - } - - protected String formatStatusMessage(String activityUrl, String status) { - return String.format("Activity %s is %s.\n", activityUrl, status); - } - - protected String subStatusAsString(ActivityStatusType statusType) { - - StringBuffer sb = new StringBuffer(); - - sb.append(statusType.getState().toString()); - - XmlCursor acursor = statusType.newCursor(); - if (acursor.toFirstChild()) { - do { - if (acursor.getName().getNamespaceURI().equals("http://schemas.ogf.org/hpcp/2007/01/fs")) { - sb.append(":"); - sb.append(acursor.getName().getLocalPart()); - } - } while (acursor.toNextSibling()); - acursor.dispose(); - return sb.toString(); - } else { - acursor.dispose(); - return sb.toString(); - } - - } - - - private String getCNFromUserDN(String userDN) { - return X500NameUtils.getAttributeValues(userDN, BCStyle.CN)[0]; - - } + if (log.isDebugEnabled()) { + log.debug("Security properties initialized."); + } + } + + public void execute(JobExecutionContext jobExecutionContext) + throws GFacProviderException, GFacException { + UnicoreHostType host = (UnicoreHostType) jobExecutionContext + .getApplicationContext().getHostDescription().getType(); + + String factoryUrl = host.getUnicoreBESEndPointArray()[0]; + + EndpointReferenceType eprt = EndpointReferenceType.Factory + .newInstance(); + eprt.addNewAddress().setStringValue(factoryUrl); + + // WSUtilities.addServerIdentity(eprt, serverDN); + + String userDN = getUserName(jobExecutionContext); + + // TODO: to be removed + if (userDN == null || userDN.equalsIgnoreCase("admin")) { + userDN = "CN=zdv575, O=Ultrascan Gateway, C=DE"; + } + + StorageClient sc = null; + + try { + + CreateActivityDocument cad = CreateActivityDocument.Factory + .newInstance(); + JobDefinitionDocument jobDefDoc = JobDefinitionDocument.Factory + .newInstance(); + +// String xlogin = getCNFromUserDN(userDN); + + // create storage + StorageCreator storageCreator = new StorageCreator(secProperties, + factoryUrl, 5, null); + + try { + sc = storageCreator.createStorage(); + } catch (Exception e2) { + log.error("Cannot create storage.."); + throw new GFacProviderException("Cannot create storage..", e2); + } + + JobDefinitionType jobDefinition = jobDefDoc.addNewJobDefinition(); + try { + jobDefinition = JSDLGenerator.buildJSDLInstance( + jobExecutionContext, sc.getUrl()).getJobDefinition(); + cad.addNewCreateActivity().addNewActivityDocument() + .setJobDefinition(jobDefinition); + log.info("JSDL" + jobDefDoc.toString()); + } catch (Exception e1) { + throw new GFacProviderException( + "Cannot generate JSDL instance from the JobExecutionContext.", + e1); + } + + // upload files if any + DataTransferrer dt = new DataTransferrer(jobExecutionContext, sc); + dt.uploadLocalFiles(); + + FactoryClient factory = null; + JobDetails jobDetails = new JobDetails(); + + try { + factory = new FactoryClient(eprt, secProperties); + } catch (Exception e) { + throw new GFacProviderException(e.getLocalizedMessage(), e); + } + CreateActivityResponseDocument response = null; + try { + log.info(String.format("Activity Submitting to %s ... \n", + factoryUrl)); + jobExecutionContext.getNotifier().publish(new StartExecutionEvent()); + response = factory.createActivity(cad); + log.info(String.format("Activity Submitted to %s \n", factoryUrl)); + } catch (Exception e) { + throw new GFacProviderException("Cannot create activity.", e); + } + EndpointReferenceType activityEpr = response.getCreateActivityResponse().getActivityIdentifier(); + + log.info("Activity : " + activityEpr.getAddress().getStringValue() + " Submitted."); + + // factory.waitWhileActivityIsDone(activityEpr, 1000); + jobId = WSUtilities.extractResourceID(activityEpr); + if (jobId == null) { + jobId = new Long(Calendar.getInstance().getTimeInMillis()) + .toString(); + } + log.info("JobID: " + jobId); + jobDetails.setJobID(activityEpr.toString()); + jobDetails.setJobDescription(activityEpr.toString()); + + jobExecutionContext.setJobDetails(jobDetails); + try { + log.info(formatStatusMessage(activityEpr.getAddress() + .getStringValue(), factory.getActivityStatus(activityEpr) + .toString())); + + jobExecutionContext.getNotifier().publish(new UnicoreJobIDEvent(jobId)); + GFacUtils.saveJobStatus(jobExecutionContext, details,JobState.SUBMITTED); + + factory.getActivityStatus(activityEpr); + log.info(formatStatusMessage(activityEpr.getAddress() + .getStringValue(), factory.getActivityStatus(activityEpr) + .toString())); + + // TODO publish the status messages to the message bus + while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) + && (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED) + && (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.CANCELLED)) { + + ActivityStatusType activityStatus = null; + try { + activityStatus = getStatus(factory, activityEpr); + JobState applicationJobStatus = getApplicationJobStatus(activityStatus); + String jobStatusMessage = "Status of job " + jobId + "is " + + applicationJobStatus; + GFacUtils.updateJobStatus(jobExecutionContext, jobDetails, + applicationJobStatus); + + jobExecutionContext.getNotifier().publish( + new StatusChangeEvent(jobStatusMessage)); + + // GFacUtils.updateApplicationJobStatus(jobExecutionContext,jobId, + // applicationJobStatus); + } catch (UnknownActivityIdentifierFault e) { + throw new GFacProviderException(e.getMessage(), + e.getCause()); + } + + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + } + continue; + } + }catch(Exception e) { + throw new GFacProviderException(e.getMessage(), + e.getCause()); + + } + + ActivityStatusType activityStatus = null; + try { + activityStatus = getStatus(factory, activityEpr); + log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState().toString())); + ActivityClient activityClient; + activityClient = new ActivityClient(activityEpr,secProperties); + dt.setStorageClient(activityClient.getUspaceClient()); + } catch (Exception e1) { + throw new GFacProviderException(e1.getMessage(), + e1.getCause()); + } + + + + if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) { + String error = activityStatus.getFault().getFaultcode() + .getLocalPart() + + "\n" + + activityStatus.getFault().getFaultstring() + + "\n EXITCODE: " + activityStatus.getExitCode(); + log.info(error); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + } + dt.downloadStdOuts(); + } else if (activityStatus.getState() == ActivityStateEnumeration.CANCELLED) { + JobState applicationJobStatus = JobState.CANCELED; + String jobStatusMessage = "Status of job " + jobId + "is " + + applicationJobStatus; + jobExecutionContext.getNotifier().publish( + new StatusChangeEvent(jobStatusMessage)); + GFacUtils.updateJobStatus(jobExecutionContext, jobDetails, + applicationJobStatus); + throw new GFacProviderException( + jobExecutionContext.getExperimentID() + "Job Canceled"); + } + + else if (activityStatus.getState() == ActivityStateEnumeration.FINISHED) { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + } + if (activityStatus.getExitCode() == 0) { + dt.downloadRemoteFiles(); + } else { + dt.downloadStdOuts(); + } + } + + } finally { + // destroy sms instance + try { + if (sc != null) { + sc.destroy(); + } + } catch (Exception e) { + log.warn( + "Cannot destroy temporary SMS instance:" + sc.getUrl(), + e); + } + } + + } + + private JobState getApplicationJobStatus(ActivityStatusType activityStatus) { + if (activityStatus == null) { + return JobState.UNKNOWN; + } + Enum state = activityStatus.getState(); + String status = null; + XmlCursor acursor = activityStatus.newCursor(); + try { + if (acursor.toFirstChild()) { + if (acursor.getName().getNamespaceURI() + .equals("http://schemas.ogf.org/hpcp/2007/01/fs")) { + status = acursor.getName().getLocalPart(); + } + } + if (status != null) { + if (status.equalsIgnoreCase("Queued") + || status.equalsIgnoreCase("Starting") + || status.equalsIgnoreCase("Ready")) { + return JobState.QUEUED; + } else if (status.equalsIgnoreCase("Staging-In")) { + return JobState.SUBMITTED; + } else if (status.equalsIgnoreCase("Staging-Out") + || status.equalsIgnoreCase("FINISHED")) { + return JobState.COMPLETE; + } else if (status.equalsIgnoreCase("Executing")) { + return JobState.ACTIVE; + } else if (status.equalsIgnoreCase("FAILED")) { + return JobState.FAILED; + } else if (status.equalsIgnoreCase("CANCELLED")) { + return JobState.CANCELED; + } + } else { + if (ActivityStateEnumeration.CANCELLED.equals(state)) { + return JobState.CANCELED; + } else if (ActivityStateEnumeration.FAILED.equals(state)) { + return JobState.FAILED; + } else if (ActivityStateEnumeration.FINISHED.equals(state)) { + return JobState.COMPLETE; + } else if (ActivityStateEnumeration.RUNNING.equals(state)) { + return JobState.ACTIVE; + } + } + } finally { + if (acursor != null) + acursor.dispose(); + } + return JobState.UNKNOWN; + } + + /** + * EndpointReference need to be saved to make cancel work. + * + * @param activityEpr + * @param jobExecutionContext + * @throws GFacProviderException + */ + public void cancelJob(String activityEpr, + JobExecutionContext jobExecutionContext) + throws GFacProviderException { + try { + // initSecurityProperties(jobExecutionContext); + EndpointReferenceType eprt = EndpointReferenceType.Factory + .parse(activityEpr); + UnicoreHostType host = (UnicoreHostType) jobExecutionContext + .getApplicationContext().getHostDescription().getType(); + + String factoryUrl = host.getUnicoreBESEndPointArray()[0]; + EndpointReferenceType epr = EndpointReferenceType.Factory + .newInstance(); + epr.addNewAddress().setStringValue(factoryUrl); + + FactoryClient factory = new FactoryClient(epr, secProperties); + factory.terminateActivity(eprt); + } catch (Exception e) { + throw new GFacProviderException(e.getLocalizedMessage(), e); + } + + } + + // FIXME: Get user details + private String getUserName(JobExecutionContext context) { + // if (context.getConfigurationData()!= null) { + // return + // context.getConfigurationData().getBasicMetadata().getUserName(); + // } else { + return ""; + // } + } + + protected ActivityStatusType getStatus(FactoryClient fc, + EndpointReferenceType activityEpr) + throws UnknownActivityIdentifierFault { + + GetActivityStatusesDocument stats = GetActivityStatusesDocument.Factory + .newInstance(); + + stats.addNewGetActivityStatuses().setActivityIdentifierArray( + new EndpointReferenceType[] { activityEpr }); + + GetActivityStatusesResponseDocument resDoc = fc + .getActivityStatuses(stats); + + ActivityStatusType activityStatus = resDoc + .getGetActivityStatusesResponse().getResponseArray()[0] + .getActivityStatus(); + return activityStatus; + } + + protected String formatStatusMessage(String activityUrl, String status) { + return String.format("Activity %s is %s.\n", activityUrl, status); + } + + protected String subStatusAsString(ActivityStatusType statusType) { + + StringBuffer sb = new StringBuffer(); + + sb.append(statusType.getState().toString()); + + XmlCursor acursor = statusType.newCursor(); + if (acursor.toFirstChild()) { + do { + if (acursor.getName().getNamespaceURI() + .equals("http://schemas.ogf.org/hpcp/2007/01/fs")) { + sb.append(":"); + sb.append(acursor.getName().getLocalPart()); + } + } while (acursor.toNextSibling()); + acursor.dispose(); + return sb.toString(); + } else { + acursor.dispose(); + return sb.toString(); + } + + } + private String getCNFromUserDN(String userDN) { + return X500NameUtils.getAttributeValues(userDN, BCStyle.CN)[0]; + + } @Override public void initProperties(Map<String, String> properties) throws GFacProviderException, GFacException { // TODO Auto-generated method stub - - } - - - + } @Override public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { secProperties = null; - - } + } @Override public void cancelJob(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { // TODO Auto-generated method stub - + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java index ae8cb8d..f811f97 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/DataTransferrer.java @@ -71,9 +71,8 @@ public class DataTransferrer { String fileName = new File(uri).getName(); if (uri.startsWith("file")) { try { - String uriWithoutProtocol = uri.substring( - uri.lastIndexOf("://") + 1, uri.length()); - FileUploader fileUploader = new FileUploader(uriWithoutProtocol, "input/" + fileName, Mode.overwrite); + String uriWithoutProtocol = uri.substring(uri.lastIndexOf("://") + 1, uri.length()); + FileUploader fileUploader = new FileUploader(uriWithoutProtocol,"input/" + fileName,Mode.overwrite); fileUploader.perform(storageClient); } catch (FileNotFoundException e3) { throw new GFacProviderException( @@ -90,7 +89,7 @@ public class DataTransferrer { } /** - * This method will download all the remote files specified according to the output + * This method will download all the remote files specified in the output * context of a job. * */ public void downloadRemoteFiles() throws GFacProviderException { @@ -112,24 +111,20 @@ public class DataTransferrer { ActualParameter outParam = (ActualParameter) outputParams .get(paramKey); - // if single urls then convert each url into jsdl source - // elements, - // that are formed by concat of gridftpurl+inputdir+filename - String paramDataType = outParam.getType().getType().toString(); if ("String".equals(paramDataType)) { String stringPrm = ((StringParameterType) outParam .getType()).getValue(); String localFileName = null; - //TODO: why analysis.tar? it wont scale to gateways.. + //TODO: why analysis.tar? it wont scale to other gateways.. if(stringPrm == null || stringPrm.isEmpty()){ localFileName = "analysis-results.tar"; }else{ localFileName = stringPrm.substring(stringPrm.lastIndexOf("/")+1); } String outputLocation = downloadLocation+File.separator+localFileName; - FileDownloader fileDownloader = new FileDownloader("output/"+stringPrm,outputLocation, Mode.overwrite); + FileDownloader fileDownloader = new FileDownloader(stringPrm,outputLocation, Mode.overwrite); try { fileDownloader.perform(storageClient); ((StringParameterType) outParam.getType()).setValue(outputLocation); @@ -145,7 +140,7 @@ public class DataTransferrer { for (String v : valueArray) { String localFileName = v.substring(v.lastIndexOf("/")+1);; String outputLocation = downloadLocation+File.separator+localFileName; - FileDownloader fileDownloader = new FileDownloader("output/"+v,outputLocation, Mode.overwrite); + FileDownloader fileDownloader = new FileDownloader(v,outputLocation, Mode.overwrite); try { fileDownloader.perform(storageClient); ((StringParameterType) outParam.getType()).setValue(outputLocation); @@ -195,7 +190,7 @@ public class DataTransferrer { ApplicationDeploymentDescriptionType appDesc = application.getType(); String stdoutLocation = downloadLocation+File.separator+stdoutFileName; - FileDownloader f1 = new FileDownloader("output/"+stdoutFileName,stdoutLocation, Mode.overwrite); + FileDownloader f1 = new FileDownloader(stdoutFileName,stdoutLocation, Mode.overwrite); try { f1.perform(storageClient); String stdoutput = readFile(stdoutLocation); @@ -204,7 +199,7 @@ public class DataTransferrer { throw new GFacProviderException(e.getLocalizedMessage(),e); } String stderrLocation = downloadLocation+File.separator+stderrFileName; - FileDownloader f2 = new FileDownloader("output/"+stderrFileName,stderrLocation, Mode.overwrite); + FileDownloader f2 = new FileDownloader(stderrFileName,stderrLocation, Mode.overwrite); try { f2.perform(storageClient); String stderror = readFile(stderrLocation); @@ -228,6 +223,10 @@ public class DataTransferrer { return buff.toString(); } + public void setStorageClient(StorageClient sc){ + storageClient = sc; + } + private String getDownloadLocation() { TaskDetails taskData = jobContext.getTaskData(); if (taskData != null && taskData.getAdvancedOutputDataHandling() != null) { http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java index d46aef9..c29e12d 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/JSDLGenerator.java @@ -64,8 +64,7 @@ public class JSDLGenerator implements BESConstants { return jobDefDoc; } - public synchronized static JobDefinitionDocument buildJSDLInstance( - JobExecutionContext context, String smsUrl) throws Exception { + public synchronized static JobDefinitionDocument buildJSDLInstance(JobExecutionContext context, String smsUrl) throws Exception { JobDefinitionDocument jobDefDoc = JobDefinitionDocument.Factory .newInstance(); @@ -82,8 +81,7 @@ public class JSDLGenerator implements BESConstants { ApplicationProcessor.generateJobSpecificAppElements(value, context); - UASDataStagingProcessor.generateDataStagingElements(value, context, - smsUrl); + UASDataStagingProcessor.generateDataStagingElements(value, context, smsUrl); return jobDefDoc; } http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java index 3a44f45..ac79f33 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/SecurityUtils.java @@ -24,8 +24,6 @@ import org.apache.airavata.gfac.bes.security.UNICORESecurityContext; import org.apache.airavata.gfac.bes.security.X509SecurityContext; import org.apache.airavata.gfac.core.context.JobExecutionContext; import org.apache.airavata.gfac.core.utils.GFacUtils; -import org.apache.airavata.gsi.ssh.api.ServerInfo; -import org.apache.airavata.schemas.gfac.GlobusHostType; import org.apache.airavata.schemas.gfac.UnicoreHostType; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.x500.X500Name; @@ -45,7 +43,7 @@ public class SecurityUtils { private final static Logger logger = LoggerFactory.getLogger(SecurityUtils.class); - public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException { + public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException { HostDescription registeredHost = jobExecutionContext.getApplicationContext().getHostDescription(); if (! (registeredHost.getType() instanceof UnicoreHostType)) { @@ -54,7 +52,12 @@ public class SecurityUtils { else { String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // set by the framework - RequestData requestData = new RequestData(ServerSettings.getDefaultUserGateway()); // coming from top tier + RequestData requestData; + try { + requestData = new RequestData(ServerSettings.getDefaultUserGateway()); + } catch (ApplicationSettingsException e1) { + throw new GFacException(e1); + } // coming from top tier requestData.setTokenId(credentialStoreToken); CredentialReader credentialReader = null; http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java index ab6dc23..6ab7ed0 100644 --- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java +++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/utils/UASDataStagingProcessor.java @@ -51,7 +51,7 @@ public class UASDataStagingProcessor { MessageContext outMessage = new MessageContext(); ActualParameter a1 = new ActualParameter(); a1.getType().changeType(StringParameterType.type); - ((StringParameterType)a1.getType()).setValue("output/analysis-results.tar"); + ((StringParameterType)a1.getType()).setValue("analysis-results.tar"); outMessage.addParameter("o1", a1); context.setOutMessageContext(outMessage); @@ -142,10 +142,6 @@ public class UASDataStagingProcessor { ActualParameter outParam = (ActualParameter) outputParams .get(paramKey); - // if single urls then convert each url into jsdl source - // elements, - // that are formed by concat of gridftpurl+inputdir+filename - String paramDataType = outParam.getType().getType().toString(); if ("URI".equals(paramDataType)) { @@ -154,8 +150,6 @@ public class UASDataStagingProcessor { createOutURIElement(value, uriPrm); } - // string params are converted into the job arguments - else if (("URIArray").equals(paramDataType)) { String[] uriArray = ((URIArrayType) outParam.getType()) .getValueArray(); @@ -165,6 +159,9 @@ public class UASDataStagingProcessor { } } + else if ("String".equals(paramDataType) || "StringArray".equals(paramDataType)) { + return value; + } else if ("String".equals(paramDataType)) { String stringPrm = ((StringParameterType) outParam .getType()).getValue(); http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-ec2/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-ec2/pom.xml b/modules/gfac/gfac-ec2/pom.xml index f083e0a..d51fddb 100644 --- a/modules/gfac/gfac-ec2/pom.xml +++ b/modules/gfac/gfac-ec2/pom.xml @@ -1,128 +1,136 @@ <?xml version="1.0" encoding="UTF-8"?> -<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file - distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under - the Apache License, Version 2.0 (theà "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to - in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF - ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under - the License. --> +<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (theà "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY ~ KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> -<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>org.apache.airavata</groupId> - <artifactId>gfac</artifactId> - <version>0.14-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> +<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.airavata</groupId> + <artifactId>gfac</artifactId> + <version>0.14-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>airavata-gfac-ec2</artifactId> - <name>Airavata GFac EC2 Implementation</name> - <description>The core GFAC EC2 implementation using the framework features</description> - <url>http://airavata.apache.org/</url> + <modelVersion>4.0.0</modelVersion> + <artifactId>airavata-gfac-ec2</artifactId> + <name>Airavata GFac EC2 Implementation</name> + <description>The core GFAC EC2 implementation using the framework features</description> + <url>http://airavata.apache.org/</url> - <dependencies> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-gfac-core</artifactId> - <version>${project.version}</version> - </dependency> + <dependencies> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-gfac-core</artifactId> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - <version>1.6</version> - </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.6</version> + </dependency> - <!-- Logging --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> + <!-- Logging --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> - <!-- GFAC schemas --> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-workflow-execution-context</artifactId> - <version>${project.version}</version> - </dependency> - <!-- Workflow Tracking --> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-workflow-tracking</artifactId> - <version>${project.version}</version> - </dependency> + <!-- GFAC schemas --> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-workflow-execution-context</artifactId> + <version>${project.version}</version> + </dependency> + <!-- Workflow Tracking --> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-workflow-tracking</artifactId> + <version>${project.version}</version> + </dependency> - <!-- SSH --> - <dependency> - <groupId>net.schmizz</groupId> - <artifactId>sshj</artifactId> - <version>0.8.0</version> - </dependency> + <!-- SSH --> + <dependency> + <groupId>net.schmizz</groupId> + <artifactId>sshj</artifactId> + <version>0.8.0</version> + </dependency> - <!-- Credential Store --> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-credential-store</artifactId> - <version>${project.version}</version> - </dependency> + <!-- Credential Store --> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-credential-store</artifactId> + <version>${project.version}</version> + </dependency> - <!-- Amazon EC2 Provider --> - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk</artifactId> - <version>1.3.20</version> - </dependency> - <dependency> - <groupId>sshtools</groupId> - <artifactId>j2ssh-core</artifactId> - <version>0.2.9</version> - </dependency> - <dependency> - <groupId>sshtools</groupId> - <artifactId>j2ssh-common</artifactId> - <version>0.2.9</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.3</version> - <type>jar</type> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - <version>4.3</version> - <type>jar</type> - </dependency> + <!-- Amazon EC2 Provider --> + <dependency> + <groupId>com.amazonaws</groupId> + <artifactId>aws-java-sdk</artifactId> + <version>1.3.20</version> + </dependency> + <dependency> + <groupId>sshtools</groupId> + <artifactId>j2ssh-core</artifactId> + <version>0.2.9</version> + </dependency> + <dependency> + <groupId>sshtools</groupId> + <artifactId>j2ssh-common</artifactId> + <version>0.2.9</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.3</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + <version>4.3</version> + <type>jar</type> + </dependency> - <!-- Test --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.1.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-client-configuration</artifactId> - <scope>test</scope> - </dependency> - </dependencies> + <!-- Test --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>6.1.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.airavata</groupId> + <artifactId>airavata-client-configuration</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcpkix-jdk15on</artifactId> + </dependency> + </dependencies> </project> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/EC2ProviderUtil.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/EC2ProviderUtil.java b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/EC2ProviderUtil.java index e9774ca..4d7fab7 100644 --- a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/EC2ProviderUtil.java +++ b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/util/EC2ProviderUtil.java @@ -28,7 +28,6 @@ import com.amazonaws.services.ec2.model.DeleteKeyPairRequest; import com.amazonaws.services.ec2.model.DescribeKeyPairsRequest; import com.amazonaws.services.ec2.model.ImportKeyPairRequest; import com.sshtools.j2ssh.util.Base64; -import org.bouncycastle.openssl.PEMWriter; import java.io.*; import java.security.KeyPair; @@ -36,6 +35,8 @@ import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; +import org.bouncycastle.openssl.PEMWriter; + /*This class holds the utility methods used for the EC2Provider*/ public class EC2ProviderUtil { http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/gfac/gfac-gram/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-gram/pom.xml b/modules/gfac/gfac-gram/pom.xml index 841e792..ac58e15 100644 --- a/modules/gfac/gfac-gram/pom.xml +++ b/modules/gfac/gfac-gram/pom.xml @@ -32,16 +32,6 @@ <groupId>org.jglobus</groupId> <artifactId>gram</artifactId> <version>${jglobus.version}</version> - <exclusions> - <exclusion> - <groupId>org.bouncycastle</groupId> - <artifactId>bcprov-jdk16</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.bouncycastle</groupId> - <artifactId>bcprov-jdk16</artifactId> </dependency> <dependency> <groupId>org.jglobus</groupId> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/test-suite/pom.xml ---------------------------------------------------------------------- diff --git a/modules/test-suite/pom.xml b/modules/test-suite/pom.xml index cb4b3fc..260051c 100644 --- a/modules/test-suite/pom.xml +++ b/modules/test-suite/pom.xml @@ -33,7 +33,7 @@ <dependency> <groupId>org.bouncycastle</groupId> - <artifactId>bcprov-jdk16</artifactId> + <artifactId>bcprov-jdk15on</artifactId> </dependency> <dependency> <groupId>commons-configuration</groupId> http://git-wip-us.apache.org/repos/asf/airavata/blob/9ae7c6ec/modules/workflow-model/workflow-model-core/pom.xml ---------------------------------------------------------------------- diff --git a/modules/workflow-model/workflow-model-core/pom.xml b/modules/workflow-model/workflow-model-core/pom.xml index 5055464..09478dd 100644 --- a/modules/workflow-model/workflow-model-core/pom.xml +++ b/modules/workflow-model/workflow-model-core/pom.xml @@ -57,6 +57,12 @@ <groupId>org.ogce</groupId> <artifactId>xsul</artifactId> <version>${xsul.version}</version> + <exclusions> + <exclusion> + <groupId>org.bouncycastle</groupId> + <artifactId>bcprov-jdk16</artifactId> + </exclusion> + </exclusions> </dependency> <dependency>
