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/05/09 22:18:03 UTC

svn commit: r169351 [10/12] - in /incubator/beehive/trunk/system-controls: ./ ant/ external/ external/commons/ external/ejb/ external/jms/ src/ src/ejb/ src/ejb/org/ src/ejb/org/apache/ src/ejb/org/apache/beehive/ src/ejb/org/apache/beehive/controls/ src/ejb/org/apache/beehive/controls/system/ src/ejb/org/apache/beehive/controls/system/ejb/ src/ejb/schema/ src/jdbc/ src/jdbc/org/ src/jdbc/org/apache/ src/jdbc/org/apache/beehive/ src/jdbc/org/apache/beehive/controls/ src/jdbc/org/apache/beehive/controls/system/ src/jdbc/org/apache/beehive/controls/system/jdbc/ src/jdbc/org/apache/beehive/controls/system/jdbc/parser/ src/jms/ src/jms/org/ src/jms/org/apache/ src/jms/org/apache/beehive/ src/jms/org/apache/beehive/controls/ src/jms/org/apache/beehive/controls/system/ src/jms/org/apache/beehive/controls/system/jms/ src/jms/org/apache/beehive/controls/system/jms/impl/ src/jms/org/apache/beehive/controls/system/jndi/ src/jms/org/apache/beehive/controls/system/jndi/impl/ src/webservice/ src/webservice/org/ src/webservice/org/apache/ src/webservice/org/apache/beehive/ src/webservice/org/apache/beehive/controls/ src/webservice/org/apache/beehive/controls/system/ src/webservice/org/apache/beehive/controls/system/webservice/ src/webservice/org/apache/beehive/controls/system/webservice/generator/ src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ src/webservice/org/apache/beehive/controls/system/webservice/utils/ test/ test/ant/ test/conf/ test/src/ test/src/jdbc/ test/src/jdbc/controls/ test/src/jdbc/controls/org/ test/src/jdbc/controls/org/apache/ test/src/jdbc/controls/org/apache/beehive/ test/src/jdbc/controls/org/apache/beehive/controls/ test/src/jdbc/controls/org/apache/beehive/controls/system/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ test/src/jdbc/controls/schemas/ test/src/jdbc/controls/schemas/badusers/ test/src/jdbc/controls/schemas/users/ test/src/jdbc/jdbc-container/ test/src/jdbc/jdbc-container/application/ test/src/jdbc/jdbc-container/src/ test/src/jdbc/jdbc-container/src/org/ test/src/jdbc/jdbc-container/src/org/apache/ test/src/jdbc/jdbc-container/src/org/apache/beehive/ test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/ test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/ test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/ test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/containertest/ test/src/jdbc/jdbc-container/webapp/ test/src/jdbc/jdbc-container/webapp/WEB-INF/ test/src/jdbc/jdbc-container/webapp/conf/ test/src/jdbc/jdbc-container/webapp/conf/Catalina/ test/src/jdbc/jdbc-container/webapp/conf/Catalina/localhost/ test/src/jdbc/junitTests/ test/src/jdbc/junitTests/org/ test/src/jdbc/junitTests/org/apache/ test/src/jdbc/junitTests/org/apache/beehive/ test/src/jdbc/junitTests/org/apache/beehive/controls/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/dbconnection/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/errors/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/

