You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2011/08/17 14:46:47 UTC
svn commit: r1158668 - in
/incubator/airavata/trunk/modules/gfac-axis2/src/main:
java/org/apache/airavata/services/gfac/axis2/GFacService.java
java/org/apache/airavata/services/gfac/axis2/reciever/GFacMessageReciever.java
resources/repository.properties
Author: lahiru
Date: Wed Aug 17 12:46:46 2011
New Revision: 1158668
URL: http://svn.apache.org/viewvc?rev=1158668&view=rev
Log:
integrating with JCRRegistry implementation.
Modified:
incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/reciever/GFacMessageReciever.java
incubator/airavata/trunk/modules/gfac-axis2/src/main/resources/repository.properties
Modified: incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java?rev=1158668&r1=1158667&r2=1158668&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java (original)
+++ incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java Wed Aug 17 12:46:46 2011
@@ -70,9 +70,8 @@ public class GFacService implements org.
RepositoryFactory repositoryFactory = (RepositoryFactory) c.newInstance();
Repository repository = repositoryFactory.getRepository(map);
Credentials credentials = new SimpleCredentials(map.get("userName"), (map.get("password")).toCharArray());
- Session session = repository.login(credentials);
+ context.setProperty("repository",repository);
context.setProperty("credentials",credentials);
- context.setProperty("repositorySession",session);
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
Modified: incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/reciever/GFacMessageReciever.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/reciever/GFacMessageReciever.java?rev=1158668&r1=1158667&r2=1158668&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/reciever/GFacMessageReciever.java (original)
+++ incubator/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/reciever/GFacMessageReciever.java Wed Aug 17 12:46:46 2011
@@ -21,12 +21,15 @@ package org.apache.airavata.services.gfa
*
*/
+import com.sun.tools.doclets.internal.toolkit.Configuration;
+import org.apache.airavata.core.gfac.api.impl.JCRRegistry;
import org.apache.airavata.core.gfac.context.InvocationContext;
import org.apache.airavata.core.gfac.context.SecurityContext;
import org.apache.airavata.core.gfac.context.impl.ExecutionContextImpl;
import org.apache.airavata.core.gfac.context.impl.ParameterContextImpl;
import org.apache.airavata.core.gfac.factory.PropertyServiceFactory;
import org.apache.airavata.core.gfac.notification.DummyNotification;
+import org.apache.airavata.core.gfac.registry.RegistryService;
import org.apache.airavata.core.gfac.services.GenericService;
import org.apache.airavata.core.gfac.type.parameter.StringParameter;
import org.apache.airavata.services.gfac.axis2.utils.GFacServiceOperations;
@@ -47,9 +50,7 @@ import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Session;
+import javax.jcr.*;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
@@ -86,13 +87,14 @@ public class GFacMessageReciever impleme
public void processInvokeOperation(MessageContext messageContext) {
MessageContext response = null;
String serviceName = getOriginalServiceName(messageContext);
+ try {
+ ConfigurationContext context = messageContext.getConfigurationContext();
OMElement input = messageContext.getEnvelope().getBody().getFirstChildWithName(new QName("input"));
- OMElement output = invokeApplication(serviceName, input);
+ OMElement output = invokeApplication(serviceName, input,context);
SOAPFactory sf = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope responseEnv = sf.createSOAPEnvelope();
sf.createSOAPBody(responseEnv);
responseEnv.getBody().addChild(output);
- try {
response = MessageContextBuilder.createOutMessageContext(messageContext);
response.setEnvelope(responseEnv);
response.getOperationContext().addMessageContext(response);
@@ -102,35 +104,27 @@ public class GFacMessageReciever impleme
}
}
- private OMElement invokeApplication(String serviceName, OMElement input) {
+ private OMElement invokeApplication(String serviceName, OMElement input,ConfigurationContext context) {
OMElement output = null;
try {
InvocationContext ct = new InvocationContext();
+ Repository repository = (Repository)context.getProperty("repository");
+ Credentials credentials = (Credentials)context.getProperty("credentials");
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);
+ ct.getExecutionContext().setRegistryService(new JCRRegistry(repository,credentials));
+ ParameterContextImpl x = new ParameterContextImpl();
// 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();
-
StringParameter value = new StringParameter();
value.parseStringVal(element.getText());
-
- ParameterContextImpl x = new ParameterContextImpl();
x.addParameter(name, value);
- ct.addMessageContext("input", x);
}
-
+ ct.addMessageContext("input", x);
if (service == null) {
service = new PropertyServiceFactory().createService();
}
@@ -147,12 +141,12 @@ public class GFacMessageReciever impleme
OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
output = fac.createOMElement("output", omNs);
- ParameterContextImpl context = (ParameterContextImpl) ct.getMessageContext("output");
- for (Iterator<String> iterator = context.getParameterNames(); iterator.hasNext(); ) {
+ ParameterContextImpl paramContext = (ParameterContextImpl) ct.getMessageContext("output");
+ for (Iterator<String> iterator = paramContext.getParameterNames(); iterator.hasNext(); ) {
String name = iterator.next();
OMElement ele = fac.createOMElement(name, omNs);
- ele.addAttribute("type", context.getParameterValue(name).getType().toString(), omNs);
- ele.setText(context.getParameterValue(name).toString());
+ ele.addAttribute("type", paramContext.getParameterValue(name).getType().toString(), omNs);
+ ele.setText(paramContext.getParameterValue(name).toString());
output.addChild(ele);
}
@@ -169,7 +163,8 @@ public class GFacMessageReciever impleme
ConfigurationContext context = messageContext.getConfigurationContext();
//todo this logic has to change based on the logic we are storing data into repository
try {
- Session session = (Session) context.getProperty("repositorySession");
+ Credentials credentials = (Credentials) context.getProperty("credentials");
+ Session session = ((Repository)context.getProperty("repository")).login(credentials);
Node node = session.getRootNode().getNode("wsdls").getNode(serviceName);
Property propertyContent = node.getProperty("content");
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader
Modified: incubator/airavata/trunk/modules/gfac-axis2/src/main/resources/repository.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-axis2/src/main/resources/repository.properties?rev=1158668&r1=1158667&r2=1158668&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-axis2/src/main/resources/repository.properties (original)
+++ incubator/airavata/trunk/modules/gfac-axis2/src/main/resources/repository.properties Wed Aug 17 12:46:46 2011
@@ -19,8 +19,6 @@
#
#
-ssl.hostcertsKeyFile=/home/ptangcha/ogce-workspace/sgfac/target/dist-bin/conf/ogce_services_key.pem
-ssl.trustedCertsFile=/home/ptangcha/ogce-workspace/sgfac/target/dist-bin/certificates
repository.factory=org.wso2.carbon.registry.jcr.RegistryRepositoryFactory
registryUrl=https://localhost:9443/registry
certPath=/Users/lahirugunathilake/work/wso2greg-4.0.0/repository/resources/security/client-truststore.jks