airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject svn commit: r1139556 - in /incubator/airavata/services/trunk/gfac-axis2: ./ .settings/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/airavata/ src/main/java/org/apache/airavata/services/ src/main/ja...
Date Sat, 25 Jun 2011 15:38:38 GMT
Author: smarru
Date: Sat Jun 25 15:38:37 2011
New Revision: 1139556

URL: http://svn.apache.org/viewvc?rev=1139556&view=rev
Log:
importing GFac Axis2 Interface after clean up

Added:
    incubator/airavata/services/trunk/gfac-axis2/
    incubator/airavata/services/trunk/gfac-axis2/.classpath
    incubator/airavata/services/trunk/gfac-axis2/.project
    incubator/airavata/services/trunk/gfac-axis2/.settings/
    incubator/airavata/services/trunk/gfac-axis2/.settings/org.eclipse.jdt.core.prefs
    incubator/airavata/services/trunk/gfac-axis2/.settings/org.maven.ide.eclipse.prefs
    incubator/airavata/services/trunk/gfac-axis2/pom.xml
    incubator/airavata/services/trunk/gfac-axis2/src/
    incubator/airavata/services/trunk/gfac-axis2/src/main/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/AmazonSecurityHandler.java
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/MyProxySecurityHandler.java
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/utils/
    incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/utils/MessageContextUtil.java
    incubator/airavata/services/trunk/gfac-axis2/src/main/resources/
    incubator/airavata/services/trunk/gfac-axis2/src/main/resources/services.xml

Added: incubator/airavata/services/trunk/gfac-axis2/.classpath
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/.classpath?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/.classpath (added)
+++ incubator/airavata/services/trunk/gfac-axis2/.classpath Sat Jun 25 15:38:37 2011
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: incubator/airavata/services/trunk/gfac-axis2/.project
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/.project?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/.project (added)
+++ incubator/airavata/services/trunk/gfac-axis2/.project Sat Jun 25 15:38:37 2011
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>GFac-Axis2-Interface</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: incubator/airavata/services/trunk/gfac-axis2/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/.settings/org.eclipse.jdt.core.prefs?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/airavata/services/trunk/gfac-axis2/.settings/org.eclipse.jdt.core.prefs Sat
Jun 25 15:38:37 2011
@@ -0,0 +1,13 @@
+#Sat Jun 25 11:33:52 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6

