bloritsch 2002/09/22 22:07:55
Modified: fortress/src/java/org/apache/excalibur/fortress
AbstractContainer.java
fortress/src/java/org/apache/excalibur/fortress/container
MetaDataContainer.java
Added: fortress/src/java/org/apache/excalibur/fortress/container/commands
DisposeComponentHandlerCommand.java
InitializeComponentHandlerCommand.java
Log:
move all commands into separate classes
Revision Changes Path
1.58 +3 -71
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/AbstractContainer.java
Index: AbstractContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/AbstractContainer.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- AbstractContainer.java 18 Sep 2002 18:02:18 -0000 1.57
+++ AbstractContainer.java 23 Sep 2002 05:07:55 -0000 1.58
@@ -67,6 +67,7 @@
import org.apache.excalibur.event.Queue;
import org.apache.excalibur.event.command.Command;
+import org.apache.excalibur.fortress.container.commands.*;
import org.apache.excalibur.fortress.handler.ComponentHandler;
import org.apache.excalibur.fortress.lifecycle.LifecycleExtensionManager;
import org.apache.excalibur.fortress.lookup.FortressServiceManager;
@@ -431,7 +432,7 @@
if( null != m_commandQueue )
{
m_commandQueue.enqueue(
- new InitComponentHandlerCommand( handler, getLogger() )
+ new InitializeComponentHandlerCommand( handler,
getLogger() )
);
}
else
@@ -530,75 +531,6 @@
protected ServiceManager getServiceManager()
{
return m_serviceManager;
- }
-
- /**
- * This is the command class to initialize a ComponentHandler
- */
- protected static final class InitComponentHandlerCommand implements Command
- {
- private final ComponentHandler m_handler;
- private final Logger m_logger;
-
- protected InitComponentHandlerCommand( ComponentHandler handler, Logger
logger )
- {
- m_handler = handler;
- m_logger = logger;
- }
-
- public void execute()
- throws Exception
- {
- try
- {
- if( !m_handler.isInitialized() )
- {
- m_handler.initialize();
-
- if( m_logger.isDebugEnabled() )
- {
- m_logger.debug( "Initialized Handler " + m_handler );
- }
- }
- }
- catch( Exception e )
- {
- if( m_logger.isErrorEnabled() )
- {
- m_logger.error( "Could not initialize ComponentHandler", e );
- }
-
- throw e;
- }
- }
- }
-
- /**
- * This is the command class to dispose a ComponentHandler
- */
- protected static final class DisposeComponentHandlerCommand implements Command
- {
- private final ComponentHandler m_handler;
- private final Logger m_logger;
-
- protected DisposeComponentHandlerCommand( ComponentHandler handler, Logger
logger )
- {
- m_handler = handler;
- m_logger = logger;
- }
-
- public void execute()
- {
- if( m_handler.isInitialized() )
- {
- m_handler.dispose();
-
- if( m_logger.isDebugEnabled() )
- {
- m_logger.debug( "Disposed of Handler " + m_handler );
- }
- }
- }
}
}
1.6 +1 -70
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/container/MetaDataContainer.java
Index: MetaDataContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/container/MetaDataContainer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MetaDataContainer.java 19 Sep 2002 17:09:29 -0000 1.5
+++ MetaDataContainer.java 23 Sep 2002 05:07:55 -0000 1.6
@@ -213,73 +213,4 @@
public void dispose()
{
}
-
- /**
- * This is the command class to initialize a ComponentHandler
- */
- protected static final class InitComponentHandlerCommand implements Command
- {
- private final ComponentHandler m_handler;
- private final Logger m_logger;
-
- protected InitComponentHandlerCommand( ComponentHandler handler, Logger
logger )
- {
- m_handler = handler;
- m_logger = logger;
- }
-
- public void execute()
- throws Exception
- {
- try
- {
- if( !m_handler.isInitialized() )
- {
- m_handler.initialize();
-
- if( m_logger.isDebugEnabled() )
- {
- m_logger.debug( "Initialized Handler " + m_handler );
- }
- }
- }
- catch( Exception e )
- {
- if( m_logger.isErrorEnabled() )
- {
- m_logger.error( "Could not initialize ComponentHandler", e );
- }
-
- throw e;
- }
- }
- }
-
- /**
- * This is the command class to dispose a ComponentHandler
- */
- protected static final class DisposeComponentHandlerCommand implements Command
- {
- private final ComponentHandler m_handler;
- private final Logger m_logger;
-
- protected DisposeComponentHandlerCommand( ComponentHandler handler, Logger
logger )
- {
- m_handler = handler;
- m_logger = logger;
- }
-
- public void execute()
- {
- if( m_handler.isInitialized() )
- {
- m_handler.dispose();
-
- if( m_logger.isDebugEnabled() )
- {
- m_logger.debug( "Disposed of Handler " + m_handler );
- }
- }
- }
- }
}
1.1
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/container/commands/DisposeComponentHandlerCommand.java
Index: DisposeComponentHandlerCommand.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.excalibur.fortress.container.commands;
import org.apache.avalon.framework.logger.*;
import org.apache.excalibur.event.command.Command;
import org.apache.excalibur.fortress.handler.ComponentHandler;
/**
* This is the command class to dispose a ComponentHandler
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/09/23 05:07:55 $
*/
public final class DisposeComponentHandlerCommand implements Command
{
private final ComponentHandler m_handler;
private final Logger m_logger;
public DisposeComponentHandlerCommand( ComponentHandler handler, Logger logger )
{
m_handler = handler;
m_logger = ( null == logger ) ? new NullLogger() : logger;
}
public void execute()
{
if( m_handler.isInitialized() )
{
m_handler.dispose();
if( m_logger.isDebugEnabled() )
{
m_logger.debug( "Disposed of Handler " + m_handler );
}
}
}
}
1.1
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/container/commands/InitializeComponentHandlerCommand.java
Index: InitializeComponentHandlerCommand.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.excalibur.fortress.container.commands;
import org.apache.avalon.framework.logger.*;
import org.apache.excalibur.event.command.Command;
import org.apache.excalibur.fortress.handler.ComponentHandler;
/**
* This is the command class to initialize a ComponentHandler
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/09/23 05:07:55 $
*/
public final class InitializeComponentHandlerCommand implements Command
{
private final ComponentHandler m_handler;
private final Logger m_logger;
public InitializeComponentHandlerCommand( ComponentHandler handler, Logger
logger )
{
m_handler = handler;
m_logger = ( null == logger ) ? new NullLogger() : logger;
}
public void execute()
throws Exception
{
try
{
if( !m_handler.isInitialized() )
{
m_handler.initialize();
if( m_logger.isDebugEnabled() )
{
m_logger.debug( "Initialized Handler " + m_handler );
}
}
}
catch( Exception e )
{
if( m_logger.isErrorEnabled() )
{
m_logger.error( "Could not initialize ComponentHandler", e );
}
throw e;
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>