You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/07/14 21:39:10 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/container ComponentLocatorImpl.java CocoonComponentManager.java
cziegeler 2004/07/14 12:39:10
Modified: src/java/org/apache/cocoon/components
ExtendedComponentSelector.java
src/java/org/apache/cocoon/components/treeprocessor/sitemap
ComponentsSelector.java
src/java/org/apache/cocoon/components/container
ComponentLocatorImpl.java
CocoonComponentManager.java
Removed: src/java/org/apache/cocoon/components ParentAware.java
ComponentLocator.java
Log:
Remove deprecated ParentAware - we will cleanup this solution when we move to Fortress
Revision Changes Path
1.10 +19 -14 cocoon-2.1/src/java/org/apache/cocoon/components/ExtendedComponentSelector.java
Index: ExtendedComponentSelector.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/ExtendedComponentSelector.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ExtendedComponentSelector.java 5 Mar 2004 13:02:45 -0000 1.9
+++ ExtendedComponentSelector.java 14 Jul 2004 19:39:09 -0000 1.10
@@ -22,6 +22,7 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.cocoon.components.container.ComponentLocatorImpl;
/**
* An extension of <code>ExcaliburComponentSelector</code> that can have a parent
@@ -32,8 +33,7 @@
*/
public class ExtendedComponentSelector
- extends ExcaliburComponentSelector
- implements ParentAware {
+ extends ExcaliburComponentSelector {
/** The role manager */
protected RoleManager roles;
@@ -42,7 +42,7 @@
protected ExtendedComponentSelector parentSelector;
/** The parent locator, if any */
- protected ComponentLocator parentLocator;
+ protected ComponentLocatorImpl parentLocator;
/** The class loader to use */
protected ClassLoader classLoader;
@@ -56,15 +56,12 @@
/** This selector's location (used for debugging purposes) */
private String location;
- public ExtendedComponentSelector()
- {
- super();
+ public ExtendedComponentSelector() {
this.classLoader = Thread.currentThread().getContextClassLoader();
}
/** Create the ComponentSelector with a Classloader */
- public ExtendedComponentSelector(ClassLoader loader)
- {
+ public ExtendedComponentSelector(ClassLoader loader) {
super(loader);
if (loader == null) {
@@ -227,8 +224,7 @@
throw new ConfigurationException(message);
}
- try
- {
+ try {
Class clazz = this.classLoader.loadClass(className);
addComponent(hint, clazz, instance);
@@ -250,6 +246,9 @@
return this.defaultHint;
}
+ /* (non-Javadoc)
+ * @see org.apache.avalon.framework.component.ComponentSelector#select(java.lang.Object)
+ */
public Component select(Object hint) throws ComponentException {
if (hint == null) {
@@ -274,6 +273,9 @@
}
}
+ /* (non-Javadoc)
+ * @see org.apache.avalon.framework.component.ComponentSelector#release(org.apache.avalon.framework.component.Component)
+ */
public void release(Component component) {
// Was it selected on the parent ?
if ( this.parentSelector != null &&
@@ -307,10 +309,13 @@
return super.hasComponent(hint);
}
- /* (non-Javadoc)
- * @see org.apache.cocoon.components.ParentAware#setParentInformation(org.apache.avalon.framework.component.ComponentManager, java.lang.String)
+ /**
+ * Set the ComponentLocatorImpl that allows access to a possible
+ * parent of this selector
+ * @param locator
+ * @throws ComponentException
*/
- public void setParentLocator(ComponentLocator locator)
+ public void setParentLocator(ComponentLocatorImpl locator)
throws ComponentException {
if (this.parentSelector != null) {
throw new ComponentException(null, "Parent selector is already set");
1.11 +5 -5 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ComponentsSelector.java
Index: ComponentsSelector.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ComponentsSelector.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ComponentsSelector.java 25 May 2004 07:28:25 -0000 1.10
+++ ComponentsSelector.java 14 Jul 2004 19:39:09 -0000 1.11
@@ -27,8 +27,8 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.cocoon.acting.Action;
-import org.apache.cocoon.components.ComponentLocator;
import org.apache.cocoon.components.ExtendedComponentSelector;
+import org.apache.cocoon.components.container.ComponentLocatorImpl;
import org.apache.cocoon.components.pipeline.OutputComponentSelector;
import org.apache.cocoon.components.pipeline.ProcessingPipeline;
import org.apache.cocoon.generation.Generator;
@@ -100,10 +100,10 @@
/** The parent selector, if it's of the current class */
private SitemapComponentSelector parentSitemapSelector;
- /* (non-Javadoc)
- * @see org.apache.cocoon.components.ParentAware#setParentInformation(org.apache.avalon.framework.component.ComponentManager, java.lang.String)
+ /**
+ * Give access to the parent selector - if any
*/
- public void setParentLocator(ComponentLocator locator)
+ public void setParentLocator(ComponentLocatorImpl locator)
throws ComponentException {
super.setParentLocator(locator);
1.3 +2 -4 cocoon-2.1/src/java/org/apache/cocoon/components/container/ComponentLocatorImpl.java
Index: ComponentLocatorImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/container/ComponentLocatorImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComponentLocatorImpl.java 12 Jul 2004 01:57:49 -0000 1.2
+++ ComponentLocatorImpl.java 14 Jul 2004 19:39:10 -0000 1.3
@@ -18,7 +18,6 @@
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.cocoon.components.ComponentLocator;
/**
* This object is set to a {@link ParentAware} component and allows
@@ -27,8 +26,7 @@
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
*/
-public class ComponentLocatorImpl
- implements ComponentLocator {
+public class ComponentLocatorImpl {
protected ComponentManager manager;
protected String role;
1.3 +4 -4 cocoon-2.1/src/java/org/apache/cocoon/components/container/CocoonComponentManager.java
Index: CocoonComponentManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/container/CocoonComponentManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CocoonComponentManager.java 26 May 2004 01:31:06 -0000 1.2
+++ CocoonComponentManager.java 14 Jul 2004 19:39:10 -0000 1.3
@@ -26,7 +26,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.components.ParentAware;
+import org.apache.cocoon.components.ExtendedComponentSelector;
import org.apache.cocoon.components.SitemapConfigurable;
import org.apache.cocoon.components.SitemapConfigurationHolder;
@@ -121,7 +121,7 @@
super.addComponent(role, clazz, conf);
// Note that at this point, we're not initialized and cannot do
// lookups, so defer parental introductions to initialize().
- if ( ParentAware.class.isAssignableFrom( clazz ) ) {
+ if ( ExtendedComponentSelector.class.isAssignableFrom( clazz ) ) {
parentAwareComponents.add(role);
}
}
@@ -143,7 +143,7 @@
Component component = null;
try {
component = this.lookup( role );
- ((ParentAware)component).setParentLocator( new ComponentLocatorImpl(this.parentManager, role ));
+ ((ExtendedComponentSelector)component).setParentLocator( new ComponentLocatorImpl(this.parentManager, role ));
} catch (ComponentException ignore) {
// we don't set the parent then
} finally {