You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2005/09/29 20:02:32 UTC

svn commit: r292495 - /cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/

Author: bloritsch
Date: Thu Sep 29 11:02:27 2005
New Revision: 292495

URL: http://svn.apache.org/viewcvs?rev=292495&view=rev
Log:
add the exception structure to the InputModule

Added:
    cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleAttributeException.java
    cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleDestructionException.java
    cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleException.java
    cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleInitializationException.java
    cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleNotFoundException.java
Modified:
    cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java

Added: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleAttributeException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleAttributeException.java?rev=292495&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleAttributeException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleAttributeException.java Thu Sep 29 11:02:27 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.modules.input;
+
+public final class InputModuleAttributeException extends InputModuleException
+{
+    public InputModuleAttributeException(String message)
+    {
+        super(message, null);
+    }
+
+    public InputModuleAttributeException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}

Added: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleDestructionException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleDestructionException.java?rev=292495&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleDestructionException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleDestructionException.java Thu Sep 29 11:02:27 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.modules.input;
+
+public final class InputModuleDestructionException extends InputModuleException
+{
+    public InputModuleDestructionException(String message)
+    {
+        super(message, null);
+    }
+
+    public InputModuleDestructionException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}

Added: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleException.java?rev=292495&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleException.java Thu Sep 29 11:02:27 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.modules.input;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+
+public class InputModuleException extends CascadingRuntimeException
+{
+    public InputModuleException(String message)
+    {
+        super(message, null);
+    }
+
+    public InputModuleException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}

Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java?rev=292495&r1=292494&r2=292495&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java Thu Sep 29 11:02:27 2005
@@ -15,7 +15,6 @@
  */
 package org.apache.cocoon.components.modules.input;
 
-import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.ServiceSelector;
@@ -48,9 +47,9 @@
      * Get the input module
      */
     private InputModule getInputModule(String name)
-    throws CascadingRuntimeException {
+    throws InputModuleException {
         if ( this.inputModules == null ) {
-            throw new RuntimeException("ModuleHelper is not setup correctly.");
+            throw new InputModuleInitializationException("ModuleHelper is not setup correctly.");
         }
         InputModule module = (InputModule) this.inputModules.get(name);
         if ( module == null ) {
@@ -59,10 +58,10 @@
                     module = (InputModule) this.serviceInputSelector.select(name);
                 }
             } catch (Exception e) {
-                throw new CascadingRuntimeException("Unable to lookup input module " + name, e);
+                throw new InputModuleNotFoundException("Unable to lookup input module " + name, e);
             }
             if ( module == null ) {
-                throw new RuntimeException("No such InputModule: "+name);
+                throw new InputModuleNotFoundException("No such InputModule: "+name);
             }
             this.inputModules.put(name, module);
         }
@@ -85,10 +84,10 @@
      * @param objectModel a <code>Map</code> value holding the current
      * ObjectModel
      * @return an <code>Object</code> value
-     * @exception CascadingRuntimeException if an error occurs. The real
+     * @throws InputModuleException if an error occurs. The real
      * exception can be obtained with <code>getCause</code>.
      */
-    private Object get(int op, String name, String attr, Map objectModel, Configuration conf) throws CascadingRuntimeException {
+    private Object get(int op, String name, String attr, Map objectModel, Configuration conf) throws InputModuleException {
 
         Object value = null;
         final InputModule input = this.getInputModule(name);
@@ -108,13 +107,13 @@
             }
 
         } catch (Exception e) {
-            throw new CascadingRuntimeException("Error accessing attribute '"+attr+"' from input module '"+name+"'. "+e.getMessage(), e);
+            throw new InputModuleAttributeException("Error accessing attribute '"+attr+"' from input module '"+name+"'. "+e.getMessage(), e);
         }
 
         return value;
     }
 
