bloritsch 2003/02/20 10:22:20
Modified: lib jars.xml
src/blocks/web3/java/org/apache/cocoon/components/web3/impl
Web3DataSourceImpl.java
Web3DataSourceSelectorImpl.java
src/java/org/apache/cocoon/environment
AbstractEnvironment.java
src/java/org/apache/cocoon/environment/commandline
CommandlineContext.java
src/java/org/apache/cocoon/generation
ServerPagesGenerator.java
src/scratchpad/src/org/apache/cocoon/transformation
TagTransformer.java
Added: legal LICENSE.util.concurrent
lib/core util.concurrent-1.3.1.jar
Log:
upgrade cocoon so that it does not depend on any deprecated jars itself
Revision Changes Path
1.1 xml-cocoon2/legal/LICENSE.util.concurrent
Index: LICENSE.util.concurrent
===================================================================
Public Domain.
Doug Lea's concurrency utils come with no warranty, nor ristrictions
to use.
1.81 +7 -0 xml-cocoon2/lib/jars.xml
Index: jars.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/lib/jars.xml,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- jars.xml 15 Feb 2003 23:01:46 -0000 1.80
+++ jars.xml 20 Feb 2003 18:22:19 -0000 1.81
@@ -10,6 +10,13 @@
<jars>
<file>
+ <title>Doug Lea's Concurrent Utilities</title>
+ <description>The concurrency management primitives that will be the foundation
of JDK 1.5 concurrency management</description>
+ <used-by>Web3 Block</used-by>
+ <lib>core/util.concurrent-1.3.1.jar</lib>
+
<homepage>http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html</homepage>
+ </file>
+ <file>
<title>Cornerstone Excalibur ThreadContext</title>
<description>The version of excalibur-threadcontext-1.0.jar that comes with
cornerstone src</description>
<used-by>Avalon Cornerstone Scheduler</used-by>
1.1 xml-cocoon2/lib/core/util.concurrent-1.3.1.jar
<<Binary file>>
1.4 +25 -25
xml-cocoon2/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/Web3DataSourceImpl.java
Index: Web3DataSourceImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/Web3DataSourceImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Web3DataSourceImpl.java 31 Jan 2003 22:49:33 -0000 1.3
+++ Web3DataSourceImpl.java 20 Feb 2003 18:22:19 -0000 1.4
@@ -57,7 +57,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.excalibur.concurrent.Mutex;
+import EDU.oswego.cs.dl.util.concurrent.Mutex;
import com.sap.mw.jco.JCO;
@@ -71,24 +71,24 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Michael Gerzabek</a>
* @version CVS $Revision$ $Date$
*/
-public class Web3DataSourceImpl extends AbstractLogEnabled
-implements Web3DataSource, ThreadSafe {
+public class Web3DataSourceImpl extends AbstractLogEnabled
+implements Web3DataSource, ThreadSafe {
protected Web3Properties properties = null;
protected int poolsize = 0;
protected int current_clients = 0;
protected String mySID = null;
-
+
protected boolean trace = false;
protected int level = 0;
-
+
private static Mutex lock = new Mutex();
protected ComponentManager manager;
-
+
public void compose(ComponentManager componentManager) throws
ComponentException {
this.manager = componentManager;
}
-
+
/** Configure backend component */
public void configure(final Configuration configuration)
throws ConfigurationException {
@@ -100,23 +100,23 @@
this.mySID = configuration.getAttribute("name");
this.poolsize = child.getAttributeAsInteger("size");
- this.properties.put("jco.client.client",
+ this.properties.put("jco.client.client",
child.getChild("client").getValue());
- this.properties.put("jco.client.user",
+ this.properties.put("jco.client.user",
child.getChild("user").getValue());
- this.properties.put("jco.client.passwd",
+ this.properties.put("jco.client.passwd",
child.getChild("password").getValue());
- this.properties.put("jco.client.ashost",
+ this.properties.put("jco.client.ashost",
child.getChild("route").getValue());
- this.properties.put("jco.client.sysnr",
+ this.properties.put("jco.client.sysnr",
child.getChild("system").getValue());
- this.properties.put("sap.gateway",
+ this.properties.put("sap.gateway",
child.getChild("gateway").getValue(""));
- this.properties.put("sap.programid",
+ this.properties.put("sap.programid",
child.getChild("program-id").getValue(""));
-
+
if ( getLogger().isDebugEnabled() ) {
- getLogger ().debug ("Configure R3DataSource [mySID="
+ getLogger ().debug ("Configure R3DataSource [mySID="
+ this.mySID );
}
} else {
@@ -124,7 +124,7 @@
" No configuration provided!");
}
}
-
+
/** initialize the component */
public void initialize() throws Exception {
try {
@@ -133,15 +133,15 @@
JCO.getClientPoolManager().getPool( this.mySID ).setTrace( this.trace
);
JCO.setTraceLevel( this.level );
} catch (Exception ex) {
- getLogger ().error ("Couldn't initialize Web3DataSource "
+ getLogger ().error ("Couldn't initialize Web3DataSource "
+ this.mySID, ex);
throw new Exception ( ex.getMessage() + this.mySID );
- }
+ }
finally {
Web3DataSourceImpl.lock.release();
}
}
-
+
/** Get the backend client, returns <code>null</code> if there is no more
client in the pool. */
public Web3Client getWeb3Client() throws Exception {
@@ -149,10 +149,10 @@
if ( this.current_clients + 1 < this.poolsize ) {
this.current_clients++;
try {
- Web3DataSourceImpl.lock.acquire();
+ Web3DataSourceImpl.lock.acquire();
theClient = (Web3Client) this.manager.lookup( Web3Client.ROLE );
theClient.initClient (JCO.getClient(this.mySID));
-
+
if ( getLogger().isDebugEnabled() ) {
getLogger ().debug ("returning client " + theClient);
}
@@ -165,7 +165,7 @@
}
return theClient;
}
-
+
public void releaseWeb3Client(Web3Client client) {
try {
Web3DataSourceImpl.lock.acquire();
@@ -180,7 +180,7 @@
Web3DataSourceImpl.lock.release();
}
}
-
+
/** Dispose properly of the pool */
public void dispose() {
try {
1.3 +115 -115
xml-cocoon2/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/Web3DataSourceSelectorImpl.java
Index: Web3DataSourceSelectorImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/web3/java/org/apache/cocoon/components/web3/impl/Web3DataSourceSelectorImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Web3DataSourceSelectorImpl.java 31 Jan 2003 22:49:33 -0000 1.2
+++ Web3DataSourceSelectorImpl.java 20 Feb 2003 18:22:19 -0000 1.3
@@ -69,7 +69,7 @@
import java.util.Enumeration;
import java.util.Hashtable;
-import org.apache.avalon.excalibur.concurrent.Mutex;
+import EDU.oswego.cs.dl.util.concurrent.Mutex;
/**
* The Default implementation for R3DataSources in Web3. This uses the
@@ -79,119 +79,119 @@
* @version 1.0, 21. Oct. 2002
*/
public class Web3DataSourceSelectorImpl
- extends AbstractLogEnabled
- implements ComponentSelector, Disposable, Composable, Configurable, ThreadSafe
{
+ extends AbstractLogEnabled
+ implements ComponentSelector, Disposable, Composable, Configurable, ThreadSafe
{
- /** The component manager instance */
- protected ComponentManager manager = null;
- protected Configuration configuration = null;
- private static Hashtable pools = new Hashtable();
- private static Mutex lock = new Mutex();
-
- /**
- * Set the current <code>ComponentManager</code> instance used by this
- * <code>Composable</code>.
- */
- public void compose(ComponentManager manager) throws ComponentException {
- this.manager = manager;
- }
-
- public void configure(Configuration configuration)
- throws ConfigurationException {
- if (null != configuration) {
- this.configuration = configuration;
- } else {
- getLogger().error(
- "Couldn't configure Web3DataSourceSelector."
- + " No configuration provided!");
- }
- }
-
- public boolean hasComponent(Object obj) {
- return Web3DataSourceSelectorImpl.pools.containsKey(obj);
- }
-
- public Component select(Object obj) throws ComponentException {
- Web3DataSource pool = null;
- try {
- Web3DataSourceSelectorImpl.lock.acquire();
- if (null != obj) {
- if (Web3DataSourceSelectorImpl.pools.containsKey(obj))
{
- pool =
- (Web3DataSource)
Web3DataSourceSelectorImpl.pools.get(
- obj);
- } else {
- Configuration a[] =
-
this.configuration.getChildren("backend"),
- c = null;
-
- if (null != a)
- for (int i = 0; i < a.length; i++) {
- try {
- String s =
a[i].getAttribute("name");
- if (null != s &&
s.equals(obj.toString())) {
- // a backend
with a name can be defined only once
- c = a[i];
- break;
- }
- } catch
(ConfigurationException x) {
- // this configuration
element has no mandatory
- //attribute name
- }
- }
- // No configuration for this backend-id found!
- if (null == c) {
- return null;
- }
- Class theClass =
- Class.forName(
- c.getChild("class").getValue(
-
"org.apache.cocoon.components.web3.impl.Web3DataSourceImpl"),
- true,
- ClassUtils.getClassLoader());
- pool = (Web3DataSource)
theClass.newInstance();
- if (pool instanceof LogEnabled) {
- ((LogEnabled)
pool).enableLogging(getLogger());
- }
- pool.compose(this.manager);
- pool.configure(c);
- pool.initialize();
- Web3DataSourceSelectorImpl.pools.put(obj,
pool);
- }
- }
- } catch (Exception ex) {
- getLogger().error(ex.getMessage(), ex);
- throw new ComponentException(ex.getMessage());
- } finally {
- Web3DataSourceSelectorImpl.lock.release();
- }
- getLogger().debug("Returning Web3DataSource[" + pool + "]");
- return pool;
- }
-
- public void release(Component component) {
- }
-
- /** Dispose properly of the pool */
- public void dispose() {
- this.manager = null;
- try {
- Web3DataSourceSelectorImpl.lock.acquire();
- String sid = null;
- Web3DataSource pool;
- for (Enumeration enum =
Web3DataSourceSelectorImpl.pools.keys();
- enum.hasMoreElements();
- ) {
- sid = (String) enum.nextElement();
- pool =
- (Web3DataSource)
Web3DataSourceSelectorImpl.pools.get(sid);
- pool.dispose();
- }
- Web3DataSourceSelectorImpl.pools.clear();
- } catch (Exception ex) {
- } finally {
- Web3DataSourceSelectorImpl.lock.release();
- }
- Web3DataSourceSelectorImpl.lock = null;
- }
+ /** The component manager instance */
+ protected ComponentManager manager = null;
+ protected Configuration configuration = null;
+ private static Hashtable pools = new Hashtable();
+ private static Mutex lock = new Mutex();
+
+ /**
+ * Set the current <code>ComponentManager</code> instance used by this
+ * <code>Composable</code>.
+ */
+ public void compose(ComponentManager manager) throws ComponentException {
+ this.manager = manager;
+ }
+
+ public void configure(Configuration configuration)
+ throws ConfigurationException {
+ if (null != configuration) {
+ this.configuration = configuration;
+ } else {
+ getLogger().error(
+ "Couldn't configure Web3DataSourceSelector."
+ + " No configuration provided!");
+ }
+ }
+
+ public boolean hasComponent(Object obj) {
+ return Web3DataSourceSelectorImpl.pools.containsKey(obj);
+ }
+
+ public Component select(Object obj) throws ComponentException {
+ Web3DataSource pool = null;
+ try {
+ Web3DataSourceSelectorImpl.lock.acquire();
+ if (null != obj) {
+ if (Web3DataSourceSelectorImpl.pools.containsKey(obj)) {
+ pool =
+ (Web3DataSource) Web3DataSourceSelectorImpl.pools.get(
+ obj);
+ } else {
+ Configuration a[] =
+ this.configuration.getChildren("backend"),
+ c = null;
+
+ if (null != a)
+ for (int i = 0; i < a.length; i++) {
+ try {
+ String s = a[i].getAttribute("name");
+ if (null != s && s.equals(obj.toString())) {
+ // a backend with a name can be defined only
once
+ c = a[i];
+ break;
+ }
+ } catch (ConfigurationException x) {
+ // this configuration element has no mandatory
+ //attribute name
+ }
+ }
+ // No configuration for this backend-id found!
+ if (null == c) {
+ return null;
+ }
+ Class theClass =
+ Class.forName(
+ c.getChild("class").getValue(
+
"org.apache.cocoon.components.web3.impl.Web3DataSourceImpl"),
+ true,
+ ClassUtils.getClassLoader());
+ pool = (Web3DataSource) theClass.newInstance();
+ if (pool instanceof LogEnabled) {
+ ((LogEnabled) pool).enableLogging(getLogger());
+ }
+ pool.compose(this.manager);
+ pool.configure(c);
+ pool.initialize();
+ Web3DataSourceSelectorImpl.pools.put(obj, pool);
+ }
+ }
+ } catch (Exception ex) {
+ getLogger().error(ex.getMessage(), ex);
+ throw new ComponentException(ex.getMessage());
+ } finally {
+ Web3DataSourceSelectorImpl.lock.release();
+ }
+ getLogger().debug("Returning Web3DataSource[" + pool + "]");
+ return pool;
+ }
+
+ public void release(Component component) {
+ }
+
+ /** Dispose properly of the pool */
+ public void dispose() {
+ this.manager = null;
+ try {
+ Web3DataSourceSelectorImpl.lock.acquire();
+ String sid = null;
+ Web3DataSource pool;
+ for (Enumeration enum = Web3DataSourceSelectorImpl.pools.keys();
+ enum.hasMoreElements();
+ ) {
+ sid = (String) enum.nextElement();
+ pool =
+ (Web3DataSource) Web3DataSourceSelectorImpl.pools.get(sid);
+ pool.dispose();
+ }
+ Web3DataSourceSelectorImpl.pools.clear();
+ } catch (Exception ex) {
+ } finally {
+ Web3DataSourceSelectorImpl.lock.release();
+ }
+ Web3DataSourceSelectorImpl.lock = null;
+ }
}
1.40 +8 -8
xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- AbstractEnvironment.java 6 Feb 2003 15:13:21 -0000 1.39
+++ AbstractEnvironment.java 20 Feb 2003 18:22:19 -0000 1.40
@@ -50,7 +50,7 @@
*/
package org.apache.cocoon.environment;
-import org.apache.avalon.excalibur.collections.IteratorEnumeration;
+import org.apache.commons.collections.IteratorEnumeration;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
@@ -119,10 +119,10 @@
/** The secure Output Stream */
protected BufferedOutputStream secureOutputStream;
-
+
/** The real output stream */
protected OutputStream outputStream;
-
+
/**
* The sitemap processor sets up new managers per sitemap. Get the
* "current" one for this environment.
@@ -458,7 +458,7 @@
* If the buffer size is 0, no buffering takes place.
* This method replaces {@link #getOutputStream()}.
*/
- public OutputStream getOutputStream(int bufferSize)
+ public OutputStream getOutputStream(int bufferSize)
throws IOException {
if (bufferSize == -1) {
if (this.secureOutputStream == null) {
@@ -470,7 +470,7 @@
} else {
this.outputStream = new java.io.BufferedOutputStream(this.outputStream,
bufferSize);
return this.outputStream;
- }
+ }
}
/**
@@ -492,13 +492,13 @@
/**
* Commit the response
*/
- public void commitResponse()
+ public void commitResponse()
throws IOException {
if (this.secureOutputStream != null) {
this.secureOutputStream.realFlush();
}
}
-
+
/**
* Get a <code>Source</code> object.
*/
1.9 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/environment/commandline/CommandlineContext.java
Index: CommandlineContext.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/commandline/CommandlineContext.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- CommandlineContext.java 31 Jan 2003 22:51:44 -0000 1.8
+++ CommandlineContext.java 20 Feb 2003 18:22:19 -0000 1.9
@@ -50,7 +50,7 @@
*/
package org.apache.cocoon.environment.commandline;
-import org.apache.avalon.excalibur.collections.IteratorEnumeration;
+import org.apache.commons.collections.IteratorEnumeration;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.cocoon.environment.Context;
1.29 +3 -3
xml-cocoon2/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java
Index: ServerPagesGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ServerPagesGenerator.java 31 Jan 2003 22:51:46 -0000 1.28
+++ ServerPagesGenerator.java 20 Feb 2003 18:22:19 -0000 1.29
@@ -50,7 +50,7 @@
*/
package org.apache.cocoon.generation;
-import org.apache.avalon.excalibur.collections.ArrayStack;
+import org.apache.commons.collections.ArrayStack;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
@@ -148,7 +148,7 @@
return this.inputSource.getURI();
return this.inputSource.getURI() + '-' + generatorkey;
}
-
+
/**
* Generate the validity object.
* Before this method can be invoked the generateKey() method
1.3 +7 -7
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/TagTransformer.java
Index: TagTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/TagTransformer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TagTransformer.java 31 Jan 2003 22:54:44 -0000 1.2
+++ TagTransformer.java 20 Feb 2003 18:22:19 -0000 1.3
@@ -59,8 +59,8 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.avalon.excalibur.collections.ArrayStack;
-import org.apache.avalon.excalibur.collections.BucketMap;
+import org.apache.commons.collections.ArrayStack;
+import org.apache.commons.collections.StaticBucketMap;
import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentException;
@@ -85,7 +85,7 @@
/**
* Transformer which implements the dynamic Tag functionalty.
- *
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Volker Schmitt</a>
*/
public class TagTransformer
@@ -123,7 +123,7 @@
/** Array for dynamic calling of Tag set property methods */
private String[] paramArray = new String[1];
/** Map for caching Tag Introspection */
- private static Map writeMethodMap = new BucketMap();
+ private static Map writeMethodMap = new StaticBucketMap();
/**
* SAX Event handling
@@ -242,13 +242,13 @@
do {
xmlDeserializer.deserialize(saxFragment);
} while (iterTag.doAfterBody() != Tag.SKIP_BODY);
-
+
} catch (ComponentException e) {
throw new SAXException("lookup XMLDeserializer failed", e);
}
finally {
if (xmlDeserializer != null)
- manager.release(xmlDeserializer);
+ manager.release(xmlDeserializer);
}
}
tag.doEndTag(namespaceURI, localName, qName);
@@ -347,7 +347,7 @@
manager.release(xmlSerializer);
xmlSerializer = null;
}
-
+
while (!tagStack.isEmpty()) {
Tag tag = (Tag) tagStack.pop();
if (tag == null)