cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: rev 56224 - in cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel: . description runtime
Date Mon, 01 Nov 2004 10:38:05 GMT
Author: pier
Date: Mon Nov  1 02:38:04 2004
New Revision: 56224

Added:
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/DeployerException.java
Modified:
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/KernelException.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Abstract.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Block.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Descriptor.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Interface.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Library.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Deployer.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Factory.java
   cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Instance.java
Log:
KernelException is now an unckecked exception, and in the Deployer internals it has been replaced
by the checked DeployerException

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/KernelException.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/KernelException.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/KernelException.java	Mon Nov  1
02:38:04 2004
@@ -13,17 +13,20 @@
 package org.apache.cocoon.kernel;
 
 /**
- * <p>A {@link KernelException} is thrown whenever an error occurred in the lookup
- * operation performed by the {@link Kernel}.</p> 
+ * <p>A {@link KernelException} is an unchecked exception thrown by the
+ * {@link Kernel} when a component can not be accessed.</p> 
  *
+ * @see Kernel#lookup(String)
  * @author <a href="mailto:pier@apache.org">Pier Fumagalli</a>
  * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/">The Apache
  *         Software Foundation</a>. All rights reserved.
  */
-public class KernelException extends Exception {
+public class KernelException extends RuntimeException {
 
     /**
      * <p>Create a new {@link KernelException} instance.</p>
+     *
+     * @param message the detail message to associate with this exception.
      */
     public KernelException(String message) {
         super(message);
@@ -31,8 +34,12 @@
 
     /**
      * <p>Create a new {@link KernelException} instance.</p>
+     *
+     * @param message the detail message to associate with this exception.
+     * @param cause the root cause of this {@link KernelException}.
      */
-    public KernelException(String message, Throwable throwable) {
-        super(message, throwable);
+    public KernelException(String message, Throwable cause) {
+        super(message, cause);
     }
+
 }

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Abstract.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Abstract.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Abstract.java	Mon Nov
 1 02:38:04 2004
@@ -16,8 +16,8 @@
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.cocoon.kernel.KernelException;
 import org.apache.cocoon.kernel.configuration.Configuration;
+import org.apache.cocoon.kernel.runtime.DeployerException;
 
 /**
  * <p>An {@link Abstract} represents a an descriptor, or a block providing only
@@ -36,13 +36,13 @@
      * <p>Create a new {@link Abstract} instance.</p>
      */
     public Abstract(Configuration configuration)
-    throws KernelException {
+    throws DeployerException {
         super(configuration);
 
         /* Specific block stuff */
         String name = configuration.name();
         if ((!"block".equals(name)) && (!"abstract".equals(name))) {
-            throw new KernelException("Invalid root element name for abstract "
+            throw new DeployerException("Invalid root element name for abstract "
                     + " descriptor at " + configuration.location());
         }
         
@@ -53,7 +53,7 @@
             Configuration current = (Configuration) iterator.next();
             String id = current.getStringAttribute("block", null);
             if (id == null) { 
-                throw new KernelException("Extended block identifier not speci"
+                throw new DeployerException("Extended block identifier not speci"
                         + "fied in descriptor at " + configuration.location());
             }
             list.add(id);

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Block.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Block.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Block.java	Mon Nov 
1 02:38:04 2004
@@ -16,8 +16,8 @@
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.cocoon.kernel.KernelException;
 import org.apache.cocoon.kernel.configuration.Configuration;
+import org.apache.cocoon.kernel.runtime.DeployerException;
 
 /**
  * <p>A {@link Block} represents a block descriptor.</p> 
@@ -43,16 +43,16 @@
      * <p>Create a new {@link Block} instance.</p>
      *
      * @param configuration A {@link Configuration} object enclosing the XML data.
-     * @throws KernelException If an error occurred processing the XML data.
+     * @throws DeployerException If an error occurred processing the XML data.
      */
     public Block(Configuration configuration)
-    throws KernelException {
+    throws DeployerException {
         /* Parse all generic stuff */
         super(configuration);
         
         /* Specific block stuff */
         if (! "block".equals(configuration.name())) {
-            throw new KernelException("Invalid root element name for block "
+            throw new DeployerException("Invalid root element name for block "
                     + " descriptor at " + configuration.location());
         }
         
@@ -63,7 +63,7 @@
             Configuration current = (Configuration) iterator.next();
             String id = current.getStringAttribute("block", null);
             if (id == null) { 
-                throw new KernelException("Extended block identifier not speci"
+                throw new DeployerException("Extended block identifier not speci"
                         + "fied in descriptor at " + configuration.location());
             }
             list.add(id);
@@ -82,7 +82,7 @@
         this.destroyer = provides.getStringAttribute("destroy", null);
         this.singleton = provides.getBooleanAttribute("singleton", true);
         if ((!singleton) && ((initializer != null) || (destroyer == null))) {
-            throw new KernelException("Non-singleton component declares initializer "
+            throw new DeployerException("Non-singleton component declares initializer "
                     + "or destroyer method at " + provides.location());
         }
 

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Descriptor.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Descriptor.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Descriptor.java	Mon
Nov  1 02:38:04 2004
@@ -19,8 +19,8 @@
 import java.util.List;
 import java.util.StringTokenizer;
 
-import org.apache.cocoon.kernel.KernelException;
 import org.apache.cocoon.kernel.configuration.Configuration;
+import org.apache.cocoon.kernel.runtime.DeployerException;
 
 /**
  * <p>A {@link Descriptor} represents a block or interface descriptor.</p> 
@@ -57,13 +57,13 @@
      * <p>Create a new {@link Descriptor} instance.</p>
      *
      * @param configuration A {@link Configuration} object enclosing the XML data.
-     * @throws KernelException If an error occurred processing the XML data.
+     * @throws DeployerException If an error occurred processing the XML data.
      */
     protected Descriptor(Configuration configuration)
-    throws KernelException {
+    throws DeployerException {
         /* Check the namespace */
         if (! NAMESPACE.equals(configuration.namespace())) { 
-            throw new KernelException("Invalid namespace \""
+            throw new DeployerException("Invalid namespace \""
                     + configuration.namespace() + "\" declared for descriptor at "
                     + configuration.location());
         }
@@ -71,14 +71,14 @@
         /* Parse and setup the ID of this interface or block */
         String id = configuration.getStringAttribute("id", null);
         if (id == null) {
-            throw new KernelException("Identifier not specified at "
+            throw new DeployerException("Identifier not specified at "
                     + configuration.location());
         }
 
         try {
             this.setupIdentifier(new URL(id));
         } catch (Throwable t) {
-            throw new KernelException("Unable to parse identifier \"" + id + "\""
+            throw new DeployerException("Unable to parse identifier \"" + id + "\""
                     + " specified at " + configuration.location(), t);
         }
 
@@ -91,13 +91,13 @@
             Configuration current = (Configuration) iterator.next();
             String url = current.getStringAttribute("href", null);
             if (url == null) { 
-                throw new KernelException("Library href attribute not specified "
+                throw new DeployerException("Library href attribute not specified "
                         + "in descriptor at " + configuration.location());
             }
             try {
                 urls.add(new URL(href, url));
             } catch (Throwable t) {
-                throw new KernelException("Unable to resolve library URL speci"
+                throw new DeployerException("Unable to resolve library URL speci"
                         + "fied in descriptor at " + configuration.location(), t);
             }
         }

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Interface.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Interface.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Interface.java	Mon Nov
 1 02:38:04 2004
@@ -12,8 +12,8 @@
  * =============================================================================== */
 package org.apache.cocoon.kernel.description;
 
-import org.apache.cocoon.kernel.KernelException;
 import org.apache.cocoon.kernel.configuration.Configuration;
+import org.apache.cocoon.kernel.runtime.DeployerException;
 
 /**
  * <p>An {@link Interface} represents an interface descriptor.</p> 
@@ -31,23 +31,23 @@
      * <p>Create a new {@link Interface} instance.</p>
      *
      * @param configuration A {@link Configuration} object enclosing the XML data.
-     * @throws KernelException If an error occurred processing the XML data.
+     * @throws DeployerException If an error occurred processing the XML data.
      */
     public Interface(Configuration configuration)
-    throws KernelException {
+    throws DeployerException {
         /* Parse all generic stuff */
         super(configuration);
         
         /* Specific interface stuff */
         if (! "interface".equals(configuration.name())) {
-            throw new KernelException("Invalid root element name for interface "
+            throw new DeployerException("Invalid root element name for interface "
                     + " descriptor at " + configuration.location());
         }
         
         Configuration exposes = configuration.child(NAMESPACE, "exposes");
         this.clazz = exposes.getStringAttribute("interface", null);
         if (this.clazz == null) {
-            throw new KernelException("Exposed interface name not specified at "
+            throw new DeployerException("Exposed interface name not specified at "
                     + exposes.location());
         }
     }

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Library.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Library.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/description/Library.java	Mon Nov
 1 02:38:04 2004
@@ -18,7 +18,7 @@
 import java.util.HashSet;
 import java.util.NoSuchElementException;
 
-import org.apache.cocoon.kernel.KernelException;
+import org.apache.cocoon.kernel.runtime.DeployerException;
 
 /**
  * <p>The {@link Library} class defines a collection of {@link Descriptor} objects
@@ -61,12 +61,12 @@
      * @return A {@link Descriptor} instance or <b>null</b> if not found.
      */
     public Descriptor get(String identifier)
-    throws KernelException {
+    throws DeployerException {
         if (identifier == null) throw new NullPointerException("Null identifier");
         try {
             return this.get(new URL(identifier));
         } catch (MalformedURLException e) {
-            throw new KernelException("Invalid descriptor " + identifier, e); 
+            throw new DeployerException("Invalid descriptor " + identifier, e); 
         }
     }
 

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Deployer.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Deployer.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Deployer.java	Mon Nov  1
02:38:04 2004
@@ -62,7 +62,7 @@
      *                      and block instances.
      */
     public void initialize(Configuration configuration)
-    throws KernelException {
+    throws DeployerException {
         this.initialize(configuration, configuration);
     }
 
@@ -73,7 +73,7 @@
      * @param instances A {@link Configuration} containing block instances.
      */
     public void initialize(Configuration descriptors, Configuration instances)
-    throws KernelException {
+    throws DeployerException {
         Factory.configure(this.library, descriptors);
         Factory.configure(this.runtime, instances);
 
@@ -111,15 +111,22 @@
      */
     public Object lookup(String name)
     throws KernelException {
+
         /* Retrieve and check the instance */
         Instance instance = this.runtime.getInstance(name);
         if (instance == null) {
-            throw new KernelException("Invalid instance name \"" + name + "\"");
+            throw new KernelException("Block instance \"" + name + "\" unknown");
         }
 
         /* Prepare wiring and component */
         Object component = this.singletons.get(instance);
-        if (component == null) this.instantiate(name, instance);
+        if (component == null) try {
+            this.instantiate(name, instance);
+        } catch (Throwable t) {
+            throw new KernelException("Unable to create non-singleton component "
+                    + " instance for block \"" + instance.getBlock().toString()
+                    + "\" instantiated with name \"" + name + "\"", t);
+        }
         Wiring wiring = new Wiring(component); 
 
         /* Create and return the proxy instance */
@@ -127,7 +134,9 @@
         try {
             return Proxy.newProxyInstance(this.runtime, interfaces, wiring);
         } catch (Throwable t) {
-            throw new KernelException("Unable to create proxy for " + name, t);
+            throw new KernelException("Unable to create component proxy instance "
+                    + " for block \"" + instance.getBlock().toString()
+                    + "\" instantiated with name \"" + name + "\"", t);
         }
     }
 
@@ -142,7 +151,7 @@
      * <p>Instantiate a new component given its block instance name.</p>
      */
     private Object instantiate(String name)
-    throws KernelException {
+    throws DeployerException {
         return this.instantiate(name, this.runtime.getInstance(name));
     }
 
@@ -150,9 +159,9 @@
      * <p>Instantiate a new component given its block instance and name.</p>
      */
     private Object instantiate(String name, Instance instance)
-    throws KernelException {
+    throws DeployerException {
         if (instance == null) {
-            throw new KernelException("Invalid instance \"" + name + "\"");
+            throw new DeployerException("Invalid instance \"" + name + "\"");
         }
 
         /* Prepare a new instance */
@@ -161,13 +170,13 @@
         try {
             component = clazz.newInstance();
         } catch (Throwable t) {
-            throw new KernelException("Can't instantiate " + clazz.getName(), t);
+            throw new DeployerException("Can't instantiate " + clazz.getName(), t);
         }
 
         /* Configure this component instance */
         Configuration configuration = this.runtime.getConfiguration(name);
         if (this.initializing.contains(name)) {
-            throw new KernelException("Circular dependancy found initializing "
+            throw new DeployerException("Circular dependancy found initializing "
                     + "instance \"" + name + "\"");
         } else {
             this.initializing.add(name);
@@ -181,7 +190,7 @@
             /* Non singletons will never have an initializer method set */
             if (initializer != null) initializer.invoke(component, NULL);
         } catch (Throwable t) {
-            throw new KernelException("Can't initialize component " + name, t);
+            throw new DeployerException("Can't initialize component " + name, t);
         }
 
         /* Return the initialized component */

Added: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/DeployerException.java
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/DeployerException.java	Mon
Nov  1 02:38:04 2004
@@ -0,0 +1,38 @@
+/* =============================================================================== *
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights reserved. *
+ *                                                                                 *
+ * 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.kernel.runtime;
+
+/**
+ * <p>A {@link DeployerException} is thrown whenever an error occurred in the
+ * internals of the {@link Deployer}.</p> 
+ *
+ * @author <a href="mailto:pier@apache.org">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/">The Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class DeployerException extends Exception {
+
+    /**
+     * <p>Create a new {@link DeployerException} instance.</p>
+     */
+    public DeployerException(String message) {
+        super(message);
+    }
+
+    /**
+     * <p>Create a new {@link DeployerException} instance.</p>
+     */
+    public DeployerException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Factory.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Factory.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Factory.java	Mon Nov  1
02:38:04 2004
@@ -18,7 +18,6 @@
 import java.util.Iterator;
 
 import org.apache.cocoon.kernel.Kernel;
-import org.apache.cocoon.kernel.KernelException;
 import org.apache.cocoon.kernel.configuration.Configuration;
 import org.apache.cocoon.kernel.configuration.ConfigurationBuilder;
 import org.apache.cocoon.kernel.description.Abstract;
@@ -46,7 +45,7 @@
      * <p>Configure the specified {@link Library} from a {@link Configuration}.</p>
      */
     public static void configure(Library library, Configuration config)
-    throws KernelException {
+    throws DeployerException {
         if (library == null) throw new NullPointerException("Null library");
         if (config == null) throw new NullPointerException("Null configuration");
 
@@ -64,14 +63,14 @@
             } else if ("interface".equals(descriptor.name())) {
                 library.add(new Interface(descriptor));
             } else {
-                throw new KernelException("Invalid descriptor root element \""
+                throw new DeployerException("Invalid descriptor root element \""
                         + descriptor.name() + "\" found in descriptor at"
                         + descriptor.location());
             }
-        } catch (KernelException e) {
+        } catch (DeployerException e) {
             throw e;
         } catch (Throwable t) {
-            throw new KernelException("Error processing descriptor at "
+            throw new DeployerException("Error processing descriptor at "
                     + current.location(), t);
         }
     }
@@ -80,7 +79,7 @@
      * <p>Configure the specified {@link Runtime} from a {@link Configuration}.</p>
      */
     public static void configure(Runtime runtime, Configuration config)
-    throws KernelException {
+    throws DeployerException {
         if (runtime == null) throw new NullPointerException("Null runtime");
         if (config == null) throw new NullPointerException("Null configuration");
 
@@ -93,19 +92,19 @@
 
             Descriptor descriptor = runtime.getLibrary().get(block);
             if (descriptor == null) {
-                throw new KernelException("Unable to retrieve descriptor for "
+                throw new DeployerException("Unable to retrieve descriptor for "
                         + "block \"" + block + " declared at " + current.location());
             }
             if (descriptor.getType() != Descriptor.BLOCK) {
-                throw new KernelException("Unable to instantiate non-block \""
+                throw new DeployerException("Unable to instantiate non-block \""
                         + block + " declared at " + current.location());
             }
             Instance instance = new Instance(runtime, (Block) descriptor);
             runtime.add(name, instance, current);
-        } catch (KernelException e) {
+        } catch (DeployerException e) {
             throw e;
         } catch (Throwable t) {
-            throw new KernelException("Unable to create block instance "
+            throw new DeployerException("Unable to create block instance "
                     + "declared at " + current.location(), t);
         }
     }
@@ -114,7 +113,7 @@
      * <p>Configure the specified component from a {@link Configuration}.</p>
      */
     public static void configure(Object o, Deployer deployer, Configuration config)
-    throws KernelException {
+    throws DeployerException {
         Iterator iterator = config.children("set");
         while (iterator.hasNext()) {
 
@@ -122,7 +121,7 @@
             Configuration current = (Configuration) iterator.next();
             String property = current.getStringAttribute("property", null);
             if (property == null) {
-                throw new KernelException("Property name not specified at "
+                throw new DeployerException("Property name not specified at "
                         + current.location());
             }
 
@@ -133,7 +132,7 @@
                         + property.substring(1);
                 descriptor = new PropertyDescriptor(property, o.getClass(), null, s);
             } catch (Throwable t) {
-                throw new KernelException("Unable to retrieve setter method for pro"
+                throw new DeployerException("Unable to retrieve setter method for pro"
                         + "perty \"" + property + "\" at " + current.location(), t);
             }
 
@@ -144,7 +143,7 @@
                 descriptor.getWriteMethod().invoke(o, new Object[] { value });
                 continue;
             } catch (Throwable t) {
-                throw new KernelException("Unable to set value for property \""
+                throw new DeployerException("Unable to set value for property \""
                         + property + "\" specified at " + current.location(), t);
             }
 
@@ -154,7 +153,7 @@
                 descriptor.getWriteMethod().invoke(o, new Object[] { value });
                 continue;
             } catch (Throwable t) {
-                throw new KernelException("Unable to set component for property \""
+                throw new DeployerException("Unable to set component for property \""
                         + property + "\" specified at " + current.location(), t);
             }
 
@@ -166,12 +165,12 @@
                 descriptor.getWriteMethod().invoke(o, new Object[] { value });
                 continue;
             } catch (Throwable t) {
-                throw new KernelException("Unable to set kernel for property \""
+                throw new DeployerException("Unable to set kernel for property \""
                         + property + "\" specified at " + current.location(), t);
             }
             
             /* We haven't continue(d), something bad happened */
-            throw new KernelException("Invalid declaration at " + current.location());
+            throw new DeployerException("Invalid declaration at " + current.location());
         }
     }
 }

Modified: cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Instance.java
==============================================================================
--- cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Instance.java	(original)
+++ cocoon/whiteboard/kernel/src/org/apache/cocoon/kernel/runtime/Instance.java	Mon Nov  1
02:38:04 2004
@@ -18,7 +18,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.cocoon.kernel.KernelException;
 import org.apache.cocoon.kernel.description.Abstract;
 import org.apache.cocoon.kernel.description.Block;
 import org.apache.cocoon.kernel.description.Descriptor;
@@ -49,7 +48,7 @@
      * <p>Create a new {@link Instance} instance.</p>
      */
     public Instance(Runtime runtime, Block block)
-    throws KernelException {
+    throws DeployerException {
         super(block.getLibraries(), runtime);
         Library library = runtime.getLibrary();
         
@@ -59,11 +58,11 @@
         for (int k = 0; k < implementations.length; k++) {
             Descriptor descriptor = library.get(implementations[k]);
             if (descriptor == null) {
-                throw new KernelException("Block " + block.toString()
+                throw new DeployerException("Block " + block.toString()
                         + " implements unknown block " + implementations[k]);
             }
             if (descriptor.getType() != Descriptor.INTERFACE) {
-                throw new KernelException("Block " + block.toString()
+                throw new DeployerException("Block " + block.toString()
                         + " implements non-interface " + descriptor.toString());
             }
 
@@ -71,7 +70,7 @@
             try {
                 interfaces.add(runtime.loadClass(clazz));
             } catch (ClassNotFoundException e) {
-                throw new KernelException("Cant find class " + clazz + " exposed by "
+                throw new DeployerException("Cant find class " + clazz + " exposed by "
                         + "interface " + descriptor.toString() + " implemented by "
                         + block.toString());
             }
@@ -83,11 +82,11 @@
         for (int k = 0; k < extensions.length; k++) {
             Descriptor descriptor = library.get(extensions[k]);
             if (descriptor == null) {
-                throw new KernelException("Block " + block.toString()
+                throw new DeployerException("Block " + block.toString()
                         + " extends unknown block " + extensions[k]);
             }
             if (descriptor.getType() == Descriptor.INTERFACE) {
-                throw new KernelException("Block " + block.toString()
+                throw new DeployerException("Block " + block.toString()
                         + " extends interface " + descriptor.toString());
             }
             collector.add(block);
@@ -98,13 +97,13 @@
         try {
             this.component = this.loadClass(block.getComponent());
         } catch (ClassNotFoundException e) {
-            throw new KernelException("Unable to resolve component class "
+            throw new DeployerException("Unable to resolve component class "
                     + block.getComponent() + " for block " + block.toString(), e);
         }
         this.interfaces = (Class[])interfaces.toArray(new Class[interfaces.size()]);
         for (int k = 0; k < this.interfaces.length; k++) {
             if (this.component.isAssignableFrom(this.interfaces[k])) continue;
-            throw new KernelException("Component class \"" + this.component.getName()
+            throw new DeployerException("Component class \"" + this.component.getName()
                     + "\" is not assignable from \"" + this.interfaces[k] + "\"");
         }
 
@@ -113,14 +112,14 @@
         if (initializer != null) try {
             this.initializer = this.component.getMethod(initializer, new Class[0]);
         } catch (NoSuchMethodException e) {
-            throw new KernelException("Initializer method \"" + initializer
+            throw new DeployerException("Initializer method \"" + initializer
                     + "\" for component \"" + block.getComponent() + "\" not found");
         }
         String destroyer = block.getComponentInitializer();
         if (destroyer != null) try {
             this.initializer = this.component.getMethod(destroyer, new Class[0]);
         } catch (NoSuchMethodException e) {
-            throw new KernelException("Initializer method \"" + destroyer
+            throw new DeployerException("Initializer method \"" + destroyer
                     + "\" for component \"" + block.getComponent() + "\" not found");
         }
         
@@ -169,10 +168,10 @@
      * <p>Add all libraries provided by a given block and its super-blocks.</p>
      */
     private void process(Library lib, Abstract abs, Set collector, Set interfaces)
-    throws KernelException {
+    throws DeployerException {
         /* Check circularities */
         if (collector.contains(abs)) {
-            throw new KernelException("Circularity exception analysing "
+            throw new DeployerException("Circularity exception analysing "
                     + "extensions for block " + abs.toString());
         }
         collector.add(abs);
@@ -183,11 +182,11 @@
             for (int k = 0; k < implementations.length; k++) {
                 Descriptor descriptor = lib.get(implementations[k]);
                 if (descriptor == null) {
-                    throw new KernelException("Block " + abs.toString() + " imple"
+                    throw new DeployerException("Block " + abs.toString() + " imple"
                             + "ments unknown interface " + implementations[k]);
                 }
                 if (descriptor.getType() != Descriptor.INTERFACE) {
-                    throw new KernelException("Block " + abs.toString()
+                    throw new DeployerException("Block " + abs.toString()
                             + " implements non-interface " + descriptor.toString());
                 }
 
@@ -195,7 +194,7 @@
                 try {
                     interfaces.add(this.getParent().loadClass(clazz));
                 } catch (ClassNotFoundException e) {
-                    throw new KernelException("Cant find class " + clazz
+                    throw new DeployerException("Cant find class " + clazz
                             + " exposed by interface " + descriptor.toString()
                             + " implemented by " + abs.toString());
                 }
@@ -211,7 +210,7 @@
         for (int k = 0; k < extensions.length; k++) {
             Descriptor descriptor = lib.get(extensions[k]);
             if (descriptor.getType() == Descriptor.INTERFACE) {
-                throw new KernelException("Block " + abs.toString()
+                throw new DeployerException("Block " + abs.toString()
                         + " extends interface " + descriptor.toString());
             }
             this.process(lib, (Block) descriptor, collector, interfaces);

Mime
View raw message