You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2013/08/21 18:28:11 UTC

git commit: KNOX-96 Fail deployment on exceptions within initialize, contribute, finalize

Updated Branches:
  refs/heads/master e764c5e1a -> 0f763c6bb


KNOX-96 Fail deployment on exceptions within initialize, contribute, finalize

Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/0f763c6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/0f763c6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/0f763c6b

Branch: refs/heads/master
Commit: 0f763c6bb1be3547d4157865df4abb2ae6514318
Parents: e764c5e
Author: Larry McCay <lm...@hortonworks.com>
Authored: Wed Aug 21 12:18:34 2013 -0400
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Wed Aug 21 12:18:34 2013 -0400

----------------------------------------------------------------------
 .../gateway/deploy/DeploymentException.java     | 27 ++++++++++++++++++++
 .../gateway/deploy/DeploymentFactory.java       |  7 +++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/0f763c6b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentException.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentException.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentException.java
new file mode 100644
index 0000000..ce7a132
--- /dev/null
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentException.java
@@ -0,0 +1,27 @@
+/**
+ * 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.hadoop.gateway.deploy;
+
+@SuppressWarnings("serial")
+public class DeploymentException extends RuntimeException {
+
+  public DeploymentException(String message, Exception e) {
+    super(message, e);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/0f763c6b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java
index ce2f7af..f9371ce 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/DeploymentFactory.java
@@ -186,6 +186,7 @@ public abstract class DeploymentFactory {
           contributor.initializeContribution( context );
         } catch( Exception e ) {
           log.failedToInitializeContribution( e );
+          throw new DeploymentException("Failed to initialize contribution.", e);
         }
       }
     }
@@ -198,6 +199,7 @@ public abstract class DeploymentFactory {
           contributor.initializeContribution( context );
         } catch( Exception e ) {
           log.failedToInitializeContribution( e );
+          throw new DeploymentException("Failed to initialize contribution.", e);
         }
       }
     }
@@ -219,6 +221,7 @@ public abstract class DeploymentFactory {
         } catch (Exception e) {
           // Maybe it makes sense to throw exception
           log.failedToInjectService( serviceName, e );
+          throw new DeploymentException("Failed to inject service.", e);
         }
       }
     }
@@ -237,6 +240,7 @@ public abstract class DeploymentFactory {
         } catch( Exception e ) {
           // Maybe it makes sense to throw exception
           log.failedToContributeProvider( provider.getName(), provider.getRole(), e );
+          throw new DeploymentException("Failed to contribute provider.", e);
         }
       }
     }
@@ -255,6 +259,7 @@ public abstract class DeploymentFactory {
         } catch( Exception e ) {
           // Maybe it makes sense to throw exception
           log.failedToContributeService( service.getName(), service.getRole(), e );
+          throw new DeploymentException("Failed to contribute provider.", e);
         }
       }
     }
@@ -314,6 +319,7 @@ public abstract class DeploymentFactory {
           } catch( Exception e ) {
             // Maybe it makes sense to throw exception
             log.failedToFinalizeContribution( e );
+            throw new DeploymentException("Failed to finalize contribution.", e);
           }
         }
       }
@@ -324,6 +330,7 @@ public abstract class DeploymentFactory {
           } catch( Exception e ) {
             // Maybe it makes sense to throw exception
             log.failedToFinalizeContribution( e );
+            throw new DeploymentException("Failed to finalize contribution.", e);
           }
         }
       }