Return-Path: X-Original-To: apmail-incubator-airavata-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-airavata-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7274EDF9F for ; Sun, 9 Sep 2012 23:17:10 +0000 (UTC) Received: (qmail 71255 invoked by uid 500); 9 Sep 2012 23:17:10 -0000 Delivered-To: apmail-incubator-airavata-commits-archive@incubator.apache.org Received: (qmail 71219 invoked by uid 500); 9 Sep 2012 23:17:10 -0000 Mailing-List: contact airavata-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: airavata-dev@incubator.apache.org Delivered-To: mailing list airavata-commits@incubator.apache.org Received: (qmail 71211 invoked by uid 99); 9 Sep 2012 23:17:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Sep 2012 23:17:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Sep 2012 23:17:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4E7762388900; Sun, 9 Sep 2012 23:16:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1382605 - in /incubator/airavata/trunk/modules/workflow-model/workflow-model-core: pom.xml src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java Date: Sun, 09 Sep 2012 23:16:23 -0000 To: airavata-commits@incubator.apache.org From: lahiru@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120909231623.4E7762388900@eris.apache.org> Author: lahiru Date: Sun Sep 9 23:16:22 2012 New Revision: 1382605 URL: http://svn.apache.org/viewvc?rev=1382605&view=rev Log: committing some refactoring code. Modified: incubator/airavata/trunk/modules/workflow-model/workflow-model-core/pom.xml incubator/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java Modified: incubator/airavata/trunk/modules/workflow-model/workflow-model-core/pom.xml URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/workflow-model-core/pom.xml?rev=1382605&r1=1382604&r2=1382605&view=diff ============================================================================== --- incubator/airavata/trunk/modules/workflow-model/workflow-model-core/pom.xml (original) +++ incubator/airavata/trunk/modules/workflow-model/workflow-model-core/pom.xml Sun Sep 9 23:16:22 2012 @@ -302,5 +302,10 @@ airavata-common-registry-api ${project.version} + + org.apache.airavata + airavata-jpa-registry + ${project.version} + Modified: incubator/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java?rev=1382605&r1=1382604&r2=1382605&view=diff ============================================================================== --- incubator/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java (original) +++ incubator/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java Sun Sep 9 23:16:22 2012 @@ -21,18 +21,31 @@ package org.apache.airavata.workflow.model.component.registry; +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; import java.net.URI; +import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Properties; import javax.jcr.RepositoryException; +import org.apache.airavata.common.exception.AiravataConfigurationException; import org.apache.airavata.common.registry.api.exception.RegistryException; +import org.apache.airavata.common.registry.api.user.User; import org.apache.airavata.common.registry.api.user.UserManager; import org.apache.airavata.commons.gfac.type.ServiceDescription; +import org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry; import org.apache.airavata.registry.api.AiravataRegistry; +import org.apache.airavata.registry.api.AiravataRegistry2; +import org.apache.airavata.registry.api.AiravataRegistryFactory; +import org.apache.airavata.registry.api.AiravataUser; +import org.apache.airavata.registry.api.Gateway; import org.apache.airavata.registry.api.impl.AiravataJCRRegistry; +import org.apache.airavata.registry.api.util.WebServiceUtil; import org.apache.airavata.workflow.model.component.ComponentReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,16 +54,32 @@ public class JCRComponentRegistry extend private static final Logger log = LoggerFactory.getLogger(JCRComponentRegistry.class); private static final String NAME = "Application Services"; + public static final String REPOSITORY_PROPERTIES = "repository.properties"; + public static final String GATEWAY_ID = "gateway.id"; + public static final String REGISTRY_USER = "registry.user"; - private AiravataJCRRegistry registry; + private AiravataRegistry2 registry; - public JCRComponentRegistry(URI url, String username, String password) throws RegistryException { + public JCRComponentRegistry(String username, String password) throws RegistryException { HashMap map = new HashMap(); - map.put("org.apache.jackrabbit.repository.uri", url.toString()); - - this.registry = new AiravataJCRRegistry(url, - "org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory", - username, password, map); + URL configURL = this.getClass().getClassLoader().getResource(REPOSITORY_PROPERTIES); + Properties properties = new Properties(); + try { + properties.load(configURL.openStream()); + if(properties.get(REGISTRY_USER) != null){ + username = (String)properties.get(REGISTRY_USER); + } + } catch (MalformedURLException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } catch (IOException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + try { + this.registry = AiravataRegistryFactory.getRegistry(new Gateway((String)properties.get(GATEWAY_ID)), + new AiravataUser(username)); + } catch (AiravataConfigurationException e) { + log.error("Error initializing AiravataRegistry2"); + } } @@ -76,10 +105,11 @@ public class JCRComponentRegistry extend public List getComponentReferenceList() { List tree = new ArrayList(); try { - List services = this.registry.searchServiceDescription(""); + List services = this.registry.getServiceDescriptors(); for (ServiceDescription serviceDescription : services) { String serviceName = serviceDescription.getType().getName(); - JCRComponentReference jcr = new JCRComponentReference(serviceName, registry.getWSDL(serviceName)); + JCRComponentReference jcr = new JCRComponentReference(serviceName, + WebServiceUtil.getWSDL(serviceDescription)); tree.add(jcr); } } catch (RegistryException e) { @@ -99,10 +129,6 @@ public class JCRComponentRegistry extend return NAME; } - public UserManager getUserManager() { - return registry.getUserManager(); - } - // public String saveDeploymentDescription(String service, String host, ApplicationDeploymentDescription app) { // // deploy the service on host // registry.deployServiceOnHost(service, host); @@ -111,7 +137,7 @@ public class JCRComponentRegistry extend // return registry.saveDeploymentDescription(service, host, app); // } - public AiravataRegistry getRegistry() { + public AiravataRegistry2 getRegistry() { return registry; } } \ No newline at end of file