donaldp 2002/06/04 00:40:21
Added: src/java/org/apache/avalon/phoenix/components/container
ComponentMetaData.java DependencyMetaData.java
Log:
Add in some javadoced generic MetaData
Revision Changes Path
1.1
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/container/ComponentMetaData.java
Index: ComponentMetaData.java
===================================================================
/*
* 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.avalon.phoenix.components.container;
import org.apache.excalibur.containerkit.ComponentInfo;
/**
* Each Component delcared in the application is represented by
* 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
* new Components as needed.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @version $Revision: 1.1 $ $Date: 2002/06/04 07:40:21 $
*/
public class ComponentMetaData
{
/**
* 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.
*/
private final DependencyMetaData[] m_dependencies;
/**
* The info object for component.
*/
private final ComponentInfo m_info;
/**
* Create a ComponentMetaData.
*
* @param name the name of component
* @param dependencies the meta data for any dependencies
* @param info the info for component
*/
public ComponentMetaData( final String name,
final DependencyMetaData[] dependencies,
final ComponentInfo info )
{
m_name = name;
m_dependencies = dependencies;
m_info = info;
}
/**
* Return the name of component.
*
* @return the name of the component.
*/
public String getName()
{
return m_name;
}
/**
* Utility method to return the classname of component.
* This is equivelent to
* <tt>getComponentInfo().getComponentDescriptor().getClassname()</tt>.
*
* @return the classname of the component.
*/
public String getClassname()
{
return getComponentInfo().getComponentDescriptor().getClassname();
}
/**
* Return the info for component.
*
* @return the info for component.
*/
public ComponentInfo getComponentInfo()
{
return m_info;
}
/**
* Return the dependency metadata for component.
*
* @return the dependency metadata for component.
*/
public DependencyMetaData[] getDependencies()
{
return m_dependencies;
}
/**
* Return the dependency metadata for component with specified role.
*
* @return the dependency metadata for component with specified role.
*/
public DependencyMetaData getDependency( final String role )
{
for( int i = 0; i < m_dependencies.length; i++ )
{
if( m_dependencies[ i ].getRole().equals( role ) )
{
return m_dependencies[ i ];
}
}
return null;
}
}
1.1
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/container/DependencyMetaData.java
Index: DependencyMetaData.java
===================================================================
/*
* 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.avalon.phoenix.components.container;
/**
* The DependencyMetaData is the mapping of a component as a dependency
* of another component. Each component declares dependencies (via
ComponentInfo)
* and for each dependency there must be a coressponding DependencyMetaData
which
* has a matching role. The name value in DependencyMetaData object must refer
* to another Component that implements Service as specified in
DependencyInfo.
*
* <p>Note that it is invalid to have circular dependencies.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @version $Revision: 1.1 $ $Date: 2002/06/04 07:40:21 $
*/
public final class DependencyMetaData
{
/**
* The name that the client component will use to access dependency.
*/
private final String m_role;
/**
* the name of the Component that will provide the dependency.
*/
private final String m_name;
/**
* Create MetaData with specified name and role.
*
* @param role the name client uses to access component
* @param name the name of provider
*/
public DependencyMetaData( final String role, final String name )
{
m_role = role;
m_name = name;
}
/**
* Return the name that the client component will use to access
dependency.
*
* @return the name that the client component will use to access
dependency.
*/
public String getRole()
{
return m_role;
}
/**
* Return the name of the Component that will provide the dependency.
*
* @return the name of the Component that will provide the dependency.
*/
public String getName()
{
return m_name;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>