Added: 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=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs (added)
+++ incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs Mon May  9 13:17:58 2005
@@ -0,0 +1,677 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.jaxrpc;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import org.apache.axis.constants.Use;
+import org.apache.axis.utils.Messages;
+import org.apache.axis.utils.JavaUtils.HolderException;
+import org.apache.beehive.controls.api.bean.AnnotationConstraints.AllowExternalOverride;
+import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Iterator;
+
+import javax.jws.WebParam;
+import javax.jws.soap.SOAPBinding;
+import javax.servlet.ServletContext;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Call;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.encoding.TypeMapping;
+import javax.xml.rpc.encoding.XMLType;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.holders.Holder;
+
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
+import org.apache.beehive.wsm.axis.registration.AxisTypeRegistrar;
+import org.apache.beehive.wsm.databinding.BindingLookupService;
+import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
+import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
+import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
+import org.apache.beehive.wsm.registration.TypeRegistrar;
+import org.apache.log4j.Logger;
+
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+import org.apache.beehive.controls.system.webservice.utils.HolderUtils;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+@ControlImplementation
+public class ServiceControlImpl implements ServiceControl, Extensible,
+		Serializable {
+	static Logger logger = Logger.getLogger(ServiceControlImpl.class);
+
+	@Context
+	public ControlBeanContext cbContext;
+
+	BindingLookupService lookupService = null;
+
+	TypeRegistrar registrar = null;
+
+	Service service = null;
+
+	QName portType;
+
+	BeehiveWsTypeMetadata mWSTM;
+
+	URL endPoint = null;
+
+	QName wsdlPort = null;
+
+	String username = null;
+
+	String password = null;
+
+	int timeout = 1000;
+
+	boolean initialized = false;
+
+	public ServiceControlImpl() {
+	}
+
+	/**
+	 * @param method
+	 * @param args
+	 * @throws Exception
+	 */
+	public Object invoke(Method method, Object[] args)
+			throws NoSuchMethodException, Exception {
+		logger.debug("invoke method: " + method.getName());
+		initialize();
+		String operationName = method.getName();
+		String alternateOperationName = getAlternateOperationName(method);
+		if (null != alternateOperationName)
+			operationName = alternateOperationName;
+		BeehiveWsMethodMetadata wmm = findMethodInOM(method, operationName);
+
+		Call call = buildCallObject(method, wmm);
+
+		Object[] callArgs = prepareArgsForSend(method, wmm, args);
+		// // Invoke the operation
+		Object res = call.invoke(callArgs);
+		fillHolders(method, wmm, call, args);
+
+		return res;
+
+	}
+
+	// create a new copy of the args where holders value have been extracted.
+	// ignore the out values
+	private Object[] prepareArgsForSend(Method method,
+			BeehiveWsMethodMetadata wmm, Object[] args) {
+
+		ArrayList argsList = new ArrayList();
+		Class[] methodParameterTypes = method.getParameterTypes();
+		Iterator<BeehiveWsParameterMetadata> it = wmm.getParams().iterator(); // size
+		// of
+		// the
+		// param
+		// list
+		// must
+		// be
+		// the
+		// size
+		// of
+		// the
+		// args
+		// array
+		for (int i = 0; i < methodParameterTypes.length; i++) {
+			Class javaTypeFromClass = methodParameterTypes[i];
+			BeehiveWsParameterMetadata nxtParamMetaData = it.next();
+			if (nxtParamMetaData.getWpMode() == WebParam.Mode.OUT)
+				continue; // don't send OUT parameters.
+			if ((nxtParamMetaData.getWpMode() == WebParam.Mode.INOUT)
+					&& Holder.class.isAssignableFrom(javaTypeFromClass)) {
+				try {
+					Holder holder = (Holder) args[i];
+					Field valueField = holder.getClass().getField("value");
+					argsList.add(valueField.get(holder));
+				} catch (Exception e) {
+					throw new RuntimeException(
+							"failed in getting holder value for: "
+									+ nxtParamMetaData.getWpName());
+				}
+
+			} else {
+				argsList.add(args[i]);
+			}
+		}
+		Object[] res = (Object[]) argsList.toArray(new Object[argsList.size()]);
+
+		return res;
+	}
+
+	// fill the hodlers in the argument array with the result of the call
+	private void fillHolders(Method method, BeehiveWsMethodMetadata wmm,
+			Call call, Object[] args) {
+		Map outParam = call.getOutputParams();
+
+		if (outParam.isEmpty())
+			return;
+		for (Object nxtOutParamKey : outParam.keySet()) {
+			logger.info("Got outparam: " + nxtOutParamKey + " value: "
+					+ outParam.get(nxtOutParamKey)
+					+ " Stuff this into the holders");
+		}
+
+		Class[] methodParameterTypes = method.getParameterTypes();
+		Iterator<BeehiveWsParameterMetadata> it = wmm.getParams().iterator(); // size
+		// of
+		// the
+		// param
+		// list
+		// must
+		// be
+		// the
+		// size
+		// of
+		// the
+		// args
+		// array
+		for (int i = 0; i < methodParameterTypes.length; i++) {
+			Class javaTypeFromClass = methodParameterTypes[i];
+			BeehiveWsParameterMetadata nxtParamMetaData = it.next();
+			if ((nxtParamMetaData.getWpMode() == WebParam.Mode.INOUT || nxtParamMetaData
+					.getWpMode() == WebParam.Mode.OUT)
+					&& Holder.class.isAssignableFrom(javaTypeFromClass)) {
+				try {
+					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
+					// namespace
+					// may not be filled
+					boolean hasReturnValue = false;
+					for (Object nxtOutParamKey : outParam.keySet()) {
+						if (((QName) nxtOutParamKey).getLocalPart().equals(
+								nxtParamMetaData.getWpName())) {
+							value = outParam.get(nxtOutParamKey);
+							hasReturnValue = true;
+							break;
+						}
+					}
+					if (hasReturnValue)
+						stuffHolderValue(holder, value);
+				} catch (Exception e) {
+					throw new RuntimeException(
+							"failed in getting holder value for: "
+									+ nxtParamMetaData.getWpName());
+				}
+
+			} else {
+				continue;
+			}
+		}
+	}
+
+	private void stuffHolderValue(Holder holder, Object value)
+			throws NoSuchFieldException, IllegalAccessException {
+		HolderUtils.stuffHolderValue(holder, value);
+	}
+
+	/**
+	 * @param method
+	 * @param operationName
+	 * @return
+	 * @throws ServiceException
+	 * @throws NoSuchMethodException
+	 * @throws Exception
+	 */
+	private Call buildCallObject(Method method, BeehiveWsMethodMetadata wmm)
+			throws ServiceException, NoSuchMethodException, Exception {
+
+		// TODO: Later cache the call objects for each method.
+
+		Call call = service.createCall();
+		if (getWsdlPort() != null) {
+			call.setPortTypeName(getWsdlPort());
+		}
+		if (getUsername() != null) {
+			call.setProperty(Call.USERNAME_PROPERTY, getUsername());
+		}
+		if (getPassword() != null) {
+			call.setProperty(Call.PASSWORD_PROPERTY, getPassword());
+		}
+		call.setOperationName(new javax.xml.namespace.QName(mWSTM
+				.getWsTargetNamespace(), wmm.getWmOperationName()));
+		// The target endpoint
+		logger.debug("endpoint: " + getEndPoint().toExternalForm());
+		call.setTargetEndpointAddress(getEndPoint().toExternalForm());
+		//       
+		// NO TImeout property in the JaxRPC
+		// int timeout = serviceControl.getTimeout();
+		// if (timeout != 0) {
+		// call.setTimeout(new Integer(timeout));
+		// }
+
+		// set style
+		SOAPBinding.Style omStyle = mWSTM.getSoapBinding().getStyle();
+		String style;
+		if (omStyle == SOAPBinding.Style.DOCUMENT) {
+			if (mWSTM.getSoapBinding().getParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED)
+				// wrapped implies document also!
+				style = "wrapped";
+			else
+				style = "document";
+		} else if (omStyle == SOAPBinding.Style.RPC)
+			style = "rpc";
+		else
+			throw new RuntimeException("Ivalid Binding style: " + omStyle);
+		logger.debug("Call style: " + style);
+		call.setProperty(Call.OPERATION_STYLE_PROPERTY, style);
+
+		if ("rpc".equals(style)
+				&& SOAPBinding.Use.LITERAL == mWSTM.getSoapBinding().getUse()) {
+			((org.apache.axis.client.Call) call).setOperationUse(Use.LITERAL);
+		}
+		// walk the argument meta data list, register type of parameters, add
+		// parameters to the
+		// call object
+		// TODO: Make sure there is nothing special that needs to be done about
+		// holder objects.
+		List<BeehiveWsParameterMetadata> omArgMetaDataList = new ArrayList<BeehiveWsParameterMetadata>();
+		omArgMetaDataList.addAll(wmm.getParams());
+
+		Class[] methodParameterTypes = method.getParameterTypes();
+		Type[] genericMethodParamTypes = method.getGenericParameterTypes();
+
+		if (omArgMetaDataList.size() != methodParameterTypes.length)
+			throw new RuntimeException(
+					"Object model and method definition don't match!");
+		List argsToSend = new ArrayList<Object>();
+		for (int i = 0; i < methodParameterTypes.length; i++) {
+
+			BeehiveWsParameterMetadata nxtArgMetaData = omArgMetaDataList
+					.get(i);
+			Class javaTypeFromClass = methodParameterTypes[i];
+
+			// sure
+			// the
+			// type
+			// is
+			// registered
+			ParameterMode mode;
+			WebParam.Mode omMode = nxtArgMetaData.getWpMode();
+			if (omMode == WebParam.Mode.IN)
+				mode = ParameterMode.IN;
+			else if (omMode == WebParam.Mode.OUT)
+				mode = ParameterMode.OUT;
+			else if (omMode == WebParam.Mode.INOUT) {
+				if (!Holder.class.isAssignableFrom(javaTypeFromClass))
+					throw new RuntimeException(
+							"Holder classes are required for the in/out parameters.");
+				mode = ParameterMode.INOUT;
+			} else
+				throw new RuntimeException("Invalid parameter mode: " + omMode);
+
+			// if mode is in or in/out and the type is holder then holder, get
+			// its value type
+			QName registeredTypeQName;
+
+			if ((mode == ParameterMode.OUT || mode == ParameterMode.INOUT)
+					&& Holder.class.isAssignableFrom(javaTypeFromClass)) {
+				javaTypeFromClass = TypeRegistrar
+						.getHoldersValueClass(genericMethodParamTypes[i]);
+			}
+			registeredTypeQName = registrar.registerType(javaTypeFromClass,
+					nxtArgMetaData.getXmlType(), mWSTM.getSoapBinding().getStyle(), mWSTM.getSoapBinding().getUse());
+
+			if (nxtArgMetaData.isWpHeader()) {
+				// TODO: addParameterAsHeader is Axis specific, later abstract
+				// out Axis from this implementation
+				logger.debug("Argument: " + nxtArgMetaData.getWpName()
+						+ " in method: " + method.getName()
+						+ " is send as soap header");
+				((org.apache.axis.client.Call) call).addParameterAsHeader(
+						new QName(nxtArgMetaData.getWpTargetNamespace(),
+								nxtArgMetaData.getWpName()),
+						registeredTypeQName, javaTypeFromClass, mode, mode);
+			} else {
+				logger.debug("Argument: " + nxtArgMetaData.getWpName()
+						+ " in method: " + method.getName()
+						+ " is send in the soap body");
+				call.addParameter(nxtArgMetaData.getWpName(),
+						registeredTypeQName, javaTypeFromClass, mode);
+			}
+		}
+		// register the return type
+		if (!wmm.isOneWay()) {
+			// QName xmlTypeFromWSDL = new QName(wmm.getWrTargetNamespace(),
+			// wmm.getWrName()); //wmm.getXmlReturnType();
+			Class javaTypeFromClass = method.getReturnType();
+			QName resultsRegisteredTypeQName = registrar.registerType(
+					javaTypeFromClass, wmm.getXmlReturnType(), mWSTM.getSoapBinding().getStyle(), mWSTM.getSoapBinding().getUse());
+			call.setReturnType(resultsRegisteredTypeQName);
+//			if ("rpc".equals(style)) {
+//				((org.apache.axis.client.Call) call).setReturnQName(new QName("", "return"));   // Hack, may need this for google!  TBD, verify the need for this.
+//				((org.apache.axis.client.Call) call).setReturnClass(javaTypeFromClass);   // Hack, may need this for google!  TBD, verify the need for this.
+//			}
+		} else
+			call.setReturnType(registrar.getVoidType());
+		// AXIS dependecy... this is needed for the Handlers
+		call.setProperty(org.apache.axis.client.Call.JAXRPC_PORTTYPE_NAME,
+				portType);
+		return call;
+	}
+
+	/**
+	 * @param method
+	 * @param operationName
+	 * @throws Exception
+	 */
+	private BeehiveWsMethodMetadata findMethodInOM(Method method,
+			String operationName) throws NoSuchMethodException, Exception {
+
+		// the obejct model doesn't store holders, rather the underlying
+		// types, so to get the method
+		// we need to get the underlying types. After the loop above the
+		// paramTypes have the underlying types
+		// for any holders in the arg list.
+
+		Type[] genericParamTypes = method.getGenericParameterTypes();
+		Class[] paramTypes = method.getParameterTypes();
+		for (int i = 0; i < paramTypes.length; i++) {
+			if (Holder.class.isAssignableFrom(paramTypes[i])) {
+				paramTypes[i] = TypeRegistrar
+						.getHoldersValueClass(genericParamTypes[i]);
+			}
+		}
+		BeehiveWsMethodMetadata wmm = mWSTM
+				.getMethod(operationName, paramTypes);
+		if (wmm == null) {
+			StringBuffer sb = new StringBuffer(
+					"No Jsr181MethodMetadata found for " + operationName + '(');
+			boolean first = true;
+			for (Class cls : paramTypes) {
+				if (first) {
+					first = false;
+				} else {
+					sb.append(',');
+				}
+				sb.append(cls.getName());
+			}
+			sb.append(')');
+			throw new NoSuchMethodException(sb.toString());
+
+		}
+		return wmm;
+	}
+
+	private synchronized void initialize() throws Exception {
+		if (initialized)
+			return;
+		XmlBeanWSDLProcessor wsdlProcessor;
+
+		ServiceControl.WSDL wsdl = (ServiceControl.WSDL) cbContext
+				.getControlPropertySet(ServiceControl.WSDL.class);
+
+		if (wsdl != null) {
+			logger.debug("read wsdl from: " + wsdl.path());
+			InputStream wsdlStream = getWSDLStream(wsdl.path());
+
+			if (wsdlStream != null) {
+				wsdlProcessor = new XmlBeanWSDLProcessor(wsdlStream);
+			} else {
+				throw new RuntimeException(
+						"No WSDL found at the provided path: " + wsdl.path());
+			}
+		} else {
+			throw new RuntimeException("No WSDL annotation found.");
+		}
+
+		ServiceFactory factory = ServiceFactory.newInstance();
+
+		service = factory.createService(wsdlProcessor.getServiceName());
+
+		HandlerInfo hInfo = new HandlerInfo();
+		hInfo.setHandlerClass(HeaderHandler.class);
+
+		TypeMapping tm = service.getTypeMappingRegistry()
+				.getDefaultTypeMapping();
+		lookupService = new SystemTypeLookupService();
+		registrar = new AxisTypeRegistrar(
+				(org.apache.axis.encoding.TypeMapping) tm, lookupService);
+		configureEndPoint();
+
+		mWSTM = wsdlProcessor.getObjectModel(lookupService);
+
+		portType = new QName(mWSTM.getWsTargetNamespace(), mWSTM.getWsName()); // porttype
+		// name
+		service.getHandlerRegistry().getHandlerChain(portType).add(hInfo);
+
+		initialized = true;
+
+	}
+
+	private String getAlternateOperationName(Method method) {
+
+		ServiceControl.OperationName opName = cbContext.getMethodPropertySet(
+				method, ServiceControl.OperationName.class);
+		if (opName != null) {
+			return opName.value();
+		}
+		return null;
+	}
+
+	private InputStream getWSDLStream(String pathToWSDL) throws Exception {
+
+		InputStream wsdlStream = null;
+		logger.debug("wsdl at:" + pathToWSDL);
+
+		if (pathToWSDL.startsWith("http://") || pathToWSDL.startsWith("file:/")) {
+			URL url = new URL(pathToWSDL);
+			wsdlStream = url.openStream();
+		} else { // it is a local file name
+
+			ServletContext servletContext = cbContext.getService(
+					ServletContext.class, null);
+			if (servletContext != null) {
+				wsdlStream = servletContext.getResourceAsStream(pathToWSDL);
+			} else {
+				wsdlStream = cbContext.getControlInterface()
+						.getResourceAsStream(pathToWSDL);
+			}
+
+			if (wsdlStream == null) {
+				File f = new File(pathToWSDL);
+				wsdlStream = new FileInputStream(f);
+			}
+		}
+		return wsdlStream;
+	}
+
+	private void configureEndPoint() throws Exception {
+
+		if (null == getEndPoint()) {
+			ServiceControl.Location location = (ServiceControl.Location) cbContext
+					.getControlPropertySet(ServiceControl.Location.class);
+
+			if (location != null) {
+				setEndPoint(new URL(location.urls()[0]));
+			} else {
+				throw new RuntimeException("No Location annotation found.");
+			}
+		}
+	}
+
+	/**
+	 * @return Returns the endPoint.
+	 */
+	public URL getEndPoint() {
+		return endPoint;
+	}
+
+	/**
+	 * @param endPoint
+	 *            The endPoint to set.
+	 */
+	public void setEndPoint(URL endPoint) {
+		this.endPoint = endPoint;
+	}
+
+	/**
+	 * @return Returns the password.
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * @param password
+	 *            The password to set.
+	 */
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	/**
+	 * @return Returns the registrar.
+	 */
+	public TypeRegistrar getRegistrar() {
+		return registrar;
+	}
+
+	/**
+	 * @param registrar
+	 *            The registrar to set.
+	 */
+	public void setRegistrar(TypeRegistrar registrar) {
+		this.registrar = registrar;
+	}
+
+	/**
+	 * @return Returns the service.
+	 */
+	public Service getService() {
+		return service;
+	}
+
+	/**
+	 * @param service
+	 *            The service to set.
+	 */
+	public void setService(Service service) {
+		this.service = service;
+	}
+
+	/**
+	 * @return Returns the timeout.
+	 */
+	public int getTimeout() {
+		return timeout;
+	}
+
+	/**
+	 * @param timeout
+	 *            The timeout to set.
+	 */
+	public void setTimeout(int timeout) {
+		this.timeout = timeout;
+	}
+
+	/**
+	 * @return Returns the username.
+	 */
+	public String getUsername() {
+		return username;
+	}
+
+	/**
+	 * @param username
+	 *            The username to set.
+	 */
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	/**
+	 * @return Returns the wsdlPort.
+	 */
+	public QName getWsdlPort() {
+		return wsdlPort;
+	}
+
+	/**
+	 * @param wsdlPort
+	 *            The wsdlPort to set.
+	 */
+	public void setWsdlPort(QName wsdlPort) {
+		this.wsdlPort = wsdlPort;
+	}
+
+	/**
+	 * 
+	 */
+	public void reset() {
+		endPoint = null;
+		wsdlPort = null;
+		username = null;
+		password = null;
+		timeout = 0;
+		HeaderHandler.reset();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.controlhaus.webservice.ServiceControl#getInputHeaders()
+	 * 
+	 * If there are any input header it is stored on my thread's Handler.
+	 */
+	public Element[] getInputHeaders() {
+		return HeaderHandler.getInHeaders();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.controlhaus.webservice.ServiceControl#setOutputHeaders(org.w3c.dom.Element[])
+	 */
+	public void setOutputHeaders(Element[] headers) {
+		HeaderHandler.setOutHeaders(headers);
+	}
+}

Added: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java (added)
+++ incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java Mon May  9 13:17:58 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.utils;
+
+import java.lang.reflect.Field;
+
+import javax.xml.rpc.holders.Holder;
+
+public class HolderUtils {
+
+	public static void stuffHolderValue(Holder holder, Object value)
+			throws NoSuchFieldException, IllegalAccessException {
+
+		Field valueField = holder.getClass().getField("value");
+		Object curValueInHolder = valueField.get(holder);
+		Class classOfValueFieldInHolder;
+		if (curValueInHolder == null) {
+			classOfValueFieldInHolder = valueField.getType();
+		} else {
+			classOfValueFieldInHolder = curValueInHolder.getClass();
+		}
+
+		if (null == value) {
+			setFieldInObject(valueField, holder, null);
+			return;
+		}
+		if (classOfValueFieldInHolder.isAssignableFrom(value.getClass())) {
+			setFieldInObject(valueField, holder, value);
+
+		} else { // we need to convert the class to the holder type
+
+			try {
+				Object convertedValue = org.apache.axis.utils.JavaUtils
+						.convert(value, classOfValueFieldInHolder);
+				setFieldInObject(valueField, holder, convertedValue);
+			} catch (IllegalArgumentException e) {
+
+				e.printStackTrace();
+			} catch (IllegalAccessException e) {
+
+				e.printStackTrace();
+			}
+		}
+
+	}
+
+	private static void setFieldInObject(Field valueField, Object destObject,
+			Object value) throws IllegalArgumentException,
+			IllegalAccessException {
+		if (valueField.getType().isPrimitive()) {
+			if (value == null)
+				; // Don't need to set anything
+			else
+				valueField.set(destObject, value);
+		} else {
+			valueField.set(destObject, value);
+		}
+	}
+
+}

Added: incubator/beehive/trunk/system-controls/systemcontrols-imports.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/systemcontrols-imports.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/systemcontrols-imports.xml (added)
+++ incubator/beehive/trunk/system-controls/systemcontrols-imports.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================== -->
+<!--                                                                          -->
+<!-- Common System controls build dependencies                                -->
+<!--                                                                          -->
+<!-- ======================================================================== -->
+<project name="module-import">
+
+    <import file="../beehive-imports.xml"/>
+    <import file="../ant/beehive-tools.xml"/>
+    <property file="${beehive.home}/system-controls/ant/systemcontrols.properties"/>
+
+
+    <path id="webservices.dependency.path">
+        <fileset file="${beehive.home}/wsm/build/jars/beehive-wsm.jar"/>
+        <fileset file="${beehive.home}/wsm/build/jars/beehive-wsm-axis.jar"/>
+        <fileset file="${beehive.home}/wsm/lib/beehive-wsldtypes.jar"/>
+        <fileset file="${beehive.home}/wsm/lib/jsr181.jar"/>
+        <fileset file="${beehive.home}/wsm/external/axis.jar"/>
+        <fileset file="${beehive.home}/wsm/external/jaxrpc.jar"/>
+        <path refid="servlet.dependency.path"/>
+        <fileset file="${external.dir}/commons/commons-cli-1.0.jar"/>
+    </path>
+
+    <path id="ejb.dependency.path">
+        <fileset file="${external.dir}/commons/commons-collections.jar"/>
+        <fileset file="${external.dir}/ejb/geronimo-spec-j2ee-1.4-rc2.jar"/>
+    </path>
+
+</project>

Added: incubator/beehive/trunk/system-controls/test/ant/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/ant/build.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/ant/build.xml (added)
+++ incubator/beehive/trunk/system-controls/test/ant/build.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/SystemControls/Test" default="drt" basedir=".">
+    
+    <import file="test-imports.xml"/>
+
+    <property name="drt.testResults.dir" location="${beehive.home}/system-controls/build/drt.testResults"/>
+    <property name="bvt.testResults.dir" location="${beehive.home}/system-controls/build/bvt.testResults"/>
+
+    <target name="prepare">
+        <mkdir dir="${test.lib.dir}"/>
+    </target>
+
+    <!-- ============================================= -->
+    <!-- Build Targets                                 -->
+    <!-- ============================================= -->
+    <target name="test.build" depends="prepare" description="Build the QA modules">
+        <antcall target="test.do.subant">
+            <param name="target.name" value="build"/>
+        </antcall>
+    </target>
+
+    <target name="test.clean" description="Clean the QA modules">
+        <delete dir="${drt.testResults.dir}"/>
+        <delete dir="${bvt.testResults.dir}"/>
+<!--
+        <antcall target="test.do.subant">
+            <param name="target.name" value="clean"/>
+        </antcall>
+-->
+    </target>
+
+    <target name="test.do.subant">
+        <subant target="${target.name}">
+            <filelist dir="${test.src.dir}">
+                <file name="jdbc/controls"/>
+                <file name="jdbc/junitTests"/>
+            </filelist>
+        </subant>
+    </target>
+
+    <!-- ============================================= -->
+    <!-- DRT Targets                                   -->
+    <!-- ============================================= -->
+    <target name="drt" depends="test.clean,test.build,junit.drt" description="Run the System Controls JUnit DRTs"/>
+
+    <target name="junit.drt">
+        <property name="formatter.type" value="xml"/>
+        <property name="testout.dir" value="${drt.testResults.dir}"/>
+        <property name="fail" value="true"/>
+
+        <antcall target="run.tests"/>
+    </target>
+
+    <target name="junit.bvt">
+        <property name="formatter.type" value="xml"/>
+        <property name="testout.dir" value="${bvt.testResults.dir}"/>
+        <property name="fail" value="false"/>
+
+        <antcall target="run.tests"/>
+    </target>
+
+    <import file="junitCore.xml"/>
+
+</project>

Added: incubator/beehive/trunk/system-controls/test/ant/junitCore.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/ant/junitCore.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/ant/junitCore.xml (added)
+++ incubator/beehive/trunk/system-controls/test/ant/junitCore.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/SystemControls/JUnitTests" basedir=".">
+
+    <import file="test-imports.xml"/>
+
+    <path id="test.classpath">
+        <path refid="junit-tests.dependency.path"/>
+        <path refid="junit.dependency.path"/>
+        <path refid="servlet.dependency.path"/>
+    </path>
+
+    <target name="run.tests">
+        <fail unless="formatter.type" message="Unspecified value for formatter.type"/>
+        <fail unless="testout.dir" message="Unspecified value for testout.dir"/>
+        <fail unless="fail" message="Unspecified value for fail"/>
+
+        <property name="classpath" refid="test.classpath"/>
+        <echo>test.classpath: ${classpath}</echo>
+
+        <property name="show.output" value="false"/>
+
+        <condition property="log4j.config" value="${log4jconfig.verbose.junit}">
+            <not><isset property="log4j.quiet"/></not>
+        </condition>
+        <condition property="log4j.config" value="${log4jconfig.junit}">
+            <and><isset property="log4j.quiet"/></and>
+        </condition>
+
+        <echo>log4j.config: ${log4j.config}</echo>
+        <echo>testout.dir: ${testout.dir}</echo>
+
+        <mkdir dir="${testout.dir}"/>
+
+        <junit printsummary="${fail}" fork="${fail}" haltonfailure="${fail}" haltonerror="${fail}" showOutput="${show.output}">
+            <jvmarg value="-ea"/>
+            <classpath refid="test.classpath"/>
+            <formatter type="${formatter.type}"/>
+            <sysproperty key="log4j.configuration" value="file:${log4j.config}"/>
+            <sysproperty key="systemcontrolsdrt.logdir" path="${testout.dir}"/>
+            <sysproperty key="derby.system.home" value="${testout.dir}"/>
+
+            <test name="org.apache.beehive.controls.system.jdbc.units.dbconnection.DBConnectionTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.sqlparser.SqlParserTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.results.DBSingleRowResultsTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.results.DBMultiRowResultsTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.results.StoredProcsDBResultsTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.results.TxResultsTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.results.XmlBeanResultsTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.results.JdbcTypesTest" todir="${testout.dir}"/>
+            <test name="org.apache.beehive.controls.system.jdbc.units.errors.ErrorPathsTest" todir="${testout.dir}"/>
+
+        </junit>
+
+        <echo>Generating a test report into: ${testout.dir}/html</echo>
+
+        <mkdir dir="${testout.dir}/html"/>
+
+        <!-- build a report -->
+        <junitreport todir="${testout.dir}/">
+            <fileset dir="${testout.dir}/">
+                <include name="TEST-*.xml"/>
+            </fileset>
+            <report format="noframes" todir="${testout.dir}/html"/>
+        </junitreport>
+    </target>
+
+    <target name="run.test">
+        <fail unless="test.name" message="No test specified, set the -Dtest.name=&lt;name&gt; property"/>
+        <java classpathref="test.classpath" classname="${test.name}"/>
+    </target>
+
+</project>

Added: incubator/beehive/trunk/system-controls/test/ant/test-imports.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/ant/test-imports.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/ant/test-imports.xml (added)
+++ incubator/beehive/trunk/system-controls/test/ant/test-imports.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/SystemControls/TestImports">
+    
+    <import file="../../systemcontrols-imports.xml"/>
+
+    <property name="test.lib.dir" location="${sc.home}/build/test-lib"/>
+    <property name="test.classes.dir" location="${sc.home}/build/test-classes"/>
+    <property name="test.dir" location="${sc.home}/test"/>
+    <property name="test.src.dir" location="${test.dir}/src"/>
+    <property name="test.external.dir" location="${test.dir}/external"/>
+    <property name="log4jconfig.verbose.junit" location="${test.dir}/conf/junitLogCfgVerbose.xml"/>
+    <property name="log4jconfig.junit" location="${test.dir}/conf/junitLogCfg.xml"/>
+    <property name="test-controls.jar.name" value="beehive-systemcontrols-testControls.jar"/>
+    <property name="test-units.jar.name" value="beehive-systemcontrols-junit-tests.jar"/>
+
+    <path id="test-controls.dependency.path">
+        <pathelement location="${test.lib.dir}/${test-controls.jar.name}"/>
+    </path>
+
+    <path id="test-units.dependency.path">
+        <pathelement location="${test.lib.dir}/${test-units.jar.name}"/>
+    </path>
+
+    <path id="jdbc-control.dependency.path">
+        <pathelement location="${build.lib.dir}/${jdbccontrol.jar.name}"/>
+    </path>
+
+    <path id="junit-tests.dependency.path">
+        <path refid="test-units.dependency.path"/>
+        <path refid="test-controls.dependency.path"/>
+        <path refid="jdbc-control.dependency.path"/>
+        <path refid="controls.dependency.path"/>
+        <path refid="derby.dependency.path"/>
+        <path refid="xbean.dependency.path"/>
+        <path refid="log4j.dependency.path"/>
+        <path refid="commons-discovery.dependency.path"/>
+        <path refid="commons-logging.dependency.path"/>
+    </path>
+
+</project>

Added: incubator/beehive/trunk/system-controls/test/conf/junitLogCfg.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/conf/junitLogCfg.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/conf/junitLogCfg.xml (added)
+++ incubator/beehive/trunk/system-controls/test/conf/junitLogCfg.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <!--Netui logfile -->
+  <appender name="SYSCTRLS_SYSLOGFILE" class="org.apache.log4j.RollingFileAppender">
+    <param name="File" value="${systemcontrolsdrt.logdir}/systemcontrols.log"/>
+    <param name="Append" value="true"/>
+    <param name="MaxFileSize" value="500000KB"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]: %m%n"/>
+    </layout>
+  </appender>
+
+  <!-- base for all netui server components -->
+  <category name="org.controlhaus">
+    <priority value="warn" />
+    <appender-ref ref="SYSCTRLS_SYSLOGFILE" />
+  </category>
+
+</log4j:configuration>

Added: incubator/beehive/trunk/system-controls/test/conf/junitLogCfgVerbose.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/conf/junitLogCfgVerbose.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/conf/junitLogCfgVerbose.xml (added)
+++ incubator/beehive/trunk/system-controls/test/conf/junitLogCfgVerbose.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <!--System Controls logfile -->
+  <appender name="SYSCTRLS_SYSLOGFILE" class="org.apache.log4j.RollingFileAppender">
+    <param name="File" value="${systemcontrolsdrt.logdir}/systemcontrols.log"/>
+    <param name="Append" value="true"/>
+    <param name="MaxFileSize" value="500000KB"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]: %m%n"/>
+    </layout>
+  </appender>
+
+  <category name="org.controlhaus">
+    <priority value="debug" />
+    <appender-ref ref="SYSCTRLS_SYSLOGFILE" />
+  </category>
+
+</log4j:configuration>

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/build.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/build.xml (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/build.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/SystemControls/TestControls" default="build" basedir=".">
+
+    <import file="../../../ant/test-imports.xml"/>
+
+    <taskdef name="apt" classname="org.apache.beehive.controls.runtime.generator.AptTask"
+        classpathref="controls.dependency.path" onerror="report"/>
+    <taskdef name="control-jar" classname="org.apache.beehive.controls.runtime.packaging.ControlJarTask"
+        classpathref="controls.dependency.path" onerror="report"/>
+
+    <property name="module.name" value="controls"/>
+    <property name="module.dir" location="${test.src.dir}/jdbc/${module.name}"/>
+    <property name="module.classes.dir" location="${test.classes.dir}/${module.name}"/>
+    <property name="module.gensrc.dir" location="${test.classes.dir}/${module.name}-generated-src"/>
+    <property name="module.jar" location="${test.lib.dir}/${test-controls.jar.name}"/>
+
+    <path id="testcontrols.classpath">
+        <path refid="jdbc-control.dependency.path"/>
+        <path refid="controls.dependency.path"/>
+        <path refid="xbean.dependency.path"/>
+        <path refid="junit.dependency.path"/>
+        <path refid="servlet.dependency.path"/>
+        <path refid="velocity.dependency.path"/>
+    </path>
+
+    <target name="build">
+        <echo>compile module: ${module.name}</echo>
+        <echo>output directory: ${test.lib.dir}</echo>
+        <echo>debug: ${compile.debug}</echo>
+
+        <mkdir dir="${test.lib.dir}"/>
+        <mkdir dir="${module.classes.dir}"/>
+        <mkdir dir="${module.gensrc.dir}"/>
+
+        <echo message="** Generating test Xml Beans **"/>
+
+        <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean"
+            classpathref="xbean.dependency.path" onerror="report"/>
+
+        <xmlbean classgendir="${module.classes.dir}"
+            classpathref="testcontrols.classpath"
+            schema="${module.dir}/schemas"
+            includeJavaRuntime="yes">
+        </xmlbean>
+
+        <echo message="** Phase One **"/>
+
+        <apt srcdir="${module.dir}"
+            gendir="${module.gensrc.dir}"
+            destdir="${module.classes.dir}"
+            classpathref="testcontrols.classpath"
+            compileByExtension="true"
+            debug="${compiler.debug}"
+            nowarn="${compiler.nowarn}"
+            srcExtensions="*.jcx,*.jcs,*.java">
+        </apt>
+
+        <control-jar destfile="${module.jar}" basedir="${module.classes.dir}"/>
+    </target>
+
+    <target name="clean">
+        <delete dir="${module.classes.dir}"/>
+        <delete file="${module.jar}"/>
+    </target>
+
+</project>
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DataSourceConnectionCtrl.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DataSourceConnectionCtrl.jcx?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DataSourceConnectionCtrl.jcx (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DataSourceConnectionCtrl.jcx Mon May  9 13:17:58 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.dbconnection;
+
+import java.sql.SQLException;
+
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+
+/**
+ * Test a datasource connection to the database.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDataSource(jndiName="java:/comp/env/jdbc/TestDB")
+@JdbcControl.ConnectionOptions(readOnly=false)
+public interface DataSourceConnectionCtrl extends JdbcControl {
+
+    @JdbcControl.SQL(statement = "CREATE TABLE FOO1 (BAR VARCHAR(3))")
+    public void createTable() throws SQLException;
+}
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrl.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrl.jcx?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrl.jcx (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrl.jcx Mon May  9 13:17:58 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.dbconnection;
+
+import java.sql.SQLException;
+
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+
+/**
+ * Test a simple connection to the database.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDriver(databaseDriverClass="org.apache.derby.jdbc.EmbeddedDriver",
+                                   databaseURL="jdbc:derby:MyDB;create=true")
+@JdbcControl.ConnectionOptions(readOnly=false)
+public interface DriverManagerConnectionCtrl extends JdbcControl {
+
+    @SQL(statement = "CREATE TABLE FOO1 (BAR VARCHAR(3))")
+    public void createTable() throws SQLException;
+}
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlAuth.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlAuth.jcx?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlAuth.jcx (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlAuth.jcx Mon May  9 13:17:58 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.dbconnection;
+
+import java.sql.SQLException;
+
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+
+/**
+ * For testing username and password params on a connection.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDriver(databaseDriverClass="org.apache.derby.jdbc.EmbeddedDriver",
+                                   databaseURL="jdbc:derby:MyDBAuth",
+                                   userName="foo",
+                                   password="bar")
+public interface DriverManagerConnectionCtrlAuth extends JdbcControl {
+
+    @SQL(statement = "CREATE TABLE FOO2 (BAR VARCHAR(3))")
+    public void createTable() throws SQLException;
+}
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlProps.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlProps.jcx?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlProps.jcx (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlProps.jcx Mon May  9 13:17:58 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.dbconnection;
+
+import java.sql.SQLException;
+
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+
+/**
+ * For testing a db connction with properties specified.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDriver(databaseDriverClass="org.apache.derby.jdbc.EmbeddedDriver",
+                                   databaseURL="jdbc:derby:MyDBAuth",
+                                   properties="user=foo;password=bar")
+public interface DriverManagerConnectionCtrlProps extends JdbcControl {
+
+    @SQL(statement = "CREATE TABLE FOO3 (BAR VARCHAR(3))")
+    public void createTable() throws SQLException;
+}
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/TestTypeMapper.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/TestTypeMapper.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/TestTypeMapper.java (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/TestTypeMapper.java Mon May  9 13:17:58 2005
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.dbconnection;
+
+import java.sql.SQLData;
+import java.sql.SQLException;
+import java.sql.SQLInput;
+import java.sql.SQLOutput;
+
+/**
+ * Test type mapper class.
+ */
+public class TestTypeMapper implements SQLData {
+
+    /**
+     * Returns the fully-qualified
+     * name of the SQL user-defined type that this object represents.
+     * This method is called by the JDBC driver to get the name of the
+     * UDT instance that is being mapped to this instance of
+     * <code>SQLData</code>.
+     *
+     * @return the type name that was passed to the method <code>readSql</code>
+     *         when this object was constructed and populated
+     * @throws java.sql.SQLException if there is a database access error
+     * @since 1.2
+     */
+    public String getSQLTypeName() throws SQLException {
+        return null;
+    }
+
+    /**
+     * Populates this object with data read from the database.
+     * The implementation of the method must follow this protocol:
+     * <UL>
+     * <LI>It must read each of the attributes or elements of the SQL
+     * type  from the given input stream.  This is done
+     * by calling a method of the input stream to read each
+     * item, in the order that they appear in the SQL definition
+     * of the type.
+     * <LI>The method <code>readSQL</code> then
+     * assigns the data to appropriate fields or
+     * elements (of this or other objects).
+     * Specifically, it must call the appropriate <i>reader</i> method
+     * (<code>SQLInput.readString</code>, <code>SQLInput.readBigDecimal</code>,
+     * and so on) method(s) to do the following:
+     * for a distinct type, read its single data element;
+     * for a structured type, read a value for each attribute of the SQL type.
+     * </UL>
+     * The JDBC driver initializes the input stream with a type map
+     * before calling this method, which is used by the appropriate
+     * <code>SQLInput</code> reader method on the stream.
+     *
+     * @param stream   the <code>SQLInput</code> object from which to read the data for
+     *                 the value that is being custom mapped
+     * @param typeName the SQL type name of the value on the data stream
+     * @throws java.sql.SQLException if there is a database access error
+     * @see java.sql.SQLInput
+     */
+    public void readSQL(SQLInput stream, String typeName) throws SQLException { }
+
+    /**
+     * Writes this object to the given SQL data stream, converting it back to
+     * its SQL value in the data source.
+     * The implementation of the method must follow this protocol:<BR>
+     * It must write each of the attributes of the SQL type
+     * to the given output stream.  This is done by calling a
+     * method of the output stream to write each item, in the order that
+     * they appear in the SQL definition of the type.
+     * Specifically, it must call the appropriate <code>SQLOutput</code> writer
+     * method(s) (<code>writeInt</code>, <code>writeString</code>, and so on)
+     * to do the following: for a Distinct Type, write its single data element;
+     * for a Structured Type, write a value for each attribute of the SQL type.
+     *
+     * @param stream the <code>SQLOutput</code> object to which to write the data for
+     *               the value that was custom mapped
+     * @throws java.sql.SQLException if there is a database access error
+     * @see java.sql.SQLOutput
+     * @since 1.2
+     */
+    public void writeSQL(SQLOutput stream) throws SQLException { }
+}

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/ErrorsTestCtrl.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/ErrorsTestCtrl.jcx?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/ErrorsTestCtrl.jcx (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/ErrorsTestCtrl.jcx Mon May  9 13:17:58 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.errors;
+
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+import testBad.customerDb.XCustomerRowBadDocument;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * This control is used for checking error reporting / recovery from the db control.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDriver(databaseDriverClass = "org.apache.derby.jdbc.EmbeddedDriver", databaseURL = "jdbc:derby:MyDB")
+public interface ErrorsTestCtrl extends JdbcControl {
+
+    public static class BadCustomer {
+        private String fnam;
+        public int serid;
+
+        public void setFname(String fname) { this.fnam = fname; }
+
+        public String getFname() { return fnam; }
+    }
+
+    public static class BadCustomer2 {
+        private int fname;
+        public int serid;
+
+        public void setFname(int fname) { this.fname = fname; }
+
+        public int getFname() { return fname; }
+    }
+
+    //
+    //  Missing @SQL annotation
+    //
+    public ResultSet getAllUsersBad1() throws SQLException;
+
+    //
+    //  BadCustomer contains improper field / method names for mapping the result
+    //
+    @SQL(statement = "SELECT * FROM USERS WHERE FNAME = {name}")
+    public BadCustomer getAUserBad1(String name) throws SQLException;
+
+    //
+    //  fname in BadCustomer2 is an int when it should be a String
+    //
+    @SQL(statement = "SELECT * FROM USERS WHERE FNAME = {fname}")
+    public BadCustomer2 getAUserBad3(String fname) throws SQLException;
+
+    //
+    // query returning an XmlObject
+    //
+    @SQL(statement = "SELECT * FROM USERS WHERE fname={someUser}")
+    public XCustomerRowBadDocument.XCustomerRowBad getAUserBad4(String someUser) throws SQLException;
+
+    //
+    // null sql param substitution
+    //
+    @SQL(statement = "SELECT * FROM USERS {sql: where}")
+    public ResultSet getAUserBad5(String where) throws SQLException;
+}
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ResultsTestCtrl.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ResultsTestCtrl.jcx?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ResultsTestCtrl.jcx (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ResultsTestCtrl.jcx Mon May  9 13:17:58 2005
@@ -0,0 +1,513 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.results;
+
+import java.sql.SQLException;
+import java.sql.ResultSet;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Date;
+import java.math.BigDecimal;
+
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+import org.apache.beehive.controls.system.jdbc.DefaultRowSetResultSetMapper;
+
+import javax.sql.RowSet;
+
+import test.customerDb.XStoogeRowDocument;
+
+/**
+ * This control is used for unit tests for results returned from the db control.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDriver(databaseDriverClass="org.apache.derby.jdbc.EmbeddedDriver", databaseURL="jdbc:derby:MyDB")
+public interface ResultsTestCtrl extends JdbcControl {
+
+    public static class Customer {
+        private String fname;
+        public int userid;
+
+        public void setFname(String fname) { this.fname = fname; }
+        public String getFname() { return fname; }
+    }
+
+    public static class CustomerInput1 {
+        private int _userid;
+
+        public int getUserid() {return _userid;}
+        public void setUserid(int userid) {_userid = userid;}
+    }
+
+    public static class CustomerInput2 {
+        public int userid;
+    }
+
+    public static class CustomerWrapper {
+        public CustomerInput2 c;
+    }
+
+    public static class CustomerInput3 extends CustomerInput1 {
+        private int foo;
+    }
+
+    public static class CustomerInput4 extends CustomerInput2 {
+        private int foo;
+    }
+
+    public static class BlobInfo {
+        private Blob blb;
+
+        public void setBlb(Blob blb) { this.blb = blb; }
+        public Blob getBlb() { return blb; }
+
+    }
+
+    public static class Binary {
+        private byte[] _bytes;
+        private byte[] _varbytes;
+        private byte[] _lvarbytes;
+
+        public void setBin(byte[] bytes) { _bytes = bytes; }
+        public byte[] getBin() { return _bytes; }
+
+        public void setVarbin(byte[] varbytes) { _varbytes = varbytes; }
+        public byte[] getVarbin() { return _varbytes; }
+
+        public void setLvarbin(byte[] lvarbytes) { _lvarbytes = lvarbytes; }
+        public byte[] getLvarbin() { return _lvarbytes; }
+    }
+
+    //
+    // simple query
+    //
+    @SQL(statement="SELECT fname FROM USERS")
+    public ResultSet getAllUsers() throws SQLException;
+
+    //
+    // simple query with param substitution
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE fname={someUser}")
+    public ResultSet getSomeUser(String someUser) throws SQLException;
+
+    //
+    // from a object getMethod
+    //
+    @SQL(statement="SELECT fname FROM USERS WHERE userid={customer.userid}")
+    public String getSomeUser(CustomerInput1 customer) throws SQLException;
+
+    //
+    // from a object getField
+    //
+    @SQL(statement="SELECT fname FROM USERS WHERE userid={customer.userid}")
+    public String getSomeUser(CustomerInput2 customer) throws SQLException;
+
+    //
+    // from a object getField
+    //
+    @SQL(statement="SELECT fname FROM USERS WHERE userid={customer.userid}")
+    public String getSomeUser(CustomerInput3 customer) throws SQLException;
+
+    //
+    // from a object getField
+    //
+    @SQL(statement="SELECT fname FROM USERS WHERE userid={customer.userid}")
+    public String getSomeUser(CustomerInput4 customer) throws SQLException;
+
+    //
+    // from a object getField
+    //
+    @SQL(statement="SELECT fname FROM USERS WHERE userid={customer.userid}")
+    public String getSomeUser(Map customer) throws SQLException;
+
+    //
+    // from a object nested getField
+    //
+    @SQL(statement="SELECT fname FROM USERS WHERE userid={customer.c.userid}")
+    public String getSomeUser(CustomerWrapper customer) throws SQLException;
+
+    //
+    // simple query with param substitution
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE userid={someUserId}")
+    public ResultSet getSomeUser(int someUserId) throws SQLException;
+
+    //
+    // query with sql substitution
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE {sql: where}")
+    public ResultSet getJustOneUser(String where) throws SQLException;
+
+    //
+    // query returning an array of Object
+    //
+    @SQL(statement="SELECT * FROM USERS")
+    public Customer[] getCustomerArray() throws SQLException;
+
+    //
+    // query returning an array of Object / array size is limited in annotation
+    //
+    @SQL(statement="SELECT * FROM USERS", arrayMaxLength=2)
+    public Customer[] getCustomerArrayLimitedSize() throws SQLException;
+
+    //
+    // query returning an array of Object / array size is limited in annotation
+    //
+    @SQL(statement="SELECT * FROM USERS", arrayMaxLength=2, maxRows=1)
+    public Customer[] getCustomerArrayLimitedSize2() throws SQLException;
+
+    //
+    // query returning an array of Object / array size is limited in annotation
+    //
+    @SQL(statement="SELECT * FROM USERS", arrayMaxLength=2, maxRows=4)
+    public Customer[] getCustomerArrayLimitedSize3() throws SQLException;
+
+    //
+    // query returning an array of Object / array size is limited in annotation by maxRows
+    //
+    @SQL(statement="SELECT * FROM USERS", maxRows=1)
+    public Customer[] getCustomerArrayLimitedSize4() throws SQLException;
+
+    //
+    // query returning a HashMap
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE userid={someUserId}")
+    public HashMap getCustomerHashMap(int someUserId) throws SQLException;
+
+    //
+    // query returning an array of HashMap
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE userid={someUserId}")
+    public HashMap[] getCustomerHashMapArray(int someUserId) throws SQLException;
+
+    //
+    // query returning a Map
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE userid={someUserId}")
+    public Map getCustomerMap(int someUserId) throws SQLException;
+
+    //
+    // query returning an iterator
+    //
+    @SQL(statement="SELECT * FROM USERS", iteratorElementType=Customer.class)
+    public Iterator getCustomerIterator() throws SQLException;
+
+    //
+    // query returning an empty value
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE userid={someUserId}")
+    public int getNoUsers(int someUserId) throws SQLException;
+
+    //
+    // query returning an object
+    //
+    @SQL(statement="SELECT * FROM USERS WHERE userid={someUserId}")
+    public Customer getACustomer(int someUserId) throws SQLException;
+
+    //
+    // query returning a RowSet -- NOTE: uses default row set mapper
+    //
+    @SQL(statement="SELECT * FROM USERS", resultSetMapper=DefaultRowSetResultSetMapper.class)
+    public RowSet getAllUsersINRS() throws SQLException;
+
+    //
+    // query returning an XmlObject
+    //
+    @SQL(statement="SELECT * FROM XBEAN_USERS WHERE stooge_name={someStooge}")
+    public XStoogeRowDocument.XStoogeRow getAUserXmlBean(String someStooge) throws SQLException;
+
+    //
+    // query returning an array of XmlObjects
+    //
+    @SQL(statement="SELECT * FROM XBEAN_USERS")
+    public XStoogeRowDocument.XStoogeRow[] getAllUserXmlBean() throws SQLException;
+
+    //
+    // set a db row with a XmlObject
+    //
+    @SQL(statement="insert into XBEAN_USERS VALUES ({stooge.STOOGENAME}, {stooge.STOOGEPECKINGORDER}, {stooge.STOOGEPANTSIZE})")
+    public void insertAXmlBean(XStoogeRowDocument.XStoogeRow stooge) throws SQLException;
+
+    //
+    // query which invokes a stored procedure
+    //
+    @SQL(statement="{call getExpensiveProductSP(?)}")
+    public void getExpensiveProduct(SQLParameter[] results) throws SQLException;
+
+    //
+    // query which invokes a stored procedure
+    //
+    @SQL(statement="{call getExpensiveProductsSP(?)}")
+    public void getExpensiveProducts(SQLParameter[] results) throws SQLException;
+
+    //
+    // query which invokes a stored procedure
+    //
+    @SQL(statement="{call getProductsByColorSP(?,?)}")
+    public void getProductsByColor(SQLParameter[] results) throws SQLException;
+
+    //
+    // creates a stored procedure
+    //
+    @SQL(statement="CREATE PROCEDURE getProductSP(IN color VARCHAR(64), IN sku INT) " +
+                    "PARAMETER STYLE JAVA " +
+                    "READS SQL DATA " +
+                    "LANGUAGE JAVA " +
+                    "EXTERNAL NAME 'org.apache.beehive.controls.system.jdbc.units.utils.StoredProcedures.getProductSP'")
+    public void createStoredProc() throws SQLException;
+
+    //
+    // invokes the stored proc -- with 2 IN params
+    //
+    @SQL(statement="{call getProductSP({inColor},{inSKU})}")
+    public void getProduct(String inColor, int inSKU) throws SQLException;
+
+    //
+    // batch updates
+    //
+    @SQL(statement="INSERT INTO users VALUES ({fname}, {userid})",  batchUpdate=true)
+    public int[] doABatchUpdate(String[] fname, int[] userid);
+
+    //
+    // a basic usage of the getGeneratedKeys annotation member
+    //
+    @SQL(statement="INSERT INTO usergen (person) VALUES ({aValue})", getGeneratedKeys=true)
+    public ResultSet getGenKeys(String aValue);
+
+    //
+    // a basic usage of the getGeneratedKeys and generatedKeyColumnNames members
+    //
+    @SQL(statement="INSERT INTO usergen (person) VALUES ({aValue})", getGeneratedKeys=true, generatedKeyColumnNames = {"user_id"})
+    public ResultSet getGenKeys2(String aValue);
+
+    //
+    // a basic usage of the getGeneratedKeys annotation member with return type mapping
+    //
+    @SQL(statement="INSERT INTO usergen (person) VALUES ({aValue})", getGeneratedKeys=true)
+    public int getGenKeys3(String aValue);
+
+    //
+    // a basic usage of the getGeneratedKeys annotation member with return type mapping
+    //
+    @SQL(statement="INSERT INTO usergen (person) VALUES ({aValue})", getGeneratedKeys=true)
+    public String getGenKeys4(String aValue);
+
+    //
+    // a basic usage of the getGeneratedKeys annotation member with return type mapping
+    //
+    @SQL(statement="INSERT INTO usergen (person) VALUES ({aValue})", getGeneratedKeys=true)
+    public int[] getGenKeys5(String aValue);
+
+    //
+    // a basic usage of the getGeneratedKeys and generatedKeyColumnIndexes annotation members
+    //
+    @SQL(statement="INSERT INTO usergen (person) VALUES ({aValue})", getGeneratedKeys=true, generatedKeyColumnIndexes = {1})
+    public ResultSet getGenKeys6(String aValue);
+
+    //
+    // a basic usage of the scrollableResultSet element
+    //
+    @SQL(statement="SELECT * FROM USERS", scrollableResultSet=ScrollType.SCROLL_INSENSITIVE_UPDATABLE)
+    public ResultSet getScrollableResultSet_IU();
+
+    //
+    // a basic usage of the scrollableResultSet element
+    //
+    @SQL(statement="SELECT * FROM USERS", scrollableResultSet=ScrollType.SCROLL_SENSITIVE)
+    public ResultSet getScrollableResultSet_SR();
+
+    //
+    // a basic usage of the fetchSize/fetchDirection elements
+    //
+    @SQL(statement="SELECT * FROM USERS", fetchDirection=FetchDirection.REVERSE, fetchSize=10)
+    public ResultSet getFetchOptmizedResultSet();
+
+    //
+    // query with non-default holdability specified
+    //
+    @SQL(statement="SELECT * FROM USERS", resultSetHoldabilityOverride=HoldabilityType.HOLD_CURSORS)
+    public ResultSet getResultSetHoldablity();
+
+    //
+    // select a single column of values from the users table,
+    // specifically tests mapping single column result set values to return type
+    //
+    @SQL(statement="SELECT fname FROM users")
+    public String[] getFnameColumn();
+
+    //
+    // /////////////////////////////// methods for JDBC types tests ////////////////////////////////////////
+    //
+
+    //
+    // insert a blob
+    //
+    @SQL(statement="INSERT INTO blob_table VALUES ({id}, {blob})")
+    public int insertABlob(int id, Blob blob);
+
+    //
+    // select a blob
+    //
+    @SQL(statement="SELECT blb FROM blob_table WHERE id={id}")
+    public BlobInfo getABlob(int id);
+
+    //
+    // select a clob
+    //
+    @SQL(statement="SELECT clb FROM clob_table WHERE id={id}")
+    public Clob getAClob(int id);
+
+    //
+    // get a char
+    //
+    @SQL(statement="SELECT c FROM basic_types")
+    public String getChar();
+
+    //
+    // get a char string
+    //
+    @SQL(statement="SELECT ca FROM basic_types")
+    public String getChar2();
+
+    //
+    // varchar test
+    //
+    @SQL(statement="SELECT vc FROM basic_types")
+    public String getVarchar();
+
+    //
+    // long varchar test
+    //
+    @SQL(statement="SELECT lvc FROM basic_types")
+    public String getLongvarchar();
+
+    //
+    // fixed length binary
+    //
+    @SQL(statement="SELECT bin FROM basic_types")
+    public Binary getFixedLengthBinary();
+
+    //
+    // var length binary
+    //
+    @SQL(statement="SELECT varbin FROM basic_types")
+    public Binary getVarLengthBinary();
+
+    //
+    // long binary
+    //
+    @SQL(statement="SELECT lvarbin FROM basic_types")
+    public Binary getLongVarLengthBinary();
+
+    //
+    // small int
+    //
+    @SQL(statement="SELECT sint FROM basic_types")
+    public short getSmallIntValue();
+
+    //
+    // small int
+    //
+    @SQL(statement="SELECT sint FROM basic_types")
+    public Short getSmallIntValue2();
+
+    //
+    // int
+    //
+    @SQL(statement="SELECT i FROM basic_types")
+    public Integer getIntValue2();
+
+    //
+    // int
+    //
+    @SQL(statement="SELECT i FROM basic_types")
+    public int getIntValue();
+
+    //
+    // bigint
+    //
+    @SQL(statement="SELECT bint FROM basic_types")
+    public long getBigIntValue();
+
+    //
+    // bigint
+    //
+    @SQL(statement="SELECT bint FROM basic_types")
+    public Long getBigIntValue2();
+
+    //
+    // real
+    //
+    @SQL(statement="SELECT r FROM basic_types")
+    public float getRealValue();
+
+    //
+    // real
+    //
+    @SQL(statement="SELECT r FROM basic_types")
+    public Float getRealValue2();
+
+    //
+    // double precision
+    //
+    @SQL(statement="SELECT dp FROM basic_types")
+    public double getDoubleValue();
+
+    //
+    // double precision
+    //
+    @SQL(statement="SELECT dp FROM basic_types")
+    public Double getDoubleValue2();
+
+    //
+    // decimal
+    //
+    @SQL(statement="SELECT d FROM basic_types")
+    public BigDecimal getDecimalValue();
+
+    //
+    // numeric
+    //
+    @SQL(statement="SELECT nu FROM basic_types")
+    public BigDecimal getNumericValue();
+
+    //
+    // date
+    //
+    @SQL(statement="SELECT dt FROM basic_types")
+    public Date getDateValue();
+
+    //
+    // time
+    //
+    @SQL(statement="SELECT t FROM basic_types")
+    public Time getTimeValue();
+
+    //
+    // timestamp
+    //
+    @SQL(statement="SELECT ts FROM basic_types")
+    public Date getTimestampValue();
+
+
+}
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/TxTestCtrl.jcx
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/TxTestCtrl.jcx?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/TxTestCtrl.jcx (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/TxTestCtrl.jcx Mon May  9 13:17:58 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.test.results;
+
+import java.sql.SQLException;
+
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+
+/**
+ * This control is used for unit tests for transactional support for the jdbc control.
+ */
+@org.apache.beehive.controls.api.bean.ControlExtension
+@JdbcControl.ConnectionDriver(databaseDriverClass="org.apache.derby.jdbc.EmbeddedDriver", databaseURL="jdbc:derby:MyDB")
+public interface TxTestCtrl extends JdbcControl {
+
+    @SQL(statement="SELECT stooge_name FROM tx_users WHERE stooge_name={stooge}")
+    public String getAUser(String stooge) throws SQLException;
+
+    @SQL(statement="INSERT INTO tx_users VALUES ({name}, {order}, {size})")
+    public void insertUserRow(String name, int order, String size) throws SQLException;
+}
+

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/badusers/badusers.xsd
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/badusers/badusers.xsd?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/badusers/badusers.xsd (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/badusers/badusers.xsd Mon May  9 13:17:58 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns="http://test_bad/customer_db"
+           targetNamespace="http://test_bad/customer_db"
+           elementFormDefault="qualified">
+
+    <xs:element name="XCustomerRowBad">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="FANME" type="xs:string" minOccurs="1" nillable="true"/>
+                <xs:element name="USERID" type="xs:int" minOccurs="1" nillable="true"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+</xs:schema>

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/users/users.xsd
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/users/users.xsd?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/users/users.xsd (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/users/users.xsd Mon May  9 13:17:58 2005
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="http://test/customer_db"
           targetNamespace="http://test/customer_db"
           elementFormDefault="qualified">

    <xs:simpleType name="SMLXSizeType">
        <xs:restriction base="xs:token">
            <xs:enumeration value="small"/>
            <xs:enumeration value="medium"/>
            <xs:enumeration value="large"/>
            <xs:enumeration value="xlarge"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:element name="XStoogeRow">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="STOOGE_NAME" type="xs:string" minOccurs="1" nillable="true"/>
                <xs:element name="STOOGE_PECKINGORDER" type="xs:int" minOccurs="1" nillable="true"/>
                <xs:element name="STOOGE_PANTSIZE" type="SMLXSizeType"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

</xs:schema>
\ No newline at end of file

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/README.txt
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/README.txt?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/README.txt (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/README.txt Mon May  9 13:17:58 2005
@@ -0,0 +1,14 @@
+
+
+GENERAL
+-------------------------------------------------------------------------------
+
+All container tests require that Apache Cactus be installed on your system and
+that the CACTUS_HOME environment variable be set to the Cactus installation
+directory.
+
+
+TOMCAT5x
+-------------------------------------------------------------------------------
+Requires that Jakarta Tomcat be installed on your system and the CATALINA_HOME
+environment variable be set.

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/application/application.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/application/application.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/application/application.xml (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/application/application.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+ 
+<!DOCTYPE application
+  PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN'
+  'http://java.sun.com/j2ee/dtds/application_1_3.dtd'>
+
+<!-- TODO: In the future you won't have to create a specific
+     application.xml in which you have to declare a Cactus test
+     war if you don't have a war in your EAR -->
+     
+<application>
+  <display-name>jdbcontrol-tests</display-name>
+  <description>Cactus Unit Tests for JdbcControl</description>
+  <module>
+    <web>
+      <web-uri>jdbccontrol-cactified.war</web-uri>
+      <context-root>/jdbccontrol-cactified</context-root>
+    </web>
+  </module>
+</application>

Added: incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/build.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/build.properties?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/build.properties (added)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/build.properties Mon May  9 13:17:58 2005
@@ -0,0 +1,15 @@
+
+# properties file for build.xml
+
+##############################################################################
+#                       Tomcat 5x server properties
+##############################################################################
+tomcat5x.port=8080
+
+###############################################################################
+#                       WEBLOGIC 9x server properties
+###############################################################################
+weblogic9x.port=7001
+weblogic9x.username=weblogic
+weblogic9x.password=weblogic
+weblogic9x.domain.dir=D:/src_15002javac/bea/user_projects/domains/cs_domain