You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/06/27 10:55:15 UTC

git commit: adding the resource interface

Repository: airavata
Updated Branches:
  refs/heads/master ffb186f0a -> bed07458d


adding the resource interface


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/bed07458
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/bed07458
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/bed07458

Branch: refs/heads/master
Commit: bed07458dd1b9364d2b838d523926fa1112f03c8
Parents: ffb186f
Author: Sachith Withana <sa...@apache.org>
Authored: Fri Jun 27 14:27:05 2014 +0530
Committer: Sachith Withana <sa...@apache.org>
Committed: Fri Jun 27 14:27:05 2014 +0530

----------------------------------------------------------------------
 modules/app-catalog/app-catalog-cpi/pom.xml     | 111 +++++++++++++++++++
 .../appcatalog/cpi/AppCatalogException.java     |  17 +++
 modules/app-catalog/app-catalog-data/pom.xml    |  10 ++
 .../catalog/data/resources/Resource.java        |  68 ++++++++++++
 modules/app-catalog/pom.xml                     |   1 +
 5 files changed, 207 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/bed07458/modules/app-catalog/app-catalog-cpi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/pom.xml b/modules/app-catalog/app-catalog-cpi/pom.xml
new file mode 100644
index 0000000..2cf5cb5
--- /dev/null
+++ b/modules/app-catalog/app-catalog-cpi/pom.xml
@@ -0,0 +1,111 @@
+<?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/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>app-catalog</artifactId>
+        <version>0.13-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>app-catalog-cpi</artifactId>
+    <packaging>jar</packaging>
+    <name>Airavata Application Catalog CPI</name>
+    <url>http://airavata.apache.org/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-data-models</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- Test -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa-all</artifactId>
+            <version>2.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbyclient</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbynet</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbytools</artifactId>
+            <version>${derby.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>${surefire.version}</version>
+                <inherited>true</inherited>
+                <configuration>
+                    <failIfNoTests>false</failIfNoTests>
+                    <skipTests>${skipTests}</skipTests>
+                    <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+                    <!-- making sure that the sure-fire plugin doesn't run the integration tests-->
+                    <!-- Integration tests are run using the fail-safe plugin in the module pom-->
+                    <excludes>
+                        <exclude>**/TaskDetailResourceTest.java</exclude>
+                        <exclude>**/WorkflowNodeDetailResourceTest.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/bed07458/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java
new file mode 100644
index 0000000..3a0a01d
--- /dev/null
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalogException.java
@@ -0,0 +1,17 @@
+package org.airavata.appcatalog.cpi;
+
+public class AppCatalogException extends Exception{
+    private static final long serialVersionUID = -2849422320139467602L;
+
+    public AppCatalogException(Throwable e) {
+        super(e);
+    }
+
+    public AppCatalogException(String message) {
+        super(message, null);
+    }
+
+    public AppCatalogException(String message, Throwable e) {
+        super(message, e);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/bed07458/modules/app-catalog/app-catalog-data/pom.xml
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/pom.xml b/modules/app-catalog/app-catalog-data/pom.xml
index c21d3a9..43adbb4 100644
--- a/modules/app-catalog/app-catalog-data/pom.xml
+++ b/modules/app-catalog/app-catalog-data/pom.xml
@@ -38,6 +38,16 @@
             <artifactId>airavata-common-utils</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-common-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>app-catalog-cpi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <!-- Test -->
         <dependency>
             <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/bed07458/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
new file mode 100644
index 0000000..a25933e
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/Resource.java
@@ -0,0 +1,68 @@
+/*
+*
+* 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+
+import java.util.List;
+
+public interface Resource {
+
+        /**
+         * This method will create associate resource objects for the given resource type.
+         * @return associated resource
+         */
+        Resource create() throws AppCatalogException;
+
+        /**
+         * This method will remove the given resource from the database
+         * @param name resource name
+         */
+        void remove(Object name) throws AppCatalogException;
+
+        /**
+         *  This method will return the given resource from the database
+         * @param name resource name
+         * @return associate resource
+         */
+        Resource get(Object name) throws AppCatalogException;
+
+        /**
+         * This method will list all the child resources for the given resource type
+         * @return list of child resources of the given child resource type
+         */
+        List<Resource> get() throws AppCatalogException;
+
+        /**
+         * This method will save the resource to the database.
+         */
+        void save() throws AppCatalogException;
+
+        /**
+         * This method will check whether an entry from the given resource type and resource name
+         * exists in the database
+         * @param name resource name
+         * @return whether the entry exists in the database or not
+         */
+        boolean isExists(Object name) throws AppCatalogException;
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/bed07458/modules/app-catalog/pom.xml
----------------------------------------------------------------------
diff --git a/modules/app-catalog/pom.xml b/modules/app-catalog/pom.xml
index 1f997c9..400bcb8 100644
--- a/modules/app-catalog/pom.xml
+++ b/modules/app-catalog/pom.xml
@@ -31,6 +31,7 @@
             </activation>
             <modules>
                 <module>app-catalog-data</module>
+                <module>app-catalog-cpi</module>
                 <!--<module>app-catalog-jpa</module>-->
             </modules>
         </profile>