Author: samindaw
Date: Wed Sep  4 17:06:07 2013
New Revision: 1520068

URL: http://svn.apache.org/r1520068
Log:
checking if the gateway is registered in airavata

Added:
    
airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/GatewayNotRegisteredException.java
   (with props)
Modified:
    
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java

Modified: 
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/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1520068&r1=1520067&r2=1520068&view=diff
==============================================================================
--- 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
 (original)
+++ 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
 Wed Sep  4 17:06:07 2013
@@ -77,6 +77,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.UserWorkflowRegistry;
 import org.apache.airavata.registry.api.WorkspaceProject;
 import 
org.apache.airavata.registry.api.exception.AiravataRegistryUninitializedException;
+import 
org.apache.airavata.registry.api.exception.GatewayNotRegisteredException;
 import 
org.apache.airavata.registry.api.exception.RegistryAPIVersionIncompatibleException;
 import 
org.apache.airavata.registry.api.exception.RegistryAccessorInstantiateException;
 import 
org.apache.airavata.registry.api.exception.RegistryAccessorNotFoundException;
@@ -150,6 +151,9 @@ public class AiravataJPARegistry extends
     
     @Override
     protected void initialize() throws RegistryException {
+       if (!ResourceUtils.isGatewayExist(getGateway().getGatewayName())){
+               throw new 
GatewayNotRegisteredException(getGateway().getGatewayName());
+       }
        jpa = new JPAResourceAccessor(this);
        //TODO check if the db connections are proper & accessible & the 
relevant db/tables are
        //present

Added: 
airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/GatewayNotRegisteredException.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/GatewayNotRegisteredException.java?rev=1520068&view=auto
==============================================================================
--- 
airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/GatewayNotRegisteredException.java
 (added)
+++ 
airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/GatewayNotRegisteredException.java
 Wed Sep  4 17:06:07 2013
@@ -0,0 +1,32 @@
+/*
+ *
+ * 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.airavata.registry.api.exception;
+
+public class GatewayNotRegisteredException extends RegistryException {
+
+       private static final long serialVersionUID = -139586125325993500L;
+
+       public GatewayNotRegisteredException(String gatewayName) {
+               super("The gateway id '"+gatewayName+"' is not registered 
within Airavata");
+       }
+
+}

Propchange: 
airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/GatewayNotRegisteredException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to