mcconnell 2003/12/29 06:31:21
Modified: merlin/activation/api/src/java/org/apache/avalon/activation/appliance
Block.java
merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl
AbstractBlock.java DefaultApplianceRepository.java
merlin/composition/api/src/java/org/apache/avalon/composition/data
package.html
merlin/composition/api/src/java/org/apache/avalon/composition/model
ContainmentModel.java
merlin/composition/impl project.xml
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java
merlin/kernel/unit/src/test/org/apache/avalon/merlin/unit/test
MerlinTestCaseTest.java
merlin project.xml
Added: merlin/composition/api/src/java/org/apache/avalon/composition/event
CompositionEvent.java CompositionEventListener.java
ContainmentEvent.java ModelEvent.java package.html
Log:
Resolution of the model removal/addition issue raised by Fernando Padilla (refer
[EMAIL PROTECTED]). The issue concerned the addition of a child appliance following a
prior removal. The problem was related to a reference held by the parent block in its
deployment graph. The solution covered by this commit invokes the retraction of the
block level methods in favour of explicit reactive modification of the block
composition structure using events propergated by the meta model.
Revision Changes Path
1.3 +14 -3
avalon/merlin/activation/api/src/java/org/apache/avalon/activation/appliance/Block.java
Index: Block.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/api/src/java/org/apache/avalon/activation/appliance/Block.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Block.java 4 Dec 2003 00:23:21 -0000 1.2
+++ Block.java 29 Dec 2003 14:31:21 -0000 1.3
@@ -72,18 +72,29 @@
/**
* Add a model as a child to this block.
+ * WARNING: this method may/will be removed
* @param model the model to add as a child of the block
* @return the appliance established to handle the model
* @exception ApplianceException if a error occurs
*/
- Appliance addModel( Model model ) throws ApplianceException;
+ //Appliance addModel( Model model ) throws ApplianceException;
/**
* Add a model as a child to this block.
+ * WARNING: this method may/will be removed
* @param url the model url
* @return the appliance established to handle the model
* @exception ApplianceException if a error occurs
*/
- Appliance addModel( URL url ) throws ApplianceException;
+ //Appliance addModel( URL url ) throws ApplianceException;
+
+ /**
+ * Add a model as a child to this block.
+ * WARNING: this method may/will be removed
+ * @param url the model url
+ * @return the appliance established to handle the model
+ * @exception ApplianceException if a error occurs
+ */
+ //void removeAppliance( String name ) throws ApplianceException;
}
1.9 +88 -25
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java
Index: AbstractBlock.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AbstractBlock.java 22 Dec 2003 21:28:09 -0000 1.8
+++ AbstractBlock.java 29 Dec 2003 14:31:21 -0000 1.9
@@ -56,6 +56,7 @@
import org.apache.avalon.activation.appliance.Appliance;
import org.apache.avalon.activation.appliance.ApplianceException;
+import org.apache.avalon.activation.appliance.ApplianceRuntimeException;
import org.apache.avalon.activation.appliance.ApplianceRepository;
import org.apache.avalon.activation.appliance.AssemblyException;
import org.apache.avalon.activation.appliance.Block;
@@ -68,6 +69,8 @@
import org.apache.avalon.activation.appliance.ServiceContext;
import org.apache.avalon.composition.data.CategoriesDirective;
import org.apache.avalon.composition.logging.LoggingManager;
+import org.apache.avalon.composition.event.CompositionEvent;
+import org.apache.avalon.composition.event.CompositionEventListener;
import org.apache.avalon.composition.model.ContainmentModel;
import org.apache.avalon.composition.model.DependencyModel;
import org.apache.avalon.composition.model.DeploymentModel;
@@ -89,7 +92,7 @@
* @version $Revision$ $Date$
*/
public abstract class AbstractBlock extends AbstractAppliance
- implements Block, Composite
+ implements Block, Composite, CompositionEventListener
{
//-------------------------------------------------------------------
// static
@@ -151,16 +154,17 @@
m_repository.enableLogging( getLogger() );
m_self.setEnabled( true );
- Model[] models = m_context.getContainmentModel().getModels();
- for( int i=0; i<models.length; i++ )
+ ContainmentModel model = m_context.getContainmentModel();
+ synchronized( model )
{
- addModel( models[i] );
+ model.addCompositionListener( this );
+ Model[] models = model.getModels();
+ for( int i=0; i<models.length; i++ )
+ {
+ Appliance appliance = createAppliance( models[i] );
+ m_repository.addAppliance( appliance );
+ }
}
- //for( int i=models.length-1; i>-1; i-- )
- //{
- // Appliance appliance = createAppliance( models[i] );
- // m_repository.addAppliance( appliance );
- //}
}
//-------------------------------------------------------------------
@@ -182,32 +186,77 @@
* @return the appliance established to handle the model
* @exception ApplianceException if a error occurs
*/
- public Appliance addModel( URL url ) throws ApplianceException
+ //public Appliance addModel( URL url ) throws ApplianceException
+ //{
+ // try
+ // {
+ // return addModel(
+ // getContainmentModel().addModel( url ) );
+ // }
+ // catch( Throwable e )
+ // {
+ // final String error =
+ // "Cannot add model due to a model related error.";
+ // throw new ApplianceException( error, e );
+ // }
+ //}
+
+ /**
+ * Add a model as a child to this block.
+ * @param model the model to add as a child of the block
+ * @return the appliance established to handle the model
+ * @exception ApplianceException if a error occurs
+ */
+ //public Appliance addModel( Model model ) throws ApplianceException
+ //{
+ // Appliance appliance = createAppliance( model );
+ // m_repository.addAppliance( appliance );
+ // return appliance;
+ //}
+
+ //-------------------------------------------------------------------
+ // CompositionEventListener
+ //-------------------------------------------------------------------
+
+ /**
+ * Notify the listener that a model has been added to
+ * a source containment model.
+ *
+ * @param event the containment event raised by the
+ * source containment model
+ */
+ public void modelAdded( CompositionEvent event )
{
try
{
- return addModel(
- getContainmentModel().addModel( url ) );
+ getLogger().debug( "event/addition: " + event );
+ Appliance appliance = createAppliance( event.getChild() );
+ m_repository.addAppliance( appliance );
}
catch( Throwable e )
{
final String error =
- "Cannot add model due to a model related error.";
- throw new ApplianceException( error, e );
+ "An error occured while attempting to create an appliance"
+ + " in response to a composition event: " + event;
+ throw new ApplianceRuntimeException( error, e );
}
}
- /**
- * Add a model as a child to this block.
- * @param model the model to add as a child of the block
- * @return the appliance established to handle the model
- * @exception ApplianceException if a error occurs
- */
- public Appliance addModel( Model model ) throws ApplianceException
+ /**
+ * Notify the listener that a model has been removed from
+ * a source containment model.
+ *
+ * @param event the containment event raised by the
+ * source containment model
+ */
+ public void modelRemoved( CompositionEvent event )
{
- Appliance appliance = createAppliance( model );
- m_repository.addAppliance( appliance );
- return appliance;
+ getLogger().debug( "event/removal: " + event );
+ final Model model = event.getChild();
+ final String name = model.getName();
+ final Appliance appliance = getLocalAppliance( name );
+ m_context.getDependencyGraph().remove( appliance );
+ m_repository.removeAppliance( appliance );
}
//-------------------------------------------------------------------
@@ -788,11 +837,13 @@
for( int i=0; i<appliances.length; i++ )
{
Appliance appliance = appliances[i];
+ m_repository.removeAppliance( appliance );
if( appliance instanceof Disposable )
{
((Disposable)appliance).dispose();
}
}
+ m_context.getContainmentModel().removeCompositionListener( this );
m_self.setEnabled( false );
}
}
@@ -941,6 +992,18 @@
graph.add( appliance );
return appliance;
}
+
+ /**
+ * Remove an appliance.
+ * @param model the component model
+ * @return the appliance
+ */
+ //public void removeAppliance( String name ) throws ApplianceException
+ //{
+ // final Appliance appliance = getLocalAppliance( name );
+ // m_context.getDependencyGraph().remove( appliance );
+ // m_repository.removeAppliance( appliance );
+ //}
//-------------------------------------------------------------------
// Object
1.4 +20 -4
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultApplianceRepository.java
Index: DefaultApplianceRepository.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultApplianceRepository.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultApplianceRepository.java 22 Dec 2003 09:06:41 -0000 1.3
+++ DefaultApplianceRepository.java 29 Dec 2003 14:31:21 -0000 1.4
@@ -189,6 +189,16 @@
}
/**
+ * Remove an appliance from the repository.
+ *
+ * @param appliance the appliance to remove
+ */
+ protected void removeAppliance( Appliance appliance )
+ {
+ m_appliances.remove( appliance.getModel().getName() );
+ }
+
+ /**
* Locate an appliance meeting the supplied criteria.
*
* @param dependency a component service dependency
@@ -202,14 +212,20 @@
/**
* Locate an appliance matching the supplied name.
*
- * @param dependency a component service dependency
- * @return the appliance
+ * @param name the appliance name
+ * @return the appliance or null if the appliance name is unknown
*/
public Appliance getLocalAppliance( String name )
{
Appliance appl = (Appliance) m_appliances.get( name );
if( appl == null && m_Logger != null )
- m_Logger.debug( "Can't find '" + name + "' in appliance repository: " +
m_appliances );
+ {
+ m_Logger.debug(
+ "Can't find '"
+ + name
+ + "' in appliance repository: "
+ + m_appliances );
+ }
return appl;
}
}
1.2 +0 -4
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/package.html
Index: package.html
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/data/package.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- package.html 24 Sep 2003 09:31:08 -0000 1.1
+++ package.html 29 Dec 2003 14:31:21 -0000 1.2
@@ -5,9 +5,5 @@
that is focussed towards the creation of a serialized deployment scenario
that can be supplied to a container for execution.
</p>
-<p>
-THIS IS EXPERIMENTAL WORK-IN-PROGRESS AND IS NOT IN USE WITHIN
-THE MERLIN RUNTIME AT THIS TIME.
-</p>
</body>
1.9 +13 -1
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java
Index: ContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ContainmentModel.java 28 Dec 2003 22:30:18 -0000 1.8
+++ ContainmentModel.java 29 Dec 2003 14:31:21 -0000 1.9
@@ -56,6 +56,7 @@
import org.apache.avalon.composition.data.ServiceDirective;
import org.apache.avalon.composition.data.CategoriesDirective;
import org.apache.avalon.composition.data.TargetDirective;
+import org.apache.avalon.composition.event.CompositionEventListener;
import org.apache.avalon.meta.info.DependencyDescriptor;
import org.apache.avalon.meta.info.StageDescriptor;
@@ -191,4 +192,15 @@
*/
void applyTargets( TargetDirective[]targets );
+ /**
+ * Add a composition listener to the model.
+ * @param listener the composition listener
+ */
+ void addCompositionListener( CompositionEventListener listener );
+
+ /**
+ * Remove a composition listener from the model.
+ * @param listener the composition listener
+ */
+ void removeCompositionListener( CompositionEventListener listener );
}
1.10 +7 -0 avalon/merlin/composition/impl/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/project.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- project.xml 18 Dec 2003 01:11:07 -0000 1.9
+++ project.xml 29 Dec 2003 14:31:21 -0000 1.10
@@ -87,6 +87,13 @@
<version>1.1</version>
</dependency>
+ <dependency>
+ <groupId>avalon-util</groupId>
+ <artifactId>avalon-util-exception</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+
<!-- logkit -->
<dependency>
1.12 +85 -2
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
Index: DefaultContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DefaultContainmentModel.java 28 Dec 2003 22:30:18 -0000 1.11
+++ DefaultContainmentModel.java 29 Dec 2003 14:31:21 -0000 1.12
@@ -56,6 +56,8 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.util.LinkedList;
+import java.util.Iterator;
import java.util.Hashtable;
import java.util.ArrayList;
import java.util.Map;
@@ -73,6 +75,8 @@
import org.apache.avalon.composition.data.builder.XMLTargetsCreator;
import org.apache.avalon.composition.data.builder.ContainmentProfileBuilder;
import org.apache.avalon.composition.data.builder.XMLContainmentProfileCreator;
+import org.apache.avalon.composition.event.CompositionEvent;
+import org.apache.avalon.composition.event.CompositionEventListener;
import org.apache.avalon.composition.model.ClassLoaderContext;
import org.apache.avalon.composition.model.ClassLoaderModel;
import org.apache.avalon.composition.model.ContainmentModel;
@@ -99,6 +103,8 @@
import org.apache.avalon.meta.info.StageDescriptor;
import org.apache.avalon.meta.info.Type;
+import org.apache.avalon.util.exception.ExceptionHelper;
+
/**
* Containment model implmentation within which composite models are aggregated
@@ -153,6 +159,8 @@
*/
private CategoriesDirective m_categories;
+ private final LinkedList m_compositionListeners = new LinkedList();
+
//==============================================================
// constructor
//==============================================================
@@ -251,6 +259,32 @@
// ContainmentModel
//==============================================================
+
+ /**
+ * Add a composition listener to the model.
+ * @param listener the composition listener
+ */
+ public void addCompositionListener( CompositionEventListener listener )
+ {
+ synchronized( m_compositionListeners )
+ {
+ m_compositionListeners.add( listener );
+ }
+ }
+
+ /**
+ * Remove a composition listener from the model.
+ * @param listener the composition listener
+ */
+ public void removeCompositionListener( CompositionEventListener listener )
+ {
+ synchronized( m_compositionListeners )
+ {
+ m_compositionListeners.remove( listener );
+ }
+ }
+
+
/**
* Return the logging categories.
* @return the logging categories
@@ -343,10 +377,35 @@
synchronized( m_models )
{
m_models.put( name, model );
+ CompositionEvent event = new CompositionEvent( this, model );
+ fireModelAddedEvent( event );
return model;
}
}
+ private void fireModelAddedEvent( CompositionEvent event )
+ {
+ Iterator iterator = m_compositionListeners.iterator();
+ while( iterator.hasNext() )
+ {
+ final CompositionEventListener listener =
+ (CompositionEventListener) iterator.next();
+ try
+ {
+ listener.modelAdded( event );
+ }
+ catch( Throwable e )
+ {
+ final String message =
+ "A composition listener raised an exception";
+ final String error =
+ ExceptionHelper.packException( message, e, true );
+ getLogger().warn( error );
+ }
+ }
+ }
+
+
/**
* Removal of a named model for the containment model.
*
@@ -357,7 +416,7 @@
{
synchronized( m_models )
{
- Object model = m_models.get( name );
+ Model model = (Model) m_models.get( name );
if( null == name )
{
final String error =
@@ -369,6 +428,30 @@
else
{
m_models.remove( name );
+ CompositionEvent event = new CompositionEvent( this, model );
+ fireModelRemovedEvent( event );
+ }
+ }
+ }
+
+ private void fireModelRemovedEvent( CompositionEvent event )
+ {
+ Iterator iterator = m_compositionListeners.iterator();
+ while( iterator.hasNext() )
+ {
+ final CompositionEventListener listener =
+ (CompositionEventListener) iterator.next();
+ try
+ {
+ listener.modelRemoved( event );
+ }
+ catch( Throwable e )
+ {
+ final String message =
+ "A composition listener raised an exception";
+ final String error =
+ ExceptionHelper.packException( message, e, true );
+ getLogger().warn( error );
}
}
}
1.2 +8 -1
avalon/merlin/kernel/unit/src/test/org/apache/avalon/merlin/unit/test/MerlinTestCaseTest.java
Index: MerlinTestCaseTest.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/unit/src/test/org/apache/avalon/merlin/unit/test/MerlinTestCaseTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MerlinTestCaseTest.java 8 Dec 2003 15:37:14 -0000 1.1
+++ MerlinTestCaseTest.java 29 Dec 2003 14:31:21 -0000 1.2
@@ -106,4 +106,11 @@
Object hello = super.resolve( "/tutorial/hello" );
assertNotNull( "hello", hello );
}
+
+ public void testHelloAquisitionAgain() throws Exception
+ {
+ Object hello = super.resolve( "/tutorial/hello" );
+ assertNotNull( "hello-2", hello );
+ }
+
}
1.16 +1 -1 avalon/merlin/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/project.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- project.xml 26 Dec 2003 09:24:25 -0000 1.15
+++ project.xml 29 Dec 2003 14:31:21 -0000 1.16
@@ -6,7 +6,7 @@
<groupId>merlin</groupId>
<id>merlin</id>
<name>Avalon Merlin</name>
- <currentVersion>3.2</currentVersion>
+ <currentVersion>3.2.1</currentVersion>
<organization>
<name>Apache Software Foundation</name>
1.1
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/event/CompositionEvent.java
Index: CompositionEvent.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 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", "Apache Avalon", "Avalon Framework" 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.avalon.composition.event;
import org.apache.avalon.composition.model.Model;
import org.apache.avalon.composition.model.ContainmentModel;
/**
* A event raised by a containment model as a result of the
* addition or removal of a subsidiary model.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision: 1.1 $ $Date: 2003/12/29 14:31:21 $
*/
public class CompositionEvent extends ContainmentEvent
{
/**
* The model added or removed from the containment model.
*/
private final Model m_child;
/**
* Create a CompositionEvent event.
*
* @param name the base category name
*/
public CompositionEvent( final ContainmentModel source, Model child )
{
super( source );
m_child = child;
}
/**
* Return the child that was added or removed from the containment
* model.
*
* @return the source containment model
*/
public Model getChild()
{
return m_child;
}
public String toString()
{
return "composition-event: [source: ["
+ getContainmentModel()
+ "], child: ["
+ getChild()
+ "]]";
}
}
1.1
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/event/CompositionEventListener.java
Index: CompositionEventListener.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 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", "Apache Avalon", "Avalon Framework" 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.avalon.composition.event;
import java.util.EventListener;
/**
* A listener for model composition changes.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision: 1.1 $ $Date: 2003/12/29 14:31:21 $
*/
public interface CompositionEventListener extends EventListener
{
/**
* Notify the listener that a model has been added to
* a source containment model.
*
* @param event the containment event raised by the
* source containment model
*/
void modelAdded( CompositionEvent event );
/**
* Notify the listener that a model has been removed from
* a source containment model.
*
* @param event the containment event raised by the
* source containment model
*/
void modelRemoved( CompositionEvent event );
}
1.1
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/event/ContainmentEvent.java
Index: ContainmentEvent.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 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", "Apache Avalon", "Avalon Framework" 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.avalon.composition.event;
import org.apache.avalon.composition.model.ContainmentModel;
/**
* A event object that descirbes a containment model related event.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision: 1.1 $ $Date: 2003/12/29 14:31:21 $
*/
public class ContainmentEvent extends ModelEvent
{
/**
* Create a ContainmentEvent instance.
*
* @param model the source containment model
*/
public ContainmentEvent( final ContainmentModel model )
{
super( model );
}
/**
* Return the the containment model that generated the event.
*
* @return the source containment model
*/
public ContainmentModel getContainmentModel()
{
return (ContainmentModel) super.getModel();
}
}
1.1
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/event/ModelEvent.java
Index: ModelEvent.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 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", "Apache Avalon", "Avalon Framework" 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.avalon.composition.event;
import java.util.EventObject;
import org.apache.avalon.composition.model.Model;
/**
* A event object that descirbes a model related event.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision: 1.1 $ $Date: 2003/12/29 14:31:21 $
*/
public abstract class ModelEvent extends EventObject
{
/**
* The source model.
*/
private final Model m_model;
/**
* Create a CategoriesDirective instance.
*
* @param name the base category name
*/
public ModelEvent( final Model model )
{
super( model );
if( null == model )
throw new NullPointerException( "model" );
m_model = model;
}
/**
* Return the the model that generated the event.
*
* @return the source model
*/
public Model getModel()
{
return m_model;
}
}
1.1
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/event/package.html
Index: package.html
===================================================================
<body>
<p>
The event package contains the defintion of a model event and listener.
</p>
</body>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]