You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/07/27 23:10:05 UTC
svn commit: r225637 - in /incubator/beehive/trunk/system-controls/src: jdbc/
jdbc/org/apache/beehive/controls/system/jdbc/ webservice/
webservice/org/apache/beehive/controls/system/webservice/jaxrpc/
Author: ekoneil
Date: Wed Jul 27 14:09:58 2005
New Revision: 225637
URL: http://svn.apache.org/viewcvs?rev=225637&view=rev
Log:
Fixes for BEEHIVE-777 and BEEHIVE-778 to switch the JDBC control and web service control off of Log4J and onto commons-logging.
These system controls will now use Log4J in the absence of a commons-logging.properties file which can be used to create LogFactory / Log instances.
**NOTE** if you are currently using either of these controls, you now *must* include commons-logging*.jar in your classpath.
BB: self
DRT: Beehive pass
Modified:
incubator/beehive/trunk/system-controls/src/jdbc/build.xml
incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs
incubator/beehive/trunk/system-controls/src/webservice/build.xml
incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java
incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
Modified: incubator/beehive/trunk/system-controls/src/jdbc/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/build.xml?rev=225637&r1=225636&r2=225637&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/build.xml (original)
+++ incubator/beehive/trunk/system-controls/src/jdbc/build.xml Wed Jul 27 14:09:58 2005
@@ -16,7 +16,7 @@
<pathelement location="${classes.dir}/${module.name}"/>
<path refid="controls.dependency.path"/>
<path refid="xbean.dependency.path"/>
- <path refid="log4j.dependency.path"/>
+ <path refid="commons-logging.dependency.path"/>
<path refid="velocity.dependency.path"/>
<path refid="tools.dependency.path"/>
</path>
Modified: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs?rev=225637&r1=225636&r2=225637&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs (original)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs Wed Jul 27 14:09:58 2005
@@ -17,20 +17,6 @@
*/
package org.apache.beehive.controls.system.jdbc;
-import org.apache.beehive.controls.api.ControlException;
-import org.apache.beehive.controls.api.bean.ControlImplementation;
-import org.apache.beehive.controls.api.bean.Extensible;
-import org.apache.beehive.controls.api.context.ControlBeanContext;
-import org.apache.beehive.controls.api.context.ResourceContext;
-import org.apache.beehive.controls.api.context.ResourceContext.ResourceEvents;
-import org.apache.beehive.controls.api.events.EventHandler;
-import org.apache.log4j.Logger;
-import org.apache.beehive.controls.system.jdbc.parser.SqlParser;
-import org.apache.beehive.controls.system.jdbc.parser.SqlStatement;
-
-import javax.naming.NamingException;
-import javax.naming.Context;
-import javax.sql.DataSource;
import java.lang.reflect.Method;
import java.sql.CallableStatement;
import java.sql.Connection;
@@ -45,6 +31,21 @@
import java.util.Map;
import java.util.Properties;
import java.util.Vector;
+import javax.naming.NamingException;
+import javax.naming.Context;
+import javax.sql.DataSource;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.context.ResourceContext;
+import org.apache.beehive.controls.api.context.ResourceContext.ResourceEvents;
+import org.apache.beehive.controls.api.events.EventHandler;
+import org.apache.beehive.controls.system.jdbc.parser.SqlParser;
+import org.apache.beehive.controls.system.jdbc.parser.SqlStatement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* The implementation class for the database controller.
@@ -69,7 +70,7 @@
private transient Vector<PreparedStatement> _resources;
private static final String EMPTY_STRING = "";
- private static final Logger logger = Logger.getLogger(JdbcControlImpl.class);
+ private static final Log LOGGER = LogFactory.getLog(JdbcControlImpl.class);
private static final ResultSetMapper DEFAULT_MAPPER = new DefaultObjectResultSetMapper();
private static final SqlParser _sqlParser = new SqlParser();
@@ -102,8 +103,8 @@
@EventHandler(field = "_resourceContext", eventSet = ResourceEvents.class, eventName = "onAcquire")
public void onAquire() {
- if (logger.isDebugEnabled()) {
- logger.debug("Enter: onAquire()");
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Enter: onAquire()");
}
try {
@@ -119,8 +120,8 @@
@EventHandler(field = "_resourceContext", eventSet = ResourceContext.ResourceEvents.class, eventName = "onRelease")
public void onRelease() {
- if (logger.isDebugEnabled()) {
- logger.debug("Enter: onRelease()");
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Enter: onRelease()");
}
for (PreparedStatement ps : getResources()) {
@@ -215,8 +216,8 @@
*/
public Object invoke(Method method, Object[] args) throws Throwable {
- if (logger.isDebugEnabled()) {
- logger.debug("Enter: invoke()");
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Enter: invoke()");
}
assert _connection.isClosed() == false : "invoke(): JDBC Connection has been closed!!!!";
return execPreparedStatement(method, args);
@@ -232,13 +233,12 @@
/**
* Returns the calendar used when working with time/date types.
*
- * @return
+ * @return
*/
public Calendar getDataSourceCalendar() {
return _cal;
}
-
// /////////////////////////////////////////// Protected Methods ////////////////////////////////////////////
@@ -271,8 +271,8 @@
SqlStatement sqlStatement = _sqlParser.parse(methodSQL.statement());
ps = sqlStatement.createPreparedStatement(_context, _connection, _cal, method, args);
- if (logger.isInfoEnabled()) {
- logger.info("PreparedStatement: "
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("PreparedStatement: "
+ sqlStatement.createPreparedStatementString(_context, _connection, method, args));
}
Modified: incubator/beehive/trunk/system-controls/src/webservice/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/build.xml?rev=225637&r1=225636&r2=225637&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/build.xml (original)
+++ incubator/beehive/trunk/system-controls/src/webservice/build.xml Wed Jul 27 14:09:58 2005
@@ -12,7 +12,7 @@
<path refid="webservices.dependency.path"/>
<path refid="controls.dependency.path"/>
<path refid="velocity.dependency.path"/>
- <path refid="log4j.dependency.path"/>
+ <path refid="commons-logging.dependency.path"/>
<path refid="xbean.dependency.path"/>
<path refid="tools.dependency.path"/>
</path>
Modified: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java?rev=225637&r1=225636&r2=225637&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java (original)
+++ incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java Wed Jul 27 14:09:58 2005
@@ -31,12 +31,14 @@
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
-import org.apache.log4j.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;
public class HeaderHandler
implements Handler {
- static Logger logger = Logger.getLogger(HeaderHandler.class);
+
+ private static Log LOGGER = LogFactory.getLog(HeaderHandler.class);
static ThreadLocal localInHeaders = new ThreadLocal();
@@ -52,7 +54,7 @@
try {
SOAPMessageContext smc = (SOAPMessageContext)mc;
SOAPMessage msg = smc.getMessage();
- logger.debug("Request message body: "
+ LOGGER.debug("Request message body: "
+ msg.getSOAPBody().toString() + "\n header: "
+ msg.getSOAPHeader().toString());
SOAPPart part = msg.getSOAPPart();
@@ -66,7 +68,7 @@
Element[] elemsToAdd = (Element[])localOutHeaders.get();
if(null == elemsToAdd) {
- logger.debug("no header to send");
+ LOGGER.debug("no header to send");
return true;
}
for(Element nxtElement : elemsToAdd) {
@@ -78,7 +80,7 @@
}
catch(SOAPException e) {
e.printStackTrace();
- logger.error("Failed to add header.", e);
+ LOGGER.error("Failed to add header.", e);
}
return true;
@@ -102,7 +104,7 @@
try {
SOAPMessageContext smc = (SOAPMessageContext)mc;
SOAPMessage msg = smc.getMessage();
- logger.debug("Response message body: "
+ LOGGER.debug("Response message body: "
+ msg.getSOAPBody().toString() + "\n header: "
+ msg.getSOAPHeader().toString());
SOAPPart part = msg.getSOAPPart();
@@ -125,10 +127,10 @@
}
catch(SOAPException e) {
e.printStackTrace();
- logger.error("Error extracting the header.", e);
+ LOGGER.error("Error extracting the header.", e);
}
- logger.debug("myInHeaders: " + localInHeaders.get());
+ LOGGER.debug("myInHeaders: " + localInHeaders.get());
return true;
}
@@ -156,7 +158,7 @@
* @see javax.xml.rpc.handler.Handler#destroy()
*/
public void destroy() {
- logger.debug("In HeaderHandler's destroy");
+ LOGGER.debug("In HeaderHandler's destroy");
}
Modified: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs?rev=225637&r1=225636&r2=225637&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs (original)
+++ incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs Wed Jul 27 14:09:58 2005
@@ -60,7 +60,8 @@
import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
import org.apache.beehive.wsm.registration.TypeRegistrar;
import org.apache.beehive.wsm.wsdl.Utilities;
-import org.apache.log4j.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.xmlbeans.XmlException;
import org.w3c.dom.Element;
import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
@@ -68,7 +69,8 @@
@ControlImplementation
public class ServiceControlImpl
implements ServiceControl, Extensible, Serializable {
- static Logger logger = Logger.getLogger(ServiceControlImpl.class);
+
+ private static final Log LOGGER = LogFactory.getLog(ServiceControlImpl.class);
@Context
public ControlBeanContext cbContext;
@@ -106,7 +108,7 @@
public Object invoke(Method method, Object[] args)
throws NoSuchMethodException, Exception {
- logger.debug("invoke method: " + method.getName());
+ LOGGER.debug("invoke method: " + method.getName());
initialize();
String operationName = method.getName();
String alternateOperationName = getAlternateOperationName(method);
@@ -182,7 +184,7 @@
return;
for(Object nxtOutParamKey : outParam.keySet()) {
- logger.info("Got outparam: " + nxtOutParamKey + " value: "
+ LOGGER.info("Got outparam: " + nxtOutParamKey + " value: "
+ outParam.get(nxtOutParamKey)
+ " Stuff this into the holders");
}
@@ -199,7 +201,7 @@
&& Holder.class.isAssignableFrom(javaTypeFromClass)) {
try {
- logger.info("Fill the holder object: " + nxtParamMetaData.getWpName());
+ LOGGER.info("Fill the holder object: " + nxtParamMetaData.getWpName());
Holder holder = (Holder)args[i];
Object value = null; // find the value, only check for
// localpart of the name, as the
@@ -269,7 +271,7 @@
new javax.xml.namespace.QName(mWSTM.getWsTargetNamespace(), wmm.getWmOperationName()));
// The target endpoint
- logger.debug("endpoint: " + getEndPoint().toExternalForm());
+ LOGGER.debug("endpoint: " + getEndPoint().toExternalForm());
call.setTargetEndpointAddress(getEndPoint().toExternalForm());
// set style
@@ -291,7 +293,7 @@
throw new ControlException("Invalid Binding style: " + omStyle);
}
- logger.debug("Call style: " + style);
+ LOGGER.debug("Call style: " + style);
call.setProperty(Call.OPERATION_STYLE_PROPERTY, style);
if("rpc".equals(style) && SOAPBinding.Use.LITERAL == mWSTM.getSoapBinding().getUse()) {
@@ -359,7 +361,7 @@
if(nxtArgMetaData.isWpHeader()) {
// TODO: addParameterAsHeader is Axis specific, later abstract out Axis from this implementation
- logger.debug("Argument: " + nxtArgMetaData.getWpName()
+ LOGGER.debug("Argument: " + nxtArgMetaData.getWpName()
+ " in method: " + method.getName()
+ " is send as soap header");
@@ -367,7 +369,7 @@
javaTypeFromClass, mode, mode);
}
else {
- logger.debug("Argument: " + nxtArgMetaData.getWpName()
+ LOGGER.debug("Argument: " + nxtArgMetaData.getWpName()
+ " in method: " + method.getName()
+ " is send in the soap body");
((org.apache.axis.client.Call)call).addParameter(headerParamQName, registeredTypeQName,
@@ -501,7 +503,7 @@
if(wsdl == null)
throw new ControlException("No WSDL annotation found.");
- logger.debug("read wsdl from: " + wsdl.path());
+ LOGGER.debug("read wsdl from: " + wsdl.path());
if(wsdl.path().startsWith("http://") || wsdl.path().startsWith("file:/")) {
url = new URL(wsdl.path());
@@ -511,13 +513,13 @@
wsdlStream = cbContext.getBeanContext().getResourceAsStream(wsdl.path(), null);
if(wsdlStream == null) {
- logger.info("Failed to load the wsdl from context, will try classloader!");
+ LOGGER.info("Failed to load the wsdl from context, will try classloader!");
wsdlStream = this.getClass().getClassLoader().getResourceAsStream(wsdl.path());
/*
- todo: why does this try to load from a hard file path?
- this value is generally unstable in a running server
- */
+ todo: why does this try to load from a hard file path?
+ this value is generally unstable in a running server
+ */
if(null == wsdlStream) {
f = new File(wsdl.path());
wsdlStream = new FileInputStream(f);
@@ -527,7 +529,7 @@
return Utilities.parseWSDL(wsdlStream);
}
catch(MalformedURLException e) {
- logger.error("ERROR: WSDL is not found, invalid URL " + url);
+ LOGGER.error("ERROR: WSDL is not found, invalid URL " + url);
throw new ControlException("ERROR: WSDL is not found, invalid URL " + url, e);
}
catch(FileNotFoundException e) {
@@ -537,11 +539,11 @@
}
catch(IOException ioe) {
}
- logger.error("ERROR: WSDL File not found: " + fpath);
+ LOGGER.error("ERROR: WSDL File not found: " + fpath);
throw new ControlException("ERROR: WSDL File not found: " + fpath, e);
}
catch(IOException e) {
- logger.error("ERROR: IO Exception in reading WSDL File");
+ LOGGER.error("ERROR: IO Exception in reading WSDL File");
throw new ControlException("ERROR: IO Exception in reading WSDL File.", e);
}
catch(XmlException e) {
@@ -692,17 +694,17 @@
}
/*
- * @see org.apache.beehive.controls.system.webservice.ServiceControl#getInputHeaders()
- *
- * If there are any input header it is stored on my thread's Handler.
- */
+ * @see org.apache.beehive.controls.system.webservice.ServiceControl#getInputHeaders()
+ *
+ * If there are any input header it is stored on my thread's Handler.
+ */
public Element[] getInputHeaders() {
return HeaderHandler.getInHeaders();
}
/*
- * @see org.apache.beehive.controls.system.webservice.ServiceControl#setOutputHeaders(org.w3c.dom.Element[])
- */
+ * @see org.apache.beehive.controls.system.webservice.ServiceControl#setOutputHeaders(org.w3c.dom.Element[])
+ */
public void setOutputHeaders(Element[] headers) {
HeaderHandler.setOutHeaders(headers);
}