bloritsch 00/11/17 11:59:13
Modified: src/org/apache/cocoon Tag: xml-cocoon2
CocoonComponentSelector.java
DefaultComponentManager.java
Log:
adjusted logging so that we don't have a lot of extraneous stuff, but all
exceptions are logged and thrown.
Revision Changes Path
No revision
No revision
1.1.2.6 +10 -3
xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java
Index: CocoonComponentSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- CocoonComponentSelector.java 2000/11/14 16:35:40 1.1.2.5
+++ CocoonComponentSelector.java 2000/11/17 19:59:13 1.1.2.6
@@ -34,7 +34,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/14 16:35:40 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/11/17 19:59:13 $
*/
public class CocoonComponentSelector implements ComponentSelector, Composer {
protected Logger log = LogKit.getLoggerFor("cocoon");
@@ -96,13 +96,11 @@
Class componentClass = (Class)this.components.get(hint);
if ( componentClass == null ) {
- log.debug("componentClass is null");
component = (Component)this.instances.get(hint);
if ( component == null ) {
log.error("Could not find component for hint '" +
hint.toString() + "'.");
throw new ComponentNotFoundException("Could not find
component for hint '" + hint.toString() + "'.");
} else {
- log.debug("Found Component for hint '" + hint.toString() +
"'.");
// we found an individual instance of a component.
return component;
}
@@ -125,11 +123,13 @@
try {
component = (Component)componentClass.newInstance();
} catch ( InstantiationException e ) {
+ log.error("Could not access class " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not instantiate component " +
componentClass.getName() + ": " + e.getMessage(),
e
);
} catch ( IllegalAccessException e ) {
+ log.error("Could not access class " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not access class " + componentClass.getName() +
": " + e.getMessage(),
e
@@ -143,11 +143,13 @@
try {
component = (Component)componentClass.newInstance();
} catch ( InstantiationException e ) {
+ log.error("Could not instantiate component " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not instantiate component " +
componentClass.getName() + ": " + e.getMessage(),
e
);
} catch ( IllegalAccessException e ) {
+ log.error("Could not access class " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not access class " + componentClass.getName() +
": " + e.getMessage(),
e
@@ -171,11 +173,13 @@
try {
component = (Component)componentClass.newInstance();
} catch ( InstantiationException e ) {
+ log.error("Could not access component", e);
throw new ComponentNotAccessibleException(
"Failed to instantiate component " +
componentClass.getName() + ": " + e.getMessage(),
e
);
} catch ( IllegalAccessException e ) {
+ log.error("Could not access component", e);
throw new ComponentNotAccessibleException(
"Could not access component " + componentClass.getName()
+ ": " + e.getMessage(),
e
@@ -200,6 +204,7 @@
new ComponentPoolController()
);
} catch (Exception e) {
+ log.error("Could not create pool for component " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not create pool for component " +
componentClass.getName() + ": " + e.getMessage(),
e
@@ -212,6 +217,7 @@
try {
component = (Component)pool.get();
} catch ( Exception e ) {
+ log.error("Could not retrieve component ", e);
throw new ComponentNotAccessibleException(
"Could not retrieve component " + componentClass.getName() +
" due to a " +
e.getClass().getName() + ": " + e.getMessage(),
@@ -232,6 +238,7 @@
(Configuration)this.configurations.get(c.getClass())
);
} catch (ConfigurationException e) {
+ log.error("Could not configure component " +
c.getClass().getName(), e);
throw new ComponentNotAccessibleException(
"Could not configure component " +
c.getClass().getName() + ".",
e
1.1.2.5 +7 -10
xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
Index: DefaultComponentManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- DefaultComponentManager.java 2000/11/14 15:35:31 1.1.2.4
+++ DefaultComponentManager.java 2000/11/17 19:59:13 1.1.2.5
@@ -35,7 +35,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/11/14 15:35:31 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/17 19:59:13 $
*/
public class DefaultComponentManager implements ComponentManager {
@@ -80,7 +80,7 @@
Component component;
if ( role == null ) {
- log.debug("Attempted to retrieve a component with a null Role");
+ log.error("Attempted to retrieve a component with a null Role");
throw new ComponentNotFoundException("Attempted to retrieve
component will null roll.");
}
@@ -88,13 +88,11 @@
Class componentClass = (Class)this.components.get(role);
if ( componentClass == null ) {
- log.debug("componentClass for " + role + " is null");
component = (Component)this.instances.get(role);
if ( component == null ) {
log.error(role + " could not be found");
throw new ComponentNotFoundException("Could not find
component for role '" + role + "'.");
} else {
- log.debug(role + " instance was found");
// we found an individual instance of a component.
return component;
}
@@ -110,13 +108,10 @@
// Work out what class of component we're dealing with.
if ( ThreadSafe.class.isAssignableFrom(componentClass) ) {
- log.debug(role + " is ThreadSafe");
component = getThreadsafeComponent(componentClass);
} else if ( Poolable.class.isAssignableFrom(componentClass) ) {
- log.debug(role + " is Poolable");
component = getPooledComponent(componentClass);
} else if ( SingleThreaded.class.isAssignableFrom(componentClass) ) {
- log.debug(role + " is SingleThreaded");
try {
component = (Component)componentClass.newInstance();
} catch ( InstantiationException e ) {
@@ -137,7 +132,6 @@
/* The component doesn't implement any of the Avalon marker
* classes, treat as normal.
*/
- log.debug(role + " is a normal Component");
try {
component = (Component)componentClass.newInstance();
} catch ( InstantiationException e ) {
@@ -171,11 +165,13 @@
try {
component = (Component)componentClass.newInstance();
} catch ( InstantiationException e ) {
+ log.error("Failed to instantiate component " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Failed to instantiate component " +
componentClass.getName() + ": " + e.getMessage(),
e
);
} catch ( IllegalAccessException e ) {
+ log.error("Could not access component " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not access component " + componentClass.getName()
+ ": " + e.getMessage(),
e
@@ -200,6 +196,7 @@
new ComponentPoolController()
);
} catch (Exception e) {
+ log.error("Could not create pool for component " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not create pool for component " +
componentClass.getName() + ": " + e.getMessage(),
e
@@ -212,6 +209,7 @@
try {
component = (Component)pool.get();
} catch ( Exception e ) {
+ log.error("Could not retrieve component " +
componentClass.getName(), e);
throw new ComponentNotAccessibleException(
"Could not retrieve component " + componentClass.getName() +
" due to a " +
e.getClass().getName() + ": " + e.getMessage(),
@@ -232,6 +230,7 @@
(Configuration)this.configurations.get(c.getClass())
);
} catch (ConfigurationException e) {
+ log.error("Could not configure component " +
c.getClass().getName(), e);
throw new ComponentNotAccessibleException(
"Could not configure component " +
c.getClass().getName() + ".",
e
@@ -261,8 +260,6 @@
Configuration current = (Configuration) instances.next();
Object hint = current.getAttribute("name");
String className = (String) current.getAttribute("class");
- log.debug("Adding new Component " + className +
- " for hint: " + hint);
try {
selector.addComponent(hint,
ClassUtils.loadClass(className), current);
} catch (Exception e) {