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 2012/09/11 21:18:12 UTC

svn commit: r1383565 - in /incubator/airavata/trunk/modules: distribution/ distribution/src/main/assembly/ distribution/src/main/resources/bin/ distribution/src/main/resources/conf/ registry/ registry/airavata-jpa-registry/src/main/java/org/apache/aira...

Author: lahiru
Date: Tue Sep 11 19:18:11 2012
New Revision: 1383565

URL: http://svn.apache.org/viewvc?rev=1383565&view=rev
Log:
more changes to new registry-service.

Added:
    incubator/airavata/trunk/modules/distribution/src/main/resources/bin/data.sql
      - copied unchanged from r1383485, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
      - copied unchanged from r1383485, incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
Removed:
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
Modified:
    incubator/airavata/trunk/modules/distribution/pom.xml
    incubator/airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml
    incubator/airavata/trunk/modules/distribution/src/main/resources/conf/repository.properties
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
    incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
    incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/utils/DatabaseCreator.java
    incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/resources/services.xml
    incubator/airavata/trunk/modules/registry/pom.xml

Modified: incubator/airavata/trunk/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/distribution/pom.xml?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/distribution/pom.xml (original)
+++ incubator/airavata/trunk/modules/distribution/pom.xml Tue Sep 11 19:18:11 2012
@@ -407,6 +407,12 @@
             <artifactId>airavata-jpa-registry</artifactId>
             <version>${project.version}</version>
         </dependency>
+	<dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-registry-service</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
     </dependencies>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Modified: incubator/airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml (original)
+++ incubator/airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml Tue Sep 11 19:18:11 2012
@@ -132,7 +132,13 @@
                 <include>*sql*</include>
             </includes>
         </fileSet>
-
+	 <fileSet>
+            <directory>../registry/airavata-jpa-registry/src/main/resources</directory>
+            <outputDirectory>standalone-server/bin/database_scripts</outputDirectory>
+            <includes>
+                <include>*sql*</include>
+            </includes>
+        </fileSet>
         <fileSet>
             <directory>src/main/resources/bin</directory>
             <outputDirectory>bin</outputDirectory>
@@ -287,6 +293,7 @@
                 <include>org.apache.airavata:airavata-message-broker:jar</include>
                 <include>org.apache.airavata:airavata-xbaya-gui:jar</include>
                 <include>org.apache.airavata:airavata-gfac-axis2-interface:jar</include>
+		<include>org.apache.airavata:airavata-registry-service:jar</include>
             </includes>
         </dependencySet>
         <dependencySet>

Modified: incubator/airavata/trunk/modules/distribution/src/main/resources/conf/repository.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/distribution/src/main/resources/conf/repository.properties?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/distribution/src/main/resources/conf/repository.properties (original)
+++ incubator/airavata/trunk/modules/distribution/src/main/resources/conf/repository.properties Tue Sep 11 19:18:11 2012
@@ -80,4 +80,6 @@ class.registry.accessor=org.apache.airav
 registry.user=airavata
 registry.password=ljsfousf
 gateway.id=airavata.gateway
+registry.jdbc.driver=com.mysql.jdbc.Driver
+registry.jdbc.url=jdbc:mysql://140.182.193.104:3306/persistent_data_lahiru?user=airavata&password=airavata
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java Tue Sep 11 19:18:11 2012
@@ -139,9 +139,9 @@ public class AiravataJPARegistry extends
     }
     
     private static final String GFAC_URL="gfac.url";
-    private static final String INTERPRETER_URL="gfac.url";
-    private static final String MESSAGE_BOX_URL="gfac.url";
-    private static final String EVENTING_URL="gfac.url";
+    private static final String INTERPRETER_URL="interpreter.url";
+    private static final String MESSAGE_BOX_URL="messagebox.url";
+    private static final String EVENTING_URL="eventing.url";
     
     public List<URI> getGFacURIs() {
     	return retrieveURIsFromConfiguration(GFAC_URL);
@@ -248,11 +248,13 @@ public class AiravataJPARegistry extends
     }
     public void addHostDescriptor(HostDescription descriptor) throws RegistryException {
         GatewayResource gateway = jpa.getGateway();
+        WorkerResource workerResource = jpa.getWorker();
         String hostName = descriptor.getType().getHostName();
 		if (isHostDescriptorExists(hostName)){
         	throw new DescriptorAlreadyExistsException(hostName);
         }
         HostDescriptorResource hostDescriptorResource = gateway.createHostDescriptorResource(hostName);
+        hostDescriptorResource.setUserName(workerResource.getUser());
         hostDescriptorResource.setContent(descriptor.toXML());
         hostDescriptorResource.save();
     }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java Tue Sep 11 19:18:11 2012
