You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/03/15 05:35:08 UTC
cvs commit: jakarta-avalon/proposal/4.0/src/java/org/apache/framework/thread ThreadContext.java ThreadManager.java ThreadPool.java
donaldp 01/03/14 20:35:08
Modified: proposal/4.0/src/java/org/apache/aut/security
AbstractPolicy.java
proposal/4.0/src/java/org/apache/avalon/camelot
AbstractCamelotDeployer.java AbstractContainer.java
AbstractDeployer.java AbstractZipDeployer.java
AvalonState.java CamelotUtil.java
DefaultFactory.java DefaultLoader.java
DefaultLocator.java DefaultLocatorRegistry.java
DefaultRegistry.java DeployerUtil.java
proposal/4.0/src/java/org/apache/avalon/component
DefaultComponentManager.java
DefaultComponentSelector.java
proposal/4.0/src/java/org/apache/avalon/configuration
AbstractConfiguration.java
DefaultConfiguration.java
DefaultConfigurationBuilder.java
SAXConfigurationHandler.java
proposal/4.0/src/java/org/apache/avalon/context
DefaultContext.java
proposal/4.0/src/java/org/apache/avalon/datasource
DataSourceComponent.java J2eeDataSource.java
JdbcConnection.java JdbcConnectionPool.java
JdbcDataSource.java
proposal/4.0/src/java/org/apache/avalon/logger
AbstractLoggable.java
proposal/4.0/src/java/org/apache/avalon/pool
AbstractPool.java DefaultObjectFactory.java
DefaultPool.java ThreadSafePool.java
proposal/4.0/src/java/org/apache/avalon/thread
DefaultThreadPool.java WorkerThread.java
Added: proposal/4.0/src/java/org/apache/framework Modifiable.java
Recyclable.java SingleThreaded.java ThreadSafe.java
proposal/4.0/src/java/org/apache/framework/component
Component.java ComponentException.java
ComponentManager.java ComponentSelector.java
Composer.java Recomposer.java
proposal/4.0/src/java/org/apache/framework/configuration
Configurable.java Configuration.java
ConfigurationBuilder.java
ConfigurationException.java Parameters.java
Reconfigurable.java
proposal/4.0/src/java/org/apache/framework/container
Container.java ContainerException.java
Deployer.java DeploymentException.java Entry.java
Factory.java FactoryException.java Loader.java
Locator.java LocatorRegistry.java MetaInfo.java
Registry.java RegistryException.java State.java
proposal/4.0/src/java/org/apache/framework/context
Context.java Contextualizable.java
Recontextualizable.java Resolvable.java
proposal/4.0/src/java/org/apache/framework/lifecycle
Disposable.java Initializable.java Resumable.java
Startable.java Stoppable.java Suspendable.java
proposal/4.0/src/java/org/apache/framework/logger
Loggable.java
proposal/4.0/src/java/org/apache/framework/pool
ObjectFactory.java Pool.java PoolController.java
Poolable.java
proposal/4.0/src/java/org/apache/framework/processor
Matcher.java Pipeline.java ProcessorPipeline.java
ProcessorTree.java Stage.java
proposal/4.0/src/java/org/apache/framework/thread
ThreadContext.java ThreadManager.java
ThreadPool.java
Removed: proposal/4.0/src/java/org/apache/avalon Modifiable.java
Recyclable.java SingleThreaded.java ThreadSafe.java
changes.txt
proposal/4.0/src/java/org/apache/avalon/component
Component.java ComponentException.java
ComponentManager.java ComponentSelector.java
Composer.java Recomposer.java
proposal/4.0/src/java/org/apache/avalon/configuration
Configurable.java Configuration.java
ConfigurationBuilder.java
ConfigurationException.java Parameters.java
Reconfigurable.java
proposal/4.0/src/java/org/apache/avalon/container
Container.java ContainerException.java
Deployer.java DeploymentException.java Entry.java
Factory.java FactoryException.java Loader.java
Locator.java LocatorRegistry.java MetaInfo.java
Registry.java RegistryException.java State.java
proposal/4.0/src/java/org/apache/avalon/context Context.java
Contextualizable.java Recontextualizable.java
Resolvable.java
proposal/4.0/src/java/org/apache/avalon/lifecycle
Disposable.java Initializable.java Resumable.java
Startable.java Stoppable.java Suspendable.java
proposal/4.0/src/java/org/apache/avalon/logger Loggable.java
proposal/4.0/src/java/org/apache/avalon/pool
ObjectFactory.java Pool.java PoolController.java
Poolable.java
proposal/4.0/src/java/org/apache/avalon/processor
Matcher.java Pipeline.java ProcessorPipeline.java
ProcessorTree.java Stage.java
proposal/4.0/src/java/org/apache/avalon/thread
ThreadContext.java ThreadManager.java
ThreadPool.java
Log:
Migrated interface classes to org.apache.framework - while implementation classes remain in org.apache.avalon
Revision Changes Path
1.3 +2 -2 jakarta-avalon/proposal/4.0/src/java/org/apache/aut/security/AbstractPolicy.java
Index: AbstractPolicy.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/aut/security/AbstractPolicy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractPolicy.java 2001/03/15 03:09:30 1.2
+++ AbstractPolicy.java 2001/03/15 04:34:44 1.3
@@ -23,8 +23,8 @@
import java.util.Enumeration;
import java.util.PropertyPermission;
import org.apache.aut.io.FileUtil;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.logger.Loggable;
+import org.apache.framework.component.Component;
+import org.apache.framework.logger.Loggable;
import org.apache.log.Logger;
/**
1.4 +14 -14 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractCamelotDeployer.java
Index: AbstractCamelotDeployer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractCamelotDeployer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractCamelotDeployer.java 2001/03/15 03:10:12 1.3
+++ AbstractCamelotDeployer.java 2001/03/15 04:34:44 1.4
@@ -8,17 +8,17 @@
package org.apache.avalon.camelot;
import java.net.URL;
-import org.apache.avalon.component.ComponentManager;
-import org.apache.avalon.component.ComponentException;
-import org.apache.avalon.component.Composer;
-import org.apache.avalon.container.DeploymentException;
-import org.apache.avalon.container.ContainerException;
-import org.apache.avalon.container.RegistryException;
-import org.apache.avalon.container.Container;
-import org.apache.avalon.container.Registry;
-import org.apache.avalon.container.LocatorRegistry;
-import org.apache.avalon.container.Entry;
-import org.apache.avalon.container.MetaInfo;
+import org.apache.framework.component.ComponentManager;
+import org.apache.framework.component.ComponentException;
+import org.apache.framework.component.Composer;
+import org.apache.framework.container.DeploymentException;
+import org.apache.framework.container.ContainerException;
+import org.apache.framework.container.RegistryException;
+import org.apache.framework.container.Container;
+import org.apache.framework.container.Registry;
+import org.apache.framework.container.LocatorRegistry;
+import org.apache.framework.container.Entry;
+import org.apache.framework.container.MetaInfo;
/**
* This class deploys resources from camelot based system.
@@ -48,19 +48,19 @@
if( m_deployToLocatorRegistry )
{
m_locatorRegistry = (LocatorRegistry)componentManager.
- lookup( "org.apache.avalon.container.LocatorRegistry" );
+ lookup( "org.apache.framework.container.LocatorRegistry" );
}
if( m_deployToInfoRegistry )
{
m_infoRegistry = (Registry)componentManager.
- lookup( "org.apache.avalon.container.Registry" );
+ lookup( "org.apache.framework.container.Registry" );
}
if( m_deployToContainer )
{
m_container = (Container)componentManager.
- lookup( "org.apache.avalon.container.Container" );
+ lookup( "org.apache.framework.container.Container" );
}
}
1.4 +4 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractContainer.java
Index: AbstractContainer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractContainer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractContainer.java 2001/03/15 03:10:12 1.3
+++ AbstractContainer.java 2001/03/15 04:34:44 1.4
@@ -9,10 +9,10 @@
import java.util.HashMap;
import java.util.Iterator;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.container.Container;
-import org.apache.avalon.container.ContainerException;
-import org.apache.avalon.container.Entry;
+import org.apache.framework.component.Component;
+import org.apache.framework.container.Container;
+import org.apache.framework.container.ContainerException;
+import org.apache.framework.container.Entry;
import org.apache.avalon.logger.AbstractLoggable;
/**
1.4 +3 -5 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractDeployer.java
Index: AbstractDeployer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractDeployer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractDeployer.java 2001/03/15 03:10:13 1.3
+++ AbstractDeployer.java 2001/03/15 04:34:44 1.4
@@ -15,13 +15,11 @@
import java.net.URL;
import java.util.HashMap;
import org.apache.avalon.logger.AbstractLoggable;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.component.ComponentNotFoundException;
+import org.apache.framework.component.Component;
import org.apache.aut.io.FileUtil;
import org.apache.log.Logger;
-import org.apache.avalon.container.Deployer;
-import org.apache.avalon.container.DeploymentException;
-
+import org.apache.framework.container.Deployer;
+import org.apache.framework.container.DeploymentException;
/**
* A Deployer is responsible for taking a URL (ie a jar/war/ear) and deploying
1.3 +2 -3 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractZipDeployer.java
Index: AbstractZipDeployer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AbstractZipDeployer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractZipDeployer.java 2001/02/27 11:02:33 1.2
+++ AbstractZipDeployer.java 2001/03/15 04:34:44 1.3
@@ -12,9 +12,8 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.zip.ZipFile;
-import org.apache.avalon.component.Composer;
-import org.apache.avalon.container.DeploymentException;
-
+import org.apache.framework.component.Composer;
+import org.apache.framework.container.DeploymentException;
/**
* This class deploys a .zip file into a registry.
1.3 +1 -2 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AvalonState.java
Index: AvalonState.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/AvalonState.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AvalonState.java 2001/02/27 11:02:34 1.2
+++ AvalonState.java 2001/03/15 04:34:44 1.3
@@ -7,8 +7,7 @@
*/
package org.apache.avalon.camelot;
-import org.apache.avalon.container.State;
-
+import org.apache.framework.container.State;
public final class AvalonState
extends State
1.3 +3 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/CamelotUtil.java
Index: CamelotUtil.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/CamelotUtil.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CamelotUtil.java 2001/02/27 11:02:35 1.2
+++ CamelotUtil.java 2001/03/15 04:34:44 1.3
@@ -11,11 +11,10 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Iterator;
-import org.apache.avalon.component.Component;
import org.apache.aut.io.ExtensionFileFilter;
-import org.apache.avalon.container.Deployer;
-import org.apache.avalon.container.DeploymentException;
-
+import org.apache.framework.component.Component;
+import org.apache.framework.container.Deployer;
+import org.apache.framework.container.DeploymentException;
/**
* Utility methods for Camelot related facilities.
1.4 +5 -7 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultFactory.java
Index: DefaultFactory.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultFactory.java 2001/03/15 03:10:13 1.3
+++ DefaultFactory.java 2001/03/15 04:34:45 1.4
@@ -9,14 +9,12 @@
import java.net.URL;
import java.util.HashMap;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.container.Factory;
-import org.apache.avalon.container.FactoryException;
-import org.apache.avalon.container.Loader;
-import org.apache.avalon.container.Locator;
import org.apache.avalon.logger.AbstractLoggable;
-
-
+import org.apache.framework.component.Component;
+import org.apache.framework.container.Factory;
+import org.apache.framework.container.FactoryException;
+import org.apache.framework.container.Loader;
+import org.apache.framework.container.Locator;
/**
* This is the component that creates the components.
1.3 +4 -5 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultLoader.java
Index: DefaultLoader.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultLoader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultLoader.java 2001/02/27 11:02:36 1.2
+++ DefaultLoader.java 2001/03/15 04:34:45 1.3
@@ -9,12 +9,11 @@
import java.net.URL;
import java.net.URLClassLoader;
-import org.apache.aut.ObjectUtil;
import org.apache.aut.ExceptionUtil;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.container.FactoryException;
-import org.apache.avalon.container.Loader;
-
+import org.apache.aut.ObjectUtil;
+import org.apache.framework.component.Component;
+import org.apache.framework.container.FactoryException;
+import org.apache.framework.container.Loader;
/**
* Class used to load resources from a source.
1.3 +2 -3 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultLocator.java
Index: DefaultLocator.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultLocator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultLocator.java 2001/02/27 11:02:37 1.2
+++ DefaultLocator.java 2001/03/15 04:34:45 1.3
@@ -8,10 +8,9 @@
package org.apache.avalon.camelot;
import java.net.URL;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.container.Locator;
+import org.apache.framework.component.Component;
+import org.apache.framework.container.Locator;
-
/**
* This contains information required to locate a component.
*
1.3 +4 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultLocatorRegistry.java
Index: DefaultLocatorRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultLocatorRegistry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultLocatorRegistry.java 2001/02/27 11:02:37 1.2
+++ DefaultLocatorRegistry.java 2001/03/15 04:34:45 1.3
@@ -7,10 +7,10 @@
*/
package org.apache.avalon.camelot;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.container.Locator;
-import org.apache.avalon.container.LocatorRegistry;
-import org.apache.avalon.container.RegistryException;
+import org.apache.framework.component.Component;
+import org.apache.framework.container.Locator;
+import org.apache.framework.container.LocatorRegistry;
+import org.apache.framework.container.RegistryException;
/**
* Represents a Registry of locators.
1.3 +4 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultRegistry.java
Index: DefaultRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DefaultRegistry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultRegistry.java 2001/02/27 11:02:38 1.2
+++ DefaultRegistry.java 2001/03/15 04:34:45 1.3
@@ -9,10 +9,10 @@
import java.util.HashMap;
import java.util.Iterator;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.container.Registry;
-import org.apache.avalon.container.RegistryException;
-import org.apache.avalon.container.MetaInfo;
+import org.apache.framework.component.Component;
+import org.apache.framework.container.Registry;
+import org.apache.framework.container.RegistryException;
+import org.apache.framework.container.MetaInfo;
/**
1.3 +5 -8 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DeployerUtil.java
Index: DeployerUtil.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/camelot/DeployerUtil.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DeployerUtil.java 2001/02/27 11:02:38 1.2
+++ DeployerUtil.java 2001/03/15 04:34:45 1.3
@@ -18,16 +18,13 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
-import org.apache.avalon.component.ComponentManager;
-import org.apache.avalon.component.ComponentNotAccessibleException;
-import org.apache.avalon.component.ComponentNotFoundException;
-import org.apache.avalon.component.Composer;
-import org.apache.avalon.configuration.Configuration;
-import org.apache.avalon.configuration.ConfigurationException;
import org.apache.avalon.configuration.DefaultConfigurationBuilder;
+import org.apache.framework.component.ComponentManager;
+import org.apache.framework.component.Composer;
+import org.apache.framework.configuration.Configuration;
+import org.apache.framework.configuration.ConfigurationException;
+import org.apache.framework.container.DeploymentException;
import org.xml.sax.SAXException;
-import org.apache.avalon.container.DeploymentException;
-
/**
* This class deploys resources from camelot based system.
1.3 +3 -0 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/component/DefaultComponentManager.java
Index: DefaultComponentManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/component/DefaultComponentManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultComponentManager.java 2001/03/15 03:10:15 1.2
+++ DefaultComponentManager.java 2001/03/15 04:34:46 1.3
@@ -9,6 +9,9 @@
import java.util.HashMap;
import java.util.Iterator;
+import org.apache.framework.component.Component;
+import org.apache.framework.component.ComponentException;
+import org.apache.framework.component.ComponentManager;
/**
* This class is a static implementation of a ComponentManager. Allow ineritance
1.3 +3 -0 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/component/DefaultComponentSelector.java
Index: DefaultComponentSelector.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/component/DefaultComponentSelector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultComponentSelector.java 2001/03/15 03:10:15 1.2
+++ DefaultComponentSelector.java 2001/03/15 04:34:46 1.3
@@ -8,6 +8,9 @@
package org.apache.avalon.component;
import java.util.HashMap;
+import org.apache.framework.component.Component;
+import org.apache.framework.component.ComponentException;
+import org.apache.framework.component.ComponentSelector;
/**
* This is the default implementation of the ComponentSelector
1.2 +3 -1 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/AbstractConfiguration.java
Index: AbstractConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/AbstractConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractConfiguration.java 2001/02/25 10:45:44 1.1
+++ AbstractConfiguration.java 2001/03/15 04:34:47 1.2
@@ -8,6 +8,8 @@
package org.apache.avalon.configuration;
import java.util.Iterator;
+import org.apache.framework.configuration.Configuration;
+import org.apache.framework.configuration.ConfigurationException;
/**
* This is an abstract <code>Configuration</code> implementation that deals
@@ -17,7 +19,7 @@
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/02/25 10:45:44 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/03/15 04:34:47 $
* @deprecated This has been deprecated in favour of configuration interface in org.apache.avalon.configuration interface
*/
public abstract class AbstractConfiguration
1.2 +2 -0 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/DefaultConfiguration.java
Index: DefaultConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/DefaultConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultConfiguration.java 2001/02/25 10:45:44 1.1
+++ DefaultConfiguration.java 2001/03/15 04:34:47 1.2
@@ -10,6 +10,8 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import org.apache.framework.configuration.Configuration;
+import org.apache.framework.configuration.ConfigurationException;
/**
* This is the default <code>Configuration</code> implementation.
1.2 +3 -0 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/DefaultConfigurationBuilder.java
Index: DefaultConfigurationBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/DefaultConfigurationBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultConfigurationBuilder.java 2001/02/25 10:45:44 1.1
+++ DefaultConfigurationBuilder.java 2001/03/15 04:34:48 1.2
@@ -11,6 +11,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import org.apache.framework.configuration.Configuration;
+import org.apache.framework.configuration.ConfigurationBuilder;
+import org.apache.framework.configuration.ConfigurationException;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
1.2 +1 -0 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/SAXConfigurationHandler.java
Index: SAXConfigurationHandler.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/configuration/SAXConfigurationHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SAXConfigurationHandler.java 2001/02/25 10:45:44 1.1
+++ SAXConfigurationHandler.java 2001/03/15 04:34:48 1.2
@@ -9,6 +9,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import org.apache.framework.configuration.Configuration;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator;
1.2 +1 -0 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/context/DefaultContext.java
Index: DefaultContext.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/context/DefaultContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultContext.java 2001/02/25 10:45:46 1.1
+++ DefaultContext.java 2001/03/15 04:34:49 1.2
@@ -9,6 +9,7 @@
import java.util.Hashtable;
import java.util.Map;
+import org.apache.framework.context.Context;
/**
* Default implementation of Context.
1.2 +4 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/DataSourceComponent.java
Index: DataSourceComponent.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/DataSourceComponent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DataSourceComponent.java 2001/02/25 10:45:46 1.1
+++ DataSourceComponent.java 2001/03/15 04:34:50 1.2
@@ -9,15 +9,15 @@
import java.sql.Connection;
import java.sql.SQLException;
-import org.apache.avalon.component.Component;
-import org.apache.avalon.configuration.Configurable;
-import org.apache.avalon.ThreadSafe;
+import org.apache.framework.component.Component;
+import org.apache.framework.configuration.Configurable;
+import org.apache.framework.ThreadSafe;
/**
* The standard interface for DataSources in Avalon.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/02/25 10:45:46 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/03/15 04:34:50 $
*/
public interface DataSourceComponent
extends Component, Configurable, ThreadSafe
1.2 +4 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/J2eeDataSource.java
Index: J2eeDataSource.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/J2eeDataSource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- J2eeDataSource.java 2001/02/25 10:45:46 1.1
+++ J2eeDataSource.java 2001/03/15 04:34:50 1.2
@@ -13,9 +13,9 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
-import org.apache.avalon.configuration.Configuration;
-import org.apache.avalon.configuration.ConfigurationException;
-import org.apache.avalon.AbstractLoggable;
+import org.apache.framework.configuration.Configuration;
+import org.apache.framework.configuration.ConfigurationException;
+import org.apache.avalon.logger.AbstractLoggable;
/**
* The J2EE implementation for DataSources in Cocoon. This uses the
@@ -23,7 +23,7 @@
* J2EE container pools the datasources properly.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/02/25 10:45:46 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/03/15 04:34:50 $
*/
public class J2eeDataSource
extends AbstractLoggable
1.4 +4 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcConnection.java
Index: JdbcConnection.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcConnection.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JdbcConnection.java 2001/03/15 03:10:17 1.3
+++ JdbcConnection.java 2001/03/15 04:34:50 1.4
@@ -15,10 +15,10 @@
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Map;
-import org.apache.avalon.Recyclable;
import org.apache.avalon.logger.AbstractLoggable;
-import org.apache.avalon.pool.Pool;
-import org.apache.avalon.pool.Poolable;
+import org.apache.framework.Recyclable;
+import org.apache.framework.pool.Pool;
+import org.apache.framework.pool.Poolable;
/**
* The Connection object used in conjunction with the JdbcDataSource
@@ -29,7 +29,7 @@
* total number of Connection objects that are created.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.3 $ $Date: 2001/03/15 03:10:17 $
+ * @version CVS $Revision: 1.4 $ $Date: 2001/03/15 04:34:50 $
*/
public class JdbcConnection
extends AbstractLoggable
1.5 +6 -6 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcConnectionPool.java
Index: JdbcConnectionPool.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcConnectionPool.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JdbcConnectionPool.java 2001/03/15 03:10:17 1.4
+++ JdbcConnectionPool.java 2001/03/15 04:34:50 1.5
@@ -12,19 +12,19 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.avalon.Recyclable;
-import org.apache.avalon.lifecycle.Disposable;
-import org.apache.avalon.lifecycle.Initializable;
import org.apache.avalon.logger.AbstractLoggable;
-import org.apache.avalon.pool.Pool;
-import org.apache.avalon.pool.Poolable;
+import org.apache.framework.Recyclable;
+import org.apache.framework.lifecycle.Disposable;
+import org.apache.framework.lifecycle.Initializable;
+import org.apache.framework.pool.Pool;
+import org.apache.framework.pool.Poolable;
/**
* The Pool implementation for JdbcConnections. It uses a background
* thread to manage the number of SQL Connections.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.4 $ $Date: 2001/03/15 03:10:17 $
+ * @version CVS $Revision: 1.5 $ $Date: 2001/03/15 04:34:50 $
*/
public class JdbcConnectionPool
extends AbstractLoggable
1.4 +4 -4 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcDataSource.java
Index: JdbcDataSource.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcDataSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JdbcDataSource.java 2001/03/15 03:10:17 1.3
+++ JdbcDataSource.java 2001/03/15 04:34:50 1.4
@@ -9,9 +9,9 @@
import java.sql.Connection;
import java.sql.SQLException;
-import org.apache.avalon.configuration.Configuration;
-import org.apache.avalon.configuration.ConfigurationException;
-import org.apache.avalon.lifecycle.Disposable;
+import org.apache.framework.configuration.Configuration;
+import org.apache.framework.configuration.ConfigurationException;
+import org.apache.framework.lifecycle.Disposable;
import org.apache.avalon.logger.AbstractLoggable;
/**
@@ -20,7 +20,7 @@
* <code>java.sql.DriverManager</code>.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.3 $ $Date: 2001/03/15 03:10:17 $
+ * @version CVS $Revision: 1.4 $ $Date: 2001/03/15 04:34:50 $
*/
public class JdbcDataSource
extends AbstractLoggable
1.2 +2 -1 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/logger/AbstractLoggable.java
Index: AbstractLoggable.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/logger/AbstractLoggable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractLoggable.java 2001/03/15 03:10:52 1.1
+++ AbstractLoggable.java 2001/03/15 04:34:54 1.2
@@ -7,7 +7,8 @@
*/
package org.apache.avalon.logger;
-import org.apache.avalon.component.Component;
+import org.apache.framework.component.Component;
+import org.apache.framework.logger.Loggable;
import org.apache.log.Logger;
/**
1.3 +6 -2 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/AbstractPool.java
Index: AbstractPool.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/AbstractPool.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractPool.java 2001/02/26 06:05:57 1.2
+++ AbstractPool.java 2001/03/15 04:34:56 1.3
@@ -7,8 +7,12 @@
*/
package org.apache.avalon.pool;
-import org.apache.avalon.lifecycle.Initializable;
-import org.apache.avalon.Recyclable;
+import org.apache.framework.Recyclable;
+import org.apache.framework.lifecycle.Initializable;
+import org.apache.framework.pool.ObjectFactory;
+import org.apache.framework.pool.Pool;
+import org.apache.framework.pool.PoolController;
+import org.apache.framework.pool.Poolable;
/**
* This is an <code>Pool</code> that caches Poolable objects for reuse.
1.2 +2 -1 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/DefaultObjectFactory.java
Index: DefaultObjectFactory.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/DefaultObjectFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultObjectFactory.java 2001/02/26 00:38:20 1.1
+++ DefaultObjectFactory.java 2001/03/15 04:34:56 1.2
@@ -8,7 +8,8 @@
package org.apache.avalon.pool;
import java.lang.reflect.Constructor;
-import org.apache.avalon.Recyclable;
+import org.apache.framework.pool.ObjectFactory;
+import org.apache.framework.pool.Poolable;
/**
* This is the default for factory that is used to create objects for Pool.
1.2 +2 -1 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/DefaultPool.java
Index: DefaultPool.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/DefaultPool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultPool.java 2001/02/26 00:38:20 1.1
+++ DefaultPool.java 2001/03/15 04:34:56 1.2
@@ -7,7 +7,8 @@
*/
package org.apache.avalon.pool;
-import org.apache.avalon.Recyclable;
+import org.apache.framework.pool.PoolController;
+import org.apache.framework.pool.ObjectFactory;
/**
* This is an <code>Pool</code> that caches Poolable objects for reuse.
1.2 +4 -2 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/ThreadSafePool.java
Index: ThreadSafePool.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/pool/ThreadSafePool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ThreadSafePool.java 2001/02/26 00:38:20 1.1
+++ ThreadSafePool.java 2001/03/15 04:34:58 1.2
@@ -7,8 +7,10 @@
*/
package org.apache.avalon.pool;
-import org.apache.avalon.Recyclable;
-import org.apache.avalon.ThreadSafe;
+import org.apache.framework.ThreadSafe;
+import org.apache.framework.pool.ObjectFactory;
+import org.apache.framework.pool.PoolController;
+import org.apache.framework.pool.Poolable;
/**
* This is a implementation of <code>Pool</code> that is thread safe.
1.2 +4 -3 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/thread/DefaultThreadPool.java
Index: DefaultThreadPool.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/thread/DefaultThreadPool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultThreadPool.java 2001/03/15 03:55:36 1.1
+++ DefaultThreadPool.java 2001/03/15 04:34:59 1.2
@@ -7,10 +7,11 @@
*/
package org.apache.avalon.thread;
-import org.apache.avalon.logger.Loggable;
-import org.apache.avalon.pool.Poolable;
-import org.apache.avalon.pool.ObjectFactory;
+import org.apache.framework.logger.Loggable;
+import org.apache.framework.pool.ObjectFactory;
+import org.apache.framework.pool.Poolable;
import org.apache.avalon.pool.ThreadSafePool;
+import org.apache.framework.thread.ThreadPool;
import org.apache.log.Logger;
/**
1.5 +4 -2 jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/thread/WorkerThread.java
Index: WorkerThread.java
===================================================================
RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/thread/WorkerThread.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WorkerThread.java 2001/03/15 03:55:36 1.4
+++ WorkerThread.java 2001/03/15 04:34:59 1.5
@@ -7,9 +7,11 @@
*/
package org.apache.avalon.thread;
-import org.apache.avalon.logger.Loggable;
-import org.apache.avalon.pool.Poolable;
import org.apache.avalon.pool.ThreadSafePool;
+import org.apache.framework.logger.Loggable;
+import org.apache.framework.pool.Poolable;
+import org.apache.framework.thread.ThreadPool;
+import org.apache.framework.thread.ThreadContext;
import org.apache.log.Logger;
/**
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/Modifiable.java
Index: Modifiable.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 file.
*/
package org.apache.framework;
/**
* This interface is implemented by those classes that change
* their behavior/results over time (non-ergodic).
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
*/
public interface Modifiable
{
/**
* Queries the class to estimate its ergodic period termination.
* <br>
* This method is called to ensure the validity of a cached product. It
* is the class responsibility to provide the fastest possible
* implementation of this method or, whether this is not possible and the
* costs of the change evaluation is comparable to the production costs,
* to return <b>true</b> directly with no further delay, thus reducing
* the evaluation overhead to a minimum.
*
* @return <b>true</b> if the class ergodic period is over and the class
* would behave differently if processed again, <b>false</b> if the
* resource is still ergodic so that it doesn't require
* reprocessing.
*/
boolean modifiedSince( long date );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/Recyclable.java
Index: Recyclable.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 file.
*/
package org.apache.framework;
/**
* This interface standardizes the behaviour of a recyclable object.
* A recyclable object is defined as an object that can be used to
* encapsulate another object without being altered by its content.
* Therefore, a recyclable object may be recycled and reused many times.
*
* This is helpful in cases where recyclable objects are continously
* created and destroied, causing a much greater amount of garbage to
* be collected by the JVM garbage collector. By making it recyclable,
* it is possible to reduce the GC execution time thus incrementing the
* overall performance of a process and decrementing the chance of
* memory overflow.
*
* Every implementation must provide their own method to allow this
* recyclable object to be reused by setting its content.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Recyclable
{
/**
* This method should be implemented to remove all costly resources
* in object. These resources can be object references, database connections,
* threads etc. What is categorised as "costly" resources is determined on
* a case by case analysis.
*/
void recycle();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/SingleThreaded.java
Index: SingleThreaded.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 file.
*/
package org.apache.framework;
/**
* A interface to mark a component as not ThreadSafe.
*
* NB: It was a deliberat e choice not to extend Component. This will have to
* be reassed once we see it in action.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface SingleThreaded
{
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/ThreadSafe.java
Index: ThreadSafe.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 file.
*/
package org.apache.framework;
/**
* A interface to mark a component as ThreadSafe or reentrant.
*
* NB: It was a deliberat e choice not to extend Component. This will have to
* be reassed once we see it in action.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface ThreadSafe
{
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/component/Component.java
Index: Component.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 file.
*/
package org.apache.framework.component;
/**
* This interface identifies classes that can be used as <code>Components</code>
* by a <code>Composer</code>.
* <br />
*
* The contract surrounding the <code>Component</code> is that it is
* used, but not a user. When a class implements this interface, it
* is stating that other entities may use that class. As part of the
* contract with the system, a <code>Component</code> must always
* declare an empty constructor.
* <br />
*
* A <code>Component</code> is the basic building block of the Avalon.
* When a class implements this interface, it allows itself to be
* managed by a <code>ComponentManager</code> and used by an outside
* element called a <code>Composer</code>. The <code>Composer</code>
* must know what type of <code>Component</code> it is accessing, so
* it will re-cast the <code>Component</code> into the type it needs.
* <br />
*
* In order for a <code>Component</code> to be useful you must either
* extend this interface, or implement this interface in conjunction
* with one that actually has methods. The new interface is the contract
* with the <code>Composer</code> that this is a particular type of
* component, and as such it can perform those functions on that type
* of component.
* <br />
*
* For example, we want a component that performs a logging function
* so we extend the <code>Component</code> to be a <code>LoggingComponent</code>.
*
* <pre>
* interface LoggingComponent extends Component {
* log(String message);
* }
* </pre>
*
* Now all <code>Composer</code>s that want to use this type of component,
* will re-cast the <code>Component</code> into a <code>LoggingComponent</code>
* and the <code>Composer</code> will be able to use the <code>log</code>
* method.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* @author <a href="mailto:bloritsch@apache.org>Berin Loritsch</a>
*/
public interface Component
{
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/component/ComponentException.java
Index: ComponentException.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 file.
*/
package org.apache.framework.component;
import org.apache.aut.CascadingException;
/**
* This base class of exceptions thrown by ComponentManager.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
*/
public class ComponentException
extends CascadingException
{
public ComponentException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>ComponentException</code> instance.
*/
public ComponentException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/component/ComponentManager.java
Index: ComponentManager.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 file.
*/
package org.apache.framework.component;
/**
* A <code>ComponentManager</code> selects <code>Component</code>s based on a
* role. The contract is that all the <code>Component</code>s implement the
* differing roles and there is one <code>Component</code> per role. If you
* need to select on of many <code>Component</code>s that implement the same
* role, then you need to use a <code>ComponentSelector</code>. Roles are the
* full interface name.
*
* A role is better understood by the analogy of a play. There are many
* different roles in a script. Any actor or actress can play any given part
* and you get the same results (phrases said, movements made, etc.). The exact
* nuances of the performance is different.
*
* Below is a list of things that might be considered the different roles:
*
* <ul>
* <li> InputAdaptor and OutputAdaptor</li>
* <li> Store and Spool</li>
* </ul>
*
* The <code>ComponentManager</code> does not specify the methodology of
* getting the <code>Component</code>, merely the interface used to get it.
* Therefore the <code>ComponentManager</code> can be implemented with a
* factory pattern, an object pool, or a simple Hashtable.
*
* @see org.apache.avalon.Component
* @see org.apache.avalon.Composer
* @see org.apache.avalon.ComponentSelector
*
* @author <a href="mailto:scoobie@betaversion.org">Federico Barbieri</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* @author <a href="mailto:bloritsch@apache.org>Berin Loritsch</a>
*/
public interface ComponentManager
{
/**
* Get the <code>Component</code> associated with the given role. For
* instance, If the <code>ComponentManager</code> had a
* <code>LoggerComponent</code> stored and referenced by role, I would use
* the following call:
* <pre>
* try {
* LoggerComponent log;
* log = (LoggerComponent) manager.lookup("org.apache.avalon.blocks.Logger");
* } catch (...) {
* ...
* }
* </pre>
*
* @param name The role name of the <code>Component</code> to retrieve.
*
* @exception ComponentException on error
*/
Component lookup( String role )
throws ComponentException;
/**
* Return the <code>Component</code> when you are finished with it. This
* allows the <code>ComponentManager</code> to handle the End-Of-Life Lifecycle
* events associated with the Component. Please note, that no Exceptions
* should be thrown at this point. This is to allow easy use of the
* ComponentManager system without having to trap Exceptions on a release.
*
* @param component The Component we are releasing.
*/
void release(Component component);
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/component/ComponentSelector.java
Index: ComponentSelector.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 file.
*/
package org.apache.framework.component;
/**
* A <code>ComponentSelector</code> selects <code>Component</code>s based on a
* hint. The contract is that all the <code>Component</code>s implement the
* same role.
*
* A role is better understood by the analogy of a play. There are many
* different roles in a script. Any actor or actress can play any given part
* and you get the same results (phrases said, movements made, etc.). The exact
* nuances of the performance is different.
*
* Below is a list of things that might be considered the same role:
*
* <ul>
* <li> XMLInputAdaptor and PropertyInputAdaptor</li>
* <li> FileGenerator and SQLGenerator</li>
* </ul>
*
* The <code>ComponentSelector</code> does not specify the methodology of
* getting the <code>Component</code>, merely the interface used to get it.
* Therefore the <code>ComponentSelector</code> can be implemented with a
* factory pattern, an object pool, or a simple Hashtable.
*
* @see org.apache.avalon.Component
* @see org.apache.avalon.Composer
* @see org.apache.avalon.ComponentManager
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
*/
public interface ComponentSelector
extends Component
{
/**
* Select the <code>Component</code> associated with the given hint.
* For instance, If the <code>ComponentSelector</code> has a
* <code>Generator</code> stored and referenced by a URL, I would use the
* following call:
*
* <pre>
* try {
* Generator input;
* input = (Generator) selector.select(new URL("foo://demo/url"));
* } catch (...) {
* ...
* }
* </pre>
*
* @param name A hint to retrieve the correct <code>Component</code>.
*
* @exception ComponentNotFoundException If the given role is not associated
* with a <code>Component</code>.
* @exception ComponentNotAccessibleException If a <code>Component</code>
* instance cannot be created.
*/
Component select( Object hint )
throws ComponentException;
/**
* Return the <code>Component</code> when you are finished with it. This
* allows the <code>ComponentManager</code> to handle the End-Of-Life Lifecycle
* events associated with the Component. Please note, that no Exceptions
* should be thrown at this point. This is to allow easy use of the
* ComponentManager system without having to trap Exceptions on a release.
*
* @param component The Component we are releasing.
*/
void release( Component component );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/component/Composer.java
Index: Composer.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 file.
*/
package org.apache.framework.component;
/**
* A composer is a class that need to connect to software components using
* a "role" abstraction, thus not depending on particular implementations
* but on behavioral interfaces.
* <br />
*
* The contract surrounding a <code>Composer</code> is that it is a user.
* The <code>Composer</code> is able to use <code>Components</code> managed
* by the <code>ComponentManager</code> it was initialized with. As part
* of the contract with the system, the instantiating entity must call
* the <code>setComponenetManager</code> method before the
* <code>Composer</code> can be considered valid. The
* <code>setComponentManager</code> method must be called after the constructor
* and before any user methods.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
*/
public interface Composer
{
/**
* Pass the <code>ComponentManager</code> to the <code>composer</code>.
* The <code>Composer</code> implementation should use the specified
* <code>ComponentManager</code> to acquire the components it needs for
* execution.
*
* @param manager The <code>ComponentManager</code> which this
* <code>Composer</code> uses.
*/
void compose( ComponentManager componentManager )
throws ComponentException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/component/Recomposer.java
Index: Recomposer.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 file.
*/
package org.apache.framework.component;
/**
* Extends composer to allow recomposing.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Recomposer
extends Composer
{
void recompose( ComponentManager componentManager );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/configuration/Configurable.java
Index: Configurable.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 file.
*/
package org.apache.framework.configuration;
/**
* This interface should be implemented by classes that need to be
* configured with custom parameters before initialization.
* <br />
*
* The contract surrounding a <code>Configurable</code> is that the
* instantiating entity must call the <code>configure</code>
* method before it is valid. The <code>configure</code> method
* must be called after the constructor, and before any other method.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Configurable
{
/**
* Pass the <code>Configuration</code> to the <code>Configurable</code>
* class. This method must always be called after the constructor
* and before any other method.
*
* @param configuration the class configurations.
*/
void configure( Configuration configuration )
throws ConfigurationException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/configuration/Configuration.java
Index: Configuration.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 file.
*/
package org.apache.framework.configuration;
import java.util.Iterator;
/**
* <code>Configuration</code> is a interface encapsulating a configuration node
* used to retrieve configuration values. This is a "read only" interface
* preventing applications from modifying their own configurations.
* <br />
*
* The contract surrounding the <code>Configuration</code> is that once
* it is created, information never changes. The <code>Configuration</code>
* is built by the <code>SAXConfigurationBuilder</code> and the
* <code>ConfigurationImpl</code> helper classes.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Configuration
{
/**
* Return the name of the node.
*
* @post getName() != null
*
* @return name of the <code>Configuration</code> node.
*/
String getName();
/**
* Return a string describing location of Configuration.
* Location can be different for different mediums (ie "file:line" for normal XML files or
* "table:primary-key" for DB based configurations);
*
* @return a string describing location of Configuration
*/
String getLocation();
/**
* Return a new <code>Configuration</code> instance encapsulating the
* specified child node.
*
* @pre child != null
* @post getConfiguration() != null
*
* @param child The name of the child node.
* @return Configuration
*/
Configuration getChild( String child );
/**
* Return a new <code>Configuration</code> instance encapsulating the
* specified child node.
*
* @pre child != null
* @post getConfiguration() != null
*
* @param child The name of the child node.
* @return Configuration
*/
// Configuration getChild( String child, boolean createNew );
/**
* Return an <code>Iterator</code> of <code>Configuration<code>
* elements containing all node children with the specified name.
*
* @pre name != null
* @post getConfigurations() != null
*
* @param name The name of the children to get.
* @return The child nodes with name
*/
Iterator getChildren( String name );
Configuration[] getChildrenAsArray(String name);
/**
* Return the value of specified attribute.
*
* @pre paramName != null
* @post getAttribute != null
*
* @param paramName The name of the parameter you ask the value of.
* @return String value of attribute.
* @exception ConfigurationException If no attribute with that name exists.
*/
String getAttribute( String paramName ) throws ConfigurationException;
/**
* Return the <code>int</code> value of the specified attribute contained
* in this node.
*
* @pre paramName != null
* @post getAttributeAsInt() != null
*
* @param paramName The name of the parameter you ask the value of.
* @return int value of attribute
* @exception ConfigurationException If no parameter with that name exists.
* or if conversion to <code>int</code> fails.
*/
int getAttributeAsInt( String paramName ) throws ConfigurationException;
/**
* Returns the value of the attribute specified by its name as a
* <code>long</code>.
*
* @pre paramName != null
* @post getAttributeAsLong() != null
*
* @param paramName The name of the parameter you ask the value of.
* @return long value of attribute
* @exception ConfigurationException If no parameter with that name exists.
* or if conversion to <code>long</code> fails.
*/
long getAttributeAsLong( String name ) throws ConfigurationException;
/**
* Return the <code>float</code> value of the specified parameter contained
* in this node.
*
* @pre paramName != null
* @post getAttributeAsFloat() != null
*
* @param paramName The name of the parameter you ask the value of.
* @return float value of attribute
* @exception ConfigurationException If no parameter with that name exists.
* or if conversion to <code>float</code> fails.
*/
float getAttributeAsFloat( String paramName ) throws ConfigurationException;
/**
* Return the <code>boolean</code> value of the specified parameter contained
* in this node.<br>
*
* @pre paramName != null
* @post getAttributeAsBoolean() != null
*
* @param paramName The name of the parameter you ask the value of.
* @return boolean value of attribute
* @exception ConfigurationException If no parameter with that name exists.
* or if conversion to <code>boolean</code> fails.
*/
boolean getAttributeAsBoolean( String paramName ) throws ConfigurationException;
/**
* Return the <code>String</code> value of the node.
*
* @post getValue() != null
*
* @return the value of the node.
*/
String getValue() throws ConfigurationException;
/**
* Return the <code>int</code> value of the node.
*
* @post getValueAsInt() != null
*
* @returns the value of the node.
*
* @exception ConfigurationException If conversion to <code>int</code> fails.
*/
int getValueAsInt() throws ConfigurationException;
/**
* Return the <code>float</code> value of the node.
*
* @post getValueAsFloat() != null
*
* @return the value of the node.
* @exception ConfigurationException If conversion to <code>float</code> fails.
*/
float getValueAsFloat() throws ConfigurationException;
/**
* Return the <code>boolean</code> value of the node.
*
* @post getValueAsBoolean() != null
*
* @return the value of the node.
* @exception ConfigurationException If conversion to <code>boolean</code> fails.
*/
boolean getValueAsBoolean() throws ConfigurationException;
/**
* Return the <code>long</code> value of the node.<br>
*
* @post getValueAsLong() != null
*
* @return the value of the node.
* @exception ConfigurationException If conversion to <code>long</code> fails.
*/
long getValueAsLong() throws ConfigurationException;
/**
* Returns the value of the configuration element as a <code>String</code>.
* If the configuration value is not set, the default value will be
* used.
*
* @pre defaultValue != null
* @post getValue(defaultValue) != null
*
* @param defaultValue The default value desired.
* @return String value of the <code>Configuration</code>, or default
* if none specified.
*/
String getValue( String defaultValue );
/**
* Returns the value of the configuration element as an <code>int</code>.
* If the configuration value is not set, the default value will be
* used.
*
* @pre defaultValue != null
* @post getValueAsInt(defaultValue) != null
*
* @param defaultValue The default value desired.
* @return int value of the <code>Configuration</code>, or default
* if none specified.
*/
int getValueAsInt( int defaultValue );
/**
* Returns the value of the configuration element as a <code>long</code>.
* If the configuration value is not set, the default value will be
* used.
*
* @pre defaultValue != null
* @post getValueAsLong(defaultValue) != null
*
* @param defaultValue The default value desired.
* @return long value of the <code>Configuration</code>, or default
* if none specified.
*/
long getValueAsLong( long defaultValue );
/**
* Returns the value of the configuration element as a <code>float</code>.
* If the configuration value is not set, the default value will be
* used.
*
* @pre defaultValue != null
* @post getValueAsFloat(defaultValue) != null
*
* @param defaultValue The default value desired.
* @return float value of the <code>Configuration</code>, or default
* if none specified.
*/
float getValueAsFloat( float defaultValue );
/**
* Returns the value of the configuration element as a <code>boolean</code>.
* If the configuration value is not set, the default value will be
* used.
*
* @pre defaultValue != null
* @post getValueAsBoolean(defaultValue) != null
*
* @param defaultValue The default value desired.
* @return boolean value of the <code>Configuration</code>, or default
* if none specified.
*/
boolean getValueAsBoolean( boolean defaultValue );
/**
* Returns the value of the attribute specified by its name as a
* <code>String</code>, or the default value if no attribute by
* that name exists or is empty.
*
* @pre name != null
* @pre defaultValue != null
* @post getAttribute(name, defaultValue) != null
*
* @param name The name of the attribute you ask the value of.
* @param defaultValue The default value desired.
* @return String value of attribute. It will return the default
* value if the named attribute does not exist, or if
* the value is not set.
*/
String getAttribute( String name, String defaultValue );
/**
* Returns the value of the attribute specified by its name as a
* <code>int</code>, or the default value if no attribute by
* that name exists or is empty.
*
* @pre name != null
* @pre defaultValue != null
* @post getAttributeAsInt(name, defaultValue) != null
*
* @param name The name of the attribute you ask the value of.
* @param defaultValue The default value desired.
* @return int value of attribute. It will return the default
* value if the named attribute does not exist, or if
* the value is not set.
*/
int getAttributeAsInt( String name, int defaultValue );
/**
* Returns the value of the attribute specified by its name as a
* <code>long</code>, or the default value if no attribute by
* that name exists or is empty.
*
* @pre name != null
* @pre defaultValue != null
* @post getAttributeAsLong(name, defaultValue) != null
*
* @param name The name of the attribute you ask the value of.
* @param defaultValue The default value desired.
* @return long value of attribute. It will return the default
* value if the named attribute does not exist, or if
* the value is not set.
*/
long getAttributeAsLong( String name, long defaultValue );
/**
* Returns the value of the attribute specified by its name as a
* <code>float</code>, or the default value if no attribute by
* that name exists or is empty.
*
* @pre name != null
* @pre defaultValue != null
* @post getAttributeAsFloat(name, defaultValue) != null
*
* @param name The name of the attribute you ask the value of.
* @param defaultValue The default value desired.
* @return float value of attribute. It will return the default
* value if the named attribute does not exist, or if
* the value is not set.
*/
float getAttributeAsFloat( String name, float defaultValue );
/**
* Returns the value of the attribute specified by its name as a
* <code>boolean</code>, or the default value if no attribute by
* that name exists or is empty.
*
* @pre name != null
* @pre defaultValue != null
* @post getAttributeAsBoolean(name, defaultValue) != null
*
* @param name The name of the attribute you ask the value of.
* @param defaultValue The default value desired.
* @return boolean value of attribute. It will return the default
* value if the named attribute does not exist, or if
* the value is not set.
*/
boolean getAttributeAsBoolean( String name, boolean defaultValue );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/configuration/ConfigurationBuilder.java
Index: ConfigurationBuilder.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 file.
*/
package org.apache.framework.configuration;
import java.io.IOException;
import org.xml.sax.SAXException;
/**
* The interface implemented to build configurations.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface ConfigurationBuilder
{
Configuration build( String resource )
throws SAXException, IOException, ConfigurationException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/configuration/ConfigurationException.java
Index: ConfigurationException.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 file.
*/
package org.apache.framework.configuration;
import org.apache.aut.CascadingException;
/**
* Thrown when a <code>Configurable</code> component cannot be configured
* properly, or if a value cannot be retrieved properly.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
*/
public final class ConfigurationException
extends CascadingException
{
/**
* Construct a new <code>ConfigurationException</code> instance.
*
* @param message The detail message for this exception.
*/
public ConfigurationException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>ConfigurationException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public ConfigurationException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/configuration/Parameters.java
Index: Parameters.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 file.
*/
package org.apache.framework.configuration;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
/**
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
*/
public final class Parameters
{
protected HashMap m_parameters;
/**
* Create a new <code>Parameters</code> instance.
*/
public Parameters()
{
m_parameters = new HashMap();
}
/**
* Set the <code>String</code> value of a specified parameter.
* <p />
* If the specified value is <b>null</b> the parameter is removed.
*
* @return The previous value of the parameter or <b>null</b>.
*/
public String setParameter( final String name, final String value )
{
if( null == name )
{
return null;
}
if( null == value )
{
return (String)m_parameters.remove( name );
}
return (String)m_parameters.put( name, value );
}
/**
* Return an <code>Enumeration</code> view of all parameter names.
*/
public Iterator getParameterNames()
{
return m_parameters.keySet().iterator();
}
/**
* Check if the specified parameter can be retrieved.
*/
public boolean isParameter( final String name )
{
return m_parameters.containsKey( name );
}
/**
* Retrieve the <code>String</code> value of the specified parameter.
* <p />
* If the specified parameter cannot be found, <b>null</b> is returned.
*/
protected String getParameter( final String name )
{
if( null == name )
{
return null;
}
return (String)m_parameters.get( name );
}
/**
* Retrieve the <code>String</code> value of the specified parameter.
* <p />
* If the specified parameter cannot be found, <code>defaultValue</code>
* is returned.
*/
public String getParameter( final String name, final String defaultValue )
{
final String value = getParameter( name );
if( null == value )
{
return defaultValue;
}
else
{
return value;
}
}
/**
* Retrieve the <code>int</code> value of the specified parameter.
* <p />
* If the specified parameter cannot be found, <code>defaultValue</code>
* is returned.
*/
public int getParameterAsInteger( final String name, final int defaultValue )
{
final String value = getParameter( name );
if( null == value )
{
return defaultValue;
}
try
{
if( value.startsWith("0x") )
{
return Integer.parseInt( value.substring(2), 16 );
}
else if( value.startsWith("0o") )
{
return Integer.parseInt( value.substring(2), 8 );
}
else if( value.startsWith("0b") )
{
return Integer.parseInt( value.substring(2), 2 );
}
else
{
return Integer.parseInt( value );
}
}
catch( final NumberFormatException nfe )
{
return defaultValue;
}
}
/**
* Retrieve the <code>long</code> value of the specified parameter.
* <p />
* If the specified parameter cannot be found, <code>defaultValue</code>
* is returned.
*/
public long getParameterAsLong( final String name, final long defaultValue )
{
final String value = getParameter( name );
if( null == value )
{
return defaultValue;
}
try
{
if( value.startsWith("0x") )
{
return Long.parseLong( value.substring(2), 16 );
}
else if( value.startsWith("0o") )
{
return Long.parseLong( value.substring(2), 8 );
}
else if( value.startsWith("0b") )
{
return Long.parseLong( value.substring(2), 2 );
}
else
{
return Long.parseLong(value);
}
}
catch( final NumberFormatException nfe )
{
return defaultValue;
}
}
/**
* Retrieve the <code>float</code> value of the specified parameter.
* <p />
* If the specified parameter cannot be found, <code>defaultValue</code>
* is returned.
*/
public float getParameterAsFloat( final String name, final float defaultValue )
{
final String value = getParameter( name );
if( null == value )
{
return defaultValue;
}
try
{
return Float.parseFloat(value);
}
catch( final NumberFormatException nfe )
{
return defaultValue;
}
}
/**
* Retrieve the <code>boolean</code> value of the specified parameter.
* <p />
* If the specified parameter cannot be found, <code>defaultValue</code>
* is returned.
*/
public boolean getParameterAsBoolean( final String name, final boolean defaultValue )
{
final String value = getParameter( name );
if( null == value )
{
return defaultValue;
}
if( value.equalsIgnoreCase("true") )
{
return true;
}
if( value.equalsIgnoreCase("false") )
{
return(false);
}
return defaultValue;
}
/**
* Merge parameters from another <code>Parameters</code> instance
* into this.
*
* @return This <code>Parameters</code> instance.
*/
public Parameters merge( final Parameters other )
{
final Iterator names = other.getParameterNames();
while( names.hasNext() )
{
final String name = (String) names.next();
final String value = other.getParameter( name );
setParameter( name, value );
}
return this;
}
/**
* Create a <code>Parameters</code> object from a <code>Configuration</code>
* object.
*/
public static Parameters fromConfiguration( final Configuration configuration )
throws ConfigurationException
{
if( null == configuration )
{
throw new ConfigurationException( "You cannot convert to parameters with " +
"a null Configuration");
}
final Iterator parameters = configuration.getChildren("parameter");
final Parameters param = new Parameters();
while( parameters.hasNext() )
{
try
{
final Configuration child = (Configuration)parameters.next();
final String name = child.getAttribute( "name" );
final String value = child.getAttribute( "value" );
param.setParameter( name, value );
}
catch( final ClassCastException cce )
{
// ignore this. Temporary work around until the Iterator
// is guaranteed to return Configuration values. Unfortunately
// there are problems with empty strings getting in there.
}
catch( final Exception e )
{
throw new ConfigurationException( "Cannot process Configurable", e );
}
}
return param;
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/configuration/Reconfigurable.java
Index: Reconfigurable.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 file.
*/
package org.apache.framework.configuration;
/**
* Extends Configurable to allow reconfiguration runtime.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Reconfigurable
extends Configurable
{
void reconfigure( Configuration configuration ) throws ConfigurationException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/Container.java
Index: Container.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 file.
*/
package org.apache.framework.container;
import java.util.Iterator;
import org.apache.framework.component.Component;
/**
* This contains it during execution and may provide certain
* facilities (like a thread per EJB etc).
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Container
extends Component
{
/**
* Add a component instance to container.
*
* @param entry the component entry
*/
void add( String name, Entry entry )
throws ContainerException;
/**
* Remove a component instance from container.
*
* @param name the name of component
*/
void remove( String name )
throws ContainerException;
/**
* Retrieve Entry from container
*
* @param name the name of entry
* @return the entry
*/
Entry getEntry( String name )
throws ContainerException;
/**
* List all names of entries in container.
*
* @return the list of all entries
*/
Iterator list();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/ContainerException.java
Index: ContainerException.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 file.
*/
package org.apache.framework.container;
import org.apache.aut.CascadingException;
/**
* Exception to indicate error manipulating container.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public final class ContainerException
extends CascadingException
{
/**
* Construct a new <code>ContainerException</code> instance.
*
* @param message The detail message for this exception.
*/
public ContainerException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>ContainerException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public ContainerException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/Deployer.java
Index: Deployer.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 file.
*/
package org.apache.framework.container;
import java.net.URL;
import org.apache.framework.component.Component;
/**
* A Deployer is responsible for taking a URL (ie a jar/war/ear) and deploying
* it to a particular "location". "location" means different things for
* different containers. For a servlet container it may mean the place to
* mount servlet (ie /myapp --> /myapp/Cocoon.xml is mapping cocoon servlet to
* /myapp context).
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Deployer
extends Component
{
/**
* Deploy a resource indicate by url to location.
*
* @param location the location to deploy to
* @param url the url of deployment
* @exception DeploymentException if an error occurs
*/
void deploy( String location, URL url )
throws DeploymentException;
/**
* undeploy a resource from a location.
*
* @param location the location
* @exception DeploymentException if an error occurs
*/
void undeploy( String location )
throws DeploymentException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/DeploymentException.java
Index: DeploymentException.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 file.
*/
package org.apache.framework.container;
import org.apache.aut.CascadingException;
/**
* Exception to indicate error deploying.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public final class DeploymentException
extends CascadingException
{
/**
* Construct a new <code>DeploymentException</code> instance.
*
* @param message The detail message for this exception.
*/
public DeploymentException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>DeploymentException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public DeploymentException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/Entry.java
Index: Entry.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 file.
*/
package org.apache.framework.container;
import org.apache.framework.component.Component;
/**
* Contains information about a particular instance of contained component.
* This would contain name, configuration data, parameters, log entries etc.
* Basically instance data.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public class Entry
implements Component
{
protected MetaInfo m_info;
protected Object m_instance;
protected State m_state;
public Entry()
{
}
public Entry( final MetaInfo info, final Object instance, final State state )
{
m_info = info;
m_instance = instance;
m_state = state;
}
/**
* Retrieve MetaInfo describing instance.
*
* @return the info
*/
public MetaInfo getInfo()
{
return m_info;
}
/**
* Mutator for info property.
*
* @param info the MetaInfo
*/
public void setInfo( final MetaInfo info )
{
m_info = info;
}
/**
* Retrieve instance of component.
*
* @return the component instance
*/
public Object getInstance()
{
return m_instance;
}
/**
* Set instance of component.
*
* @return the component instance
*/
public void setInstance( final Object instance )
{
m_instance = instance;
}
/**
* Retrieve state of a component.
*
* @return the components state
*/
public State getState()
{
return m_state;
}
/**
* set state of a component.
*
* @param state the components state
*/
public void setState( final State state )
{
m_state = state;
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/Factory.java
Index: Factory.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 file.
*/
package org.apache.framework.container;
import org.apache.framework.component.Component;
/**
* This is the component that creates the components.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Factory
extends Component
{
/**
* Create a component whos position is indicated by locator.
*
* @param locator the locator indicating the component location
* @return the component
* @exception FactoryException if an error occurs
*/
Object create( Locator locator )
throws FactoryException;
/**
* Create a component whos position is indicated by locator.
* Make sure it is of the correct type.
*
* @param locator the locator indicating the component location
* @param clazz the expected type of component
* @return the component
* @exception FactoryException if an error occurs
*/
Object create( Locator locator, Class clazz )
throws FactoryException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/FactoryException.java
Index: FactoryException.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 file.
*/
package org.apache.framework.container;
import org.apache.aut.CascadingException;
/**
* Exception to indicate error creating entries in factory.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public final class FactoryException
extends CascadingException
{
/**
* Construct a new <code>FactoryException</code> instance.
*
* @param message The detail message for this exception.
*/
public FactoryException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>FactoryException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public FactoryException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/Loader.java
Index: Loader.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 file.
*/
package org.apache.framework.container;
import org.apache.framework.component.Component;
/**
* Class used to load resources from a source.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Loader
extends Component
{
/**
* Retrieve classloader associated with source.
*
* @return the ClassLoader
*/
ClassLoader getClassLoader();
/**
* Load an object from source.
*
* @param component the name of object
* @return the Object
* @exception Exception if an error occurs
*/
Object load( String component )
throws FactoryException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/Locator.java
Index: Locator.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 file.
*/
package org.apache.framework.container;
import java.net.URL;
import org.apache.framework.component.Component;
/**
* This contains information required to locate a component.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Locator
extends MetaInfo
{
/**
* Retrieve "name" of component type.
* The "name" usually indicates the classname.
*
* @return the name
*/
String getName();
/**
* Retrieve location of component.
* Usually references the archive (zip/jar/war/ear)
* which contains the name (ie classname)
*
* @return the URL of location
*/
URL getLocation();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/LocatorRegistry.java
Index: LocatorRegistry.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 file.
*/
package org.apache.framework.container;
/**
* Represents a database of Locators.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface LocatorRegistry
extends Registry
{
/**
* Retrieve a Locator by name.
*
* @param name the name
* @return the Info
* @exception RegistryException if an error occurs
*/
Locator getLocator( String name ) throws RegistryException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/MetaInfo.java
Index: MetaInfo.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 file.
*/
package org.apache.framework.container;
/**
* This contains information about the component.
* (ie would be a BlockInfo, an EJBDescriptor, a MailetInfo etc)
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface MetaInfo
{
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/Registry.java
Index: Registry.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 file.
*/
package org.apache.framework.container;
import java.util.Iterator;
import org.apache.framework.component.Component;
/**
* Represents a database of Infos.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Registry
extends Component
{
/**
* register an info under a particular name.
*
* @param name the name
* @param info the info
* @exception RegistryException if info is invalid or name already contains info under name
*/
void register( String name, MetaInfo info ) throws RegistryException;
/**
* unregister an info.
*
* @param name the name of info
* @exception RegistryException if no such info exists
*/
void unregister( String name ) throws RegistryException;
/**
* Retrieve an MetaInfo by name.
*
* @param name the name
* @return the MetaInfo
* @exception RegistryException if an error occurs
*/
MetaInfo getInfo( String name ) throws RegistryException;
/**
* Return an iterator of all names of infos registered.
*
* @return the info names
*/
Iterator getInfoNames();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/RegistryException.java
Index: RegistryException.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 file.
*/
package org.apache.framework.container;
import org.apache.aut.CascadingException;
/**
* Exception to indicate registry error.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public final class RegistryException
extends CascadingException
{
/**
* Construct a new <code>RegistryException</code> instance.
*
* @param message The detail message for this exception.
*/
public RegistryException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>RegistryException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public RegistryException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/container/State.java
Index: State.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 file.
*/
package org.apache.framework.container;
import org.apache.aut.ValuedEnum;
/**
* Defines possible states for contained components.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public abstract class State
extends ValuedEnum
{
public State( final String name, final int value )
{
super( name, value );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Context.java
Index: Context.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 file.
*/
package org.apache.framework.context;
/**
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
*/
public interface Context
{
Object get( Object key );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Contextualizable.java
Index: Contextualizable.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 file.
*/
package org.apache.framework.context;
/**
* This inteface should be implemented by classes that need
* a Context to work. Context contains runtime generated object
* provided by the parent to this class.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
*/
public interface Contextualizable
{
/**
* Pass the Context to the contextualizable class. This method
* is always called after the constructor and, if present,
* after configure but before any other method.
*
*/
void contextualize( Context context );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Recontextualizable.java
Index: Recontextualizable.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 file.
*/
package org.apache.framework.context;
/**
* Extends composer to allow recontextualizing.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Recontextualizable
extends Contextualizable
{
void recontextualizable( Context context ) ;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Resolvable.java
Index: Resolvable.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 file.
*/
package org.apache.framework.context;
/**
* This interface is used to indicate objects that need to be
* resolved in some particular context.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Resolvable
{
/**
* Resolve a object to a value.
*
* @param context the contextwith respect which to resolve
* @return the resolved object
*/
Object resolve( Context context );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/lifecycle/Disposable.java
Index: Disposable.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 file.
*/
package org.apache.framework.lifecycle;
/**
* This interface should be implemented by those classes that
* need to provide a service that requires some resources to be
* initialized before being able to operate and properly destroyed
* before termination and unloading.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Disposable
{
/**
* Destroys the service. This method is guaranteed to be called always
* after the stop() method if this class implements <code>Stoppable</code>.
*/
void dispose()
throws Exception;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/lifecycle/Initializable.java
Index: Initializable.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 file.
*/
package org.apache.framework.lifecycle;
/**
* This interface should be implemented by those classes that
* need to provide a service that requires some resources to be
* initialized before being able to operate.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Initializable
{
/**
* Initialize the service. This method is guaranteed to be called always
* after methods in <code>Configurable</code> and <code>Component</code>,
* if the class implements those interfaces and before the run() method
* if the class implements <code>Runnable</code>.
*/
void init()
throws Exception;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/lifecycle/Resumable.java
Index: Resumable.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 file.
*/
package org.apache.framework.lifecycle;
/**
* This is used to restart execturion after temporarily halt.
* The halt may have been for some re- configuring|composing|contextualizing
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Resumable
{
/**
* Resumes the component.
*/
void resume();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/lifecycle/Startable.java
Index: Startable.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 file.
*/
package org.apache.framework.lifecycle;
/**
* This interface is the dual interface of Stoppable.
*
* It provides a method through which components can be "started"
* without requiring a thread. Useful for reactive or passive objects.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Startable
{
/**
* Starts the component.
*/
void start()
throws Exception;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/lifecycle/Stoppable.java
Index: Stoppable.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 file.
*/
package org.apache.framework.lifecycle;
/**
* This interface is the dual interface of the <code>java.lang.Runnable</code>
* interface and provides a hook to safely stop the thread of execution.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
*/
public interface Stoppable
{
/**
* Stops the current thread of execution.
*/
void stop()
throws Exception;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/lifecycle/Suspendable.java
Index: Suspendable.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 file.
*/
package org.apache.framework.lifecycle;
/**
* This is used to temporarily halt execution of a component.
* The execution may be halted so that you can reconfigure/
* recompose/recontextualize component
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Suspendable
{
/**
* Suspends the component.
*/
void suspend();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/logger/Loggable.java
Index: Loggable.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 file.
*/
package org.apache.framework.logger;
import org.apache.log.Logger;
/**
* Interface through which to provide Loggers.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Loggable
{
void setLogger( Logger logger );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/pool/ObjectFactory.java
Index: ObjectFactory.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 file.
*/
package org.apache.framework.pool;
/**
* This is the interface for factory that is used to create objects for Pool.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface ObjectFactory
{
Poolable newInstance() throws Exception;
Class getCreatedClass();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/pool/Pool.java
Index: Pool.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 file.
*/
package org.apache.framework.pool;
/**
* This is an <code>Pool</code> that caches Poolable objects for reuse.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@mad.scientist.com">Peter Donald</a>
*/
public interface Pool
{
Poolable get() throws Exception;
void put( Poolable poolable );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/pool/PoolController.java
Index: PoolController.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 file.
*/
package org.apache.framework.pool;
/**
* This is the interface you implement if you want to control how Pools capacity
* changes overtime.
*
* It gets called everytime that a Pool tries to go below or above it's minimum or maximum.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
*/
public interface PoolController
{
/**
* Called when a Pool reaches it's minimum.
*
* Return the number of elements to increase minimum and maximum by.
*
* @return the element increase
*/
int grow();
/**
* Called when a pool reaches it's maximum.
*
* Returns the number of elements to decrease mi and max by.
*
* @return the element decrease
*/
int shrink();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/pool/Poolable.java
Index: Poolable.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 file.
*/
package org.apache.framework.pool;
/**
* Poolable marker interface.
*
* Components implement this interface if it is reasonable to
* Pool the object. Components that don't implement this interface
* will be created anew via a factory.
*
* NB: It was a deliberat e choice not to extend Component. This will have to
* be reassed once we see it in action.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface Poolable
{
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/processor/Matcher.java
Index: Matcher.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 file.
*/
package org.apache.framework.processor;
/**
* This represents a conditional procesing rule.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
*/
public interface Matcher
{
/**
* Returns true if the object match the specific condition defined by this matcher.
*/
boolean match( Object object );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/processor/Pipeline.java
Index: Pipeline.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 file.
*/
package org.apache.framework.processor;
import java.util.NoSuchElementException;
/**
* This represents a pipeline made up of stages.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
*/
public interface Pipeline
extends Stage
{
/**
* Retrieve size of pipeline (number of stages).
*
* @return the size of pipeline
*/
int getSize();
/**
* Retrieve a particular stage of pipeline
*
* @param index the index of stage
* @return the stage
* @exception NoSuchElementException if index >= getSize() or index < 0
*/
Stage getStage( int index )
throws NoSuchElementException;
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/processor/ProcessorPipeline.java
Index: ProcessorPipeline.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 file.
*/
package org.apache.framework.processor;
import java.lang.IndexOutOfBoundsException;
import java.util.ArrayList;
/**
* This is the default implementation of a Pipeline.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
*/
public class ProcessorPipeline
implements Pipeline
{
private final ArrayList m_stages = new ArrayList();
/**
* Process the specified object calling
* <code> process(Object object) </code>
* in all stages in this pipeline.
*/
public boolean process( final Object object )
{
boolean cont = true;
for (int i = 0; i < getSize() && cont; i++) {
cont = getStage(i).process(object);
}
return cont;
}
/**
* Return the number of stages in this pipeline.
*/
public int getSize()
{
return m_stages.size();
}
/**
* Return the stage at the specified index.
*/
public Stage getStage( final int index )
throws IndexOutOfBoundsException
{
return (Stage)m_stages.get( index );
}
/**
* Add the specified stage at the end of this pipeline.
*/
public void addStage( final Stage stage )
{
m_stages.add( stage );
}
/**
* Insert the specified stage in the specified position.
*/
public void addStage(int index, Stage stage)
{
m_stages.add(index, stage);
}
/**
* Remove the specified stage from the specified position.
*/
public Stage removeStage(int index) {
return (Stage) m_stages.remove(index );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/processor/ProcessorTree.java
Index: ProcessorTree.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 file.
*/
package org.apache.framework.processor;
/**
* This implements a single conditional processing node. Incoming object are
* checked agaist the matcher and go to the <code> trueBranch </code> if the
* object match the matcher requirements else the <code> falseBranch </code>.
* Using many ProcessorTree is possible to implement any processing graph.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
*/
public class ProcessorTree
implements Stage
{
private Matcher matcher;
private Stage trueBranch, falseBranch;
/**
* Create a new ProcessorTree with the specified matcher, trueBranch and falseBranch.
*/
public ProcessorTree( Matcher matcher, Stage trueBranch, Stage falseBranch) {
this.matcher = matcher;
this.trueBranch = trueBranch;
this.falseBranch = falseBranch;
}
/**
* Process the spefified object through the trueBranc if the object matchs
* the requirements of this matcher, through the falseBranch else.
*/
public boolean process(Object object) {
if (matcher.match(object)) {
return trueBranch.process(object);
} else {
return falseBranch.process(object);
}
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/processor/Stage.java
Index: Stage.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 file.
*/
package org.apache.framework.processor;
/**
* This represents a stage in a pipeline.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
*/
public interface Stage
{
/**
* Process the specified object. Returns false if the
* object should be destroyed after processing.
*/
boolean process( Object object );
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/thread/ThreadContext.java
Index: ThreadContext.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 file.
*/
package org.apache.framework.thread;
/**
* To deal with *current* ThreadContext.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public final class ThreadContext
{
protected final static InheritableThreadLocal c_context = new InheritableThreadLocal();
public static ThreadPool getCurrentThreadPool()
{
return (ThreadPool)c_context.get();
}
public static void setCurrentThreadPool( final ThreadPool threadPool )
{
//TODO: protect by a permission guard
c_context.set( threadPool );
}
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/thread/ThreadManager.java
Index: ThreadManager.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 file.
*/
package org.apache.framework.thread;
/**
* Interface for component that hands out thread pools.
*
* @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface ThreadManager
{
ThreadPool getThreadPool( String name );
ThreadPool getDefaultThreadPool();
}
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/framework/thread/ThreadPool.java
Index: ThreadPool.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 file.
*/
package org.apache.framework.thread;
/**
* This class is the public frontend for the thread pool code.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public interface ThreadPool
{
/**
* Run work in separate thread.
*
* @param work the work to be executed.
* @exception Exception if an error occurs
*/
void execute( final Runnable work )
throws Exception;
/**
* Run work in separate thread at a particular priority.
*
* @param work the work to be executed.
* @param priority the priority
* @exception Exception if an error occurs
*/
void execute( final Runnable work, final int priority )
throws Exception;
/**
* Run work in separate thread.
* Wait till work is complete before returning.
*
* @param work the work to be executed.
* @exception Exception if an error occurs
*/
void executeAndWait( final Runnable work )
throws Exception;
/**
* Run work in separate thread at a particular priority.
* Wait till work is complete before returning.
*
* @param work the work to be executed.
* @param priority the priority
* @exception Exception if an error occurs
*/
void executeAndWait( final Runnable work, final int priority )
throws Exception;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org