You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/10/30 13:48:23 UTC
svn commit: r329558 - in /cocoon/trunk/src/java/org/apache/cocoon:
components/treeprocessor/sitemap/SitemapLanguage.java
core/container/CoreServiceManager.java
core/container/ServiceNotFoundException.java
Author: cziegeler
Date: Sun Oct 30 04:47:38 2005
New Revision: 329558
URL: http://svn.apache.org/viewcvs?rev=329558&view=rev
Log:
Fix per sitemap logger creation
Added:
cocoon/trunk/src/java/org/apache/cocoon/core/container/ServiceNotFoundException.java (with props)
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java?rev=329558&r1=329557&r2=329558&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java Sun Oct 30 04:47:38 2005
@@ -97,14 +97,8 @@
newManager = new CocoonServiceManager(this.parentProcessorManager, classloader);
- // It's possible to define a logger on a per sitemap base.
- // This is the default logger for all components defined with this sitemap.
- Logger sitemapLogger = this.getLogger();
- if ( config.getAttribute("logger", null) != null) {
- sitemapLogger = sitemapLogger.getChildLogger(config.getAttribute("logger"));
- }
// Go through the component lifecycle
- ContainerUtil.enableLogging(newManager, sitemapLogger);
+ ContainerUtil.enableLogging(newManager, this.getLogger());
ContainerUtil.contextualize(newManager, context);
// before we pass the configuration we have to strip the
// additional configuration parts, like classpath etc. as these
@@ -121,6 +115,7 @@
ContainerUtil.configure(newManager, c);
ContainerUtil.initialize(newManager);
+ Logger sitemapLogger = ((CocoonServiceManager)newManager).getServiceManagerLogger();
// check for an application specific container
final Configuration appContainer = config.getChild("application-container", false);
if ( appContainer != null ) {
Modified: cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java?rev=329558&r1=329557&r2=329558&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java Sun Oct 30 04:47:38 2005
@@ -183,6 +183,12 @@
* @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
*/
public void configure(Configuration configuration) throws ConfigurationException {
+ // It's possible to define a logger on a per sitemap/service manager base.
+ // This is the default logger for all components defined with this sitemap/manager.
+ if ( configuration.getAttribute("logger", null) != null ) {
+ this.enableLogging(this.loggerManager.getLoggerForCategory(configuration.getAttribute("logger")));
+
+ }
this.componentEnv = new ComponentEnvironment(this.classloader, getLogger(), this.roleManager, this.loggerManager, this.context, this);
// Setup location
@@ -208,6 +214,13 @@
}
}
+ /**
+ * Return the service manager logger.
+ */
+ public Logger getServiceManagerLogger() {
+ return this.getLogger();
+ }
+
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Initializable#initialize()
*/
@@ -339,6 +352,9 @@
if( this.parentManager != null ) {
try {
return this.parentManager.lookup( role );
+ } catch ( ServiceNotFoundException snfe) {
+ // ignore. If the exception is thrown, we try to
+ // create the component next
} catch( Exception e ) {
if( this.getLogger().isWarnEnabled() ) {
final String message =
@@ -401,7 +417,7 @@
if( this.getLogger().isDebugEnabled() ) {
this.getLogger().debug( message );
}
- throw new ServiceException( role, message );
+ throw new ServiceNotFoundException( role, message );
}
Object component = null;
Added: cocoon/trunk/src/java/org/apache/cocoon/core/container/ServiceNotFoundException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/ServiceNotFoundException.java?rev=329558&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/ServiceNotFoundException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/ServiceNotFoundException.java Sun Oct 30 04:47:38 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 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.core.container;
+
+import org.apache.avalon.framework.service.ServiceException;
+
+/**
+ * This exception indicates the a services manager was not able to find a component.
+ * @since 2.2
+ * @version $Id$
+ */
+public class ServiceNotFoundException extends ServiceException {
+
+ public ServiceNotFoundException(String arg0, String arg1, Throwable arg2) {
+ super(arg0, arg1, arg2);
+ }
+
+ public ServiceNotFoundException(String arg0, String arg1) {
+ super(arg0, arg1);
+ }
+}
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/container/ServiceNotFoundException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/container/ServiceNotFoundException.java
------------------------------------------------------------------------------
svn:keywords = Id