notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2112 - in development/main/metro: . activation/providers/avalon/src/main/net/dpml/activation/avalon activation/providers/metro/src/main/net/dpml/activation/metro composition/api/src/main/net/dpml/composition/data composition/api/src/main/net/dpml/composition/model composition/api/src/test/net/dpml/composition/data/test composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl composition/impl/src/test/net/dpml/composition/model/impl meta/api/src/main/net/dpml/meta/info meta/api/src/test/net/dpml/meta/info/test meta/impl/src/main/net/dpml/meta/info/builder/impl meta/impl/src/main/net/dpml/meta/info/writer/impl meta/impl/src/test/net/dpml/meta/compat meta/impl/src/test/net/dpml/meta/legacy meta/tools/src/main/net/dpml/meta/info/ant meta/tools/src/main/net/dpml/meta/info/tags testing/playground/src/main/net/dpml/test/playground
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2112 - in development/main/metro: . activation/providers/avalon/src/main/net/dpml/activation/avalon activation/providers/metro/src/main/net/dpml/activation/metro composition/api/src/main/net/dpml/composition/data composition/api/src/main/net/dpml/composition/model composition/api/src/test/net/dpml/composition/data/test composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl composition/impl/src/test/net/dpml/composition/model/impl meta/api/src/main/net/dpml/meta/info meta/api/src/test/net/dpml/meta/info/test meta/impl/src/main/net/dpml/meta/info/builder/impl meta/impl/src/main/net/dpml/meta/info/writer/impl meta/impl/src/test/net/dpml/meta/compat meta/impl/src/test/net/dpml/meta/legacy meta/tools/src/main/net/dpml/meta/info/ant meta/tools/src/main/net/dpml/meta/info/tags testing/playground/src/main/net/dpml/test/playground
- Date: Mon, 21 Mar 2005 16:16:59 -0500
Author: mcconnell AT dpml.net
Date: Mon Mar 21 16:16:59 2005
New Revision: 2112
Removed:
development/main/metro/composition/api/src/main/net/dpml/composition/data/SelectionDirective.java
development/main/metro/composition/api/src/main/net/dpml/composition/data/StageDirective.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/LifecycleCreateExtension.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/LifecycleDestroyExtension.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/StageModel.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultStageModel.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/SecurityDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ExtensionDescriptorTestCase.java
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/PermissionDescriptorTestCase.java
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/SecurityDescriptorTestCase.java
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/StageDescriptorTestCase.java
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLLegacyCreator.java
development/main/metro/meta/impl/src/test/net/dpml/meta/compat/
development/main/metro/meta/impl/src/test/net/dpml/meta/legacy/
development/main/metro/meta/tools/src/main/net/dpml/meta/info/tags/ExtensionTag.java
development/main/metro/meta/tools/src/main/net/dpml/meta/info/tags/SecurityTag.java
development/main/metro/meta/tools/src/main/net/dpml/meta/info/tags/StageTag.java
development/main/metro/testing/playground/src/main/net/dpml/test/playground/DemoManager.java
development/main/metro/testing/playground/src/main/net/dpml/test/playground/Demonstratable.java
development/main/metro/testing/playground/src/main/net/dpml/test/playground/Exploitable.java
development/main/metro/testing/playground/src/main/net/dpml/test/playground/ExploitationManager.java
Modified:
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractLifestyleManager.java
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java
development/main/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelSelector.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultProfileSelector.java
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
development/main/metro/composition/impl/src/test/net/dpml/composition/model/impl/SimpleDeploymentModel.java
development/main/metro/index.xml
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/TypeTestCase.java
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
development/main/metro/meta/impl/src/main/net/dpml/meta/info/writer/impl/XMLTypeWriter.java
development/main/metro/meta/tools/src/main/net/dpml/meta/info/ant/MetaTask.java
development/main/metro/meta/tools/src/main/net/dpml/meta/info/tags/TypeTag.java
development/main/metro/testing/playground/src/main/net/dpml/test/playground/SimpleComponent.java
Log:
Remove the permission, security, extension and stage descriptors from the
meta type definition and update tools, composition and activation to reflect
this (i.e. back to the core component model stuff).
Modified:
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractLifestyleManager.java
==============================================================================
---
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractLifestyleManager.java
(original)
+++
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractLifestyleManager.java
Mon Mar 21 16:16:59 2005
@@ -28,17 +28,13 @@
import net.dpml.activation.ComponentFactory;
import net.dpml.composition.model.ComponentModel;
-import net.dpml.composition.model.StageModel;
import net.dpml.composition.provider.LifestyleManager;
import net.dpml.logging.Logger;
import net.dpml.context.Context;
import net.dpml.context.impl.DefaultContext;
-import org.apache.avalon.lifecycle.Accessor;
-
import net.dpml.meta.info.InfoDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
@@ -115,8 +111,7 @@
*/
public Object resolve() throws Exception
{
- Object instance = handleResolve();
- return applyExtensionStages( instance, true );
+ return handleResolve();
}
/**
@@ -137,16 +132,6 @@
*/
public void release( Object instance )
{
- try
- {
- applyExtensionStages( instance, false );
- }
- catch( Throwable e )
- {
- final String error =
- "Ignoring error returned from release extension.";
- getLogger().error( error, e );
- }
handleRelease( instance );
}
@@ -214,6 +199,19 @@
}
}
+ //-------------------------------------------------------------------
+ // Object
+ //-------------------------------------------------------------------
+
+ public void finalize()
+ {
+ decommission();
+ }
+
+ //-------------------------------------------------------------------
+ // internal
+ //-------------------------------------------------------------------
+
private class StrongReference extends WeakReference
{
private final Object m_instance;
@@ -230,89 +228,4 @@
}
}
- private Object applyExtensionStages( Object instance, boolean flag )
- throws Exception
- {
- StageDescriptor[] stages = m_model.getType().getStages();
- for( int i=0; i<stages.length; i++ )
- {
- StageDescriptor descriptor = stages[i];
- StageModel stage = m_model.getStageModel( descriptor );
-
- ComponentModel provider = getStageProvider( stage );
- Class c = provider.getDeploymentClass();
-
- if( Accessor.class.isAssignableFrom( c ) )
- {
- Accessor handler = (Accessor) provider.resolve();
- try
- {
- Map map = m_model.getContextModel().getContextMap();
- Context context = new DefaultContext( map );
- if( flag )
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying access stage to: "
+ id );
- }
- handler.access( instance, new AvalonContext( context
) );
- }
- else
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying release stage to: "
+ id );
- }
- handler.release( instance, new AvalonContext(
context ) );
- }
- }
- catch( Throwable e )
- {
- final String error =
- REZ.getString(
- "lifecycle.stage.accessor.error",
- stage.getStage().getKey() );
- if( flag )
- {
- throw new LifecycleException( error, e );
- }
- else
- {
- getLogger().warn( error, e );
- }
- }
- finally
- {
- provider.release( handler );
- }
- }
- }
- return instance;
- }
-
- private ComponentModel getStageProvider( StageModel stage ) throws
LifecycleException
- {
- try
- {
- return (ComponentModel) stage.getProvider();
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to resolve access stage provider.";
- throw new LifecycleException( error, e );
- }
- }
-
- //-------------------------------------------------------------------
- // Object
- //-------------------------------------------------------------------
-
- public void finalize()
- {
- decommission();
- }
-
}
Modified:
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java
==============================================================================
---
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java
(original)
+++
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java
Mon Mar 21 16:16:59 2005
@@ -27,9 +27,6 @@
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContextModel;
import net.dpml.composition.model.DeploymentModel;
-import net.dpml.composition.model.LifecycleCreateExtension;
-import net.dpml.composition.model.LifecycleDestroyExtension;
-import net.dpml.composition.model.StageModel;
import net.dpml.configuration.Configuration;
@@ -43,14 +40,10 @@
import net.dpml.logging.Logger;
-import net.dpml.meta.info.StageDescriptor;
-
import net.dpml.parameters.Parameters;
import net.dpml.service.ServiceManager;
-import org.apache.avalon.lifecycle.Creator;
-
/**
* A factory enabling the establishment of component instances.
@@ -129,49 +122,38 @@
getLogger().debug( message );
}
- try
- {
- applyCreateStage( instance, false );
- }
- catch( Throwable e )
+ if( instance instanceof
org.apache.avalon.framework.activity.Startable )
{
- // will not happen
- }
- finally
- {
- if( instance instanceof
org.apache.avalon.framework.activity.Startable )
+ getLogger().debug( "applying shutdown" );
+ try
{
- getLogger().debug( "applying shutdown" );
- try
- {
- ContainerUtil.stop( instance );
- }
- catch( Throwable e )
+ ContainerUtil.stop( instance );
+ }
+ catch( Throwable e )
+ {
+ if( getLogger().isWarnEnabled() )
{
- if( getLogger().isWarnEnabled() )
- {
- final String warning =
- "Ignoring component source shutdown error.";
- getLogger().warn( warning, e );
- }
+ final String warning =
+ "Ignoring component source shutdown error.";
+ getLogger().warn( warning, e );
}
}
+ }
- if( instance instanceof
org.apache.avalon.framework.activity.Disposable )
+ if( instance instanceof
org.apache.avalon.framework.activity.Disposable )
+ {
+ getLogger().debug( "applying disposal" );
+ try
{
- getLogger().debug( "applying disposal" );
- try
- {
- ContainerUtil.dispose( instance );
- }
- catch( Throwable e )
+ ContainerUtil.dispose( instance );
+ }
+ catch( Throwable e )
+ {
+ if( getLogger().isWarnEnabled() )
{
- if( getLogger().isWarnEnabled() )
- {
- final String warning =
- "Ignoring component source disposal error.";
- getLogger().warn( warning, e );
- }
+ final String warning =
+ "Ignoring component source disposal error.";
+ getLogger().warn( warning, e );
}
}
}
@@ -248,12 +230,6 @@
}
//
- // handle lifecycle extensions
- //
-
- applyCreateStage( instance, true );
-
- //
// complete intialization
//
@@ -313,18 +289,6 @@
throw new LifecycleException( error, e );
}
}
-
- /*
- DeliveryDescriptor delivery =
m_model.getContextModel().getDeliveryDescriptor();
- if( null == delivery )
- {
- return null;
- }
- else
- {
- return delivery.getCastingInterfaceClass();
- }
- */
}
private Object getTargetContext()
@@ -622,277 +586,4 @@
throw new LifecycleException( error, e );
}
}
-
- private void applyCreateStage( Object instance, boolean flag )
- throws LifecycleException
- {
- StageDescriptor[] stages = m_model.getType().getStages();
- if( ( stages.length > 0 ) && getLogger().isDebugEnabled() )
- {
- getLogger().debug( "stage count: " + stages.length );
- }
-
- for( int i=0; i<stages.length; i++ )
- {
- StageDescriptor stage = stages[i];
- ComponentModel provider = getStageProvider( stage );
- Class c = provider.getDeploymentClass();
-
- if( Creator.class.isAssignableFrom( c ) )
- {
-
- getLogger().debug( "processing create: " + c.getName() );
-
- Creator handler = getCreator( provider );
- org.apache.avalon.framework.context.Context context =
- (org.apache.avalon.framework.context.Context)
getTargetContext();
-
- try
- {
- if( flag )
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying create stage to: "
+ id );
- }
- try
- {
- handler.create( instance, context );
- }
- catch( Throwable e )
- {
- final String error =
- "Create stage error raised by extension.";
- throw new LifecycleException( error, e );
- }
- }
- else
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying destroy stage to: "
+ id );
- }
- handler.destroy( instance, context );
- }
- }
- catch( Throwable e )
- {
- final String error =
- REZ.getString(
- "lifecycle.error.stage.creator", stage.getKey() );
- if( flag )
- {
- throw new LifecycleException( error, e );
- }
- else
- {
- getLogger().warn( error, e );
- }
- }
- finally
- {
- provider.release( handler );
- }
- }
-
- if( flag && LifecycleCreateExtension.class.isAssignableFrom( c )
)
- {
- LifecycleCreateExtension handler =
- getLifecycleCreateExtension( provider );
-
- try
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying model create stage to:
" + id );
- }
- handler.create( m_model, stage, instance );
- }
- catch( Throwable e )
- {
- final String error =
- "Create stage extension error.";
- throw new LifecycleException( error, e );
- }
- finally
- {
- provider.release( handler );
- }
- }
- else if( !flag &&
LifecycleDestroyExtension.class.isAssignableFrom( c ) )
- {
- LifecycleDestroyExtension handler =
- getLifecycleDestroyExtension( provider );
-
- try
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying model destroy stage to:
" + id );
- }
- handler.destroy( m_model, stage, instance );
- }
- catch( Throwable e )
- {
- if( getLogger().isWarnEnabled() )
- {
- final String error =
- "Ignoring destroy stage error";
- getLogger().warn( error, e );
- }
- }
- finally
- {
- provider.release( handler );
- }
- }
- }
- }
-
- private org.apache.avalon.lifecycle.Creator getCreator( DeploymentModel
provider )
- throws LifecycleException
- {
- try
- {
- return (org.apache.avalon.lifecycle.Creator) provider.resolve();
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to resolve creation stage provider.";
- throw new LifecycleException( error, e );
- }
- }
-
- private LifecycleCreateExtension getLifecycleCreateExtension(
- DeploymentModel provider ) throws LifecycleException
- {
- try
- {
- return (LifecycleCreateExtension) provider.resolve();
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to resolve lifecycle creation extension provider.";
- throw new LifecycleException( error, e );
- }
- }
-
- private LifecycleDestroyExtension getLifecycleDestroyExtension(
- DeploymentModel provider ) throws LifecycleException
- {
- try
- {
- return (LifecycleDestroyExtension) provider.resolve();
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to resolve lifecycle destroy extension provider.";
- throw new LifecycleException( error, e );
- }
- }
-
- private ComponentModel getStageProvider( StageDescriptor stage )
- throws IllegalStateException
- {
- final String key = stage.getKey();
- StageModel model = m_model.getStageModel( stage );
- DeploymentModel provider = model.getProvider();
- if( provider instanceof ComponentModel )
- {
- return (ComponentModel) provider;
- }
- else
- {
- final String error =
- REZ.getString(
- "lifecycle.error.invalid-stage-provider",
- key );
- throw new IllegalStateException( error );
- }
- }
-/* Never used
- private void applyContext(
- final Object instance, DeliveryDescriptor delivery, final Object
context )
- throws LifecycleException
- {
- if( null == context ) return;
-
- final ContextModel model = m_model.getContextModel();
- if( delivery instanceof NativeDeliveryDescriptor )
- {
- getLogger().debug( "applying context" );
-
- //
- // its classic context
- //
-
- try
- {
- ContainerUtil.contextualize( instance, context );
- }
- catch( Throwable e )
- {
- final String error =
- REZ.getString(
- "lifecycle.error.avalon-contextualization",
- m_model.getQualifiedName() );
- throw new LifecycleException( error, e );
- }
- }
- else if( delivery instanceof StagedDeliveryDescriptor )
- {
- getLogger().debug( "applying custom context" );
- final DeploymentModel provider = model.getProvider();
- try
- {
- ContextualizationHandler handler =
- (ContextualizationHandler) provider.resolve();
- handler.contextualize( instance, (Context) context );
- }
- catch( Throwable e )
- {
- final String error =
- REZ.getString(
- "lifecycle.error.custom-contextualization",
- m_model.getQualifiedName(),
- provider.toString() );
- throw new LifecycleException( error, e );
- }
- }
- else
- {
- final String error =
- "Unrecognized delivery strategy: ["
- + delivery.getClass().getName()
- + "].";
- throw new IllegalStateException( error );
- }
- }
-
- private void printClassLoader( String name, ClassLoader loader )
- {
- System.out.println( "## " + name + " " + System.identityHashCode(
loader ) );
- if( loader instanceof URLClassLoader )
- {
- URL[] urls = ((URLClassLoader)loader).getURLs();
- for( int i=0; i<urls.length; i++ )
- {
- System.out.println( " (" + i + ") " + m_system.toString(
urls[i] ) );
- }
- }
- ClassLoader parent = loader.getParent();
- if( parent != null )
- {
- printClassLoader( name + ">", parent );
- }
- }
-*/
-
}
Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
Mon Mar 21 16:16:59 2005
@@ -37,10 +37,7 @@
import net.dpml.composition.model.ContextModel;
import net.dpml.composition.model.ContextualizationHandler;
import net.dpml.composition.model.DeploymentModel;
-import net.dpml.composition.model.LifecycleCreateExtension;
-import net.dpml.composition.model.LifecycleDestroyExtension;
import net.dpml.composition.model.ModelException;
-import net.dpml.composition.model.StageModel;
import net.dpml.configuration.Configurable;
import net.dpml.configuration.Configuration;
@@ -58,8 +55,6 @@
import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
-import net.dpml.meta.info.StageDescriptor;
-
import net.dpml.parameters.Parameterizable;
import net.dpml.parameters.Parameters;
@@ -160,49 +155,38 @@
getLogger().debug( message );
}
- try
+ if( instance instanceof Startable )
{
- applyCreateStage( instance, false );
- }
- catch( Throwable e )
- {
- // will not happen
- }
- finally
- {
- if( instance instanceof Startable )
+ getLogger().debug( "applying shutdown" );
+ try
{
- getLogger().debug( "applying shutdown" );
- try
- {
- ContainerUtil.stop( instance );
- }
- catch( Throwable e )
+ ContainerUtil.stop( instance );
+ }
+ catch( Throwable e )
+ {
+ if( getLogger().isWarnEnabled() )
{
- if( getLogger().isWarnEnabled() )
- {
- final String warning =
- "Ignoring component source shutdown error.";
- getLogger().warn( warning, e );
- }
+ final String warning =
+ "Ignoring component source shutdown error.";
+ getLogger().warn( warning, e );
}
}
+ }
- if( instance instanceof Disposable )
+ if( instance instanceof Disposable )
+ {
+ getLogger().debug( "applying disposal" );
+ try
{
- getLogger().debug( "applying disposal" );
- try
- {
- ContainerUtil.dispose( instance );
- }
- catch( Throwable e )
+ ContainerUtil.dispose( instance );
+ }
+ catch( Throwable e )
+ {
+ if( getLogger().isWarnEnabled() )
{
- if( getLogger().isWarnEnabled() )
- {
- final String warning =
- "Ignoring component source disposal error.";
- getLogger().warn( warning, e );
- }
+ final String warning =
+ "Ignoring component source disposal error.";
+ getLogger().warn( warning, e );
}
}
}
@@ -272,12 +256,6 @@
}
//
- // handle lifecycle extensions
- //
-
- applyCreateStage( instance, true );
-
- //
// complete intialization
//
@@ -549,127 +527,6 @@
}
}
- private void applyCreateStage( Object instance, boolean flag )
- throws LifecycleException
- {
- StageDescriptor[] stages = m_model.getType().getStages();
- if( ( stages.length > 0 ) && getLogger().isDebugEnabled() )
- {
- getLogger().debug( "stage count: " + stages.length );
- }
-
- for( int i=0; i<stages.length; i++ )
- {
- StageDescriptor stage = stages[i];
- ComponentModel provider = getStageProvider( stage );
- Class c = provider.getDeploymentClass();
-
- if( flag && LifecycleCreateExtension.class.isAssignableFrom( c )
)
- {
- LifecycleCreateExtension handler =
- getLifecycleCreateExtension( provider );
-
- try
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying model create stage to:
" + id );
- }
- handler.create( m_model, stage, instance );
- }
- catch( Throwable e )
- {
- final String error =
- "Create stage extension error.";
- throw new LifecycleException( error, e );
- }
- finally
- {
- provider.release( handler );
- }
- }
- else if( !flag &&
LifecycleDestroyExtension.class.isAssignableFrom( c ) )
- {
- LifecycleDestroyExtension handler =
- getLifecycleDestroyExtension( provider );
-
- try
- {
- if( getLogger().isDebugEnabled() )
- {
- int id = System.identityHashCode( instance );
- getLogger().debug( "applying model destroy stage to:
" + id );
- }
- handler.destroy( m_model, stage, instance );
- }
- catch( Throwable e )
- {
- if( getLogger().isWarnEnabled() )
- {
- final String error =
- "Ignoring destroy stage error";
- getLogger().warn( error, e );
- }
- }
- finally
- {
- provider.release( handler );
- }
- }
- }
- }
-
- private LifecycleCreateExtension getLifecycleCreateExtension(
- DeploymentModel provider ) throws LifecycleException
- {
- try
- {
- return (LifecycleCreateExtension) provider.resolve();
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to resolve lifecycle creation extension provider.";
- throw new LifecycleException( error, e );
- }
- }
-
- private LifecycleDestroyExtension getLifecycleDestroyExtension(
- DeploymentModel provider ) throws LifecycleException
- {
- try
- {
- return (LifecycleDestroyExtension) provider.resolve();
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to resolve lifecycle destroy extension provider.";
- throw new LifecycleException( error, e );
- }
- }
-
- private ComponentModel getStageProvider( StageDescriptor stage )
- throws IllegalStateException
- {
- final String key = stage.getKey();
- StageModel model = m_model.getStageModel( stage );
- DeploymentModel provider = model.getProvider();
- if( provider instanceof ComponentModel )
- {
- return (ComponentModel) provider;
- }
- else
- {
- final String error =
- REZ.getString(
- "lifecycle.error.invalid-stage-provider",
- key );
- throw new IllegalStateException( error );
- }
- }
-
private void applyContext(
final Object instance, DeliveryDescriptor delivery, final Object
context )
throws LifecycleException
Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
Mon Mar 21 16:16:59 2005
@@ -139,11 +139,6 @@
*/
private DependencyDirective[] m_dependencies;
- /**
- * The stage directives.
- */
- private StageDirective[] m_stages;
-
//--------------------------------------------------------------------------
// constructor
//--------------------------------------------------------------------------
@@ -159,7 +154,7 @@
throws NullArgumentException
{
this(
- name, DeploymentProfile.DEFAULT, InfoDescriptor.UNDEFINED,
classname, null, null, null, null,
+ name, DeploymentProfile.DEFAULT, InfoDescriptor.UNDEFINED,
classname, null, null, null,
null, null, Mode.IMPLICIT );
}
@@ -179,7 +174,6 @@
template.m_categories,
template.m_context,
template.m_dependencies,
- template.m_stages,
template.m_parameters,
template.m_configuration,
Mode.EXPLICIT );
@@ -193,7 +187,6 @@
final CategoriesDirective categories,
final ContextDirective context,
final DependencyDirective[] dependencies,
- final StageDirective[] stages,
final Parameters parameters,
final Configuration config,
final Mode mode )
@@ -221,15 +214,6 @@
{
m_dependencies = dependencies;
}
-
- if( null == stages )
- {
- m_stages = new StageDirective[0];
- }
- else
- {
- m_stages = stages;
- }
}
//--------------------------------------------------------------------------
@@ -298,36 +282,6 @@
}
/**
- * Return the stage directives.
- *
- * @return the set of StageDirective statements for the profile.
- */
- public StageDirective[] getStageDirectives()
- {
- return m_stages;
- }
-
- /**
- * Return the dependency directive for a supplied key.
- *
- * @return the matching DependencyDirective (possibly null if
- * no directive is declared for the given key)
- */
- public StageDirective getStageDirective( final String key )
- {
- StageDirective[] directives = getStageDirectives();
- for( int i=0; i<directives.length; i++ )
- {
- StageDirective directive = directives[i];
- if( directive.getKey().equals( key ) )
- {
- return directive;
- }
- }
- return null;
- }
-
- /**
* Return the Parameters for the profile.
*
* @return the Parameters for Component (if any).
Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java
Mon Mar 21 16:16:59 2005
@@ -21,7 +21,6 @@
import net.dpml.configuration.Configuration;
import net.dpml.parameters.Parameters;
import net.dpml.meta.info.DependencyDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
/**
@@ -188,22 +187,6 @@
DependencyModel getDependencyModel( DependencyDescriptor dependency );
/**
- * Return the stage models for this deployment model.
- *
- * @return the stage models
- */
- StageModel[] getStageModels();
-
- /**
- * Return a stage model matching the supplied descriptor or null
- * if no match found.
- *
- * @param stage the stage descriptor
- * @return the matching stage model
- */
- StageModel getStageModel( StageDescriptor stage );
-
- /**
* Return the set of services produced by the model as a array of classes.
*
* @return the service classes
Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java
Mon Mar 21 16:16:59 2005
@@ -22,7 +22,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.logging.Logger;
@@ -112,13 +111,6 @@
/**
* Return TRUE is this model is capable of supporting a supplied
- * stage dependency.
- * @return true if this model can fulfill the dependency
- */
- boolean isaCandidate( StageDescriptor stage );
-
- /**
- * Return TRUE is this model is capable of supporting a supplied
* service.
*
* @param reference the service reference descriptor
Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java
Mon Mar 21 16:16:59 2005
@@ -20,7 +20,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
/**
* The model repository interface declares operations through which
@@ -66,15 +65,6 @@
DependencyDescriptor dependency );
/**
- * Locate all models meeting the supplied criteria.
- *
- * @param stage a component stage dependency
- * @return the candidate models
- */
- DeploymentModel[] getCandidateProviders(
- StageDescriptor stage );
-
- /**
* Locate all models meeting the supplied service reference criteria.
*
* @param reference a service reference
@@ -84,14 +74,6 @@
ReferenceDescriptor reference );
/**
- * Locate a model meeting the supplied criteria.
- *
- * @param stage a component stage dependency
- * @return the model
- */
- DeploymentModel getModel( StageDescriptor stage );
-
- /**
* Add an model to the repository.
*
* @param model the model to add
Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java
Mon Mar 21 16:16:59 2005
@@ -20,7 +20,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
/**
* Interface implemented by a service selection implementation mechanism.
Classes
@@ -50,15 +49,6 @@
/**
* Returns the preferred model from an available selection of candidates
* @param models the set of candidate models
- * @param stage the stage dependency
- * @return the preferred provider or null if no satisfactory provider
- * can be established
- */
- DeploymentModel select( DeploymentModel[] models, StageDescriptor stage
);
-
- /**
- * Returns the preferred model from an available selection of candidates
- * @param models the set of candidate models
* @param reference the versioned service reference
* @return the preferred provider or null if no satisfactory provider
* can be established
Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java
Mon Mar 21 16:16:59 2005
@@ -22,7 +22,6 @@
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
-import net.dpml.meta.info.StageDescriptor;
/**
* Interface defining the contract for profile selection.
@@ -48,17 +47,6 @@
* candidates profiles.
*
* @param profiles the set of candidate profiles
- * @param stage a stage dependency
- * @return the preferred extension provider profile or null if
- * no satisfactory profile can be established
- */
- DeploymentProfile select( DeploymentProfile[] profiles, StageDescriptor
stage );
-
- /**
- * Returns the preferred profile from an available selection of
- * candidates profiles.
- *
- * @param profiles the set of candidate profiles
* @param reference a service reference
* @return the preferred profile or null if
* no satisfactory profile can be established
Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java
Mon Mar 21 16:16:59 2005
@@ -23,7 +23,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
/**
@@ -100,13 +99,6 @@
*/
Type[] getTypes( ReferenceDescriptor reference, boolean search );
- /**
- * Locate the set of component types that provide the supplied extension.
- * @param stage a stage descriptor
- * @return a set of types that support the supplied stage
- */
- Type[] getTypes( StageDescriptor stage );
-
/**
* Return the set of deployment profiles for the supplied type. An
* implementation is required to return a array of types > 0 in length
Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ComponentProfileTestCase.java
Mon Mar 21 16:16:59 2005
@@ -25,7 +25,6 @@
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ImportDirective;
import net.dpml.composition.data.Mode;
-import net.dpml.composition.data.StageDirective;
import net.dpml.configuration.Configuration;
@@ -55,7 +54,6 @@
private Configuration m_configuration;
private ContextDirective m_context;
private DependencyDirective[] m_dependencies;
- private StageDirective[] m_stages;
private String m_name;
private String m_classname;
private int m_collection;
@@ -73,7 +71,6 @@
new ContextDirective( getClass().getName(), new ImportDirective[0]
);
m_configuration = new DefaultConfiguration("test");
m_dependencies = new DependencyDirective[0];
- m_stages = new StageDirective[0];
m_parameters = new DefaultParameters( System.getProperties(), true );
m_activation = DeploymentProfile.ENABLED;
m_mode = Mode.IMPLICIT;
@@ -85,7 +82,7 @@
{
ComponentProfile profile = new ComponentProfile(
m_name, m_activation, m_collection, m_classname, m_categories,
- m_context, m_dependencies, m_stages, m_parameters,
+ m_context, m_dependencies, m_parameters,
m_configuration, m_mode );
assertEquals( "name", m_name, profile.getName() );
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
Mon Mar 21 16:16:59 2005
@@ -38,7 +38,6 @@
import net.dpml.composition.data.ImportDirective;
import net.dpml.composition.data.Mode;
import net.dpml.composition.data.Parameter;
-import net.dpml.composition.data.StageDirective;
import net.dpml.meta.info.InfoDescriptor;
@@ -106,8 +105,6 @@
getContextDirective( config.getChild( "context", false ) );
final DependencyDirective[] dependencies =
getDependencyDirectives( config.getChild( "dependencies" ) );
- final StageDirective[] stages =
- getStageDirectives( config.getChild( "stages" ) );
final Parameters params =
getParameters( config.getChild( "parameters", false ) );
final Configuration configuration =
@@ -115,7 +112,7 @@
return new ComponentProfile(
name, activation, collection, classname, categories, context,
dependencies,
- stages, params, configuration, Mode.EXPLICIT );
+ params, configuration, Mode.EXPLICIT );
}
/**
@@ -155,30 +152,6 @@
return new DependencyDirective( key, source );
}
- protected StageDirective[] getStageDirectives( Configuration config )
- throws ConfigurationException
- {
- if( config != null )
- {
- ArrayList list = new ArrayList();
- Configuration[] deps = config.getChildren( "stage" );
- for( int i=0; i<deps.length; i++ )
- {
- list.add( getStageDirective( deps[i] ) );
- }
- return (StageDirective[]) list.toArray( new StageDirective[0] );
- }
- return new StageDirective[0];
- }
-
- protected StageDirective getStageDirective( Configuration config )
- throws ConfigurationException
- {
- final String key = config.getAttribute( "key" );
- final String source = config.getAttribute( "source", null );
- return new StageDirective( key, source );
- }
-
protected Parameters getParameters( Configuration config )
throws ParameterException
{
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
Mon Mar 21 16:16:59 2005
@@ -30,7 +30,6 @@
import net.dpml.composition.data.DependencyDirective;
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.Mode;
-import net.dpml.composition.data.StageDirective;
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContextModel;
@@ -38,7 +37,6 @@
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ModelRuntimeException;
-import net.dpml.composition.model.StageModel;
import net.dpml.composition.provider.ComponentContext;
@@ -62,7 +60,6 @@
import net.dpml.meta.info.InfoDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
import net.dpml.parameters.Parameterizable;
@@ -109,8 +106,6 @@
private final DependencyModel[] m_dependencies;
- private final StageModel[] m_stages;
-
private final DefaultState m_assembly =
new DefaultState();
// --------------------------------------------------------------
@@ -227,24 +222,6 @@
.getPartitionName(), context.getProfile().getName(),
descriptor, directive );
}
-
- //
- // create the stage models for subsequent assembly
- // management
- //
-
- StageDescriptor[] stages = m_context.getType().getStages();
- m_stages = new DefaultStageModel[stages.length];
-
- for ( int i = 0; i < stages.length; i++ )
- {
- StageDescriptor descriptor = stages[i];
- StageDirective directive = context.getComponentProfile()
- .getStageDirective( descriptor.getKey() );
- m_stages[i] = new DefaultStageModel( context.getLogger()
- .getChildLogger( "stages" ),
- context.getPartitionName(), descriptor, directive );
- }
}
/**
@@ -316,24 +293,6 @@
*/
public boolean isAssembled()
{
- return ( isStageAssembled() && isServiceAssembled() );
- }
-
- private boolean isStageAssembled()
- {
- StageModel[] stages = getStageModels();
- for ( int i = 0; i < stages.length; i++ )
- {
- if ( null == stages[i].getProvider() )
- {
- return false;
- }
- }
- return true;
- }
-
- private boolean isServiceAssembled()
- {
DependencyModel[] dependencies = getDependencyModels();
for ( int i = 0; i < dependencies.length; i++ )
{
@@ -362,12 +321,6 @@
}
final ArrayList list = new ArrayList();
- StageModel[] stages = getStageModels();
- for ( int i = 0; i < stages.length; i++ )
- {
- StageModel stage = stages[i];
- list.add( stage.getProvider() );
- }
DependencyModel[] dependencies = getDependencyModels();
for ( int i = 0; i < dependencies.length; i++ )
{
@@ -410,19 +363,6 @@
}
/**
- * Return TRUE is this model is capable of supporting a supplied stage
- * dependency.
- *
- * @param stage
- * the stage descriptor
- * @return TRUE if this model can fulfill the stage dependency
- */
- public boolean isaCandidate( StageDescriptor stage )
- {
- return m_context.getType().getExtension( stage ) != null;
- }
-
- /**
* Return TRUE is this model is capable of supporting a supplied service.
*
* @param reference
@@ -855,7 +795,7 @@
*
* @param dependency
* the dependency descriptor
- * @return the matching stage model
+ * @return the matching dependency model
*/
public DependencyModel getDependencyModel( DependencyDescriptor
dependency )
{
@@ -872,38 +812,6 @@
}
/**
- * Return the stage models for this component type.
- *
- * @return the stage models
- */
- public StageModel[] getStageModels()
- {
- return m_stages;
- }
-
- /**
- * Return a stage model matching the supplied descriptor. If no stage
model
- * matches the supplied descriptor the implementation will return null.
- *
- * @param stage
- * the stage descriptor
- * @return the matching stage model
- */
- public StageModel getStageModel( StageDescriptor stage )
- {
- StageModel[] stages = getStageModels();
- for ( int i = 0; i < stages.length; i++ )
- {
- StageModel model = stages[i];
- if ( stage.equals( model.getStage() ) )
- {
- return model;
- }
- }
- return null;
- }
-
- /**
* Return the set of services produced by the model as a array of
classes.
*
* @return the service classes
@@ -925,20 +833,6 @@
list.add( getComponentClass( classLoader, classname ) );
}
- //
- // if the component is an extension then add all implemented
- // interfaces
- //
-
- if ( getType().getExtensions().length > 0 )
- {
- Class[] interfaces = getDeploymentClass().getInterfaces();
- for ( int i = 0; i < interfaces.length; i++ )
- {
- list.add( interfaces[i] );
- }
- }
-
return (Class[]) list.toArray( new Class[0] );
}
@@ -970,9 +864,9 @@
}
}
- // ==============================================================
+ // --------------------------------------------------------------
// implementation
- // ==============================================================
+ // --------------------------------------------------------------
/**
* Test to determin if the first constructor supports the context base
class
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
Mon Mar 21 16:16:59 2005
@@ -56,7 +56,6 @@
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ModelRepository;
import net.dpml.composition.model.ServiceModel;
-import net.dpml.composition.model.StageModel;
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.provider.ComponentContext;
@@ -78,7 +77,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
import net.dpml.parameters.Parameters;
@@ -339,18 +337,6 @@
return false;
}
- /**
- * Return TRUE is this model is capable of supporting a supplied
- * stage dependency. The containment model implementation will
- * allways return FALSE.
- *
- * @return FALSE containers don't export stage handling
- */
- public boolean isaCandidate( StageDescriptor stage )
- {
- return false;
- }
-
/**
* Returns the assembled state of the model.
* @return true if this model is assembled
@@ -439,12 +425,6 @@
private void dissasemble( ComponentModel model )
{
model.getContextModel().setProvider( null );
- StageModel[] stages = model.getStageModels();
- for( int i=0; i<stages.length; i++ )
- {
- StageModel stage = stages[i];
- stage.setProvider( null );
- }
DependencyModel[] dependencies = model.getDependencyModels();
for( int i=0; i<dependencies.length; i++ )
{
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
Mon Mar 21 16:16:59 2005
@@ -34,7 +34,6 @@
import net.dpml.composition.model.ModelSelector;
import net.dpml.composition.model.ProfileSelector;
import net.dpml.composition.model.ProviderNotFoundException;
-import net.dpml.composition.model.StageModel;
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.TypeUnknownException;
@@ -47,7 +46,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
/**
@@ -91,37 +89,6 @@
ModelRepository repository = m_context.getModelRepository();
//
- // locate and resolve the stage providers
- //
-
- StageModel[] stages = model.getStageModels();
- for ( int i = 0; i < stages.length; i++ )
- {
- StageModel stage = stages[i];
- if( null == stage.getProvider() )
- {
- try
- {
- subjects.add( model );
- DeploymentModel provider = findExtensionProvider(
- repository, stage, subjects );
- stage.setProvider( provider );
- }
- catch ( Throwable e )
- {
- final String error = "Unable to assemble component: "
- + model
- + " due to a component extension handler
establishment failure.";
- throw new AssemblyException( error, e );
- }
- finally
- {
- subjects.remove( model );
- }
- }
- }
-
- //
// locate and resolve the service providers
//
@@ -328,101 +295,6 @@
}
}
- private DeploymentProfile[] findExtensionProfiles( StageDescriptor stage
)
- {
- TypeRepository repository = m_context.getClassLoaderModel()
- .getTypeRepository();
- Type[] types = repository.getTypes( stage );
- try
- {
- return getProfiles( repository, types );
- }
- catch ( TypeUnknownException tue )
- {
- // will not happen
- final String error = "An irrational condition has occured.";
- throw new ModelRuntimeException( error, tue );
- }
- }
-
- private DeploymentModel findExtensionProvider( ModelRepository
repository,
- StageDescriptor stage, List subjects ) throws AssemblyException
- {
- DeploymentModel[] candidates = repository.getCandidateProviders(
stage );
- ModelSelector selector = new DefaultModelSelector();
- DeploymentModel model = selector.select( candidates, stage );
- if( model != null )
- {
- assembleModel( model, subjects );
- return model;
- }
-
- //
- // otherwise, check for any packaged profiles that
- // we could use to construct the model
- //
-
- DeploymentProfile[] profiles = findExtensionProfiles( stage );
- ProfileSelector profileSelector = new DefaultProfileSelector();
- DeploymentProfile profile = profileSelector.select( profiles, stage
);
- if( profile != null )
- {
- try
- {
- DeploymentModel solution = m_model
- .createDeploymentModel( profile );
- assembleModel( solution, subjects );
- m_model.addModel( solution );
- return solution;
- }
- catch ( AssemblyException ae )
- {
- final String error = "Nested assembly failure while
attempting to construct model"
- + " for the extension profile: ["
- + profile
- + "] for the stage dependency: [" + stage + "].";
- throw new AssemblyException( error, ae );
- }
- catch ( ModelException me )
- {
- final String error = "Nested model failure while attempting
to add model"
- + " for the extension profile: "
- + profile
- + " for the stage dependency: [" + stage + "].";
- throw new AssemblyException( error, me );
- }
- }
- else
- {
- final String error = "Unable to locate a extension provider for
the stage: [ "
- + stage + "].";
- throw new ProviderNotFoundException( error );
- }
- }
-
- private DeploymentModel findExtensionProvider( ModelRepository
repository,
- StageModel stage, List subjects ) throws AssemblyException
- {
- String path = stage.getPath();
- if( null != path )
- {
- DeploymentModel model = m_model.getModel( path );
- if( null == model )
- {
- final String error = "Could not locate a model at the
address: ["
- + path + "] in " + this + ".";
- throw new AssemblyException( error );
- }
- assembleModel( model, subjects );
- return model;
- }
- else
- {
- return findExtensionProvider( repository, stage.getStage(),
- subjects );
- }
- }
-
private DeploymentProfile[] findServiceProfiles(
ReferenceDescriptor reference )
{
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java
Mon Mar 21 16:16:59 2005
@@ -31,13 +31,12 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
/**
* The model repository interface declares operations through which
* clients may resolve registered model instances relative to
- * a stage or service dependencies.
+ * a service dependencies.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
@@ -122,36 +121,6 @@
}
/**
- * Locate all models meeting the supplied criteria.
- *
- * @param stage a component stage dependency
- * @return the candidate models
- */
- public DeploymentModel[] getCandidateProviders( StageDescriptor stage )
- {
- ArrayList list = new ArrayList();
- Iterator iterator = m_models.values().iterator();
- while( iterator.hasNext() )
- {
- DeploymentModel model = (DeploymentModel) iterator.next();
- if( model.isaCandidate( stage ) )
- {
- list.add( model );
- }
- }
-
- if( m_parent != null )
- {
- DeploymentModel[] models = m_parent.getCandidateProviders( stage
);
- for( int i=0; i<models.length; i++ )
- {
- list.add( models[i] );
- }
- }
- return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
- }
-
- /**
* Locate all models meeting the supplied dependency criteria.
*
* @param dependency a component service dependency
@@ -213,33 +182,6 @@
return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
}
- /**
- * Locate a model meeting the supplied criteria.
- *
- * @param stage a component stage dependency
- * @return the model
- */
- public DeploymentModel getModel( StageDescriptor stage )
- {
- Iterator iterator = m_models.values().iterator();
- while( iterator.hasNext() )
- {
- DeploymentModel model = (DeploymentModel) iterator.next();
-
- if( model.isaCandidate( stage ) )
- {
- return model;
- }
- }
-
- if( m_parent != null )
- {
- return m_parent.getModel( stage );
- }
-
- return null;
- }
-
//------------------------------------------------------------------
// implementation
//------------------------------------------------------------------
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelSelector.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelSelector.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelSelector.java
Mon Mar 21 16:16:59 2005
@@ -26,7 +26,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
/**
@@ -40,9 +39,9 @@
*/
class DefaultModelSelector implements ModelSelector
{
- //==============================================================
+ //--------------------------------------------------------------
// ModelSelector
- //==============================================================
+ //--------------------------------------------------------------
/**
* Returns the preferred model from an available selection of
@@ -62,19 +61,6 @@
/**
* Returns the preferred model from an available selection of candidates
* @param models the set of candidate models
- * @param stage the stage dependency
- * @return the preferred provider or null if no satisfactory
- * provider can be established
- */
- public DeploymentModel select( DeploymentModel[] models, StageDescriptor
stage )
- {
- DeploymentModel[] candidates = filterCandidateProviders( models,
stage );
- return select( candidates );
- }
-
- /**
- * Returns the preferred model from an available selection of candidates
- * @param models the set of candidate models
* @param reference the versioned service reference
* @return the preferred provider or null if no satisfactory provider
* can be established
@@ -85,10 +71,9 @@
return select( candidates );
}
-
- //==============================================================
+ //--------------------------------------------------------------
// implementation
- //==============================================================
+ //--------------------------------------------------------------
private DeploymentModel[] filterCandidateProviders(
DeploymentModel[] models, ReferenceDescriptor reference )
@@ -120,21 +105,6 @@
return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
}
- private DeploymentModel[] filterCandidateProviders(
- DeploymentModel[] models, StageDescriptor stage )
- {
- ArrayList list = new ArrayList();
- for( int i = 0; i < models.length; i++ )
- {
- DeploymentModel model = models[i];
- if( model.isaCandidate( stage ) )
- {
- list.add( model );
- }
- }
- return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
- }
-
/**
* Select a model from a set of models based on a priority ordering
* of EXPLICIT, PACKAGE and lastly IMPLICIT. If multiple candidates
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultProfileSelector.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultProfileSelector.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultProfileSelector.java
Mon Mar 21 16:16:59 2005
@@ -23,7 +23,6 @@
import net.dpml.composition.model.ProfileSelector;
import net.dpml.meta.info.DependencyDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
/**
@@ -60,20 +59,6 @@
* candidates profiles.
*
* @param profiles the set of candidate profiles
- * @param dependency a stage dependency
- * @return the preferred extension provider profile or null if
- * no satisfactory profile can be established
- */
- public DeploymentProfile select( DeploymentProfile[] profiles,
StageDescriptor stage )
- {
- return select( profiles );
- }
-
- /**
- * Returns the preferred profile from an available selection of
- * candidates profiles.
- *
- * @param profiles the set of candidate profiles
* @param reference a service reference
* @return the preferred profile or null if
* no satisfactory profile can be established
Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
Mon Mar 21 16:16:59 2005
@@ -43,7 +43,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
@@ -348,43 +347,6 @@
}
- /**
- * Locate the set of local component types that provide the
- * supplied extension.
- * @param stage a stage descriptor
- * @return a set of types that support the supplied stage
- */
- public Type[] getTypes( StageDescriptor stage )
- throws NullArgumentException
- {
- if( stage == null )
- {
- throw new NullArgumentException( "stage" );
- }
-
- ArrayList list = new ArrayList();
- Type[] types = getTypes( false );
- for( int i=0; i<types.length; i++ )
- {
- Type type = types[i];
- if( type.getExtension( stage ) != null )
- {
- list.add( type );
- }
- }
-
- if( m_parent != null )
- {
- Type[] suppliment = m_parent.getTypes( stage );
- for( int i=0; i<suppliment.length; i++ )
- {
- list.add( suppliment[i] );
- }
- }
-
- return (Type[]) list.toArray( new Type[0] );
- }
-
/**
* Return the set of deployment profiles for the supplied type. An
* implementation is required to return a array of types > 0 in length
Modified:
development/main/metro/composition/impl/src/test/net/dpml/composition/model/impl/SimpleDeploymentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/test/net/dpml/composition/model/impl/SimpleDeploymentModel.java
(original)
+++
development/main/metro/composition/impl/src/test/net/dpml/composition/model/impl/SimpleDeploymentModel.java
Mon Mar 21 16:16:59 2005
@@ -31,7 +31,6 @@
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.logging.Logger;
@@ -114,16 +113,6 @@
{
}
- public AccessControlContext getAccessControlContext()
- {
- return null;
- }
-
- public boolean isCodeSecurityEnabled()
- {
- return m_secure;
- }
-
//-----------------------------------------------------------
// service production
//-----------------------------------------------------------
@@ -149,16 +138,6 @@
/**
* Return TRUE is this model is capable of supporting a supplied
- * stage dependency.
- * @return true if this model can fulfill the dependency
- */
- public boolean isaCandidate( StageDescriptor stage )
- {
- return true;
- }
-
- /**
- * Return TRUE is this model is capable of supporting a supplied
* service.
* @return true if this model can fulfill the service
*/
@@ -167,7 +146,6 @@
return true;
}
-
//-----------------------------------------------------------
// composite assembly
//-----------------------------------------------------------
Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Mon Mar 21 16:16:59 2005
@@ -723,7 +723,6 @@
</types>
</info>
<dependencies>
- <include key="avalon-util-lifecycle" tag="api"/>
<include key="dpml-activity-api" tag="api"/>
<include key="dpml-composition-api" tag="api"/>
<include key="avalon-framework-api" tag="api"/>
@@ -1013,15 +1012,6 @@
<resource>
<info>
- <group>avalon/util</group>
- <name>avalon-util-lifecycle</name>
- <version>1.1.1</version>
- </info>
- </resource>
-
-
- <resource>
- <info>
<name>xercesImpl</name>
<version>2.6.2</version>
<group>xerces</group>
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
==============================================================================
--- development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
(original)
+++ development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
Mon Mar 21 16:16:59 2005
@@ -48,92 +48,19 @@
public class Type implements Serializable
{
private final InfoDescriptor m_descriptor;
- private final SecurityDescriptor m_security;
private final ContextDescriptor m_context;
private final Configuration m_configuration;
private final ServiceDescriptor[] m_services;
private final DependencyDescriptor[] m_dependencies;
private final CategoryDescriptor[] m_loggers;
- private final StageDescriptor[] m_stages;
- private final ExtensionDescriptor[] m_extensions;
private final Parameters m_parameters;
- /**
- * Creation of a new Type instance using a supplied component descriptor,
- * logging, cotext, services, depedencies, stages and extension
descriptors.
- * @param descriptor a component descriprot that contains information
about
- * the component type
- * @param loggers a set of logger descriptors the declare the logging
channels
- * required by the type
- * @param context a component context descriptor that declares the
context type
- * and context entry key and value classnames
- * @param services a set of service descriptors that detail the service
that
- * this component type is capable of supplying
- * @param dependencies a set of depedency descriptors that detail the
service
- * that this component type is depedent on
- * @param stages a set of stage descriprors that detail the extension
stage
- * interfaces that this component requires a handler for
- * @param extensions a set of lifecycle extension capabilities that this
- * componet can provide to its container during the process of stage
- * suppier resolution
- * @exception NullPointerException if the descriptor, loggers, context,
services,
- * dependencies, stages, or extensions argument is null
- * @since 1.1
- */
- public Type( final InfoDescriptor descriptor,
- final CategoryDescriptor[] loggers,
- final ContextDescriptor context,
- final ServiceDescriptor[] services,
- final DependencyDescriptor[] dependencies,
- final StageDescriptor[] stages,
- final ExtensionDescriptor[] extensions )
- throws NullPointerException
- {
- this( descriptor, loggers, context, services, dependencies, stages,
extensions, null );
- }
-
- /**
- * Creation of a new Type instance using a supplied component descriptor,
- * logging, cotext, services, depedencies, stages and extension
descriptors.
- * @param descriptor a component descriprot that contains information
about
- * the component type
- * @param loggers a set of logger descriptors the declare the logging
channels
- * required by the type
- * @param context a component context descriptor that declares the
context type
- * and context entry key and value classnames
- * @param services a set of service descriprors that detail the service
that
- * this component type is capable of supplying
- * @param dependencies a set of depedency descriprors that detail the
service
- * that this component type is depedent on
- * @param stages a set of stage descriprors that detail the extensiuon
stage
- * interfaces that this component requires a handler for
- * @param extensions a set of lifecycle extension capabilities that this
- * componet can provide to its container during the process of stage
- * suppier resolution
- * @exception NullPointerException if the descriptor, loggers, context,
services,
- * dependencies, stages, or extensions argument is null
- */
- public Type( final InfoDescriptor descriptor,
- final CategoryDescriptor[] loggers,
- final ContextDescriptor context,
- final ServiceDescriptor[] services,
- final DependencyDescriptor[] dependencies,
- final StageDescriptor[] stages,
- final ExtensionDescriptor[] extensions,
- final Configuration defaults )
- throws NullPointerException
- {
- this(
- descriptor, new SecurityDescriptor( null, null ), loggers,
context, services, dependencies,
- stages, extensions, defaults );
- }
/**
* Creation of a new Type instance using a supplied component descriptor,
* logging, cotext, services, depedencies, stages and extension
descriptors.
* @param descriptor a component descriptor that contains information
about
* the component type
- * @param security a component security descriptor
* @param loggers a set of logger descriptors the declare the logging
channels
* required by the type
* @param context a component context descriptor that declares the
context type
@@ -142,62 +69,16 @@
* this component type is capable of supplying
* @param dependencies a set of depedency descriprors that detail the
service
* that this component type is depedent on
- * @param stages a set of stage descriprors that detail the extensiuon
stage
- * interfaces that this component requires a handler for
- * @param extensions a set of lifecycle extension capabilities that this
- * componet can provide to its container during the process of stage
- * suppier resolution
- * @exception NullPointerException if the descriptor, loggers, context,
services,
- * dependencies, stages, or extensions argument is null
- */
- public Type( final InfoDescriptor descriptor,
- final SecurityDescriptor security,
- final CategoryDescriptor[] loggers,
- final ContextDescriptor context,
- final ServiceDescriptor[] services,
- final DependencyDescriptor[] dependencies,
- final StageDescriptor[] stages,
- final ExtensionDescriptor[] extensions,
- final Configuration defaults )
- throws NullPointerException
- {
- this(
- descriptor, security, loggers, context, services, dependencies,
- stages, extensions, defaults, null );
- }
-
- /**
- * Creation of a new Type instance using a supplied component descriptor,
- * logging, cotext, services, depedencies, stages and extension
descriptors.
- * @param descriptor a component descriptor that contains information
about
- * the component type
- * @param security a component security descriptor
- * @param loggers a set of logger descriptors the declare the logging
channels
- * required by the type
- * @param context a component context descriptor that declares the
context type
- * and context entry key and value classnames
- * @param services a set of service descriprors that detail the service
that
- * this component type is capable of supplying
- * @param dependencies a set of depedency descriprors that detail the
service
- * that this component type is depedent on
- * @param stages a set of stage descriprors that detail the extensiuon
stage
- * interfaces that this component requires a handler for
- * @param extensions a set of lifecycle extension capabilities that this
- * componet can provide to its container during the process of stage
- * suppier resolution
* @param defaults the static configuration defaults
* @param params static parameter defaults
* @exception NullPointerException if the descriptor, loggers, context,
services,
- * dependencies, stages, or extensions argument is null
+ * or dependencies argument are null
*/
public Type( final InfoDescriptor descriptor,
- final SecurityDescriptor security,
final CategoryDescriptor[] loggers,
final ContextDescriptor context,
final ServiceDescriptor[] services,
final DependencyDescriptor[] dependencies,
- final StageDescriptor[] stages,
- final ExtensionDescriptor[] extensions,
final Configuration defaults,
final Parameters params )
throws NullPointerException
@@ -206,10 +87,6 @@
{
throw new NullPointerException( "descriptor" );
}
- if ( null == security )
- {
- throw new NullPointerException( "security" );
- }
if ( null == loggers )
{
throw new NullPointerException( "loggers" );
@@ -226,23 +103,12 @@
{
throw new NullPointerException( "dependencies" );
}
- if ( null == stages )
- {
- throw new NullPointerException( "stages" );
- }
- if ( null == extensions )
- {
- throw new NullPointerException( "extensions" );
- }
m_descriptor = descriptor;
- m_security = security;
m_loggers = loggers;
m_context = context;
m_services = services;
m_dependencies = dependencies;
- m_stages = stages;
- m_extensions = extensions;
m_configuration = defaults;
m_parameters = params;
}
@@ -258,16 +124,6 @@
}
/**
- * Return the security descriptor
- *
- * @return the security descriptor.
- */
- public SecurityDescriptor getSecurity()
- {
- return m_security;
- }
-
- /**
* Return the set of Logger that this Component will use.
*
* @return the set of Logger that this Component will use.
@@ -404,59 +260,6 @@
return m_parameters;
}
-
- /**
- * Return the lifecycle stages extensions required by this component
type.
- *
- * @return an array of stage descriptors.
- */
- public StageDescriptor[] getStages()
- {
- return m_stages;
- }
-
- /**
- * Return the stages extension handling provided by this extension.
- *
- * @return an array of extension descriptors.
- */
- public ExtensionDescriptor[] getExtensions()
- {
- return m_extensions;
- }
-
- /**
- * Return the extension supporting the supplied stage.
- *
- * @param stage the lifecycle stage that this type requires a handler for
- * @return a matching extension or null if no matching extension
- */
- public ExtensionDescriptor getExtension( StageDescriptor stage )
- {
- return getExtension( stage.getKey() );
- }
-
- /**
- * Return the extension supporting the supplied stage.
- *
- * @param key the lifecycle stage that this type requires a handler for
- * @return a matching extension or null if no matching extension
- */
- public ExtensionDescriptor getExtension( String key )
- {
- ExtensionDescriptor[] extensions = getExtensions();
- for ( int i = 0; i < extensions.length; i++ )
- {
- ExtensionDescriptor extension = extensions[i];
- String ref = extension.getKey();
- if ( key.equals( ref ) )
- {
- return extension;
- }
- }
- return null;
- }
-
/**
* Return a string representation of the type.
* @return the stringified type
@@ -483,9 +286,6 @@
if( ! m_descriptor.equals( t.m_descriptor ) )
return false;
- if( ! m_security.equals( t.m_security ) )
- return false;
-
if( null == m_configuration )
{
if( ! ( null == t.m_configuration ) )
@@ -526,16 +326,6 @@
if( ! m_dependencies[i].equals( t.m_dependencies[i] ) )
return false;
}
- for( int i=0; i<m_stages.length; i++ )
- {
- if( ! m_stages[i].equals( t.m_stages[i] ) )
- return false;
- }
- for( int i=0; i<m_extensions.length; i++ )
- {
- if( ! m_extensions[i].equals( t.m_extensions[i] ) )
- return false;
- }
return true;
}
@@ -546,7 +336,6 @@
public int hashCode()
{
int hash = m_descriptor.hashCode();
- hash ^= m_security.hashCode();
hash ^= m_context.hashCode();
if( m_configuration != null )
@@ -574,16 +363,7 @@
hash ^= m_loggers[i].hashCode();
hash = hash + 471312761;
}
- for( int i=0; i<m_stages.length; i++ )
- {
- hash ^= m_stages[i].hashCode();
- hash = hash + 71371219;
- }
- for( int i=0; i<m_extensions.length; i++ )
- {
- hash ^= m_extensions[i].hashCode();
- hash = hash - 13712377;
- }
+
return hash;
}
}
Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/TypeTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/TypeTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/TypeTestCase.java
Mon Mar 21 16:16:59 2005
@@ -34,12 +34,9 @@
import net.dpml.meta.info.ContextDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.EntryDescriptor;
-import net.dpml.meta.info.ExtensionDescriptor;
import net.dpml.meta.info.InfoDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.meta.info.SecurityDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
import net.dpml.configuration.Configuration;
@@ -60,13 +57,10 @@
public class TypeTestCase extends TestCase
{
private InfoDescriptor m_descriptor;
- private SecurityDescriptor m_security;
private CategoryDescriptor[] m_loggers;
private ContextDescriptor m_context;
private ServiceDescriptor[] m_services;
private DependencyDescriptor[] m_dependencies;
- private StageDescriptor[] m_stages;
- private ExtensionDescriptor[] m_extensions;
private Configuration m_defaults;
private Parameters m_parameters;
private ReferenceDescriptor m_reference;
@@ -82,7 +76,6 @@
m_reference = new ReferenceDescriptor(TypeTestCase.class.getName());
m_key = TypeTestCase.class.getName();
m_descriptor = createSimpleInfo(TypeTestCase.class.getName());
- m_security = new SecurityDescriptor( null, null );
m_loggers = new CategoryDescriptor[] {
new CategoryDescriptor("name", new Properties())
};
@@ -94,12 +87,6 @@
m_dependencies = new DependencyDescriptor[] {
new DependencyDescriptor("role", m_reference)
};
- m_stages = new StageDescriptor[] {
- new StageDescriptor( m_key )
- };
- m_extensions = new ExtensionDescriptor[] {
- new ExtensionDescriptor( m_key )
- };
m_defaults = new DefaultConfiguration("default");
m_parameters = DefaultParameters.EMPTY_PARAMETERS;
}
@@ -108,19 +95,15 @@
{
assertNotNull(type);
checkArray(m_loggers, type.getCategories());
- assertEquals( m_security, type.getSecurity() );
assertEquals( m_defaults, type.getConfiguration() );
assertEquals( m_parameters , type.getParameters() );
assertEquals( m_context, type.getContext());
checkArray(m_dependencies, type.getDependencies());
assertEquals(m_dependencies[0],
type.getDependency(m_dependencies[0].getKey()));
- assertEquals(m_extensions[0], type.getExtension(
m_stages[0].getKey() ) );
- checkArray(m_extensions, type.getExtensions());
assertEquals( m_descriptor, type.getInfo() );
assertEquals( m_services[0], type.getService(m_reference));
assertEquals( m_services[0], type.getService(
m_services[0].getReference().getClassname()));
checkArray(m_services, type.getServices());
- checkArray(m_stages, type.getStages());
assertTrue(type.isaCategory(m_loggers[0].getName()));
assertTrue( !type.isaCategory( "fake name" ) );
}
@@ -138,8 +121,8 @@
{
Type type =
new Type(
- m_descriptor, m_security, m_loggers, m_context, m_services,
m_dependencies,
- m_stages, m_extensions, m_defaults, m_parameters );
+ m_descriptor, m_loggers, m_context, m_services, m_dependencies,
+ m_defaults, m_parameters );
checkType(type);
}
@@ -147,8 +130,8 @@
{
Type type =
new Type(
- m_descriptor, m_security, m_loggers, m_context, m_services,
m_dependencies,
- m_stages, m_extensions, m_defaults, m_parameters );
+ m_descriptor, m_loggers, m_context, m_services, m_dependencies,
+ m_defaults, m_parameters );
checkType( type );
Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
Mon Mar 21 16:16:59 2005
@@ -39,13 +39,9 @@
import net.dpml.meta.info.ContextDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.EntryDescriptor;
-import net.dpml.meta.info.ExtensionDescriptor;
import net.dpml.meta.info.CategoryDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
-import net.dpml.meta.info.SecurityDescriptor;
-import net.dpml.meta.info.PermissionDescriptor;
import net.dpml.meta.info.Type;
import net.dpml.meta.info.builder.BuildException;
@@ -129,12 +125,6 @@
throws BuildException
{
final String topLevelName = info.getName();
-
- if( topLevelName.equals( "blockinfo" ) )
- {
- return new XMLLegacyCreator().createType( classname, info );
- }
-
if( !topLevelName.equals( "type" ) )
{
final String message =
@@ -156,10 +146,6 @@
final InfoDescriptor descriptor =
buildInfoDescriptor( classname, configuration );
- configuration = info.getChild( "security", false );
- final SecurityDescriptor security =
- buildSecurityDescriptor( configuration );
-
configuration = info.getChild( "loggers" );
final CategoryDescriptor[] loggers = buildLoggers( configuration );
@@ -173,72 +159,10 @@
final DependencyDescriptor[] dependencies =
buildDependencies( configuration );
- configuration = info.getChild( "stages" );
- final StageDescriptor[] phases = buildStages( configuration );
-
- configuration = info.getChild( "extensions" );
- final ExtensionDescriptor[] extensions = buildExtensions(
configuration );
-
return new Type(
- descriptor, security, loggers, context, services, dependencies,
phases,
- extensions, defaults, params );
+ descriptor, loggers, context, services, dependencies, defaults,
params );
}
- /**
- * Utility function to create a set of phase descriptor from a
configuration.
- * @param config a configuration containing 0..n phase elements
- * @return an array of phase descriptors
- * @exception BuildException if a build error occurs
- */
- protected StageDescriptor[] buildStages( Configuration config )
- throws BuildException
- {
- ArrayList list = new ArrayList();
- Configuration[] stages = config.getChildren( "stage" );
- for( int i = 0; i < stages.length; i++ )
- {
- StageDescriptor stage = buildPhase( stages[i] );
- list.add( stage );
- }
- return (StageDescriptor[])list.toArray( new StageDescriptor[ 0 ] );
- }
-
- /**
- * Utility function to create a set of phase descriptor from a
configuration.
- * @param config a configuration containing 0..n phase elements
- * @return an array of phase descriptors
- * @exception BuildException if a build error occurs
- */
- protected StageDescriptor buildPhase( Configuration config )
- throws BuildException
- {
-
- try
- {
- String id = null;
- if( config.getAttribute( "type", null ) != null ) // legacy
- {
- id = config.getAttribute( "type" );
- }
- else if( config.getAttribute( "key", null ) != null ) // legacy
- {
- id = config.getAttribute( "key" );
- }
-
- if( id == null ) id = config.getAttribute( "id" ); // standard
-
- final Properties attributes =
- buildAttributes( config.getChild( "attributes" ) );
- return new StageDescriptor( id, attributes );
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to construct a stage descriptor from source fragment:"
- + ConfigurationUtil.list( config );
- throw new BuildException( error, e );
- }
- }
/**
* A utility method to build a {@link ReferenceDescriptor}
@@ -480,63 +404,6 @@
name, classname, version, lifestyle, collection, schema, isNative,
attributes );
}
- /**
- * A utility method to build a {@link SecurityDescriptor}
- * object from specified configuration data.
- *
- * @param config the security configuration fragment
- * @return the created SecurityDescriptor
- * @throws BuildException if an error occurs
- */
- public SecurityDescriptor buildSecurityDescriptor( final Configuration
config )
- throws BuildException
- {
- if( null == config ) return new SecurityDescriptor( null, null );
-
- try
- {
- final Properties attributes =
- buildAttributes( config.getChild( "attributes" ) );
- PermissionDescriptor[] permissions = buildPermissions( config );
- return new SecurityDescriptor( permissions, attributes );
- }
- catch( ConfigurationException e )
- {
- final String error =
- "Cannot build secrity descriptor.";
- throw new BuildException( error, e );
- }
- }
-
- private PermissionDescriptor[] buildPermissions( final Configuration
config )
- throws ConfigurationException
- {
- ArrayList list = new ArrayList();
- Configuration[] children = config.getChildren( "permission" );
- for( int i = 0; i < children.length; i++ )
- {
- list.add( buildPermission( children[i] ) );
- }
- return (PermissionDescriptor[])list.toArray( new
PermissionDescriptor[ 0 ] );
- }
-
- private PermissionDescriptor buildPermission( final Configuration config
)
- throws ConfigurationException
- {
- final String classname = config.getAttribute( "class" );
- final String name = config.getAttribute( "name", null );
- ArrayList list = new ArrayList();
- Configuration[] children = config.getChildren( "action" );
- for( int i=0; i<children.length; i++ )
- {
- Configuration child = children[i];
- String action = child.getValue();
- list.add( action );
- }
- String[] actions = (String[])list.toArray( new String[0] );
- return new PermissionDescriptor( classname, name, actions );
- }
-
/**
* Handle the resolution of the component lifestyle. Normally this is
* resolved by retrieving the <lifestyle> element value, however,
for
@@ -561,63 +428,6 @@
}
}
- /**
- * Utility function to create a set of phase descriptor from a
configuration.
- * @param config a configuration containing 0..n phase elements
- * @return an array of phase descriptors
- * @exception BuildException if a build error occurs
- */
- protected ExtensionDescriptor[] buildExtensions( Configuration config )
- throws BuildException
- {
- ArrayList list = new ArrayList();
- Configuration[] extensions = config.getChildren( "extension" );
- for( int i = 0; i < extensions.length; i++ )
- {
- list.add( buildExtension( extensions[i] ) );
- }
- return (ExtensionDescriptor[])list.toArray( new ExtensionDescriptor[
0 ] );
- }
-
- /**
- * Utility function to create an extension descriptor from a
configuration.
- * @param config a configuration containing the extension definition
- * @return the extension descriptor
- * @exception BuildException if a build error occurs
- */
- protected ExtensionDescriptor buildExtension( Configuration config )
- throws BuildException
- {
- if( config.getAttribute( "type", null ) != null ) // legacy
- {
- String urn = config.getAttribute( "type", null );
- final Properties attributes =
- buildAttributes( config.getChild( "attributes" ) );
- return new ExtensionDescriptor( urn, attributes );
- }
- else
- {
- String id = config.getAttribute( "urn", null ); // legacy
- if( id == null )
- {
- try
- {
- id = config.getAttribute( "id" );
- }
- catch( ConfigurationException e )
- {
- final String error =
- "Missing extensions identifier 'id' attribute."
- + ConfigurationUtil.list( config );
- throw new BuildException( error, e );
- }
- }
- final Properties attributes =
- buildAttributes( config.getChild( "attributes" ) );
- return new ExtensionDescriptor( id, attributes );
- }
- }
-
/**
* Creation of a reference descriptor from the supplied path.
* @param path the classname
Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/writer/impl/XMLTypeWriter.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/writer/impl/XMLTypeWriter.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/writer/impl/XMLTypeWriter.java
Mon Mar 21 16:16:59 2005
@@ -31,11 +31,7 @@
import net.dpml.meta.info.InfoDescriptor;
import net.dpml.meta.info.CategoryDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
-import net.dpml.meta.info.ExtensionDescriptor;
import net.dpml.meta.info.Type;
-import net.dpml.meta.info.SecurityDescriptor;
-import net.dpml.meta.info.PermissionDescriptor;
import net.dpml.meta.info.writer.TypeWriter;
/**
@@ -69,13 +65,10 @@
writeDoctype( writer, "type", type.getInfo().isNative() );
writer.write( "\n\n<type>" );
writeInfo( writer, type.getInfo() );
- writeSecurity( writer, type.getSecurity() );
writeLoggers( writer, type.getCategories() );
writeContext( writer, type.getContext(), type.getInfo().isNative() );
writeServices( writer, type.getServices() );
writeDependencies( writer, type.getDependencies() );
- writeStages( writer, type.getStages() );
- writeExtensions( writer, type.getExtensions() );
writer.write( "\n</type>" );
writer.flush();
}
@@ -167,74 +160,6 @@
}
/**
- * Write out xml representation of the security criteria.
- *
- * @param writer the writer
- * @param security the security descriptor
- * @throws IOException if unable to write xml
- */
- private void writeSecurity( final Writer writer,
- final SecurityDescriptor descriptor )
- throws IOException
- {
- PermissionDescriptor[] permissions = descriptor.getPermissions();
- if(
- ( 0 == descriptor.getAttributeNames().length )
- && ( 0 == permissions.length ) )
- {
- return;
- }
-
- writer.write( "\n <security>" );
- for( int i = 0; i < permissions.length; i++ )
- {
- writePermission( writer, permissions[ i ] );
- }
-
- writer.write( "\n </security>" );
- }
-
-
- /**
- * Write out xml representation of a logger.
- *
- * @param writer the writer
- * @param logger the logger
- * @throws IOException if unable to write xml
- */
- private void writePermission( final Writer writer,
- final PermissionDescriptor permission )
- throws IOException
- {
- writer.write( "\n <permission class=\"" );
- writer.write( permission.getClassname() );
- writer.write( "\" " );
- if( null != permission.getName() )
- {
- writer.write( "name=\"" );
- writer.write( permission.getName() );
- writer.write( "\"" );
- }
- if( 0 == permission.getActions().length )
- {
- writer.write( "/>" );
- }
- else
- {
- writer.write( ">" );
- String[] actions = permission.getActions();
- for( int i=0; i<actions.length; i++ )
- {
- String action = actions[i];
- writer.write( "\n <action>" );
- writer.write( action );
- writer.write( "</action>" );
- }
- writer.write( "\n </permission>" );
- }
- }
-
- /**
* Write out xml representation of a set of loggers.
*
* @param writer the writer
@@ -512,85 +437,6 @@
writer.write( "\"/>" );
}
- /**
- * Write out xml representation of a set of stages.
- *
- * @param writer the writer
- * @param stages the stages
- * @throws IOException if unable to write xml
- */
- private void writeStages( final Writer writer,
- final StageDescriptor[] stages )
- throws IOException
- {
- if( 0 == stages.length )
- {
- return;
- }
-
- writer.write( "\n <stages>" );
- for( int i = 0; i < stages.length; i++ )
- {
- final StageDescriptor stage = stages[ i ];
- writer.write( "\n <stage " );
- writer.write( "id=\"" );
- writer.write( stage.getKey() );
-
- final int count = stage.getAttributeNames().length;
- if( 0 == count )
- {
- writer.write( "\"/>" );
- }
- else
- {
- writer.write( "\">" );
- writeAttributes( writer, stage );
- writer.write( "\n </stage>" );
- }
- }
- writer.write( "\n </stages>" );
- }
-
- /**
- * Write out xml representation of a set of extensions.
- *
- * @param writer the writer
- * @param extensions the extensions
- * @throws IOException if unable to write xml
- */
- private void writeExtensions( final Writer writer,
- final ExtensionDescriptor[] extensions )
- throws IOException
- {
- if( 0 == extensions.length )
- {
- return;
- }
-
- writer.write( "\n <extensions>" );
- for( int i = 0; i < extensions.length; i++ )
- {
- final ExtensionDescriptor extension = extensions[ i ];
-
- writer.write( "\n <extension " );
- writer.write( "id=\"" );
- writer.write( extension.getKey() );
-
- final int count = extension.getAttributeNames().length;
- if( 0 == count )
- {
- writer.write( "\"/>" );
- }
- else
- {
- writer.write( "\">" );
- writeAttributes( writer, extension );
- writer.write( "\n </extension>" );
- }
- }
- writer.write( "\n </extensions>" );
- }
-
private String getContextClassname( boolean flag )
{
if( flag )
Modified:
development/main/metro/meta/tools/src/main/net/dpml/meta/info/ant/MetaTask.java
==============================================================================
---
development/main/metro/meta/tools/src/main/net/dpml/meta/info/ant/MetaTask.java
(original)
+++
development/main/metro/meta/tools/src/main/net/dpml/meta/info/ant/MetaTask.java
Mon Mar 21 16:16:59 2005
@@ -169,7 +169,6 @@
}
}
-
private String validatePostfix( String postfix )
{
if( postfix.equalsIgnoreCase( "xtype" )
Modified:
development/main/metro/meta/tools/src/main/net/dpml/meta/info/tags/TypeTag.java
==============================================================================
---
development/main/metro/meta/tools/src/main/net/dpml/meta/info/tags/TypeTag.java
(original)
+++
development/main/metro/meta/tools/src/main/net/dpml/meta/info/tags/TypeTag.java
Mon Mar 21 16:16:59 2005
@@ -24,12 +24,9 @@
import net.dpml.meta.info.Version;
import net.dpml.meta.info.ContextDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
-import net.dpml.meta.info.ExtensionDescriptor;
import net.dpml.meta.info.InfoDescriptor;
import net.dpml.meta.info.CategoryDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
-import net.dpml.meta.info.StageDescriptor;
-import net.dpml.meta.info.SecurityDescriptor;
import net.dpml.meta.info.Type;
import com.thoughtworks.qdox.model.DocletTag;
@@ -122,19 +119,14 @@
final InfoDescriptor info =
new InfoDescriptor(
name, type, version, lifestyle, collection, schema, isNative(),
properties );
- final SecurityDescriptor security =
- new SecurityTag( getJavaClass(), isNative()
).getSecurityDescriptor();
final ServiceDescriptor[] services = new ServicesTag(
getJavaClass(), isNative() ).getServices();
final CategoryDescriptor[] loggers = new LoggerTag( getJavaClass(),
isNative() ).getCategories();
final DependencyDescriptor[] dependencies =
new DependencyTag( getJavaClass(), isNative() ).getDependencies();
- final StageDescriptor[] stages = new StageTag( getJavaClass(),
isNative() ).getStages();
- final ExtensionDescriptor[] extensions = new ExtensionTag(
getJavaClass(), isNative() ).getExtensions();
final ContextDescriptor context = new ContextTag( getJavaClass(),
isNative() ).getContext();
return new Type(
- info, security, loggers, context, services, dependencies,
- stages, extensions, null );
+ info, loggers, context, services, dependencies, null, null );
}
private String getName(DocletTag tag)
Modified:
development/main/metro/testing/playground/src/main/net/dpml/test/playground/SimpleComponent.java
==============================================================================
---
development/main/metro/testing/playground/src/main/net/dpml/test/playground/SimpleComponent.java
(original)
+++
development/main/metro/testing/playground/src/main/net/dpml/test/playground/SimpleComponent.java
Mon Mar 21 16:16:59 2005
@@ -34,14 +34,11 @@
* BasicService and provides SimpleService.
*
* @metro.component name="simple" lifestyle="singleton"
- * @metro.stage id="urn:dpml.test.playground:exploitable"
- * @metro.stage id="urn:dpml.test.playground:demonstratable"
* @metro.service type="net.dpml.test.playground.SimpleService"
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
*/
public class SimpleComponent extends AbstractLogEnabled
- implements Configurable, Serviceable, Initializable, Startable,
SimpleService,
- Exploitable, Demonstratable, Disposable
+ implements Configurable, Serviceable, Initializable, Startable,
SimpleService, Disposable
{
private String m_message;
@@ -82,40 +79,6 @@
}
//=======================================================================
- // Exploitable
- //=======================================================================
-
- /**
- * The create stage interface implementation for the Exloitable
extension.
- */
- public void incarnate()
- {
- getLogger().info( "incarnation stage" );
- }
-
- /**
- * The destroy stage interface implementation for the Exloitable
extension.
- */
- public void etherialize()
- {
- getLogger().info( "etherialize stage" );
- }
-
-
- //=======================================================================
- // Demonstratable
- //=======================================================================
-
- /**
- * Prints out the supplied message.
- * @param message the message to print
- */
- public void demo( String message )
- {
- getLogger().info( "handling demonstratable stage: " + message );
- }
-
- //=======================================================================
// Initializable
//=======================================================================
- svn commit: r2112 - in development/main/metro: . activation/providers/avalon/src/main/net/dpml/activation/avalon activation/providers/metro/src/main/net/dpml/activation/metro composition/api/src/main/net/dpml/composition/data composition/api/src/main/net/dpml/composition/model composition/api/src/test/net/dpml/composition/data/test composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl composition/impl/src/test/net/dpml/composition/model/impl meta/api/src/main/net/dpml/meta/info meta/api/src/test/net/dpml/meta/info/test meta/impl/src/main/net/dpml/meta/info/builder/impl meta/impl/src/main/net/dpml/meta/info/writer/impl meta/impl/src/test/net/dpml/meta/compat meta/impl/src/test/net/dpml/meta/legacy meta/tools/src/main/net/dpml/meta/info/ant meta/tools/src/main/net/dpml/meta/info/tags testing/playground/src/main/net/dpml/test/playground, mcconnell, 03/21/2005
Archive powered by MHonArc 2.6.24.