Added: incubator/airavata/services/trunk/gfac-axis2/.settings/org.maven.ide.eclipse.prefs
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/.settings/org.maven.ide.eclipse.prefs?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/.settings/org.maven.ide.eclipse.prefs (added)
+++ incubator/airavata/services/trunk/gfac-axis2/.settings/org.maven.ide.eclipse.prefs Sat
Jun 25 15:38:37 2011
@@ -0,0 +1,8 @@
+#Sat Jun 25 11:27:33 EDT 2011
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: incubator/airavata/services/trunk/gfac-axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/pom.xml?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/pom.xml (added)
+++ incubator/airavata/services/trunk/gfac-axis2/pom.xml Sat Jun 25 15:38:37 2011
@@ -0,0 +1,74 @@
+<?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>
+	<groupId>GFac</groupId>
+	<artifactId>GFac-Axis2-Interface</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>GFac-Axis2-Interface</name>
+	<description>Axis2 Interface to the GFac-Core</description>
+	<properties>
+		<org.slf4j.version>1.6.1</org.slf4j.version>
+		<log4j.version>1.2.16</log4j.version>
+		<axis2.version>1.5.4</axis2.version>
+		<axiom.version>1.2.8</axiom.version>
+	</properties>
+	<repositories>
+		<repository>
+			<name>ogce.m2.all</name>
+			<id>ogce.m2.all</id>
+			<url>http://community.ucs.indiana.edu:9090/archiva/repository/ogce.m2.all
+				</url>
+		</repository>
+	</repositories>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.axis2</groupId>
+			<artifactId>axis2</artifactId>
+			<version>${axis2.version}</version>
+		</dependency>	
+		<dependency>
+			<groupId>org.apache.ws.commons.axiom</groupId>
+			<artifactId>axiom-api</artifactId>
+			<version>${axiom.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.ws.commons.axiom</groupId>
+			<artifactId>axiom-impl</artifactId>
+			<version>${axiom.version}</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.axis2</groupId>
+				<artifactId>axis2-aar-maven-plugin</artifactId>
+				<version>${axis2.version}</version>
+				<configuration>
+					<servicesXmlFile>src/main/resources/services.xml</servicesXmlFile>
+				</configuration>
+				<executions>
+					<execution>
+						<id>createAAR</id>
+						<phase>package</phase>
+						<goals>
+							<goal>aar</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Added: incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
(added)
+++ incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
Sat Jun 25 15:38:37 2011
@@ -0,0 +1,146 @@
+/*
+ *
+ * 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.services.gfac.axis2;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.services.gfac.axis2.handlers.AmazonSecurityHandler;
+import org.apache.airavata.services.gfac.axis2.handlers.MyProxySecurityHandler;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.Phase;
+import org.apache.axis2.engine.ServiceLifeCycle;
+import org.ogce.gfac.context.InvocationContext;
+import org.ogce.gfac.context.SecurityContext;
+import org.ogce.gfac.context.impl.ExecutionContextImpl;
+import org.ogce.gfac.context.impl.ParameterContextImpl;
+import org.ogce.gfac.factory.PropertyServiceFactory;
+import org.ogce.gfac.notification.DummyNotification;
+import org.ogce.gfac.services.GenericService;
+
+public class GFacService implements ServiceLifeCycle {
+
+	public static final String SECURITY_CONTEXT = "security_context";
+
+	public static GenericService service;
+
+	public void startUp(ConfigurationContext configctx, AxisService service) {
+		AxisConfiguration config = null;
+		List<Phase> phases = null;
+
+		config = service.getAxisConfiguration();
+		phases = config.getInFlowPhases();
+
+		for (Iterator iterator = phases.iterator(); iterator.hasNext();) {
+			Phase phase = (Phase) iterator.next();
+			if ("Security".equals(phase.getPhaseName())) {
+				phase.addHandler(new MyProxySecurityHandler());
+				phase.addHandler(new AmazonSecurityHandler());
+				return;
+			}
+		}
+
+	}
+
+	public void shutDown(ConfigurationContext configctx, AxisService service) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public OMElement getWSDL(String serviceName) {
+		return null;
+	}
+
+	public OMElement invoke(String serviceName, OMElement input) {
+		
+		OMElement output = null;
+
+		try {
+			InvocationContext ct = new InvocationContext();
+			ct.setExecutionContext(new ExecutionContextImpl());
+
+			ct.getExecutionContext().setNotificationService(new DummyNotification());
+
+			MessageContext msgContext = MessageContext.getCurrentMessageContext();			
+			Map<String, Object> m = (Map)msgContext.getProperty(SECURITY_CONTEXT);
+			for (String key : m.keySet()) {
+				ct.addSecurityContext(key, (SecurityContext)m.get(key));
+			}
+			ct.setServiceName(serviceName);
+
+			// TODO define real parameter passing in SOAP body
+			//handle parameter
+			for (Iterator iterator = input.getChildren(); iterator.hasNext();) {
+				OMElement element = (OMElement) iterator.next();
+				String name = element.getQName().getLocalPart();
+				String type = element.getAttribute(new QName("type")).getAttributeValue();
+				String value = element.getText();
+				
+				ParameterContextImpl x = new ParameterContextImpl();
+				x.addParameter(name, type, value);	
+				ct.addMessageContext("input", x);	
+			}
+
+			if (service == null) {
+				service = new PropertyServiceFactory().createService();
+			}
+			
+			//invoke service
+			service.execute(ct);
+			
+			
+			//TODO also define how output too
+			/*
+			 * Process Output
+			 */
+			OMFactory fac = OMAbstractFactory.getOMFactory();
+	        OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
+	        output = fac.createOMElement("output", omNs);	        
+		
+			org.ogce.gfac.context.MessageContext context = ct.getMessageContext("output");
+			for (Iterator<String> iterator = context.getParameterNames(); iterator.hasNext();)
{
+				String name = iterator.next();
+				OMElement ele = fac.createOMElement(name, omNs);
+				ele.addAttribute("type", context.getParameterType(name), omNs);
+				ele.setText(context.getParameterValue(name).toString());
+				
+				//add output
+				output.addChild(ele);
+			}
+						
+		} catch (Exception e) {
+			e.printStackTrace();
+
+		}
+		return output;
+	}
+}

Added: incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/AmazonSecurityHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/AmazonSecurityHandler.java?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/AmazonSecurityHandler.java
(added)
+++ incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/AmazonSecurityHandler.java
Sat Jun 25 15:38:37 2011
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.services.gfac.axis2.handlers;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.services.gfac.axis2.GFacService;
+import org.apache.airavata.services.gfac.axis2.utils.MessageContextUtil;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.ogce.gfac.context.impl.AmazonSecurityContext;
+
+public class AmazonSecurityHandler extends AbstractHandler {
+
+	private static final String SECURITY_CONTEXT = "security-context";
+	private static final String AMAZON = "amazon-webservices";
+	private static final String ACCESS_KEY_ID = "access-key-id";
+	private static final String SECRET_ACCESS_KEY = "secret-access-key";
+
+	public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+		SOAPEnvelope envelope = msgContext.getEnvelope();
+		SOAPHeader header = envelope.getHeader();
+		Iterator it = header.examineAllHeaderBlocks();
+		while (it.hasNext()) {
+			SOAPHeaderBlock x = (SOAPHeaderBlock) it.next();
+			String elementName = x.getLocalName();
+
+			if (elementName.equals(SECURITY_CONTEXT)) {
+
+				OMElement amazon = x.getFirstChildWithName(new QName(null, AMAZON));
+
+				if (amazon != null) {
+
+					AmazonSecurityContext amazonSecurityContext = new AmazonSecurityContext();
+
+					OMElement accessKey = amazon.getFirstChildWithName(new QName(null, ACCESS_KEY_ID));
+					OMElement secretKey = amazon.getFirstChildWithName(new QName(null, SECRET_ACCESS_KEY));
+
+					amazonSecurityContext.setAccessKey(accessKey.getText());
+					amazonSecurityContext.setSecretKey(secretKey.getText());
+
+					// set to context
+					MessageContextUtil.addContextToProperty(msgContext, GFacService.SECURITY_CONTEXT, "amazon",amazonSecurityContext);
+				}
+			}
+		}
+		return InvocationResponse.CONTINUE;
+	}
+
+}

