You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by he...@apache.org on 2012/02/23 17:31:07 UTC
svn commit: r1292844 - in
/incubator/airavata/trunk/modules/registry-migrator: ./ 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/migrator/ src/main/java/or...
Author: heshan
Date: Thu Feb 23 16:31:06 2012
New Revision: 1292844
URL: http://svn.apache.org/viewvc?rev=1292844&view=rev
Log:
AIRAVATA-309 Adding the initial version for the registry migration tool.
Added:
incubator/airavata/trunk/modules/registry-migrator/
incubator/airavata/trunk/modules/registry-migrator/pom.xml
incubator/airavata/trunk/modules/registry-migrator/src/
incubator/airavata/trunk/modules/registry-migrator/src/main/
incubator/airavata/trunk/modules/registry-migrator/src/main/java/
incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/
incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/
incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/
incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/
incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/
incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/XRegistryMigrate.java
incubator/airavata/trunk/modules/registry-migrator/src/main/resources/
incubator/airavata/trunk/modules/registry-migrator/src/main/resources/application.xml
incubator/airavata/trunk/modules/registry-migrator/src/main/resources/host.xml
incubator/airavata/trunk/modules/registry-migrator/src/main/resources/service.xml
incubator/airavata/trunk/modules/registry-migrator/src/main/resources/xregistry.properties
Added: incubator/airavata/trunk/modules/registry-migrator/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/pom.xml?rev=1292844&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/pom.xml (added)
+++ incubator/airavata/trunk/modules/registry-migrator/pom.xml Thu Feb 23 16:31:06 2012
@@ -0,0 +1,97 @@
+<?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">
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>registry-migrator</artifactId>
+ <name>Registry-Migrator</name>
+ <description>Migrate descriptors from XRegistry to Airavata Registry</description>
+
+ <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>xregistry</groupId>
+ <artifactId>xregistry-client</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>xregistry</groupId>
+ <artifactId>xregistry_generated</artifactId>
+ <version>0.8.3</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>messagebroker</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>registry-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>workflowtracking</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>gfac</groupId>
+ <artifactId>gfac-schema-utils</artifactId>
+ <version>0.4.4</version>
+ </dependency>
+
+ <!-- JCR Support -->
+ <!-- TODO need clean up -->
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>gfac-schema-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- Set working directory to test-class directory -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+ </configuration>
+ <version>${surefire.version}</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/XRegistryMigrate.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/XRegistryMigrate.java?rev=1292844&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/XRegistryMigrate.java (added)
+++ incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/XRegistryMigrate.java Thu Feb 23 16:31:06 2012
@@ -0,0 +1,160 @@
+package org.apache.airavata.migrator.registry;
+
+import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.registry.api.impl.AiravataJCRRegistry;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.StringParameterType;
+import org.apache.xmlbeans.XmlException;
+import org.ogce.schemas.gfac.beans.ApplicationBean;
+import org.ogce.schemas.gfac.beans.HostBean;
+import org.ogce.schemas.gfac.beans.ServiceBean;
+import org.ogce.xregistry.client.XRegistryClient;
+import org.ogce.xregistry.client.XRegistryClientUtil;
+import org.ogce.xregistry.utils.XRegistryClientException;
+import xregistry.generated.FindAppDescResponseDocument;
+import xregistry.generated.HostDescData;
+import xregistry.generated.ServiceDescData;
+
+import javax.jcr.RepositoryException;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class XRegistryMigrate {
+ private static String propertyfile = "xregistry.properties";
+
+ public static void main(String[] args) throws XRegistryClientException {
+ /* Create database */
+ Map<String,String> config = new HashMap<String,String>();
+ config.put("org.apache.jackrabbit.repository.home","target");
+ AiravataJCRRegistry jcrRegistry = null;
+ try {
+ jcrRegistry = new AiravataJCRRegistry(null,
+ "org.apache.jackrabbit.core.RepositoryFactoryImpl", "admin",
+ "admin", config);
+ } catch (RepositoryException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+ XRegistryClient client = XRegistryClientUtil.CreateGSISecureRegistryInstance("xregistry.properties");
+
+ HostDescData[] hostDescs = client.findHosts("");
+ Map<QName, HostDescData> val = new HashMap<QName, HostDescData>();
+ for (HostDescData hostDesc : hostDescs) {
+ val.put(hostDesc.getName(), hostDesc);
+ String hostDescStr = client.getHostDesc(hostDesc.getName().getLocalPart());
+ System.out.println(hostDescStr);
+ HostBean hostBean = null;
+ try {
+ hostBean = org.ogce.schemas.gfac.beans.utils.HostUtils.simpleHostBeanRequest(hostDescStr);
+ } catch (XmlException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+ if(hostBean != null){
+// hostBean.
+ }
+
+ }
+
+ FindAppDescResponseDocument.FindAppDescResponse.AppData[] appDatas = client.findAppDesc("");
+ Map<QName, FindAppDescResponseDocument.FindAppDescResponse.AppData> val2 = new HashMap<QName, FindAppDescResponseDocument.FindAppDescResponse.AppData>();
+ for (FindAppDescResponseDocument.FindAppDescResponse.AppData appDesc : appDatas) {
+ val2.put(appDesc.getName(), appDesc);
+ String appDescStr = client.getAppDesc(appDesc.getName().toString(),appDesc.getHostName());
+ System.out.println(appDescStr);
+ ApplicationBean appBean = null;
+ try {
+ appBean = org.ogce.schemas.gfac.beans.utils.ApplicationUtils.simpleApplicationBeanRequest(appDescStr);
+ } catch (XmlException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+
+ ServiceDescData[] serviceDescDatas = client.findServiceDesc("");
+ Map<QName, ServiceDescData> val3 = new HashMap<QName, ServiceDescData>();
+ for (ServiceDescData serviceDesc : serviceDescDatas) {
+ val3.put(serviceDesc.getName(), serviceDesc);
+ String serviceDescStr = client.getServiceDesc(serviceDesc.getName());
+ System.out.println(serviceDescStr);
+ ServiceBean serviceBean = null;
+ try {
+ serviceBean = org.ogce.schemas.gfac.beans.utils.ServiceUtils.serviceBeanRequest(serviceDescStr);
+ } catch (XmlException 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.
+ }
+ }
+
+ /*
+ * Save to registry
+ */
+ /*jcrRegistry.saveHostDescription(host);
+ jcrRegistry.saveDeploymentDescription(serv.getType().getName(), host
+ .getType().getHostName(), appDesc);
+ jcrRegistry.saveServiceDescription(serv);
+ jcrRegistry.deployServiceOnHost(serv.getType().getName(), host
+ .getType().getHostName());*/
+
+ }
+
+ private HostDescription createHostDescription(String hostName, String hostAddress) {
+ HostDescription host = new HostDescription();
+ host.getType().setHostName(hostName);
+ host.getType().setHostAddress(hostAddress);
+ return host;
+ }
+
+ private ServiceDescription createServiceDescription() {
+ ServiceDescription serv = new ServiceDescription();
+ serv.getType().setName("SimpleEcho");
+
+ List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+ InputParameterType input = InputParameterType.Factory.newInstance();
+ input.setParameterName("echo_input");
+ input.setParameterType(StringParameterType.Factory.newInstance());
+ inputList.add(input);
+ InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
+ .size()]);
+
+ List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+ OutputParameterType output = OutputParameterType.Factory.newInstance();
+ output.setParameterName("echo_output");
+ output.setParameterType(StringParameterType.Factory.newInstance());
+ outputList.add(output);
+ OutputParameterType[] outputParamList = outputList
+ .toArray(new OutputParameterType[outputList.size()]);
+
+ serv.getType().setInputParametersArray(inputParamList);
+ serv.getType().setOutputParametersArray(outputParamList);
+ return serv;
+ }
+
+ private ApplicationDeploymentDescription createAppDeploymentDescription() {
+ ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription();
+ ApplicationDeploymentDescriptionType app = appDesc.getType();
+ ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
+ .newInstance();
+ name.setStringValue("EchoLocal");
+ app.setApplicationName(name);
+ app.setExecutableLocation("/bin/echo");
+ app.setScratchWorkingDirectory("/tmp");
+ app.setStaticWorkingDirectory("/tmp");
+ app.setInputDataDirectory("/tmp/input");
+ app.setOutputDataDirectory("/tmp/output");
+ app.setStandardOutput("/tmp/echo.stdout");
+ app.setStandardError("/tmp/echo.stdout");
+ return appDesc;
+ }
+
+}
+
Added: incubator/airavata/trunk/modules/registry-migrator/src/main/resources/application.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/src/main/resources/application.xml?rev=1292844&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/src/main/resources/application.xml (added)
+++ incubator/airavata/trunk/modules/registry-migrator/src/main/resources/application.xml Thu Feb 23 16:31:06 2012
@@ -0,0 +1,22 @@
+<gfac:ApplicationDescription xmlns:gfac="http://www.extreme.indiana.edu/namespaces/2004/01/gFac">
+ <gfac:applicationName targetNamespace="http://www.extreme.indiana.edu/namespaces/2004/01/gFac">Localservice
+ </gfac:applicationName>
+ <gfac:jobType>single</gfac:jobType>
+ <gfac:project>
+ <gfac:projectName/>
+ </gfac:project>
+ <gfac:queue>
+ <gfac:queueName/>
+ </gfac:queue>
+ <gfac:maxWallTime>0</gfac:maxWallTime>
+ <gfac:count>0</gfac:count>
+ <gfac:deploymentDescription>
+ <gfac:hostName>dropbox.ucs.indiana.edu</gfac:hostName>
+ <gfac:executable>/home/simplegrid/runscript/runservice.sh</gfac:executable>
+ <gfac:leadNameListFile/>
+ <gfac:workDir>/tmp</gfac:workDir>
+ <gfac:tmpDir>/tmp</gfac:tmpDir>
+ </gfac:deploymentDescription>
+ <gfac:hostCount>0</gfac:hostCount>
+ <gfac:minMemory>0</gfac:minMemory>
+</gfac:ApplicationDescription>
\ No newline at end of file
Added: incubator/airavata/trunk/modules/registry-migrator/src/main/resources/host.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/src/main/resources/host.xml?rev=1292844&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/src/main/resources/host.xml (added)
+++ incubator/airavata/trunk/modules/registry-migrator/src/main/resources/host.xml Thu Feb 23 16:31:06 2012
@@ -0,0 +1,16 @@
+<gfac:HostDescription xmlns:gfac="http://www.extreme.indiana.edu/namespaces/2004/01/gFac">
+ <gfac:hostName>dropbox.ucs.indiana.edu</gfac:hostName>
+ <gfac:hostConfiguration>
+ <gfac:gFacPath>/home/simplegrid/ogce-all-rc1/gfac/target/dist-bin</gfac:gFacPath>
+ <gfac:tmpDir>/tmp</gfac:tmpDir>
+ <gfac:portRange>
+ <gfac:start>12000</gfac:start>
+ <gfac:end>12500</gfac:end>
+ </gfac:portRange>
+ <gfac:java>
+ <gfac:name>jdk1.5</gfac:name>
+ <gfac:version>jdk1.5</gfac:version>
+ <gfac:home>/usr/java/jdk1.6.0_26/</gfac:home>
+ </gfac:java>
+ </gfac:hostConfiguration>
+</gfac:HostDescription>
\ No newline at end of file
Added: incubator/airavata/trunk/modules/registry-migrator/src/main/resources/service.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/src/main/resources/service.xml?rev=1292844&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/src/main/resources/service.xml (added)
+++ incubator/airavata/trunk/modules/registry-migrator/src/main/resources/service.xml Thu Feb 23 16:31:06 2012
@@ -0,0 +1,31 @@
+<gfac:ServiceMap xmlns:gfac="http://www.extreme.indiana.edu/namespaces/2004/01/gFac">
+ <gfac:service>
+ <gfac:serviceName targetNamespace="http://www.extreme.indiana.edu/namespaces/2004/01/gFac">LocalRun
+ </gfac:serviceName>
+ </gfac:service>
+ <gfac:portType>
+ <gfac:method>
+ <gfac:methodName>Run</gfac:methodName>
+ <gfac:methodDescription>run</gfac:methodDescription>
+ <gfac:application paramValuesOnly="true">
+ <gfac:applicationName targetNamespace="http://www.extreme.indiana.edu/namespaces/2004/01/gFac">
+ Localservice
+ </gfac:applicationName>
+ <gfac:applicationDescription>run</gfac:applicationDescription>
+ </gfac:application>
+ <gfac:inputParameter>
+ <gfac:parameterName>input</gfac:parameterName>
+ <gfac:parameterDescription/>
+ <gfac:parameterType>Integer</gfac:parameterType>
+ </gfac:inputParameter>
+ <gfac:outputParameter>
+ <gfac:parameterName>restart</gfac:parameterName>
+ <gfac:parameterDescription/>
+ <gfac:parameterType>Integer</gfac:parameterType>
+ </gfac:outputParameter>
+ </gfac:method>
+ </gfac:portType>
+ <gfac:lifeTime>
+ <gfac:notAfterInactiveMinutes>15</gfac:notAfterInactiveMinutes>
+ </gfac:lifeTime>
+</gfac:ServiceMap>
\ No newline at end of file
Added: incubator/airavata/trunk/modules/registry-migrator/src/main/resources/xregistry.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/src/main/resources/xregistry.properties?rev=1292844&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/src/main/resources/xregistry.properties (added)
+++ incubator/airavata/trunk/modules/registry-migrator/src/main/resources/xregistry.properties Thu Feb 23 16:31:06 2012
@@ -0,0 +1,7 @@
+registryURL=
+ssl.trustedCertsFile=
+ssl.hostcertsKeyFile=
+myproxyServer=
+myproxyUser=
+myproxyPass=
+myproxyLifetime=
\ No newline at end of file