You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2011/06/25 17:17:38 UTC
svn commit: r1139550 [1/6] - in /incubator/airavata/core/trunk/gfac: ./
.settings/ src/main/java/org/apache/airavata/core/gfac/context/
src/main/java/org/apache/airavata/core/gfac/context/impl/
src/main/java/org/apache/airavata/core/gfac/context/impl/u...
Author: smarru
Date: Sat Jun 25 15:17:35 2011
New Revision: 1139550
URL: http://svn.apache.org/viewvc?rev=1139550&view=rev
Log:
Applied Airavata Formatting styles and ASF headers generated using Apache Rat incubator tool.
Modified:
incubator/airavata/core/trunk/gfac/ (props changed)
incubator/airavata/core/trunk/gfac/.project
incubator/airavata/core/trunk/gfac/.settings/org.eclipse.jdt.core.prefs
incubator/airavata/core/trunk/gfac/pom.xml
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ExecutionContext.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/InvocationContext.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/MessageContext.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/SecurityContext.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ServiceContext.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/AmazonSecurityContext.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ExecutionContextImpl.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/GSISecurityContext.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ParameterContextImpl.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/utils/MyProxyManager.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/FileTransferFault.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/GfacException.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/JobSubmissionFault.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/Chain.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/DataServiceChain.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/ExitableChain.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PostExecuteChain.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PreExecuteChain.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/external/GridFtp.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/factory/AbstractServiceFactory.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/factory/PropertyServiceFactory.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/model/ExecutionModel.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/notification/DummyNotification.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/notification/NotificationService.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/AbstractProvider.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/EC2Provider.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/GramProvider.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/LocalProvider.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/Provider.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/SSHProvider.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/registry/RegistryService.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/registry/impl/XregistryServiceWrapper.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/scheduler/Scheduler.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/services/GenericService.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/type/BooleanParameter.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/type/DoubleParameter.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/type/FloatParameter.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/type/IntegerParameter.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/type/Parameter.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/type/StringParameter.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/type/URIParameter.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/utils/ContactInfo.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/utils/ErrorCodes.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/utils/GFacConstants.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/utils/GFacOptions.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/utils/GfacUtils.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/utils/GlobalConfiguration.java
incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/utils/OutputUtils.java
incubator/airavata/core/trunk/gfac/src/main/resources/service.properties
incubator/airavata/core/trunk/gfac/src/test/java/org/apache/airavata/core/gfac/factory/OGCEGenericFactoryTest.java
incubator/airavata/core/trunk/gfac/src/test/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImplTest.java
incubator/airavata/core/trunk/gfac/src/test/java/org/apache/airavata/core/gfac/type/StringParameterTest.java
incubator/airavata/core/trunk/gfac/src/test/resources/service.properties
Propchange: incubator/airavata/core/trunk/gfac/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jun 25 15:17:35 2011
@@ -0,0 +1 @@
+target
Modified: incubator/airavata/core/trunk/gfac/.project
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/.project?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/.project (original)
+++ incubator/airavata/core/trunk/gfac/.project Sat Jun 25 15:17:35 2011
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>gfac-pojo</name>
+ <name>GFac-Core</name>
<comment></comment>
<projects>
</projects>
Modified: incubator/airavata/core/trunk/gfac/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/.settings/org.eclipse.jdt.core.prefs?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/.settings/org.eclipse.jdt.core.prefs (original)
+++ incubator/airavata/core/trunk/gfac/.settings/org.eclipse.jdt.core.prefs Sat Jun 25 15:17:35 2011
@@ -1,6 +1,6 @@
#Fri Jun 24 05:47:57 EDT 2011
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: incubator/airavata/core/trunk/gfac/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/pom.xml?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/pom.xml (original)
+++ incubator/airavata/core/trunk/gfac/pom.xml Sat Jun 25 15:17:35 2011
@@ -1,3 +1,16 @@
+<?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. -->
+
<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">
<modelVersion>4.0.0</modelVersion>
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ExecutionContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ExecutionContext.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ExecutionContext.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ExecutionContext.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context;
import org.apache.airavata.core.gfac.model.ExecutionModel;
@@ -7,27 +28,27 @@ import org.ogce.namespaces.x2010.x08.x30
public interface ExecutionContext {
- ExecutionModel getExecutionModel();
+ ExecutionModel getExecutionModel();
+
+ void setExectionModel(ExecutionModel model);
+
+ WorkflowContextHeader getWorkflowHeader();
- void setExectionModel(ExecutionModel model);
+ void setWorkflowHeader(WorkflowContextHeader header);
- WorkflowContextHeader getWorkflowHeader();
+ NotificationService getNotificationService();
- void setWorkflowHeader(WorkflowContextHeader header);
+ void setNotificationService(NotificationService service);
- NotificationService getNotificationService();
+ SecurityContext getSecurityContext();
- void setNotificationService(NotificationService service);
+ void setSecurityContext(SecurityContext context);
- SecurityContext getSecurityContext();
+ ServiceContext getServiceContext();
- void setSecurityContext(SecurityContext context);
+ void setServiceContext(ServiceContext context);
- ServiceContext getServiceContext();
+ RegistryService getRegistryService();
- void setServiceContext(ServiceContext context);
-
- RegistryService getRegistryService();
-
- void setRegistryService(RegistryService registryService);
+ void setRegistryService(RegistryService registryService);
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/InvocationContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/InvocationContext.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/InvocationContext.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/InvocationContext.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context;
import java.util.HashMap;
@@ -6,38 +27,44 @@ import java.util.Map;
/**
* Main context that is used throughout the service
*
- * @author Patanachai Tangchaisin
- *
+ *
*/
public class InvocationContext {
- private String serviceName;
- private ExecutionContext executionContext;
- private Map<String, MessageContext> messageContextMap = new HashMap<String, MessageContext>();
- private Map<String, SecurityContext> securityContextMap = new HashMap<String, SecurityContext>();;
-
- public String getServiceName() {
- return serviceName;
- }
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
- public ExecutionContext getExecutionContext() {
- return executionContext;
- }
- public void setExecutionContext(ExecutionContext executionContext) {
- this.executionContext = executionContext;
- }
- public MessageContext getMessageContext(String name) {
- return this.messageContextMap.get(name);
- }
- public void addMessageContext(String name, MessageContext messageContext) {
- this.messageContextMap.put(name, messageContext);
- }
- public SecurityContext getSecurityContext(String name) {
- return this.securityContextMap.get(name);
- }
- public void addSecurityContext(String name, SecurityContext securityContext) {
- this.securityContextMap.put(name, securityContext);
- }
+ private String serviceName;
+ private ExecutionContext executionContext;
+ private Map<String, MessageContext> messageContextMap = new HashMap<String, MessageContext>();
+ private Map<String, SecurityContext> securityContextMap = new HashMap<String, SecurityContext>();;
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public ExecutionContext getExecutionContext() {
+ return executionContext;
+ }
+
+ public void setExecutionContext(ExecutionContext executionContext) {
+ this.executionContext = executionContext;
+ }
+
+ public MessageContext getMessageContext(String name) {
+ return this.messageContextMap.get(name);
+ }
+
+ public void addMessageContext(String name, MessageContext messageContext) {
+ this.messageContextMap.put(name, messageContext);
+ }
+
+ public SecurityContext getSecurityContext(String name) {
+ return this.securityContextMap.get(name);
+ }
+
+ public void addSecurityContext(String name, SecurityContext securityContext) {
+ this.securityContextMap.put(name, securityContext);
+ }
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/MessageContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/MessageContext.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/MessageContext.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/MessageContext.java Sat Jun 25 15:17:35 2011
@@ -1,18 +1,39 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context;
import java.util.Iterator;
public interface MessageContext<T> {
-
- public Iterator<String> getParameterNames();
- public T getParameterValue(String name);
+ public Iterator<String> getParameterNames();
+
+ public T getParameterValue(String name);
+
+ public String getParameterType(String name);
+
+ public String getStringParameterValue(String name);
- public String getParameterType(String name);
+ public void addParameter(String name, String type, T value);
- public String getStringParameterValue(String name);
-
- public void addParameter(String name, String type, T value);
-
- public void setValue(String name, T value);
+ public void setValue(String name, T value);
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/SecurityContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/SecurityContext.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/SecurityContext.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/SecurityContext.java Sat Jun 25 15:17:35 2011
@@ -1,5 +1,25 @@
-package org.apache.airavata.core.gfac.context;
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.airavata.core.gfac.context;
public interface SecurityContext {
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ServiceContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ServiceContext.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ServiceContext.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/ServiceContext.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context;
import org.apache.airavata.core.gfac.utils.GlobalConfiguration;
@@ -5,8 +26,8 @@ import org.ogce.schemas.gfac.documents.S
public interface ServiceContext {
- ServiceMapType getService();
+ ServiceMapType getService();
- GlobalConfiguration getGlobalConfiguration();
+ GlobalConfiguration getGlobalConfiguration();
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/AmazonSecurityContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/AmazonSecurityContext.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/AmazonSecurityContext.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/AmazonSecurityContext.java Sat Jun 25 15:17:35 2011
@@ -1,26 +1,47 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context.impl;
import org.apache.airavata.core.gfac.context.SecurityContext;
public class AmazonSecurityContext implements SecurityContext {
- private String accessKey;
- private String secretKey;
-
- public String getAccessKey() {
- return accessKey;
- }
-
- public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
- }
-
- public String getSecretKey() {
- return secretKey;
- }
-
- public void setSecretKey(String secretKey) {
- this.secretKey = secretKey;
- }
+ private String accessKey;
+ private String secretKey;
+
+ public String getAccessKey() {
+ return accessKey;
+ }
+
+ public void setAccessKey(String accessKey) {
+ this.accessKey = accessKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ public void setSecretKey(String secretKey) {
+ this.secretKey = secretKey;
+ }
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ExecutionContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ExecutionContextImpl.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ExecutionContextImpl.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ExecutionContextImpl.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context.impl;
import org.apache.airavata.core.gfac.context.ExecutionContext;
@@ -10,62 +31,62 @@ import org.ogce.namespaces.x2010.x08.x30
public class ExecutionContextImpl implements ExecutionContext {
- private ExecutionModel executionModel;
- private WorkflowContextHeader workflowContextHeader;
- private NotificationService notificationService;
- private RegistryService registryService;
- private SecurityContext securityContext;
+ private ExecutionModel executionModel;
+ private WorkflowContextHeader workflowContextHeader;
+ private NotificationService notificationService;
+ private RegistryService registryService;
+ private SecurityContext securityContext;
- public ExecutionModel getExecutionModel() {
- return executionModel;
- }
+ public ExecutionModel getExecutionModel() {
+ return executionModel;
+ }
- public void setExectionModel(ExecutionModel model) {
- this.executionModel = model;
- }
+ public void setExectionModel(ExecutionModel model) {
+ this.executionModel = model;
+ }
- public WorkflowContextHeader getWorkflowHeader() {
- return workflowContextHeader;
- }
+ public WorkflowContextHeader getWorkflowHeader() {
+ return workflowContextHeader;
+ }
- public void setWorkflowHeader(WorkflowContextHeader header) {
- this.workflowContextHeader = header;
- }
+ public void setWorkflowHeader(WorkflowContextHeader header) {
+ this.workflowContextHeader = header;
+ }
- public NotificationService getNotificationService() {
- return this.notificationService;
- }
+ public NotificationService getNotificationService() {
+ return this.notificationService;
+ }
- public void setNotificationService(NotificationService service) {
- this.notificationService = service;
+ public void setNotificationService(NotificationService service) {
+ this.notificationService = service;
- }
+ }
- public SecurityContext getSecurityContext() {
- return this.securityContext;
- }
+ public SecurityContext getSecurityContext() {
+ return this.securityContext;
+ }
- public void setSecurityContext(SecurityContext context) {
- this.securityContext = context;
+ public void setSecurityContext(SecurityContext context) {
+ this.securityContext = context;
- }
+ }
- public ServiceContext getServiceContext() {
- // TODO Auto-generated method stub
- return null;
- }
+ public ServiceContext getServiceContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- public void setServiceContext(ServiceContext context) {
- // TODO Auto-generated method stub
+ public void setServiceContext(ServiceContext context) {
+ // TODO Auto-generated method stub
- }
+ }
- public RegistryService getRegistryService() {
- return this.registryService;
- }
+ public RegistryService getRegistryService() {
+ return this.registryService;
+ }
- public void setRegistryService(RegistryService registryService) {
- this.registryService = registryService;
- }
+ public void setRegistryService(RegistryService registryService) {
+ this.registryService = registryService;
+ }
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/GSISecurityContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/GSISecurityContext.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/GSISecurityContext.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/GSISecurityContext.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context.impl;
import org.apache.airavata.core.gfac.context.SecurityContext;
@@ -13,98 +34,100 @@ import org.slf4j.LoggerFactory;
public class GSISecurityContext implements SecurityContext {
- protected final Logger log = LoggerFactory.getLogger(this.getClass());
+ protected final Logger log = LoggerFactory.getLogger(this.getClass());
- private MyProxyManager proxyRenewer;
+ private MyProxyManager proxyRenewer;
- private String myproxyUserName;
+ private String myproxyUserName;
- private String myproxyPasswd;
+ private String myproxyPasswd;
- private String myproxyServer;
-
- private int myproxyLifetime;
-
- private String trustedCertLoc;
-
- private GSSCredential gssCredentails;
- private GlobalConfiguration globalConfiguration;
-
- public GSISecurityContext() {
-
- }
-
- public GSISecurityContext(GlobalConfiguration globalConfiguration) throws GfacException {
- try {
- this.globalConfiguration = globalConfiguration;
- myproxyUserName = globalConfiguration.getProperty("myproxyUserName");
- myproxyPasswd = globalConfiguration.getProperty("myproxyPasswd");
- myproxyServer = globalConfiguration.getProperty("myproxyServer");
- String lifetime = globalConfiguration.getProperty("myproxyLifetime");
- trustedCertLoc = globalConfiguration.getTrustedCertsFile();
- // Load the Credential configurations
- if (myproxyUserName != null && myproxyPasswd != null && myproxyServer != null && lifetime != null) {
- this.myproxyLifetime = Integer.parseInt(lifetime);
- this.proxyRenewer = new MyProxyManager(myproxyUserName, myproxyPasswd, MyProxy.MYPROXY_SERVER_PORT, myproxyLifetime, myproxyServer, trustedCertLoc);
- log.info("loaded credentails from Proxy server");
- } else {
- log.info(myproxyUserName + " " + (myproxyPasswd != null) + " " + myproxyServer + " " + myproxyLifetime);
- this.proxyRenewer = null;
- }
- } catch (NumberFormatException e) {
- throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
- } catch (Exception e) {
- throw new GfacException(e, FaultCode.InternalServiceError);
- }
- }
-
- public GSSCredential getGssCredentails() throws GfacException, GSSException {
- try {
- System.out.println(gssCredentails);
- if (gssCredentails == null || gssCredentails.getRemainingLifetime() < 10 * 90) {
- if (proxyRenewer != null) {
- gssCredentails = proxyRenewer.renewProxy();
- } else if (myproxyUserName != null && myproxyPasswd != null && myproxyServer != null) {
- this.proxyRenewer = new MyProxyManager(myproxyUserName, myproxyPasswd, MyProxy.MYPROXY_SERVER_PORT, myproxyLifetime, myproxyServer, trustedCertLoc);
- log.info("loaded credentails from Proxy server");
- gssCredentails = this.proxyRenewer.renewProxy();
- }
- }
- return gssCredentails;
- } catch (Exception e) {
- throw new GfacException(e, FaultCode.ErrorAtDependentService);
- }
- }
-
- public String getMyproxyUserName() {
- return myproxyUserName;
- }
-
- public void setMyproxyUserName(String myproxyUserName) {
- this.myproxyUserName = myproxyUserName;
- }
-
- public String getMyproxyPasswd() {
- return myproxyPasswd;
- }
-
- public void setMyproxyPasswd(String myproxyPasswd) {
- this.myproxyPasswd = myproxyPasswd;
- }
-
- public String getMyproxyServer() {
- return myproxyServer;
- }
-
- public void setMyproxyServer(String myproxyServer) {
- this.myproxyServer = myproxyServer;
- }
-
- public int getMyproxyLifetime() {
- return myproxyLifetime;
- }
-
- public void setMyproxyLifetime(int myproxyLifetime) {
- this.myproxyLifetime = myproxyLifetime;
- }
+ private String myproxyServer;
+
+ private int myproxyLifetime;
+
+ private String trustedCertLoc;
+
+ private GSSCredential gssCredentails;
+ private GlobalConfiguration globalConfiguration;
+
+ public GSISecurityContext() {
+
+ }
+
+ public GSISecurityContext(GlobalConfiguration globalConfiguration) throws GfacException {
+ try {
+ this.globalConfiguration = globalConfiguration;
+ myproxyUserName = globalConfiguration.getProperty("myproxyUserName");
+ myproxyPasswd = globalConfiguration.getProperty("myproxyPasswd");
+ myproxyServer = globalConfiguration.getProperty("myproxyServer");
+ String lifetime = globalConfiguration.getProperty("myproxyLifetime");
+ trustedCertLoc = globalConfiguration.getTrustedCertsFile();
+ // Load the Credential configurations
+ if (myproxyUserName != null && myproxyPasswd != null && myproxyServer != null && lifetime != null) {
+ this.myproxyLifetime = Integer.parseInt(lifetime);
+ this.proxyRenewer = new MyProxyManager(myproxyUserName, myproxyPasswd, MyProxy.MYPROXY_SERVER_PORT,
+ myproxyLifetime, myproxyServer, trustedCertLoc);
+ log.info("loaded credentails from Proxy server");
+ } else {
+ log.info(myproxyUserName + " " + (myproxyPasswd != null) + " " + myproxyServer + " " + myproxyLifetime);
+ this.proxyRenewer = null;
+ }
+ } catch (NumberFormatException e) {
+ throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
+ } catch (Exception e) {
+ throw new GfacException(e, FaultCode.InternalServiceError);
+ }
+ }
+
+ public GSSCredential getGssCredentails() throws GfacException, GSSException {
+ try {
+ System.out.println(gssCredentails);
+ if (gssCredentails == null || gssCredentails.getRemainingLifetime() < 10 * 90) {
+ if (proxyRenewer != null) {
+ gssCredentails = proxyRenewer.renewProxy();
+ } else if (myproxyUserName != null && myproxyPasswd != null && myproxyServer != null) {
+ this.proxyRenewer = new MyProxyManager(myproxyUserName, myproxyPasswd, MyProxy.MYPROXY_SERVER_PORT,
+ myproxyLifetime, myproxyServer, trustedCertLoc);
+ log.info("loaded credentails from Proxy server");
+ gssCredentails = this.proxyRenewer.renewProxy();
+ }
+ }
+ return gssCredentails;
+ } catch (Exception e) {
+ throw new GfacException(e, FaultCode.ErrorAtDependentService);
+ }
+ }
+
+ public String getMyproxyUserName() {
+ return myproxyUserName;
+ }
+
+ public void setMyproxyUserName(String myproxyUserName) {
+ this.myproxyUserName = myproxyUserName;
+ }
+
+ public String getMyproxyPasswd() {
+ return myproxyPasswd;
+ }
+
+ public void setMyproxyPasswd(String myproxyPasswd) {
+ this.myproxyPasswd = myproxyPasswd;
+ }
+
+ public String getMyproxyServer() {
+ return myproxyServer;
+ }
+
+ public void setMyproxyServer(String myproxyServer) {
+ this.myproxyServer = myproxyServer;
+ }
+
+ public int getMyproxyLifetime() {
+ return myproxyLifetime;
+ }
+
+ public void setMyproxyLifetime(int myproxyLifetime) {
+ this.myproxyLifetime = myproxyLifetime;
+ }
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ParameterContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ParameterContextImpl.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ParameterContextImpl.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/ParameterContextImpl.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context.impl;
import java.util.HashMap;
@@ -9,38 +30,38 @@ import org.apache.airavata.core.gfac.typ
@SuppressWarnings("rawtypes")
public class ParameterContextImpl implements MessageContext<Parameter> {
-
- private Map<String, Parameter> value;
-
- public ParameterContextImpl(){
- this.value = new HashMap<String, Parameter>();
- }
-
- public Iterator<String> getParameterNames() {
- return this.value.keySet().iterator();
- }
-
- public Parameter getParameterValue(String name) {
- return this.value.get(name);
- }
-
- public String getParameterType(String name) {
- return this.value.get(name).getTypeName();
- }
-
- public String getStringParameterValue(String name) {
- if(this.value.containsKey(name))
- return this.value.get(name).toString();
- else
- return null;
- }
-
- public void addParameter(String name, String type, Parameter value){
- this.value.put(name, value);
- }
-
- public void setValue(String name, Parameter value) {
- this.value.put(name, value);
- }
+
+ private Map<String, Parameter> value;
+
+ public ParameterContextImpl() {
+ this.value = new HashMap<String, Parameter>();
+ }
+
+ public Iterator<String> getParameterNames() {
+ return this.value.keySet().iterator();
+ }
+
+ public Parameter getParameterValue(String name) {
+ return this.value.get(name);
+ }
+
+ public String getParameterType(String name) {
+ return this.value.get(name).getTypeName();
+ }
+
+ public String getStringParameterValue(String name) {
+ if (this.value.containsKey(name))
+ return this.value.get(name).toString();
+ else
+ return null;
+ }
+
+ public void addParameter(String name, String type, Parameter value) {
+ this.value.put(name, value);
+ }
+
+ public void setValue(String name, Parameter value) {
+ this.value.put(name, value);
+ }
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/utils/MyProxyManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/utils/MyProxyManager.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/utils/MyProxyManager.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/context/impl/utils/MyProxyManager.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.context.impl.utils;
import java.io.File;
@@ -19,17 +40,17 @@ import org.slf4j.LoggerFactory;
public class MyProxyManager {
- private final Logger log = LoggerFactory.getLogger(this.getClass());
-
- private final String username;
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ private final String username;
private final String password;
private final int port;
private final int lifetime;
private final String hostname;
private String trustedCertsLoc;
- public MyProxyManager(final String username, final String password, final int port,
- final int lifetime, final String hostname) {
+ public MyProxyManager(final String username, final String password, final int port, final int lifetime,
+ final String hostname) {
super();
this.username = username;
this.password = password;
@@ -37,8 +58,9 @@ public class MyProxyManager {
this.lifetime = lifetime;
this.hostname = hostname;
}
- public MyProxyManager(final String username, final String password, final int port,
- final int lifetime, final String hostname, String trustedCertsLoc) {
+
+ public MyProxyManager(final String username, final String password, final int port, final int lifetime,
+ final String hostname, String trustedCertsLoc) {
super();
this.username = username;
this.password = password;
@@ -47,6 +69,7 @@ public class MyProxyManager {
this.hostname = hostname;
this.trustedCertsLoc = trustedCertsLoc;
}
+
public MyProxyManager(String username, String password, int lifetime) {
super();
this.username = username;
@@ -55,59 +78,59 @@ public class MyProxyManager {
hostname = "rainier.extreme.indiana.edu";
this.port = MyProxy.DEFAULT_PORT;
}
-
- private void init() {
- if(trustedCertsLoc != null){
- TrustedCertificates certificates = TrustedCertificates.load(trustedCertsLoc);
- TrustedCertificates.setDefaultTrustedCertificates(certificates);
- }
- }
-
- public GSSCredential renewProxy() throws GfacException {
-
- try {
- init() ;
- String proxyloc = null;
- MyProxy myproxy = new MyProxy(hostname, port);
- GSSCredential proxy = myproxy.get(username, password, lifetime);
- GlobusCredential globusCred = null;
- if (proxy instanceof GlobusGSSCredentialImpl) {
- globusCred = ((GlobusGSSCredentialImpl) proxy).getGlobusCredential();
- log.info("got proxy from myproxy for " + username + " with " + lifetime + " lifetime.");
- String uid=username;
- if (proxyloc == null) {
- // uid = XpolaUtil.getSysUserid();
- log.info("uid: " + uid);
- proxyloc = "/tmp/x509up_u" + uid + UUID.randomUUID().toString();
- }
- log.info("proxy location: " + proxyloc);
- File proxyfile = new File(proxyloc);
- if (proxyfile.exists() == false) {
- String dirpath = proxyloc.substring(0, proxyloc.lastIndexOf('/'));
- File dir = new File(dirpath);
- if (dir.exists() == false) {
- dir.mkdirs();
- log.info("new directory " + dirpath + " is created.");
- }
- proxyfile.createNewFile();
- log.info("new proxy file " + proxyloc + " is created.");
- }
- FileOutputStream fout = new FileOutputStream(proxyfile);
- globusCred.save(fout);
- fout.close();
- Runtime.getRuntime().exec("/bin/chmod 600 " + proxyloc);
- log.info("Proxy file renewed to " + proxyloc + " for the user "
- + username + " with " + lifetime + " lifetime.");
-
- }
- return proxy;
- } catch (MyProxyException e) {
- throw new GfacException(e,FaultCode.ErrorAtDependentService);
- } catch (FileNotFoundException e) {
- throw new GfacException(e,FaultCode.LocalError);
- } catch (IOException e) {
- throw new GfacException(e,FaultCode.LocalError);
- }
- }
+
+ private void init() {
+ if (trustedCertsLoc != null) {
+ TrustedCertificates certificates = TrustedCertificates.load(trustedCertsLoc);
+ TrustedCertificates.setDefaultTrustedCertificates(certificates);
+ }
+ }
+
+ public GSSCredential renewProxy() throws GfacException {
+
+ try {
+ init();
+ String proxyloc = null;
+ MyProxy myproxy = new MyProxy(hostname, port);
+ GSSCredential proxy = myproxy.get(username, password, lifetime);
+ GlobusCredential globusCred = null;
+ if (proxy instanceof GlobusGSSCredentialImpl) {
+ globusCred = ((GlobusGSSCredentialImpl) proxy).getGlobusCredential();
+ log.info("got proxy from myproxy for " + username + " with " + lifetime + " lifetime.");
+ String uid = username;
+ if (proxyloc == null) {
+ // uid = XpolaUtil.getSysUserid();
+ log.info("uid: " + uid);
+ proxyloc = "/tmp/x509up_u" + uid + UUID.randomUUID().toString();
+ }
+ log.info("proxy location: " + proxyloc);
+ File proxyfile = new File(proxyloc);
+ if (proxyfile.exists() == false) {
+ String dirpath = proxyloc.substring(0, proxyloc.lastIndexOf('/'));
+ File dir = new File(dirpath);
+ if (dir.exists() == false) {
+ dir.mkdirs();
+ log.info("new directory " + dirpath + " is created.");
+ }
+ proxyfile.createNewFile();
+ log.info("new proxy file " + proxyloc + " is created.");
+ }
+ FileOutputStream fout = new FileOutputStream(proxyfile);
+ globusCred.save(fout);
+ fout.close();
+ Runtime.getRuntime().exec("/bin/chmod 600 " + proxyloc);
+ log.info("Proxy file renewed to " + proxyloc + " for the user " + username + " with " + lifetime
+ + " lifetime.");
+
+ }
+ return proxy;
+ } catch (MyProxyException e) {
+ throw new GfacException(e, FaultCode.ErrorAtDependentService);
+ } catch (FileNotFoundException e) {
+ throw new GfacException(e, FaultCode.LocalError);
+ } catch (IOException e) {
+ throw new GfacException(e, FaultCode.LocalError);
+ }
+ }
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/FileTransferFault.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/FileTransferFault.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/FileTransferFault.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/FileTransferFault.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.exception;
import java.net.URI;
@@ -5,8 +26,9 @@ import java.net.URI;
import org.apache.airavata.core.gfac.utils.GFacOptions.FileTransferServiceType;
import org.ogce.schemas.gfac.inca.faults.DataTransfer;
-public class FileTransferFault extends GfacException{
- public FileTransferFault(Throwable cause,FileTransferServiceType api,String origHost, URI source,URI dest, String options) {
+public class FileTransferFault extends GfacException {
+ public FileTransferFault(Throwable cause, FileTransferServiceType api, String origHost, URI source, URI dest,
+ String options) {
super(cause, FaultCode.ErrorAtDependentService);
DataTransfer dataTransfer = DataTransfer.Factory.newInstance();
dataTransfer.setOrigHost(origHost);
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/GfacException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/GfacException.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/GfacException.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/GfacException.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.exception;
import java.text.DateFormat;
@@ -5,70 +26,74 @@ import java.util.Date;
import org.apache.xmlbeans.XmlObject;
import org.ogce.schemas.gfac.inca.faults.ActionDocument;
+import org.ogce.schemas.gfac.inca.faults.ActionDocument.Action;
import org.ogce.schemas.gfac.inca.faults.Application;
import org.ogce.schemas.gfac.inca.faults.DataTransfer;
import org.ogce.schemas.gfac.inca.faults.FileSystem;
import org.ogce.schemas.gfac.inca.faults.Job;
-import org.ogce.schemas.gfac.inca.faults.ActionDocument.Action;
public class GfacException extends Exception {
- public static enum FaultCode{ServiceNotReachable, InvalidRequest, InternalServiceError, ErrorAtDependentService, ErrorAtClientBeforeWsCall,
- ErrorAtClientWhileWsCall, ErrorAtClientAfterWsCall, InitalizationError, UnsupportedMessage, InvaliedLocalArgumnet,
- LocalError, CmdAppError, ErrorAtCreatedService, InvalidConfig, Unknown, InvaliedResponse, JobSubmissionFailed};
-
+ public static enum FaultCode {
+ ServiceNotReachable, InvalidRequest, InternalServiceError, ErrorAtDependentService, ErrorAtClientBeforeWsCall, ErrorAtClientWhileWsCall, ErrorAtClientAfterWsCall, InitalizationError, UnsupportedMessage, InvaliedLocalArgumnet, LocalError, CmdAppError, ErrorAtCreatedService, InvalidConfig, Unknown, InvaliedResponse, JobSubmissionFailed
+ };
+
private static final long serialVersionUID = 1L;
private static DateFormat formatter = DateFormat.getTimeInstance();
protected ActionDocument errorActionDocument;
protected String faultCode;
+
public GfacException(String message, Throwable cause) {
super(message, cause);
}
-
- public GfacException(String message, Throwable cause,FaultCode faultCode) {
+
+ public GfacException(String message, Throwable cause, FaultCode faultCode) {
super(message, cause);
this.faultCode = faultCode.toString();
}
- public GfacException(String message,FaultCode faultCode) {
+ public GfacException(String message, FaultCode faultCode) {
super(message);
this.faultCode = faultCode.toString();
}
- public GfacException(Throwable cause,FaultCode faultCode) {
+ public GfacException(Throwable cause, FaultCode faultCode) {
super(cause);
- if(cause instanceof GfacException){
- GfacException gfacExeption = (GfacException)cause;
+ if (cause instanceof GfacException) {
+ GfacException gfacExeption = (GfacException) cause;
setFaultCode(gfacExeption.getFaultCode());
}
this.faultCode = faultCode.toString();
}
+
public String getFaultCode() {
- return faultCode != null?faultCode:getMessage();
+ return faultCode != null ? faultCode : getMessage();
}
+
public void setFaultCode(String faultCode) {
this.faultCode = faultCode;
}
- public ActionDocument createFaultData(XmlObject fault,String api,Throwable e){
+
+ public ActionDocument createFaultData(XmlObject fault, String api, Throwable e) {
ActionDocument document = ActionDocument.Factory.newInstance();
Action type = document.addNewAction();
type.setId("");
type.setApplication("lead");
type.setApi(api);
-
- if(fault instanceof DataTransfer){
- type.setDataTransferArray(new DataTransfer[]{(DataTransfer)fault});
- }else if(fault instanceof Job){
- type.setJobArray(new Job[]{(Job)fault});
- }else if(fault instanceof Job){
- type.setFileSystemArray(new FileSystem[]{(FileSystem)fault});
- }else if(fault instanceof Application){
- type.setCmdapplicationArray(new Application[]{(Application)fault});
+
+ if (fault instanceof DataTransfer) {
+ type.setDataTransferArray(new DataTransfer[] { (DataTransfer) fault });
+ } else if (fault instanceof Job) {
+ type.setJobArray(new Job[] { (Job) fault });
+ } else if (fault instanceof Job) {
+ type.setFileSystemArray(new FileSystem[] { (FileSystem) fault });
+ } else if (fault instanceof Application) {
+ type.setCmdapplicationArray(new Application[] { (Application) fault });
}
type.setEndTime(formatter.format(new Date()));
Throwable cause = e;
- while(cause.getCause() != null){
+ while (cause.getCause() != null) {
cause = cause.getCause();
}
return document;
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/JobSubmissionFault.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/JobSubmissionFault.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/JobSubmissionFault.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/exception/JobSubmissionFault.java Sat Jun 25 15:17:35 2011
@@ -1,12 +1,32 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.exception;
-import org.apache.airavata.core.gfac.provider.Provider;
import org.apache.airavata.core.gfac.utils.GFacOptions.CurrentProviders;
import org.ogce.schemas.gfac.inca.faults.Job;
-public class JobSubmissionFault extends GfacException{
- public JobSubmissionFault(Throwable cause,String submitHost, String contact,String rsl,CurrentProviders api) {
- super(cause,FaultCode.ErrorAtDependentService);
+public class JobSubmissionFault extends GfacException {
+ public JobSubmissionFault(Throwable cause, String submitHost, String contact, String rsl, CurrentProviders api) {
+ super(cause, FaultCode.ErrorAtDependentService);
Job job = Job.Factory.newInstance();
job.setContact(contact);
job.setRsl(rsl);
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/Chain.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/Chain.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/Chain.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/Chain.java Sat Jun 25 15:17:35 2011
@@ -1,20 +1,41 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.extension;
import org.apache.airavata.core.gfac.context.InvocationContext;
import org.apache.airavata.core.gfac.exception.GfacException;
public abstract class Chain<T> {
- protected T next;
+ protected T next;
- public T setNext(T nextChain) {
- this.next = nextChain;
- return this.next;
- }
+ public T setNext(T nextChain) {
+ this.next = nextChain;
+ return this.next;
+ }
- /**
- * Start the chain
- *
- * @param context
- */
- public abstract void start(InvocationContext context) throws GfacException;
+ /**
+ * Start the chain
+ *
+ * @param context
+ */
+ public abstract void start(InvocationContext context) throws GfacException;
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/DataServiceChain.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/DataServiceChain.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/DataServiceChain.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/DataServiceChain.java Sat Jun 25 15:17:35 2011
@@ -1,5 +1,26 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.extension;
-public abstract class DataServiceChain extends ExitableChain{
-
+public abstract class DataServiceChain extends ExitableChain {
+
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/ExitableChain.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/ExitableChain.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/ExitableChain.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/ExitableChain.java Sat Jun 25 15:17:35 2011
@@ -1,20 +1,41 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.extension;
import org.apache.airavata.core.gfac.context.InvocationContext;
import org.apache.airavata.core.gfac.exception.GfacException;
public abstract class ExitableChain extends Chain<ExitableChain> {
- public final void start(InvocationContext context) throws GfacException{
- boolean breakTheChain = this.execute(context);
- if (next != null && !breakTheChain) {
- this.next.start(context);
- }
- }
-
- /**
- *
- * @param context
- * @return true if no need for further processing
- */
- protected abstract boolean execute(InvocationContext context) throws GfacException;
+ public final void start(InvocationContext context) throws GfacException {
+ boolean breakTheChain = this.execute(context);
+ if (next != null && !breakTheChain) {
+ this.next.start(context);
+ }
+ }
+
+ /**
+ *
+ * @param context
+ * @return true if no need for further processing
+ */
+ protected abstract boolean execute(InvocationContext context) throws GfacException;
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PostExecuteChain.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PostExecuteChain.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PostExecuteChain.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PostExecuteChain.java Sat Jun 25 15:17:35 2011
@@ -1,5 +1,26 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.extension;
-public abstract class PostExecuteChain extends ExitableChain{
-
+public abstract class PostExecuteChain extends ExitableChain {
+
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PreExecuteChain.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PreExecuteChain.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PreExecuteChain.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/PreExecuteChain.java Sat Jun 25 15:17:35 2011
@@ -1,5 +1,25 @@
-package org.apache.airavata.core.gfac.extension;
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.airavata.core.gfac.extension;
-public abstract class PreExecuteChain extends ExitableChain{
+public abstract class PreExecuteChain extends ExitableChain {
}
Modified: incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java
URL: http://svn.apache.org/viewvc/incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java?rev=1139550&r1=1139549&r2=1139550&view=diff
==============================================================================
--- incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java (original)
+++ incubator/airavata/core/trunk/gfac/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java Sat Jun 25 15:17:35 2011
@@ -1,3 +1,24 @@
+/*
+ *
+ * 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.
+ *
+ */
+
package org.apache.airavata.core.gfac.extension.data;
import java.io.File;
@@ -33,136 +54,143 @@ import org.ogce.schemas.gfac.documents.S
public class RegistryDataService extends DataServiceChain {
- private static final String INPUT_MESSAGE_CONTEXT = "input";
- private static final String OUTPUT_MESSAGE_CONTEXT = "output";
+ private static final String INPUT_MESSAGE_CONTEXT = "input";
+ private static final String OUTPUT_MESSAGE_CONTEXT = "output";
- public boolean execute(InvocationContext context) throws GfacException {
+ public boolean execute(InvocationContext context) throws GfacException {
- /*
- * Load host and app description from registry
- */
- RegistryService registryService = context.getExecutionContext().getRegistryService();
- String serviceMapStr = registryService.getServiceMap(context.getServiceName());
- System.out.println(serviceMapStr);
- if (serviceMapStr != null) {
- try {
-
- ServiceMapType serviceMap = ServiceMapDocument.Factory.parse(serviceMapStr).getServiceMap();
- QName appName = GfacUtils.findApplcationName(serviceMap);
-
- // host name
- String hostName = findHostFromServiceMap(registryService, appName);
-
- // app
- String appDesc = registryService.getAppDesc(appName.toString(), hostName);
- ApplicationDescriptionType appDescType = ApplicationDescriptionDocument.Factory.parse(appDesc).getApplicationDescription();
-
- // host desc
- String hostDesc = registryService.getHostDesc(hostName);
- HostDescriptionType hostDescType = HostDescriptionDocument.Factory.parse(hostDesc).getHostDescription();
-
- // application deployment
- DeploymentDescriptionType deploymentDesc = appDescType.getDeploymentDescription();
- String tmpDir = deploymentDesc.getTmpDir();
- if (tmpDir == null && hostDescType != null) {
- tmpDir = hostDescType.getHostConfiguration().getTmpDir();
- }
-
- if (tmpDir == null) {
- tmpDir = "/tmp";
- }
-
- String date = new Date().toString();
- date = date.replaceAll(" ", "_");
- date = date.replaceAll(":", "_");
-
- tmpDir = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + "_" + date + "_" + UUID.randomUUID();
-
- String workingDir = deploymentDesc.getWorkDir();
- if (workingDir == null || workingDir.trim().length() == 0) {
- workingDir = tmpDir;
- }
-
- String stdOut = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stdout";
- String stderr = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stderr";
- String executable = deploymentDesc.getExecutable();
- String host = deploymentDesc.getHostName();
-
- NameValuePairType[] env = deploymentDesc.getApplicationEnvArray();
- Map<String, String> envMap = new HashMap<String, String>();
- if (env != null) {
- for (int i = 0; i < env.length; i++) {
- envMap.put(env[i].getName(), env[i].getValue());
- }
- }
-
- String inputDataDir = tmpDir + File.separator + "inputData";
- String outputDataDir = tmpDir + File.separator + "outputData";
-
- GlobusGatekeeperType[] gatekeepers = hostDescType.getHostConfiguration().getGlobusGatekeeperArray();
-
- ExecutionModel model = new ExecutionModel();
- model.setHost(host);
- model.setExecutable(executable);
- model.setTmpDir(tmpDir);
- model.setWorkingDir(workingDir);
- model.setStdOut(stdOut);
- model.setStderr(stderr);
- model.setInputDataDir(inputDataDir);
- model.setOutputDataDir(outputDataDir);
- model.setEnv(envMap);
- model.setAplicationDesc(appDescType);
- model.setHostDesc(hostDescType);
- model.setGatekeeper(gatekeepers[0]);
-
- // input parameter
- ArrayList<String> tmp = new ArrayList<String>();
- for (Iterator<String> iterator = context.getMessageContext(INPUT_MESSAGE_CONTEXT).getParameterNames(); iterator.hasNext();) {
- String key = iterator.next();
- tmp.add(context.getMessageContext(INPUT_MESSAGE_CONTEXT).getStringParameterValue(key));
- }
- model.setInputParameters(tmp);
-
- context.getExecutionContext().setExectionModel(model);
-
- // output parameter
- //TODO type mapping
- if (serviceMap.getPortTypeArray(0).getMethodArray(0).getOutputParameterArray() != null) {
- ParameterContextImpl outtmp = new ParameterContextImpl();
- for (OutputParameterType output : serviceMap.getPortTypeArray(0).getMethodArray(0).getOutputParameterArray()) {
- outtmp.addParameter(output.getParameterName(), output.getParameterType().toString(), new StringParameter());
- }
- context.addMessageContext(OUTPUT_MESSAGE_CONTEXT, outtmp);
- }
-
- } catch (XmlException e) {
- throw new GfacException(e, FaultCode.InitalizationError);
- }
- } else {
- throw new GfacException("Service Map for " + context.getServiceName() + " does not found on resource Catalog " + registryService, FaultCode.InvalidRequest);
- }
-
- return false;
- }
-
- private String findHostFromServiceMap(RegistryService regService, QName appName) throws GfacException {
-
- System.out.println("Searching registry for some deployed application hosts\n");
- String[] hosts = regService.app2Hosts(appName.toString());
- if (hosts.length > 1) {
- String hostNames = "";
- for (int i = 0; i < hosts.length; i++) {
- hostNames = hostNames + hosts[i];
- }
- System.out.println("Application deployed on more than one machine. The full Host list is " + hostNames + "\n");
- }
- if (hosts.length >= 1) {
- System.out.println("Found Host = " + hosts[0]);
- return hosts[0];
- } else {
- System.out.println("Applcation " + appName.getLocalPart() + " not found in registry");
- return null;
- }
- }
+ /*
+ * Load host and app description from registry
+ */
+ RegistryService registryService = context.getExecutionContext().getRegistryService();
+ String serviceMapStr = registryService.getServiceMap(context.getServiceName());
+ System.out.println(serviceMapStr);
+ if (serviceMapStr != null) {
+ try {
+
+ ServiceMapType serviceMap = ServiceMapDocument.Factory.parse(serviceMapStr).getServiceMap();
+ QName appName = GfacUtils.findApplcationName(serviceMap);
+
+ // host name
+ String hostName = findHostFromServiceMap(registryService, appName);
+
+ // app
+ String appDesc = registryService.getAppDesc(appName.toString(), hostName);
+ ApplicationDescriptionType appDescType = ApplicationDescriptionDocument.Factory.parse(appDesc)
+ .getApplicationDescription();
+
+ // host desc
+ String hostDesc = registryService.getHostDesc(hostName);
+ HostDescriptionType hostDescType = HostDescriptionDocument.Factory.parse(hostDesc).getHostDescription();
+
+ // application deployment
+ DeploymentDescriptionType deploymentDesc = appDescType.getDeploymentDescription();
+ String tmpDir = deploymentDesc.getTmpDir();
+ if (tmpDir == null && hostDescType != null) {
+ tmpDir = hostDescType.getHostConfiguration().getTmpDir();
+ }
+
+ if (tmpDir == null) {
+ tmpDir = "/tmp";
+ }
+
+ String date = new Date().toString();
+ date = date.replaceAll(" ", "_");
+ date = date.replaceAll(":", "_");
+
+ tmpDir = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + "_" + date + "_"
+ + UUID.randomUUID();
+
+ String workingDir = deploymentDesc.getWorkDir();
+ if (workingDir == null || workingDir.trim().length() == 0) {
+ workingDir = tmpDir;
+ }
+
+ String stdOut = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stdout";
+ String stderr = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stderr";
+ String executable = deploymentDesc.getExecutable();
+ String host = deploymentDesc.getHostName();
+
+ NameValuePairType[] env = deploymentDesc.getApplicationEnvArray();
+ Map<String, String> envMap = new HashMap<String, String>();
+ if (env != null) {
+ for (int i = 0; i < env.length; i++) {
+ envMap.put(env[i].getName(), env[i].getValue());
+ }
+ }
+
+ String inputDataDir = tmpDir + File.separator + "inputData";
+ String outputDataDir = tmpDir + File.separator + "outputData";
+
+ GlobusGatekeeperType[] gatekeepers = hostDescType.getHostConfiguration().getGlobusGatekeeperArray();
+
+ ExecutionModel model = new ExecutionModel();
+ model.setHost(host);
+ model.setExecutable(executable);
+ model.setTmpDir(tmpDir);
+ model.setWorkingDir(workingDir);
+ model.setStdOut(stdOut);
+ model.setStderr(stderr);
+ model.setInputDataDir(inputDataDir);
+ model.setOutputDataDir(outputDataDir);
+ model.setEnv(envMap);
+ model.setAplicationDesc(appDescType);
+ model.setHostDesc(hostDescType);
+ model.setGatekeeper(gatekeepers[0]);
+
+ // input parameter
+ ArrayList<String> tmp = new ArrayList<String>();
+ for (Iterator<String> iterator = context.getMessageContext(INPUT_MESSAGE_CONTEXT).getParameterNames(); iterator
+ .hasNext();) {
+ String key = iterator.next();
+ tmp.add(context.getMessageContext(INPUT_MESSAGE_CONTEXT).getStringParameterValue(key));
+ }
+ model.setInputParameters(tmp);
+
+ context.getExecutionContext().setExectionModel(model);
+
+ // output parameter
+ // TODO type mapping
+ if (serviceMap.getPortTypeArray(0).getMethodArray(0).getOutputParameterArray() != null) {
+ ParameterContextImpl outtmp = new ParameterContextImpl();
+ for (OutputParameterType output : serviceMap.getPortTypeArray(0).getMethodArray(0)
+ .getOutputParameterArray()) {
+ outtmp.addParameter(output.getParameterName(), output.getParameterType().toString(),
+ new StringParameter());
+ }
+ context.addMessageContext(OUTPUT_MESSAGE_CONTEXT, outtmp);
+ }
+
+ } catch (XmlException e) {
+ throw new GfacException(e, FaultCode.InitalizationError);
+ }
+ } else {
+ throw new GfacException("Service Map for " + context.getServiceName()
+ + " does not found on resource Catalog " + registryService, FaultCode.InvalidRequest);
+ }
+
+ return false;
+ }
+
+ private String findHostFromServiceMap(RegistryService regService, QName appName) throws GfacException {
+
+ System.out.println("Searching registry for some deployed application hosts\n");
+ String[] hosts = regService.app2Hosts(appName.toString());
+ if (hosts.length > 1) {
+ String hostNames = "";
+ for (int i = 0; i < hosts.length; i++) {
+ hostNames = hostNames + hosts[i];
+ }
+ System.out.println("Application deployed on more than one machine. The full Host list is " + hostNames
+ + "\n");
+ }
+ if (hosts.length >= 1) {
+ System.out.println("Found Host = " + hosts[0]);
+ return hosts[0];
+ } else {
+ System.out.println("Applcation " + appName.getLocalPart() + " not found in registry");
+ return null;
+ }
+ }
}