You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2007/03/31 12:59:18 UTC
svn commit: r524406 - in
/cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon:
components/web3/impl/ transformation/
Author: joerg
Date: Sat Mar 31 03:59:16 2007
New Revision: 524406
URL: http://svn.apache.org/viewvc?view=rev&rev=524406
Log:
clean ups (should not change anything in behaviour)
Modified:
cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3ClientImpl.java
cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceImpl.java
cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceSelectorImpl.java
cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/transformation/Web3RfcTransformer.java
Modified: cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3ClientImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3ClientImpl.java?view=diff&rev=524406&r1=524405&r2=524406
==============================================================================
--- cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3ClientImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3ClientImpl.java Sat Mar 31 03:59:16 2007
@@ -16,22 +16,22 @@
*/
package org.apache.cocoon.components.web3.impl;
-import org.apache.cocoon.components.web3.Web3Client;
+import java.net.URL;
+import java.util.Date;
+import java.util.Properties;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.avalon.excalibur.pool.Poolable;
+import org.apache.avalon.excalibur.pool.Recyclable;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import com.sap.mw.jco.JCO;
-import com.sap.mw.jco.IRepository;
+import org.apache.cocoon.components.web3.Web3Client;
-import java.net.URL;
-import java.util.Properties;
-import java.util.Date;
+import com.sap.mw.jco.IRepository;
+import com.sap.mw.jco.JCO;
/**
- * The standard interface for R3Clients in Web3.
+ * TBD
*
* @since 2.1
* @version $Id$
@@ -42,29 +42,20 @@
protected JCO.Client client;
protected String repository;
- /**
- * @see org.apache.cocoon.components.web3.Web3Client#initClient(com.sap.mw.jco.JCO.Client)
- */
public void initClient(JCO.Client client) {
this.client = client;
this.repository = "" + (new Date ()).getTime();
}
- /**
- * @see org.apache.cocoon.components.web3.Web3Client#releaseClient()
- */
public void releaseClient() {
JCO.releaseClient(this.client);
this.client = null;
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- this.client = null;
this.repository = null;
}
+
+ public void recycle() { }
+
+ public void dispose() { }
public IRepository getRepository() {
if (null != this.repository) {
@@ -252,10 +243,5 @@
public void setThroughput(JCO.Throughput throughput) {
this.client.setThroughput (throughput);
}
-
- public void recycle() {
- this.client = null;
- this.repository = null;
- }
}
Modified: cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceImpl.java?view=diff&rev=524406&r1=524405&r2=524406
==============================================================================
--- cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceImpl.java Sat Mar 31 03:59:16 2007
@@ -51,9 +51,6 @@
private static Mutex lock = new Mutex();
protected ServiceManager manager;
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
public void service(ServiceManager manager) throws ServiceException {
this.manager = manager;
}
Modified: cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceSelectorImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceSelectorImpl.java?view=diff&rev=524406&r1=524405&r2=524406
==============================================================================
--- cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceSelectorImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/components/web3/impl/Web3DataSourceSelectorImpl.java Sat Mar 31 03:59:16 2007
@@ -24,21 +24,20 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.components.LifecycleHelper;
import org.apache.cocoon.components.web3.Web3DataSource;
import org.apache.cocoon.util.ClassUtils;
import EDU.oswego.cs.dl.util.concurrent.Mutex;
/**
- * The Default implementation for R3DataSources in Web3. This uses the
- * normal <code>com.sap.mw.jco.JCO</code> classes.
+ * TBD
*
* @since 2.1
* @version $Id$
@@ -112,12 +111,7 @@
true,
ClassUtils.getClassLoader());
pool = (Web3DataSource) theClass.newInstance();
- if (pool instanceof LogEnabled) {
- ((LogEnabled) pool).enableLogging(getLogger());
- }
- pool.service(this.manager);
- pool.configure(c);
- pool.initialize();
+ LifecycleHelper.setupComponent(pool, getLogger(), null, this.manager, c);
Web3DataSourceSelectorImpl.pools.put(obj, pool);
}
}
Modified: cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/transformation/Web3RfcTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/transformation/Web3RfcTransformer.java?view=diff&rev=524406&r1=524405&r2=524406
==============================================================================
--- cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/transformation/Web3RfcTransformer.java (original)
+++ cocoon/trunk/blocks/cocoon-web3/cocoon-web3-impl/src/main/java/org/apache/cocoon/transformation/Web3RfcTransformer.java Sat Mar 31 03:59:16 2007
@@ -26,6 +26,7 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.avalon.framework.service.Serviceable;
@@ -51,7 +52,7 @@
implements Serviceable, Disposable, Configurable, Poolable, Recyclable {
/** The service manager instance */
- protected ServiceManager manager;
+ protected ServiceManager manager;
protected Web3DataSource web3source;
protected Web3Client connection;
@@ -70,33 +71,27 @@
protected String default_backend;
protected String streamer;
protected HashMap tags = new HashMap();
-
+
+ public void configure(final Configuration configuration) throws ConfigurationException {
+ this.default_backend = configuration.getChild("system").getValue(null);
+ }
+
+ public void service(ServiceManager manager) throws ServiceException {
+ this.manager = manager;
+ initTags();
+ }
+
public void setup(SourceResolver resolver, Map objectModel,
- String source, Parameters parameters)
- throws SAXException {
-
+ String source, Parameters parameters) throws SAXException {
try {
- backend = parameters.getParameter("system");
+ this.backend = parameters.getParameter("system");
}
catch (Exception x) {
- if ( null == backend ) {
- getLogger().warn("No backend configured! Try to use configuration");
- backend = default_backend;
- }
+ getLogger().warn("No backend configured! Try to use configuration");
+ this.backend = this.default_backend;
}
}
- public void service(ServiceManager manager) {
- this.manager = manager;
- initTags();
- }
-
- public void configure(final Configuration configuration)
- throws ConfigurationException {
-
- this.default_backend = configuration.getChild("system").getValue(null);
- }
-
public void recycle() {
this.connection = null;
this.repository = null;
@@ -121,33 +116,10 @@
}
/**
- * Receive notification of the beginning of a document.
- */
- public void startDocument()
- throws SAXException {
-
- if ( null != super.contentHandler ) {
- super.contentHandler.startDocument();
- }
- }
-
- /**
- * Receive notification of the end of a document.
- */
- public void endDocument()
- throws SAXException {
-
- if ( null != super.contentHandler) {
- super.contentHandler.endDocument();
- }
- }
-
- /**
* Receive notification of the beginning of an element.
*/
public void startElement(String uri, String loc, String raw, Attributes a)
- throws SAXException {
-
+ throws SAXException {
if ( Web3.URI.equals( uri ) && !this.error ) {
switch ( Integer.parseInt( (String) this.tags.get( loc ))) {
case INCLUDE_ELEM:
@@ -170,13 +142,13 @@
getLogger().error (error, ex);
error = ex.getMessage();
- attributes.clear();
- super.contentHandler.startElement(uri, loc, raw, a);
- super.contentHandler.startElement(uri, Web3.PROCESSING_X_ELEM,
- Web3.PROCESSING_X_ELEM, attributes);
- super.contentHandler.characters(error.toCharArray(), 0,
+ this.attributes.clear();
+ super.startElement(uri, loc, raw, a);
+ super.startElement(uri, Web3.PROCESSING_X_ELEM,
+ Web3.PROCESSING_X_ELEM, this.attributes);
+ super.characters(error.toCharArray(), 0,
error.length());
- super.contentHandler.endElement(uri, Web3.PROCESSING_X_ELEM,
+ super.endElement(uri, Web3.PROCESSING_X_ELEM,
Web3.PROCESSING_X_ELEM);
this.error = true;
}
@@ -218,16 +190,15 @@
getLogger().error("Invalid element " + loc);
}
}
- else if (super.contentHandler != null) {
- super.contentHandler.startElement(uri, loc, raw, a);
+ else {
+ super.startElement(uri, loc, raw, a);
}
}
/**
* Receive notification of the end of an element.
*/
- public void characters(char c[], int start, int len)
- throws SAXException {
+ public void characters(char c[], int start, int len) throws SAXException {
String theValue = new String(c, start, len).trim();
if ( null != this.fillMe ) {
if ( "".equals( theValue )) {
@@ -245,18 +216,14 @@
}
}
else {
- if (super.contentHandler != null) {
- super.contentHandler.characters(c, start, len);
- }
+ super.characters(c, start, len);
}
}
/**
* Receive notification of the end of an element.
*/
- public void endElement(String uri, String loc, String raw)
- throws SAXException
- {
+ public void endElement(String uri, String loc, String raw) throws SAXException {
if ( Web3.URI.equals(uri) && !this.error ) {
switch ( Integer.parseInt( (String) this.tags.get( loc ))) {
case INCLUDE_ELEM:
@@ -268,15 +235,15 @@
(ServiceSelector)
this.manager.lookup( Web3Streamer.ROLE + "Selector" );
w3s = (Web3Streamer) streamerSelector.select( this.streamer );
- w3s.stream( this.function, super.contentHandler );
+ w3s.stream( this.function, this.contentHandler );
}
catch (Exception x) {
this.attributes.clear();
- super.contentHandler.startElement(uri, Web3.ABAP_EXCEPTION_ELEM,
+ super.startElement(uri, Web3.ABAP_EXCEPTION_ELEM,
Web3.ABAP_EXCEPTION_ELEM, this.attributes);
- super.contentHandler.characters(x.getMessage ().toCharArray(),
+ super.characters(x.getMessage ().toCharArray(),
0, x.getMessage ().length());
- super.contentHandler.endElement(uri, Web3.ABAP_EXCEPTION_ELEM,
+ super.endElement(uri, Web3.ABAP_EXCEPTION_ELEM,
Web3.ABAP_EXCEPTION_ELEM);
getLogger().error(x.getMessage(), x);
}
@@ -285,7 +252,7 @@
if ( null != streamerSelector ) {
streamerSelector.release( w3s );
}
- manager.release( streamerSelector );
+ this.manager.release( streamerSelector );
}
this.connection = null;
this.repository = null;
@@ -300,8 +267,8 @@
break;
}
}
- else if (super.contentHandler != null) {
- super.contentHandler.endElement(uri,loc,raw);
+ else {
+ super.endElement(uri,loc,raw);
}
}
@@ -315,7 +282,6 @@
protected final static int TABLE_ELEM = 8;
protected void initTags() {
-
this.tags.put( Web3.INCLUDE_ELEM, "1" );
this.tags.put( Web3.IMPORT_ELEM, "2" );
this.tags.put( Web3.EXPORT_ELEM, "3" );
@@ -325,5 +291,5 @@
this.tags.put( Web3.STRUCTURE_ELEM, "7" );
this.tags.put( Web3.TABLE_ELEM, "8" );
}
-}
+}