Hi,
Heres a bunch of changes to containerkit. It includes;
* removing all references to the term "role" and replacing them with
references to "key".
* allowing metadata to have attributes attached to elements
* addition of PartitionMetaData to represent "groups" of components
* adaption of MetaDataBuilder so it takes a map of parameters
* a few typo fixes
This is one half of the changes to ContainerKit that are needed to get
auto-assembly closer to happening
--
Cheers,
Peter Donald
--------------------------------------------------
"An intellectual is someone who has been educated
beyond their intelligence."
--------------------------------------------------
? containerkit.txt
Index: src/java/org/apache/excalibur/containerkit/demo/SimpleMetaDataBuilder.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/demo/SimpleMetaDataBuilder.java,v
retrieving revision 1.1
diff -u -r1.1 SimpleMetaDataBuilder.java
--- src/java/org/apache/excalibur/containerkit/demo/SimpleMetaDataBuilder.java 23 Aug
2002 08:51:15 -0000 1.1
+++ src/java/org/apache/excalibur/containerkit/demo/SimpleMetaDataBuilder.java 26 Nov
+2002 11:56:36 -0000
@@ -8,12 +8,15 @@
package org.apache.excalibur.containerkit.demo;
import java.util.ArrayList;
+import java.util.Map;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
+import org.apache.avalon.framework.info.Attribute;
import org.apache.excalibur.containerkit.metadata.ComponentMetaData;
import org.apache.excalibur.containerkit.metadata.DependencyMetaData;
import org.apache.excalibur.containerkit.metadata.MetaDataBuilder;
+import org.apache.excalibur.containerkit.metadata.PartitionMetaData;
import org.xml.sax.InputSource;
/**
@@ -26,7 +29,20 @@
public class SimpleMetaDataBuilder
implements MetaDataBuilder
{
- public ComponentMetaData[] loadMetaData( final String location )
+ public static final String CONFIG_LOCATION = "simple:location";
+
+ public PartitionMetaData loadAssembly( final Map parameters )
+ throws Exception
+ {
+ final String location = (String)parameters.get( CONFIG_LOCATION );
+ final ComponentMetaData[] components = loadMetaData( location );
+ return new PartitionMetaData( "main", new String[ 0 ],
+ new PartitionMetaData[ 0 ],
+ components,
+ Attribute.EMPTY_SET );
+ }
+
+ private ComponentMetaData[] loadMetaData( final String location )
throws Exception
{
final DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
@@ -62,7 +78,7 @@
final DependencyMetaData[] dependencies =
parseAssociations( component.getChildren( "provide" ) );
- return new ComponentMetaData( name, impl, dependencies, null, config );
+ return new ComponentMetaData( name, impl, dependencies, null, config, null );
}
private DependencyMetaData[] parseAssociations( final Configuration[] provides )
@@ -72,9 +88,10 @@
for( int i = 0; i < provides.length; i++ )
{
final Configuration provide = provides[ i ];
- final String role = provide.getAttribute( "role" );
- final String provider = provide.getAttribute( "name" );
- final DependencyMetaData association = new DependencyMetaData( role,
provider );
+ final String key = provide.getAttribute( "key" );
+ final String provider = provide.getAttribute( "provider" );
+ final DependencyMetaData association =
+ new DependencyMetaData( key, provider, key, Attribute.EMPTY_SET );
associations.add( association );
}
return (DependencyMetaData[])associations.toArray( new DependencyMetaData[
associations.size() ] );
Index: src/java/org/apache/excalibur/containerkit/demo/SimpleServiceKernel.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/demo/SimpleServiceKernel.java,v
retrieving revision 1.2
diff -u -r1.2 SimpleServiceKernel.java
--- src/java/org/apache/excalibur/containerkit/demo/SimpleServiceKernel.java 2 Oct
2002 01:52:19 -0000 1.2
+++ src/java/org/apache/excalibur/containerkit/demo/SimpleServiceKernel.java 26 Nov
+2002 11:56:36 -0000
@@ -18,6 +18,9 @@
import org.apache.excalibur.containerkit.lifecycle.ResourceProvider;
import org.apache.excalibur.containerkit.metadata.ComponentMetaData;
import org.apache.excalibur.containerkit.metadata.MetaDataBuilder;
+import org.apache.excalibur.containerkit.metadata.PartitionMetaData;
+import java.util.Map;
+import java.util.HashMap;
/**
* This is a simple ServiceKernel.
@@ -53,7 +56,10 @@
m_metaDataBuilder = new SimpleMetaDataBuilder();
setupLogger( getFactory(), "builder" );
- final ComponentMetaData[] components = m_metaDataBuilder.loadMetaData(
m_configURL );
+ final Map parameters = new HashMap();
+ parameters.put( SimpleMetaDataBuilder.CONFIG_LOCATION, m_configURL );
+ final PartitionMetaData partition = m_metaDataBuilder.loadAssembly(
+parameters );
+ final ComponentMetaData[] components = partition.getComponents();
for( int i = 0; i < components.length; i++ )
{
final ComponentMetaData component = components[ i ];
Index: src/java/org/apache/excalibur/containerkit/kernel/processor/DependencyMap.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel/processor/DependencyMap.java,v
retrieving revision 1.2
diff -u -r1.2 DependencyMap.java
--- src/java/org/apache/excalibur/containerkit/kernel/processor/DependencyMap.java
2 Oct 2002 01:52:19 -0000 1.2
+++ src/java/org/apache/excalibur/containerkit/kernel/processor/DependencyMap.java
+ 26 Nov 2002 11:56:37 -0000
@@ -217,12 +217,12 @@
for( int i = 0; i < entrySet.length; i++ )
{
final ComponentProfile other = entrySet[ i ];
- final DependencyMetaData[] roles =
+ final DependencyMetaData[] dependencies =
other.getMetaData().getDependencies();
- for( int j = 0; j < roles.length; j++ )
+ for( int j = 0; j < dependencies.length; j++ )
{
- final String depends = roles[ j ].getProviderName();
+ final String depends = dependencies[ j ].getProviderName();
if( depends.equals( name ) )
{
visitcomponent( other, false, done, order, store );
Index:
src/java/org/apache/excalibur/containerkit/lifecycle/impl/AbstractResourceProvider.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/lifecycle/impl/AbstractResourceProvider.java,v
retrieving revision 1.19
diff -u -r1.19 AbstractResourceProvider.java
---
src/java/org/apache/excalibur/containerkit/lifecycle/impl/AbstractResourceProvider.java
16 Nov 2002 13:09:33 -0000 1.19
+++
+src/java/org/apache/excalibur/containerkit/lifecycle/impl/AbstractResourceProvider.java
+ 26 Nov 2002 11:56:38 -0000
@@ -339,7 +339,7 @@
/**
* Create a Map of services for specified component.
- * The map maps role name to service provider.
+ * The map maps key name to service provider.
*
* @param componentEntry the component entry creating map for
* @return the map
@@ -359,9 +359,9 @@
for( int i = 0; i < dependencies.length; i++ )
{
final DependencyMetaData dependency = dependencies[ i ];
- final String role = dependency.getRole();
+ final String key = dependency.getKey();
final String providerName = dependency.getProviderName();
- final boolean optional = info.getDependency( role ).isOptional();
+ final boolean optional = info.getDependency( key ).isOptional();
final Object service =
getService( providerName, componentEntry );
@@ -370,7 +370,7 @@
final String message =
REZ.getString( "resource.missing-dependency.error",
optional ? "1" : "2",
- role,
+ key,
component.getName() );
if( !optional )
{
@@ -383,7 +383,7 @@
}
}
- services.put( role, service );
+ services.put( key, service );
}
return services;
Index: src/java/org/apache/excalibur/containerkit/lifecycle/impl/Resource.properties
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/lifecycle/impl/Resource.properties,v
retrieving revision 1.2
diff -u -r1.2 Resource.properties
--- src/java/org/apache/excalibur/containerkit/lifecycle/impl/Resource.properties
25 Jun 2002 04:32:29 -0000 1.2
+++ src/java/org/apache/excalibur/containerkit/lifecycle/impl/Resource.properties
+ 26 Nov 2002 11:56:38 -0000
@@ -1,7 +1,7 @@
resource.missing-context-value.error=Missing {0,choice,1#Optional|2#Required} Context
Entry with key "{1}" for component named "{2}".
resource.bad-value-type.error=Bad value retrieved for
{0,choice,1#Optional|2#Required} Context Entry with key "{1}" for component named
"{2}". Expected to be of type "{3}" but was of type "{4}".
resource.bad-context-type.error=The class of Contex object for component named "{2}"
was expected to be of type {0} but was of tpye {1}.
-resource.service-not-a-component.error=The service with role "0" and implemenation
class "{1}" does not implement the Component interface but is being exposed via
ComponentManager.
-resource.missing-dependency.error=Missing {0,choice,1#Optional|2#Required} dependency
with role "{1}" for component named {2}.
+resource.service-not-a-component.error=The service with key "0" and implemenation
+class "{1}" does not implement the Component interface but is being exposed via
+ComponentManager.
+resource.missing-dependency.error=Missing {0,choice,1#Optional|2#Required} dependency
+with key "{1}" for component named {2}.
resource.missing-parameters.error=Missing Parameters object for component named "{0}".
resource.missing-parameters.error=Missing Configuration for component named "{0}".
Index: src/java/org/apache/excalibur/containerkit/metadata/ComponentMetaData.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metadata/ComponentMetaData.java,v
retrieving revision 1.13
diff -u -r1.13 ComponentMetaData.java
--- src/java/org/apache/excalibur/containerkit/metadata/ComponentMetaData.java 18 Aug
2002 03:34:28 -0000 1.13
+++ src/java/org/apache/excalibur/containerkit/metadata/ComponentMetaData.java 26 Nov
+2002 11:56:38 -0000
@@ -8,11 +8,13 @@
package org.apache.excalibur.containerkit.metadata;
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.info.Attribute;
+import org.apache.avalon.framework.info.FeatureDescriptor;
import org.apache.avalon.framework.parameters.Parameters;
/**
* Each component declared in the application is represented by
- * a ComponentPolicy. Note that this does not necessarily imply
+ * a ComponentMetaData. Note that this does not necessarily imply
* that there is only one instance of actual component. The
* ComponentMetaData could represent a pool of components, a single
* component or a component prototype that is reused to create
@@ -22,8 +24,15 @@
* @version $Revision: 1.13 $ $Date: 2002/08/18 03:34:28 $
*/
public class ComponentMetaData
+ extends FeatureDescriptor
{
/**
+ * The name of the component. This is an
+ * abstract name used during assembly.
+ */
+ private final String m_name;
+
+ /**
* The implementationKey for this component.
* Usually this represents a classname but
* alternative mechanisms could be used (ie URL
@@ -32,12 +41,6 @@
private final String m_implementationKey;
/**
- * The name of the component. This is an
- * abstract name used during assembly.
- */
- private final String m_name;
-
- /**
* The resolution of any dependencies required by
* the component type.
*/
@@ -57,14 +60,20 @@
* Create a ComponentMetaData.
*
* @param name the abstract name of component meta data instance
+ * @param implementationKey the key used to create component (usually a classname)
* @param dependencies the meta data for any dependencies
+ * @param parameters the parameters that the component will be provided (may be
+null)
+ * @param configuration the configuration that the component will be provided
+(may be null)
+ * @param attributes the extra attributes that are used to describe component
*/
public ComponentMetaData( final String name,
final String implementationKey,
final DependencyMetaData[] dependencies,
final Parameters parameters,
- final Configuration configuration )
+ final Configuration configuration,
+ final Attribute[] attributes )
{
+ super( attributes );
if( null == name )
{
throw new NullPointerException( "name" );
@@ -86,9 +95,9 @@
}
/**
- * Return the name of component profile.
+ * Return the name of component metadata.
*
- * @return the name of the component profile.
+ * @return the name of the component metadata.
*/
public String getName()
{
@@ -136,15 +145,15 @@
}
/**
- * Return the dependency for component with specified role.
+ * Return the dependency for component with specified key.
*
- * @return the dependency for component with specified role.
+ * @return the dependency for component with specified key.
*/
- public DependencyMetaData getDependency( final String role )
+ public DependencyMetaData getDependency( final String key )
{
for( int i = 0; i < m_dependencies.length; i++ )
{
- if( m_dependencies[ i ].getRole().equals( role ) )
+ if( m_dependencies[ i ].getKey().equals( key ) )
{
return m_dependencies[ i ];
}
Index: src/java/org/apache/excalibur/containerkit/metadata/DependencyMetaData.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metadata/DependencyMetaData.java,v
retrieving revision 1.10
diff -u -r1.10 DependencyMetaData.java
--- src/java/org/apache/excalibur/containerkit/metadata/DependencyMetaData.java 2 Oct
2002 01:46:57 -0000 1.10
+++ src/java/org/apache/excalibur/containerkit/metadata/DependencyMetaData.java 26 Nov
+2002 11:56:39 -0000
@@ -7,12 +7,15 @@
*/
package org.apache.excalibur.containerkit.metadata;
+import org.apache.avalon.framework.info.FeatureDescriptor;
+import org.apache.avalon.framework.info.Attribute;
+
/**
* The {@link DependencyMetaData} is the mapping of a component as a dependency
* of another component. Each component declares dependencies (via
* {@link org.apache.avalon.framework.info.ComponentInfo})
* and for each dependency there must be a coressponding DependencyMetaData which
- * has a matching role. The name value in {@link DependencyMetaData} object must refer
+ * has a matching key. The name value in {@link DependencyMetaData} object must refer
* to another Component that implements a service as specified in DependencyInfo.
*
* <p>Note that it is invalid to have circular dependencies.</p>
@@ -22,11 +25,12 @@
* @version $Revision: 1.10 $ $Date: 2002/10/02 01:46:57 $
*/
public final class DependencyMetaData
+ extends FeatureDescriptor
{
/**
- * The name that the client component will use to access a dependency.
+ * The key that the client component will use to access a dependency.
*/
- private final String m_role;
+ private final String m_key;
/**
* the name of the component profile that represents a component
@@ -35,29 +39,52 @@
private final String m_providerName;
/**
- * Create Association between role and provider.
+ * The key that is used when the dependency is a map dependency.
+ * Usually this defaults to the same value as the key.
+ */
+ private final String m_alias;
+
+ /**
+ * Create Association between key and provider.
*
- * @param role the name client uses to access component
+ * @param key the key the client uses to access component
* @param providerName the name of {@link ComponentMetaData}
* that is associated as a service provider
*/
- public DependencyMetaData( final String role,
- final String providerName )
+ public DependencyMetaData( final String key,
+ final String providerName,
+ final String alias,
+ final Attribute[] attributes )
{
- m_role = role;
+ super( attributes );
+
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+ if( null == providerName )
+ {
+ throw new NullPointerException( "providerName" );
+ }
+ if( null == alias )
+ {
+ throw new NullPointerException( "alias" );
+ }
+ m_key = key;
m_providerName = providerName;
+ m_alias = alias;
}
/**
- * Return the name that will be used by a component instance to access a
+ * Return the key that will be used by a component instance to access a
* dependent service.
*
* @return the name that the client component will use to access dependency.
* @see org.apache.avalon.framework.service.ServiceManager#lookup( String )
*/
- public String getRole()
+ public String getKey()
{
- return m_role;
+ return m_key;
}
/**
@@ -69,5 +96,17 @@
public String getProviderName()
{
return m_providerName;
+ }
+
+ /**
+ * The key under which the dependency is placed in map if dependency is
+ * a Map dependency.
+ *
+ * @return the key under which the dependency is placed in map if dependency is
+ * a Map dependency.
+ */
+ public String getAlias()
+ {
+ return m_alias;
}
}
Index: src/java/org/apache/excalibur/containerkit/metadata/MetaDataBuilder.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metadata/MetaDataBuilder.java,v
retrieving revision 1.2
diff -u -r1.2 MetaDataBuilder.java
--- src/java/org/apache/excalibur/containerkit/metadata/MetaDataBuilder.java 2 Oct
2002 01:52:19 -0000 1.2
+++ src/java/org/apache/excalibur/containerkit/metadata/MetaDataBuilder.java 26 Nov
+2002 11:56:39 -0000
@@ -7,11 +7,11 @@
*/
package org.apache.excalibur.containerkit.metadata;
-
+import java.util.Map;
/**
- * Load metadata from some source. The source is usually
- * one or more xml config files.
+ * Load metadata for an Assembly from some source.
+ * The source is usually one or more xml config files.
*
* @author <a href="mailto:peter at apache.org">Peter Donald</a>
* @version $Revision: 1.2 $ $Date: 2002/10/02 01:52:19 $
@@ -20,15 +20,14 @@
{
/**
* Load metadata from a particular source
- * defined by location string. The format of
- * location string and format of source loaded
- * from is left unspecified.
+ * using specified map of parameters. The content
+ * of the parameters is left unspecified.
*
- * @param location the location of meta data source
+ * @param parameters the parameters indicating method to load meta data source
* @return the set of components in metadata
- * @throws java.lang.Exception if unable to load or resolve meta
- * data for any reason
+ * @throws Exception if unable to load or resolve
+ * meta data for any reason
*/
- ComponentMetaData[] loadMetaData( String location )
+ PartitionMetaData loadAssembly( Map parameters )
throws Exception;
}
Index: src/java/org/apache/excalibur/containerkit/metadata/package.html
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metadata/package.html,v
retrieving revision 1.2
diff -u -r1.2 package.html
--- src/java/org/apache/excalibur/containerkit/metadata/package.html 6 Jul 2002
01:13:01 -0000 1.2
+++ src/java/org/apache/excalibur/containerkit/metadata/package.html 26 Nov 2002
+11:56:39 -0000
@@ -1,5 +1,4 @@
-
<body>
A set of classes supporting the representation of information about a
-component profile.
+component assembly.
</body>
Index: src/java/org/apache/excalibur/containerkit/registry/ComponentProfile.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/registry/ComponentProfile.java,v
retrieving revision 1.1
diff -u -r1.1 ComponentProfile.java
--- src/java/org/apache/excalibur/containerkit/registry/ComponentProfile.java 24 Aug
2002 08:49:03 -0000 1.1
+++ src/java/org/apache/excalibur/containerkit/registry/ComponentProfile.java 26 Nov
+2002 11:56:39 -0000
@@ -27,6 +27,7 @@
* the type of this component.
*/
private final ComponentInfo m_info;
+
/**
* The {@link ComponentMetaData} that describes
* this component.
Index: src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java,v
retrieving revision 1.40
diff -u -r1.40 AssemblyVerifier.java
--- src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java 12 Nov
2002 01:39:42 -0000 1.40
+++ src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java 26 Nov
+2002 11:56:40 -0000
@@ -245,13 +245,13 @@
throws VerifyException
{
final ComponentInfo info = component.getInfo();
- final DependencyMetaData[] roles = component.getMetaData().getDependencies();
+ final DependencyMetaData[] dependencies =
+component.getMetaData().getDependencies();
- for( int i = 0; i < roles.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- final String providerName = roles[ i ].getProviderName();
- final String roleName = roles[ i ].getRole();
- final String implementationKey = info.getDependency( roleName ).getType();
+ final String providerName = dependencies[ i ].getProviderName();
+ final String key = dependencies[ i ].getKey();
+ final String implementationKey = info.getDependency( key ).getType();
//Get the other component that is providing service
final ComponentProfile provider = getComponentProfile( providerName,
others );
@@ -259,7 +259,7 @@
{
final String message =
REZ.getString( "assembly.missing-dependency.error",
- roleName,
+ key,
providerName,
component.getMetaData().getName() );
throw new VerifyException( message );
@@ -404,15 +404,15 @@
protected void verifyDependenciesMap( final ComponentProfile component )
throws VerifyException
{
- //Make sure all role entries specified in config file are valid
+ //Make sure all dependency entries specified in config file are valid
final DependencyMetaData[] dependencySet =
component.getMetaData().getDependencies();
for( int i = 0; i < dependencySet.length; i++ )
{
- final String roleName = dependencySet[ i ].getRole();
+ final String key = dependencySet[ i ].getKey();
final ComponentInfo info = component.getInfo();
- final DependencyDescriptor descriptor = info.getDependency( roleName );
+ final DependencyDescriptor descriptor = info.getDependency( key );
//If there is no dependency descriptor in ComponentInfo then
//user has specified an uneeded dependency.
@@ -420,8 +420,8 @@
{
final String message =
REZ.getString( "assembly.unknown-dependency.error",
- roleName,
- roleName,
+ key,
+ key,
component.getMetaData().getName() );
throw new VerifyException( message );
}
@@ -433,12 +433,12 @@
for( int i = 0; i < dependencies.length; i++ )
{
final DependencyDescriptor dependency = dependencies[ i ];
- final DependencyMetaData role =
+ final DependencyMetaData dependencyMetaData =
component.getMetaData().getDependency( dependency.getKey() );
- //If there is no Role then the user has failed
+ //If there is no metaData then the user has failed
//to specify a needed dependency.
- if( null == role && !dependency.isOptional() )
+ if( null == dependencyMetaData && !dependency.isOptional() )
{
final String message =
REZ.getString( "assembly.unspecified-dependency.error",
Index: src/java/org/apache/excalibur/containerkit/verifier/Resources.properties
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/Resources.properties,v
retrieving revision 1.11
diff -u -r1.11 Resources.properties
--- src/java/org/apache/excalibur/containerkit/verifier/Resources.properties 14 Sep
2002 06:21:00 -0000 1.11
+++ src/java/org/apache/excalibur/containerkit/verifier/Resources.properties 26 Nov
+2002 11:56:41 -0000
@@ -6,11 +6,11 @@
assembly.nocircular-dependencies.notice=Verifying that there are no circular
dependencies between Components.
assembly.component-type.notice=Verifying that the specified Components have valid
types.
assembly.circular-dependency.error=Component named "{0}" has a circular dependency
via path: {1}.
-assembly.missing-dependency.error=Component "{1}" that satisfies the dependency with
role "{0}" of Component "{2}" does not exist.
+assembly.missing-dependency.error=Component "{1}" that satisfies the dependency with
+key "{0}" of Component "{2}" does not exist.
assembly.dependency-missing-service.error=Dependency "{0}" of Block "{2}" does not
offer the required service "{1}".
assembly.bad-class.error=Unable to load class "{1}" for Component named "{0}".
(Reason: {2}).
assembly.bad-name.error=The Component name "{0}" is invalid. Valid names contain only
letters, digits and the '-' character.
assembly.duplicate-name.error=The name "{0}" is used by multiple Components in
assembly.
-assembly.unknown-dependency.error=Unknown dependency named "{0}" with role "{1}"
declared for Component {2}.
-assembly.unspecified-dependency.error=Dependency for role "{0}" not specified for the
Component named "{1}".
+assembly.unknown-dependency.error=Unknown dependency named "{0}" with key "{1}"
+declared for Component {2}.
+assembly.unspecified-dependency.error=Dependency for key "{0}" not specified for the
+Component named "{1}".
error=Component named "{0}" of type "{1}" is not Contextualizable but declares
Context Entrys.
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.containerkit.metadata;
import org.apache.avalon.framework.info.Attribute;
import org.apache.avalon.framework.info.FeatureDescriptor;
/**
* In each Assembly there may be groups of components that
* are activated together and treated as a group. These
* components are all "visible" to each other as peers.
* The group will have a name and may use resources from
* other partitions. Partitions can also be nested one inside
* each other.
*
* @author <a href="mailto:peter at apache.org">Peter Donald</a>
* @version $Revision: 1.13 $ $Date: 2002/08/18 03:34:28 $
*/
public class PartitionMetaData
extends FeatureDescriptor
{
/**
* Constant for an empty set of partitions.
*/
public static final PartitionMetaData[] EMPTY_SET = new PartitionMetaData[ 0 ];
/**
* The name of the partition. This is an
* abstract name used during assembly.
*/
private final String m_name;
/**
* An array listing the set of other partitions required by
* this partition. The required partitions must be initialized
* and in ready state prior to this partition starting and this
* partition must be shutdown prior
*/
private final String[] m_depends;
/**
* AN array of partitions that are contained by this
* object.
*/
private final PartitionMetaData[] m_partitions;
/**
* AN array of partitions that are contained by this
* object.
*/
private final ComponentMetaData[] m_components;
/**
* Create a ComponentMetaData.
*
* @param name the abstract name of component meta data instance
* @param depends the partitions depended upon by this parition
* @param partitions the partitions contained by this partition
* @param components the components contained by this partition
* @param attributes the extra attributes that are used to describe component
*/
public PartitionMetaData( final String name,
final String[] depends,
final PartitionMetaData[] partitions,
final ComponentMetaData[] components,
final Attribute[] attributes )
{
super( attributes );
if( null == name )
{
throw new NullPointerException( "name" );
}
if( null == depends )
{
throw new NullPointerException( "depends" );
}
if( null == partitions )
{
throw new NullPointerException( "partitions" );
}
if( null == components )
{
throw new NullPointerException( "components" );
}
m_name = name;
m_depends = depends;
m_partitions = partitions;
m_components = components;
}
/**
* Return the name of component profile.
*
* @return the name of the component profile.
*/
public String getName()
{
return m_name;
}
/**
* Return the set of prereqs for this partition.
*
* @return the set of prereqs for this partition.
*/
public String[] getDepends()
{
return m_depends;
}
/**
* Return the set of partitions contained in this partition.
*
* @return the set of partitions contained in this partition.
*/
public PartitionMetaData[] getPartitions()
{
return m_partitions;
}
/**
* Return the set of components contained in this partition.
*
* @return the set of components contained in this partition.
*/
public ComponentMetaData[] getComponents()
{
return m_components;
}
/**
* Return the partition with specified name.
*
* @return the partition with specified name.
*/
public PartitionMetaData getPartition( final String name )
{
for( int i = 0; i < m_partitions.length; i++ )
{
final PartitionMetaData partition = m_partitions[ i ];
if( partition.getName().equals( name ) )
{
return partition;
}
}
return null;
}
/**
* Return the component with specified name.
*
* @return the component with specified name.
*/
public ComponentMetaData getComponent( final String name )
{
for( int i = 0; i < m_components.length; i++ )
{
final ComponentMetaData component = m_components[ i ];
if( component.getName().equals( name ) )
{
return component;
}
}
return null;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>