Added: incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/MyProxySecurityHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/MyProxySecurityHandler.java?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/MyProxySecurityHandler.java
(added)
+++ incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/handlers/MyProxySecurityHandler.java
Sat Jun 25 15:38:37 2011
@@ -0,0 +1,81 @@
+/*
+ *
+ * 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.services.gfac.axis2.handlers;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.services.gfac.axis2.GFacService;
+import org.apache.airavata.services.gfac.axis2.utils.MessageContextUtil;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.ogce.gfac.context.impl.GSISecurityContext;
+
+public class MyProxySecurityHandler extends AbstractHandler {
+
+	private static final String SECURITY_CONTEXT = "security-context";
+	private static final String MYPROXY = "grid-myproxy";
+	private static final String MYPROXY_SERVER = "myproxy-server";
+	private static final String MYPROXY_USERNAME = "username";
+	private static final String MYPROXY_PASSWORD = "password";
+	private static final String MYPROXY_LIFE = "life-time-inhours";
+
+	public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+		SOAPEnvelope envelope = msgContext.getEnvelope();
+		SOAPHeader header = envelope.getHeader();
+		Iterator it = header.examineAllHeaderBlocks();
+		while (it.hasNext()) {
+			SOAPHeaderBlock x = (SOAPHeaderBlock) it.next();
+			String elementName = x.getLocalName();
+
+			if (elementName.equals(SECURITY_CONTEXT)) {
+
+				OMElement myproxy = x.getFirstChildWithName(new QName(null, MYPROXY));
+
+				if (myproxy != null) {
+					GSISecurityContext gsiSecurityContext = new GSISecurityContext();
+
+					OMElement server = myproxy.getFirstChildWithName(new QName(null, MYPROXY_SERVER));
+					OMElement username = myproxy.getFirstChildWithName(new QName(null, MYPROXY_USERNAME));
+					OMElement password = myproxy.getFirstChildWithName(new QName(null, MYPROXY_PASSWORD));
+					OMElement life = myproxy.getFirstChildWithName(new QName(null, MYPROXY_LIFE));
+
+					gsiSecurityContext.setMyproxyServer(server.getText());
+					gsiSecurityContext.setMyproxyUserName(username.getText());
+					gsiSecurityContext.setMyproxyPasswd(password.getText());
+					gsiSecurityContext.setMyproxyLifetime(Integer.parseInt(life.getText()));
+
+					// set to context
+					MessageContextUtil.addContextToProperty(msgContext, GFacService.SECURITY_CONTEXT, "myproxy",
gsiSecurityContext);
+				}
+			}
+		}
+		return InvocationResponse.CONTINUE;
+	}
+
+}

Added: incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/utils/MessageContextUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/utils/MessageContextUtil.java?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/utils/MessageContextUtil.java
(added)
+++ incubator/airavata/services/trunk/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/utils/MessageContextUtil.java
Sat Jun 25 15:38:37 2011
@@ -0,0 +1,51 @@
+/*
+ *
+ * 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.services.gfac.axis2.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.axis2.context.MessageContext;
+
+public class MessageContextUtil {
+
+	
+	/**
+	 * Add object to Map object in message context's property. Create a new list if necessary.

+	 * 
+	 * @param msgContext
+	 * @param propertyString
+	 * @param item
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public static synchronized void addContextToProperty(MessageContext msgContext, String propertyString,
String name, Object item){
+		Map<String, Object> m = null;
+		if(msgContext.getProperty(propertyString) != null){
+			Object obj = msgContext.getProperty(propertyString);
+			m = (Map)obj;
+		}else{
+			m = new HashMap<String, Object>();
+		}		
+		m.put(name, item);
+		msgContext.setProperty(propertyString, m);
+	}
+}

Added: incubator/airavata/services/trunk/gfac-axis2/src/main/resources/services.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/services/trunk/gfac-axis2/src/main/resources/services.xml?rev=1139556&view=auto
==============================================================================
--- incubator/airavata/services/trunk/gfac-axis2/src/main/resources/services.xml (added)
+++ incubator/airavata/services/trunk/gfac-axis2/src/main/resources/services.xml Sat Jun 25
15:38:37 2011
@@ -0,0 +1,23 @@
+<?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. -->
+
+<service name="GfacService">
+	<Description>
+		Gfac contact point
+	</Description>
+	<messageReceivers>
+		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
/>
+		<messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
+	</messageReceivers>
+	<parameter name="ServiceClass" locked="false">org.apache.airavata.services.gfac.axis2.GFacService</parameter>
+</service>



Mime
View raw message