@@ -31,11 +31,11 @@ public class Host_Descriptor {
     private String gateway_name;
     private String host_descriptor_xml;
 
-    @ManyToOne(cascade=CascadeType.PERSIST)
+    @ManyToOne(cascade=CascadeType.MERGE)
     @JoinColumn(name = "gateway_name")
     private Gateway gateway;
 
-    @ManyToOne (cascade=CascadeType.PERSIST)
+    @ManyToOne (cascade=CascadeType.MERGE)
     @JoinColumn(name = "updated_user", referencedColumnName = "user_name")
     private Users user;
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml Tue Sep 11 19:18:11 2012
@@ -29,7 +29,7 @@
 		<class>org.apache.airavata.provenance.model.Gram_Data</class>
 		<properties>
 			<property name="openjpa.ConnectionURL"
-				value="jdbc:mysql://gf7.ucs.indiana.edu:3306/workflow_provenance" />
+				value="jdbc:mysql://140.182.193.104:3306/workflow_provenance" />
 			<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
 			<property name="openjpa.ConnectionUserName" value="airavata" />
 			<property name="openjpa.ConnectionPassword" value="airavata" />
@@ -55,7 +55,7 @@
         <class>org.apache.airavata.persistance.registry.jpa.model.Experiment</class>
         <properties>
             <property name="openjpa.ConnectionURL"
-                      value="jdbc:mysql://localhost:3306/persitant_data" />
+                      value="jdbc:mysql://140.182.193.104:3306/persitant_data" />
             <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
             <property name="openjpa.ConnectionUserName" value="airavata" />
             <property name="openjpa.ConnectionPassword" value="airavata" />

Modified: incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/RegistryService.java Tue Sep 11 19:18:11 2012
@@ -29,12 +29,15 @@ import org.apache.axis2.engine.ServiceLi
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
+import java.net.URL;
 import java.sql.Connection;
+import java.util.Properties;
 
 public class RegistryService implements ServiceLifeCycle {
     private static final Logger logger = LoggerFactory.getLogger(RegistryService.class);
 
-    public static final String PERSISTANT_DATA = "persistant_data";
+    public static final String PERSISTANT_DATA = "Configuration";
     private JdbcStorage db;
 
     @Override
@@ -42,14 +45,22 @@ public class RegistryService implements 
         //todo have to read these properties from some configuration
         String jdbcUrl = null;
         String jdbcDriver = null;
-
+        URL resource = this.getClass().getClassLoader().getResource("repository.properties");
+        Properties properties = new Properties();
+        try {
+            properties.load(resource.openStream());
+        } catch (IOException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        jdbcDriver = properties.getProperty("registry.jdbc.driver");
+        jdbcUrl = properties.getProperty("registry.jdbc.url");
         db = new JdbcStorage(10, 50, jdbcUrl, jdbcDriver, true);
 
         Connection conn = null;
         try {
             conn = db.connect();
             if (!DatabaseCreator.isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
-                DatabaseCreator.createMsgBoxDatabase(conn);
+                DatabaseCreator.createRegistryDatabase(conn);
                 logger.info("New Database created for Registry");
             } else {
                 logger.info("Database already created for Registry!");

Modified: incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/utils/DatabaseCreator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/utils/DatabaseCreator.java?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/utils/DatabaseCreator.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/utils/DatabaseCreator.java Tue Sep 11 19:18:11 2012
@@ -66,7 +66,7 @@ public class DatabaseCreator {
      *
      * @throws Exception
      */
-    public static void createMsgBoxDatabase(Connection conn) throws Exception {
+    public static void createRegistryDatabase(Connection conn) throws Exception {
         createDatabase("data", conn);
     }
 

Modified: incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/resources/services.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/resources/services.xml?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/resources/services.xml (original)
+++ incubator/airavata/trunk/modules/registry/airavata-registry-service/src/main/resources/services.xml Tue Sep 11 19:18:11 2012
@@ -10,7 +10,7 @@
 	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="RegistryService" >
+<service name="RegistryService" class="org.apache.airavata.registry.services.RegistryService" >
 	<Description>
 		Provide Simple Service for Testing Purpose including addition, subtraction, multiplication, array-generator
 	</Description>

Modified: incubator/airavata/trunk/modules/registry/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/pom.xml?rev=1383565&r1=1383564&r2=1383565&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/pom.xml (original)
+++ incubator/airavata/trunk/modules/registry/pom.xml Tue Sep 11 19:18:11 2012
@@ -30,6 +30,7 @@
             </activation>
             <modules>
                 <module>airavata-jpa-registry</module>
+                <module>airavata-registry-service</module>
             </modules>
         </profile>
     </profiles>