-    private Object get(int op, String name, String attr, Map objectModel) throws RuntimeException {
+    private Object get(int op, String name, String attr, Map objectModel) throws InputModuleException {
         return get(op, name, attr, objectModel, null);
     }
 
@@ -125,16 +124,16 @@
      * service manager and service selector in instance 
      * 
      * @param manager a <code>ServiceManager</code> value
-     * @exception RuntimeException if an error occurs
+     * @throws InputModuleException if an error occurs
      */
-    public void setup(ServiceManager manager) throws RuntimeException {
+    public void setup(ServiceManager manager) throws InputModuleException {
 
         this.inputModules = new HashMap();
         this.serviceManager = manager;
         try {
             this.serviceInputSelector = (ServiceSelector) this.serviceManager.lookup(INPUT_MODULE_SELECTOR); 
         } catch (Exception e) {
-            throw new CascadingRuntimeException("Could not obtain selector for InputModule.",e);
+            throw new InputModuleInitializationException("Could not obtain selector for InputModule.",e);
         }
     }
 
@@ -149,9 +148,9 @@
      * @param name a <code>String</code> value holding the attribute name
      * @param deflt an <code>Object</code> value holding a default value
      * @return an <code>Object</code> value
-     * @exception RuntimeException if an error occurs
+     * @throws InputModuleException if an error occurs
      */
-    public Object getAttribute(Map objectModel, Configuration conf, String module, String name, Object deflt) throws RuntimeException {
+    public Object getAttribute(Map objectModel, Configuration conf, String module, String name, Object deflt) throws InputModuleException {
 
         Object result = this.get(OP_GET, module, name, objectModel, conf);
         if (result == null) result = deflt;
@@ -163,7 +162,7 @@
      * #getAttribute(Map, Configuration, String, String, Object)} with a
      * <code>null</code> configuration.
      */
-    public Object getAttribute(Map objectModel, String module, String name, Object deflt) throws RuntimeException {
+    public Object getAttribute(Map objectModel, String module, String name, Object deflt) throws InputModuleException {
         return getAttribute(objectModel, null, module, name, deflt);
     }
 
@@ -178,9 +177,9 @@
      * @param name a <code>String</code> value holding the attribute name
      * @param deflt an <code>Object[]</code> value holding a default value
      * @return an <code>Object[]</code> value
-     * @exception RuntimeException if an error occurs
+     * @throws InputModuleException if an error occurs
      */
-    public Object[] getAttributeValues(Map objectModel, Configuration conf, String module, String name, Object[] deflt) throws RuntimeException {
+    public Object[] getAttributeValues(Map objectModel, Configuration conf, String module, String name, Object[] deflt) throws InputModuleException {
 
         Object[] result = (Object[]) this.get(OP_VALUES, module, name, objectModel, conf);
         if (result == null) result = deflt;
@@ -192,7 +191,7 @@
      * {@link #getAttributeValues(Map, Configuration, String, String, Object[])}
      * with a <code>null</code> configuration.
      */
-    public Object[] getAttributeValues(Map objectModel, String module, String name, Object[] deflt) throws RuntimeException {
+    public Object[] getAttributeValues(Map objectModel, String module, String name, Object[] deflt) throws InputModuleException {
         return getAttributeValues(objectModel, null, module, name, deflt);
     }
 
@@ -204,9 +203,9 @@
      * @param objectModel a <code>Map</code> value
      * @param module the module's name
      * @return an <code>Iterator</code> value
-     * @exception RuntimeException if an error occurs
+     * @throws InputModuleException if an error occurs
      */
-    public Iterator getAttributeNames(Map objectModel, Configuration conf, String module) throws RuntimeException {
+    public Iterator getAttributeNames(Map objectModel, Configuration conf, String module) throws InputModuleException {
 
         return (Iterator) this.get(OP_NAMES, module, null, objectModel);
     }
@@ -215,7 +214,7 @@
      * as {@link #getAttributeNames(Map, Configuration, String)} with a
      * <code>null</code> configuration.
      */
-    public Iterator getAttributeNames(Map objectModel, String module) throws RuntimeException {
+    public Iterator getAttributeNames(Map objectModel, String module) throws InputModuleException {
         return getAttributeNames(objectModel, (Configuration)null, module);
     }
 
@@ -224,9 +223,9 @@
     /**
      * Releases all obtained module references.
      *
-     * @exception RuntimeException if an error occurs
+     * @throws InputModuleException if an error occurs
      */
-    public void releaseAll() throws RuntimeException {
+    public void releaseAll() throws InputModuleException {
 
         if ( this.inputModules != null ) {
             if ( this.serviceManager != null ) {
@@ -240,7 +239,7 @@
                     this.serviceManager = null;
                     this.inputModules = null;
                 } catch (Exception e) {
-                    throw new CascadingRuntimeException("Could not release InputModules.",e);
+                    throw new InputModuleDestructionException("Could not release InputModules.",e);
                 }
                 
             }

Added: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleInitializationException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleInitializationException.java?rev=292495&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleInitializationException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleInitializationException.java Thu Sep 29 11:02:27 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.modules.input;
+
+public final class InputModuleInitializationException extends InputModuleException
+{
+    public InputModuleInitializationException(String message)
+    {
+        super(message, null);
+    }
+
+    public InputModuleInitializationException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}

Added: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleNotFoundException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleNotFoundException.java?rev=292495&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleNotFoundException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/InputModuleNotFoundException.java Thu Sep 29 11:02:27 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.components.modules.input;
+
+public final class InputModuleNotFoundException extends InputModuleException
+{
+    public InputModuleNotFoundException(String message)
+    {
+        super(message, null);
+    }
+
+    public InputModuleNotFoundException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}