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 [4/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/ejb/schema/web-app_2_4.xsd
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/ejb/schema/web-app_2_4.xsd?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/ejb/schema/web-app_2_4.xsd (added)
+++ incubator/beehive/trunk/system-controls/src/ejb/schema/web-app_2_4.xsd Mon May 9 13:17:58 2005
@@ -0,0 +1,1233 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/j2ee"
+ xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="2.4">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)web-app_2_4.xsds 1.60 03/08/26
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Copyright 2003 Sun Microsystems, Inc., 901 San Antonio
+ Road, Palo Alto, California 94303, U.S.A. All rights
+ reserved.
+
+ Sun Microsystems, Inc. has intellectual property rights
+ relating to technology described in this document. In
+ particular, and without limitation, these intellectual
+ property rights may include one or more of the U.S. patents
+ listed at http://www.sun.com/patents and one or more
+ additional patents or pending patent applications in the
+ U.S. and other countries.
+
+ This document and the technology which it describes are
+ distributed under licenses restricting their use, copying,
+ distribution, and decompilation. No part of this document
+ may be reproduced in any form by any means without prior
+ written authorization of Sun and its licensors, if any.
+
+ Third-party software, including font technology, is
+ copyrighted and licensed from Sun suppliers.
+
+ Sun, Sun Microsystems, the Sun logo, Solaris, Java, J2EE,
+ JavaServer Pages, Enterprise JavaBeans and the Java Coffee
+ Cup logo are trademarks or registered trademarks of Sun
+ Microsystems, Inc. in the U.S. and other countries.
+
+ Federal Acquisitions: Commercial Software - Government Users
+ Subject to Standard License Terms and Conditions.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ This is the XML Schema for the Servlet 2.4 deployment descriptor.
+ The deployment descriptor must be named "WEB-INF/web.xml" in the
+ web application's war file. All Servlet deployment descriptors
+ must indicate the web application schema by using the J2EE
+ namespace:
+
+ http://java.sun.com/xml/ns/j2ee
+
+ and by indicating the version of the schema by
+ using the version element as shown below:
+
+ <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="..."
+ version="2.4">
+ ...
+ </web-app>
+
+ The instance documents may indicate the published version of
+ the schema using the xsi:schemaLocation attribute for J2EE
+ namespace with the following location:
+
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following conventions apply to all J2EE
+ deployment descriptor elements unless indicated otherwise.
+
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:include schemaLocation="j2ee_1_4.xsd"/>
+ <xsd:include schemaLocation="jsp_2_0.xsd"/>
+
+
+<!-- **************************************************** -->
+
+
+ <xsd:element name="web-app" type="j2ee:web-appType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-app element is the root of the deployment
+ descriptor for a web application. Note that the sub-elements
+ of this element can be in the arbitrary order. Because of
+ that, the multiplicity of the elements of distributable,
+ session-config, welcome-file-list, jsp-config, login-config,
+ and locale-encoding-mapping-list was changed from "?" to "*"
+ in this schema. However, the deployment descriptor instance
+ file must not contain multiple elements of session-config,
+ jsp-config, and login-config. When there are multiple elements of
+ welcome-file-list or locale-encoding-mapping-list, the container
+ must concatinate the element contents. The multiple occurance
+ of the element distributable is redundant and the container
+ treats that case exactly in the same way when there is only
+ one distributable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:unique name="web-app-servlet-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet element contains the name of a servlet.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:servlet"/>
+ <xsd:field xpath="j2ee:servlet-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-app-filter-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The filter element contains the name of a filter.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:filter"/>
+ <xsd:field xpath="j2ee:filter-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-app-ejb-local-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-local-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:ejb-local-ref"/>
+ <xsd:field xpath="j2ee:ejb-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-app-ejb-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:ejb-ref"/>
+ <xsd:field xpath="j2ee:ejb-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-app-resource-env-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-name element specifies the name of
+ a resource environment reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:resource-env-ref"/>
+ <xsd:field xpath="j2ee:resource-env-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-app-message-destination-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-ref-name element specifies the name of
+ a message destination reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:message-destination-ref"/>
+ <xsd:field xpath="j2ee:message-destination-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-app-res-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-ref-name element specifies the name of a
+ resource manager connection factory reference. The name
+ is a JNDI name relative to the java:comp/env context.
+ The name must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:resource-ref"/>
+ <xsd:field xpath="j2ee:res-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-app-env-entry-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The env-entry-name element contains the name of a web
+ application's environment entry. The name is a JNDI
+ name relative to the java:comp/env context. The name
+ must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:selector xpath="j2ee:env-entry"/>
+ <xsd:field xpath="j2ee:env-entry-name"/>
+ </xsd:unique>
+
+ <xsd:key name="web-app-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ A role-name-key is specified to allow the references
+ from the security-role-refs.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:security-role"/>
+ <xsd:field xpath="j2ee:role-name"/>
+ </xsd:key>
+
+ <xsd:keyref name="web-app-role-name-references"
+ refer="j2ee:web-app-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The keyref indicates the references from
+ security-role-ref to a specified role-name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="j2ee:servlet/j2ee:security-role-ref"/>
+ <xsd:field xpath="j2ee:role-link"/>
+ </xsd:keyref>
+ </xsd:element>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="auth-constraintType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The auth-constraintType indicates the user roles that
+ should be permitted access to this resource
+ collection. The role-name used here must either correspond
+ to the role-name of one of the security-role elements
+ defined for this web application, or be the specially
+ reserved role-name "*" that is a compact syntax for
+ indicating all roles in the web application. If both "*"
+ and rolenames appear, the container interprets this as all
+ roles. If no roles are defined, no user is allowed access
+ to the portion of the web application described by the
+ containing security-constraint. The container matches
+ role names case sensitively when determining access.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="j2ee:descriptionType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="j2ee:role-nameType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="auth-methodType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The auth-methodType is used to configure the authentication
+ mechanism for the web application. As a prerequisite to
+ gaining access to any web resources which are protected by
+ an authorization constraint, a user must have authenticated
+ using the configured mechanism. Legal values are "BASIC",
+ "DIGEST", "FORM", "CLIENT-CERT", or a vendor-specific
+ authentication scheme.
+
+ Used in: login-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="dispatcherType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The dispatcher has four legal values: FORWARD, REQUEST, INCLUDE,
+ and ERROR. A value of FORWARD means the Filter will be applied
+ under RequestDispatcher.forward() calls. A value of REQUEST
+ means the Filter will be applied under ordinary client calls to
+ the path or servlet. A value of INCLUDE means the Filter will be
+ applied under RequestDispatcher.include() calls. A value of
+ ERROR means the Filter will be applied under the error page
+ mechanism. The absence of any dispatcher elements in a
+ filter-mapping indicates a default of applying filters only under
+ ordinary client calls to the path or servlet.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:string">
+ <xsd:enumeration value="FORWARD"/>
+ <xsd:enumeration value="INCLUDE"/>
+ <xsd:enumeration value="REQUEST"/>
+ <xsd:enumeration value="ERROR"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="encodingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The encodingType defines IANA character sets.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[^\s]+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="error-codeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The error-code contains an HTTP error code, ex: 404
+
+ Used in: error-page
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:xsdPositiveIntegerType">
+ <xsd:pattern value="\d{3}"/>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="error-pageType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The error-pageType contains a mapping between an error code
+ or exception type to the path of a resource in the web
+ application.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element name="error-code"
+ type="j2ee:error-codeType"/>
+
+ <xsd:element name="exception-type"
+ type="j2ee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The exception-type contains a fully qualified class
+ name of a Java exception type.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
+
+ <xsd:element name="location"
+ type="j2ee:war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The location element contains the location of the
+ resource in the web application relative to the root of
+ the web application. The value of the location must have
+ a leading `/'.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="filter-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Declaration of the filter mappings in this web
+ application is done by using filter-mappingType.
+ The container uses the filter-mapping
+ declarations to decide which filters to apply to a request,
+ and in what order. The container matches the request URI to
+ a Servlet in the normal way. To determine which filters to
+ apply it matches filter-mapping declarations either on
+ servlet-name, or on url-pattern for each filter-mapping
+ element, depending on which style is used. The order in
+ which filters are invoked is the order in which
+ filter-mapping declarations that match a request URI for a
+ servlet appear in the list of filter-mapping elements.The
+ filter-name value must be the value of the filter-name
+ sub-elements of one of the filter declarations in the
+ deployment descriptor.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="filter-name"
+ type="j2ee:filter-nameType"/>
+ <xsd:choice>
+ <xsd:element name="url-pattern"
+ type="j2ee:url-patternType"/>
+ <xsd:element name="servlet-name"
+ type="j2ee:servlet-nameType"/>
+ </xsd:choice>
+ <xsd:element name="dispatcher"
+ type="j2ee:dispatcherType"
+ minOccurs="0" maxOccurs="4"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="filter-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The logical name of the filter is declare
+ by using filter-nameType. This name is used to map the
+ filter. Each filter name is unique within the web
+ application.
+
+ Used in: filter, filter-mapping
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="j2ee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="filterType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The filterType is used to declare a filter in the web
+ application. The filter is mapped to either a servlet or a
+ URL pattern in the filter-mapping element, using the
+ filter-name value to reference. Filters can access the
+ initialization parameters declared in the deployment
+ descriptor at runtime via the FilterConfig interface.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:group ref="j2ee:descriptionGroup"/>
+ <xsd:element name="filter-name"
+ type="j2ee:filter-nameType"/>
+ <xsd:element name="filter-class"
+ type="j2ee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The fully qualified classname of the filter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="init-param"
+ type="j2ee:param-valueType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The init-param element contains a name/value pair as
+ an initialization param of a servlet filter
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="form-login-configType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The form-login-configType specifies the login and error
+ pages that should be used in form based login. If form based
+ authentication is not used, these elements are ignored.
+
+ Used in: login-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+
+ <xsd:element name="form-login-page"
+ type="j2ee:war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The form-login-page element defines the location in the web
+ app where the page that can be used for login can be
+ found. The path begins with a leading / and is interpreted
+ relative to the root of the WAR.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="form-error-page"
+ type="j2ee:war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The form-error-page element defines the location in
+ the web app where the error page that is displayed
+ when login is not successful can be found.
+ The path begins with a leading / and is interpreted
+ relative to the root of the WAR.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="http-methodType">
+ <xsd:annotation>
+
+ <xsd:documentation>
+
+ The http-method contains an HTTP method recognized by the
+ web-app, for example GET, POST, ...
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:string">
+ <xsd:enumeration value="GET"/>
+ <xsd:enumeration value="POST"/>
+ <xsd:enumeration value="PUT"/>
+ <xsd:enumeration value="DELETE"/>
+ <xsd:enumeration value="HEAD"/>
+ <xsd:enumeration value="OPTIONS"/>
+ <xsd:enumeration value="TRACE"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="locale-encoding-mapping-listType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The locale-encoding-mapping-list contains one or more
+ locale-encoding-mapping(s).
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="locale-encoding-mapping"
+ type="j2ee:locale-encoding-mappingType"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="locale-encoding-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The locale-encoding-mapping contains locale name and
+ encoding name. The locale name must be either "Language-code",
+ such as "ja", defined by ISO-639 or "Language-code_Country-code",
+ such as "ja_JP". "Country code" is defined by ISO-3166.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="locale"
+ type="j2ee:localeType"/>
+ <xsd:element name="encoding"
+ type="j2ee:encodingType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="localeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The localeType defines valid locale defined by ISO-639-1
+ and ISO-3166.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[a-z]{2}(_|-)?([\p{L}\-\p{Nd}]{2})?"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="login-configType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The login-configType is used to configure the authentication
+ method that should be used, the realm name that should be
+ used for this application, and the attributes that are
+ needed by the form login mechanism.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="auth-method"
+ type="j2ee:auth-methodType"
+ minOccurs="0"/>
+ <xsd:element name="realm-name"
+ type="j2ee:string" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The realm name element specifies the realm name to
+ use in HTTP Basic authorization.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="form-login-config"
+ type="j2ee:form-login-configType"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="mime-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The mime-mappingType defines a mapping between an extension
+ and a mime type.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The extension element contains a string describing an
+ extension. example: "txt"
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:element name="extension"
+ type="j2ee:string"/>
+ <xsd:element name="mime-type"
+ type="j2ee:mime-typeType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="mime-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The mime-typeType is used to indicate a defined mime type.
+
+ Example:
+ "text/plain"
+
+ Used in: mime-mapping
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:string">
+ <xsd:pattern value="[\p{L}\-\p{Nd}]+/[\p{L}\-\p{Nd}\.]+"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="nonEmptyStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+ This type defines a string which contains at least one
+ character.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:string">
+ <xsd:minLength value="1"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-constraintType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The security-constraintType is used to associate
+ security constraints with one or more web resource
+ collections
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="display-name"
+ type="j2ee:display-nameType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="web-resource-collection"
+ type="j2ee:web-resource-collectionType"
+ maxOccurs="unbounded"/>
+ <xsd:element name="auth-constraint"
+ type="j2ee:auth-constraintType"
+ minOccurs="0"/>
+ <xsd:element name="user-data-constraint"
+ type="j2ee:user-data-constraintType"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="servlet-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet-mappingType defines a mapping between a
+ servlet and a url pattern.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="servlet-name"
+ type="j2ee:servlet-nameType"/>
+ <xsd:element name="url-pattern"
+ type="j2ee:url-patternType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="servlet-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet-name element contains the canonical name of the
+ servlet. Each servlet name is unique within the web
+ application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="j2ee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="servletType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servletType is used to declare a servlet.
+ It contains the declarative data of a
+ servlet. If a jsp-file is specified and the load-on-startup
+ element is present, then the JSP should be precompiled and
+ loaded.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:group ref="j2ee:descriptionGroup"/>
+ <xsd:element name="servlet-name"
+ type="j2ee:servlet-nameType"/>
+ <xsd:choice>
+ <xsd:element name="servlet-class"
+ type="j2ee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet-class element contains the fully
+ qualified class name of the servlet.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="jsp-file"
+ type="j2ee:jsp-fileType"/>
+
+ </xsd:choice>
+
+ <xsd:element name="init-param"
+ type="j2ee:param-valueType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="load-on-startup"
+ type="j2ee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The load-on-startup element indicates that this
+ servlet should be loaded (instantiated and have
+ its init() called) on the startup of the web
+ application. The optional contents of these
+ element must be an integer indicating the order in
+ which the servlet should be loaded. If the value
+ is a negative integer, or the element is not
+ present, the container is free to load the servlet
+ whenever it chooses. If the value is a positive
+ integer or 0, the container must load and
+ initialize the servlet as the application is
+ deployed. The container must guarantee that
+ servlets marked with lower integers are loaded
+ before servlets marked with higher integers. The
+ container may choose the order of loading of
+ servlets with the same load-on-start-up value.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="run-as"
+ type="j2ee:run-asType"
+ minOccurs="0"/>
+ <xsd:element name="security-role-ref"
+ type="j2ee:security-role-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="session-configType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The session-configType defines the session parameters
+ for this web application.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="session-timeout"
+ type="j2ee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The session-timeout element defines the default
+ session timeout interval for all sessions created
+ in this web application. The specified timeout
+ must be expressed in a whole number of minutes.
+ If the timeout is 0 or less, the container ensures
+ the default behaviour of sessions is never to time
+ out. If this element is not specified, the container
+ must set its default timeout period.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="transport-guaranteeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The transport-guaranteeType specifies that the communication
+ between client and server should be NONE, INTEGRAL, or
+ CONFIDENTIAL. NONE means that the application does not
+ require any transport guarantees. A value of INTEGRAL means
+ that the application requires that the data sent between the
+ client and server be sent in such a way that it can't be
+ changed in transit. CONFIDENTIAL means that the application
+ requires that the data be transmitted in a fashion that
+ prevents other entities from observing the contents of the
+ transmission. In most cases, the presence of the INTEGRAL or
+ CONFIDENTIAL flag will indicate that the use of SSL is
+ required.
+
+ Used in: user-data-constraint
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:string">
+ <xsd:enumeration value="NONE"/>
+ <xsd:enumeration value="INTEGRAL"/>
+ <xsd:enumeration value="CONFIDENTIAL"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="user-data-constraintType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The user-data-constraintType is used to indicate how
+ data communicated between the client and container should be
+ protected.
+
+ Used in: security-constraint
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="j2ee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="transport-guarantee"
+ type="j2ee:transport-guaranteeType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate a path starting
+ with a "/" and interpreted relative to the root of a WAR
+ file.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="j2ee:string">
+ <xsd:pattern value="/.*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="web-app-versionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type contains the recognized versions of
+ web-application supported. It is used to designate the
+ version of the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="2.4"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="web-appType">
+
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:group ref="j2ee:descriptionGroup"/>
+ <xsd:element name="distributable"
+ type="j2ee:emptyType"/>
+ <xsd:element name="context-param"
+ type="j2ee:param-valueType">
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The context-param element contains the declaration
+ of a web application's servlet context
+ initialization parameters.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="filter"
+ type="j2ee:filterType"/>
+ <xsd:element name="filter-mapping"
+ type="j2ee:filter-mappingType"/>
+ <xsd:element name="listener"
+ type="j2ee:listenerType"/>
+ <xsd:element name="servlet"
+ type="j2ee:servletType"/>
+ <xsd:element name="servlet-mapping"
+ type="j2ee:servlet-mappingType"/>
+ <xsd:element name="session-config"
+ type="j2ee:session-configType"/>
+ <xsd:element name="mime-mapping"
+ type="j2ee:mime-mappingType"/>
+ <xsd:element name="welcome-file-list"
+ type="j2ee:welcome-file-listType"/>
+ <xsd:element name="error-page"
+ type="j2ee:error-pageType"/>
+ <xsd:element name="jsp-config"
+ type="j2ee:jsp-configType"/>
+ <xsd:element name="security-constraint"
+ type="j2ee:security-constraintType"/>
+ <xsd:element name="login-config"
+ type="j2ee:login-configType"/>
+ <xsd:element name="security-role"
+ type="j2ee:security-roleType"/>
+ <xsd:group ref="j2ee:jndiEnvironmentRefsGroup"/>
+ <xsd:element name="message-destination"
+ type="j2ee:message-destinationType"/>
+ <xsd:element name="locale-encoding-mapping-list"
+ type="j2ee:locale-encoding-mapping-listType"/>
+ </xsd:choice>
+
+ <xsd:attribute name="version"
+ type="j2ee:web-app-versionType"
+ use="required"/>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="web-resource-collectionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-resource-collectionType is used to identify a subset
+ of the resources and HTTP methods on those resources within
+ a web application to which a security constraint applies. If
+ no HTTP methods are specified, then the security constraint
+ applies to all HTTP methods.
+
+ Used in: security-constraint
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="web-resource-name"
+ type="j2ee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-resource-name contains the name of this web
+ resource collection.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="description"
+ type="j2ee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="url-pattern"
+ type="j2ee:url-patternType"
+ maxOccurs="unbounded"/>
+ <xsd:element name="http-method"
+ type="j2ee:http-methodType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="welcome-file-listType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The welcome-file-list contains an ordered list of welcome
+ files elements.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="welcome-file"
+ type="xsd:string"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The welcome-file element contains file name to use
+ as a default welcome file, such as index.html
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+</xsd:schema>
+
Added: 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=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/build.xml (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/build.xml Mon May 9 13:17:58 2005
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+
+<project name="Jdbc Control Build" default="build" basedir=".">
+
+ <import file="../../systemcontrols-imports.xml"/>
+ <property environment="os"/>
+
+ <!-- taskdefs -->
+ <taskdef name="control-jar" classname="org.apache.beehive.controls.runtime.packaging.ControlJarTask"
+ classpathref="controls.dependency.path" onerror="report"/>
+
+ <!-- build locations -->
+ <property name="module.name" value="jdbc-control"/>
+ <property name="module.dir" location="${src.dir}/jdbc"/>
+ <property name="sqlgrammar.file" value="${module.dir}/org/controlhaus/jdbc/parser/SqlGrammar.jj"/>
+ <property name="sqlgrammar.gen.dir" value="${module.dir}/org/controlhaus/jdbc/parser"/>
+
+ <!-- classpath -->
+ <path id="module.classpath">
+ <pathelement location="${classes.dir}/${module.name}"/>
+ <path refid="controls.dependency.path"/>
+ <path refid="xbean.dependency.path"/>
+ <path refid="log4j.dependency.path"/>
+ <path refid="velocity.dependency.path"/>
+ <path refid="tools.dependency.path"/>
+ </path>
+
+ <!-- =================================================================== -->
+ <!-- build - build the Jdbc Control -->
+ <!-- =================================================================== -->
+ <target name="build" description="Compiles and builds the jdbc-control.">
+
+ <echo>compile module: ${module.name}</echo>
+ <property name="classpath" refid="module.classpath"/>
+ <echo>module classpath: ${classpath}</echo>
+ <echo>debug: ${compile.debug}</echo>
+
+ <mkdir dir="${classes.dir}/${module.name}"/>
+ <mkdir dir="${gen.src.dir}/${module.name}"/>
+
+ <build-controls srcdir="${module.dir}" destdir="${classes.dir}/${module.name}"
+ tempdir="${gen.src.dir}/${module.name}" classpathref="module.classpath"/>
+
+ <control-jar destfile="${build.lib.dir}/${jdbccontrol.jar.name}" basedir="${classes.dir}/${module.name}"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- sqlgrammer - builds the parser using javacc -->
+ <!-- =================================================================== -->
+ <target name="sqlgrammar_javacc">
+ <javacc
+ target="${sqlgrammar.file}"
+ outputdirectory="${sqlgrammar.gen.dir}"
+ javacchome="${javacc.home}"
+ />
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- clean - cleans the Jdbc Control -->
+ <!-- =================================================================== -->
+ <target name="clean" description="Cleans the Jdbc Control build.">
+ <delete dir="${classes.dir}/${module.name}"/>
+ <delete dir="${gen.src.dir}/${module.name}"/>
+ <delete file="${build.lib.dir}/${jdbccontrol.jar.name}"/>
+ </target>
+
+</project>
Added: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java Mon May 9 13:17:58 2005
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.util.Calendar;
+import java.util.Iterator;
+
+/**
+ * Default ResultSetMapper implementation for Iterators.
+ */
+public class DefaultIteratorResultSetMapper extends ResultSetMapper {
+
+ /**
+ * Map a ResultSet to an object type
+ * Type of object to interate over is defined in the SQL annotation for the method.
+ *
+ * @param context A ControlBeanContext instance, see Beehive controls javadoc for additional information
+ * @param m Method assoicated with this call.
+ * @param resultSet Result set to map.
+ * @param cal A Calendar instance for time/date value resolution.
+ * @return The Iterator object instance resulting from the ResultSet
+ */
+ public Iterator mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
+ return new ResultSetIterator(context, m, resultSet, cal);
+ }
+
+ /**
+ * Can the ResultSet which this mapper uses be closed by the database control on return from its invoke() method?
+ * @return always returns false
+ */
+ public boolean canCloseResultSet() { return false; }
+}
Added: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java Mon May 9 13:17:58 2005
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.Context;
+
+/**
+ * Default context factory implementation.
+ * May be overridden in class's ConnectionDataSource annotation.
+ */
+class DefaultJndiContextFactory extends JdbcControl.JndiContextFactory {
+
+ /**
+ * Return a Jndi InitialContext
+ * @return InitialContext instance
+ * @throws NamingException on error.
+ */
+ public Context getContext() throws NamingException {
+ return (Context) new InitialContext();
+ }
+}
Added: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java Mon May 9 13:17:58 2005
@@ -0,0 +1,117 @@
+/*
+ * 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;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.system.jdbc.JdbcControl.SQL;
+
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Calendar;
+
+/**
+ * Default ResultSetMapper implementation for Objects.
+ */
+public class DefaultObjectResultSetMapper extends ResultSetMapper {
+
+ /**
+ * static reference to the TypeMappingsFactory for this class
+ */
+ protected static final TypeMappingsFactory _tmf = TypeMappingsFactory.getInstance();
+
+ /**
+ * Map the ResultSet to the method's return type. The object type returned is defined by the return type of the method.
+ *
+ * @param context A ControlBeanContext instance, see Beehive controls javadoc for additional information
+ * @param m Method assoicated with this call.
+ * @param resultSet Result set to map.
+ * @param cal A Calendar instance for time/date value resolution.
+ * @return The Object resulting from the ResultSet
+ */
+ public Object mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
+
+ final Class returnType = m.getReturnType();
+ final boolean isArray = returnType.isArray();
+
+ try {
+ if (isArray) {
+ final SQL methodSQL = (SQL) context.getMethodPropertySet(m, SQL.class);
+ return arrayFromResultSet(resultSet, methodSQL.arrayMaxLength(), returnType, cal);
+ } else {
+ if (!resultSet.next()) {
+ return _tmf.fixNull(m.getReturnType());
+ }
+ return RowMapperFactory.getRowMapper(resultSet, returnType, cal).mapRowToReturnType();
+ }
+ } catch (SQLException e) {
+ throw new ControlException(e.getMessage(), e);
+ }
+ }
+
+ //
+ // ////////////////////////////////// PRIVATE METHODS //////////////////////////////////////////
+ //
+
+ /**
+ * Invoked when the return type of the method is an array type.
+ *
+ * @param rs ResultSet to process.
+ * @param maxRows The maximum size of array to create
+ * @param arrayClass The class of object contained within the array
+ * @param cal A calendar instance to use for date/time values
+ * @return An array of the specified class type
+ * @throws SQLException On error.
+ */
+ protected Object arrayFromResultSet(ResultSet rs, int maxRows, Class arrayClass, Calendar cal)
+ throws SQLException {
+
+ Class componentType = arrayClass.getComponentType();
+ ResultSetMetaData md = rs.getMetaData();
+
+ ArrayList<Object> list = new ArrayList<Object>();
+ int numRows;
+
+ boolean hasMoreRows = rs.next();
+ RowMapper rowMapper = RowMapperFactory.getRowMapper(rs, componentType, cal);
+
+ for (numRows = 0; numRows != maxRows && hasMoreRows; numRows++) {
+ list.add(rowMapper.mapRowToReturnType());
+ hasMoreRows = rs.next();
+ }
+
+ Object array = java.lang.reflect.Array.newInstance(componentType, numRows);
+ try {
+ for (int i = 0; i < numRows; i++) {
+ java.lang.reflect.Array.set(array, i, list.get(i));
+ }
+ } catch (IllegalArgumentException iae) {
+ // assuming no errors in resultSetObject() this can only happen
+ // for single column result sets.
+ throw new ControlException("The declared Java type for array " + componentType.getName()
+ + "is incompatible with the SQL format of column " + md.getColumnName(1)
+ + md.getColumnTypeName(1) + "which returns objects of type + "
+ + list.get(0).getClass().getName());
+ }
+ return array;
+ }
+}
Added: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultResultSetMapper.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultResultSetMapper.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultResultSetMapper.java (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultResultSetMapper.java Mon May 9 13:17:58 2005
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.util.Calendar;
+
+/**
+ * Default ResultSetMapper implementation for ResultSets.
+ */
+public class DefaultResultSetMapper extends ResultSetMapper {
+
+ /**
+ * Maps a ResultSet to a ResultSet. The default implementation is a NOOP.
+ *
+ * @param context A ControlBeanContext instance.
+ * @param m Method assoicated with this call.
+ * @param resultSet Result set to map.
+ * @param cal A Calendar instance for resolving date/time values.
+ * @return An object.
+ */
+ public Object mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
+ return resultSet;
+ }
+
+ /**
+ * Can the ResultSet which this mapper uses be closed by the database control?
+ * @return always false
+ */
+ public boolean canCloseResultSet() { return false; }
+}
Added: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java Mon May 9 13:17:58 2005
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+import com.sun.rowset.CachedRowSetImpl;
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.system.jdbc.JdbcControl.SQL;
+
+import javax.sql.RowSet;
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Calendar;
+
+/**
+ * Default ResultSetMapper implementation for RowSets.
+ */
+public class DefaultRowSetResultSetMapper extends ResultSetMapper {
+
+ private static final TypeMappingsFactory _tmf = TypeMappingsFactory.getInstance();
+
+ /**
+ * Map a ResultSet to a RowSet. Type of RowSet is defined by the SQL annotation for the method.
+ *
+ * @param context A ControlBeanContext instance.
+ * @param m Method assoicated with this call.
+ * @param resultSet Result set to map.
+ * @param cal A Calendar instance for resolving date/time values.
+ * @return A RowSet object.
+ */
+ public RowSet mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
+ final SQL methodSQL = (SQL) context.getMethodPropertySet(m, SQL.class);
+ final int maxrows = methodSQL.maxRows();
+
+ try {
+ CachedRowSetImpl rows = new CachedRowSetImpl();
+
+ if (maxrows > 0) {
+ rows.setMaxRows(maxrows);
+ }
+
+ rows.populate(resultSet);
+ return rows;
+ } catch (SQLException e) {
+ throw new ControlException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Can the ResultSet which this mapper uses be closed by the database control?
+ *
+ * @return always false
+ */
+ public boolean canCloseResultSet() { return false; }
+}
Added: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultXmlObjectResultSetMapper.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultXmlObjectResultSetMapper.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultXmlObjectResultSetMapper.java (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultXmlObjectResultSetMapper.java Mon May 9 13:17:58 2005
@@ -0,0 +1,65 @@
+/*
+ * 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;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.system.jdbc.JdbcControl.SQL;
+
+import java.lang.reflect.Method;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Calendar;
+
+/**
+ * Default ResultSetMapper implementation for XmlObjects.
+ */
+public class DefaultXmlObjectResultSetMapper extends DefaultObjectResultSetMapper {
+
+ /**
+ * Map a ResultSet to an XmlObject. Object type is defined by the return type of the method.
+ *
+ * @param context A ControlBeanContext instance.
+ * @param m Method associated with this call.
+ * @param resultSet Result set to map.
+ * @param cal A Calendar instance for resolving date/time values.
+ * @return An XmlObject
+ */
+ public Object mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) {
+
+ final Class returnType = m.getReturnType();
+ final boolean isArray = returnType.isArray();
+
+ try {
+ if (isArray) {
+ final SQL methodSQL = (SQL) context.getMethodPropertySet(m, SQL.class);
+ return arrayFromResultSet(resultSet, methodSQL.arrayMaxLength(), returnType, cal);
+ } else {
+
+ if (!resultSet.next()) {
+ return _tmf.fixNull(m.getReturnType());
+ }
+
+ return RowMapperFactory.getRowMapper(resultSet, returnType, cal).mapRowToReturnType();
+ }
+ } catch (SQLException e) {
+ throw new ControlException(e.getMessage(), e);
+ }
+ }
+}
Added: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControl.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControl.java (added)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControl.java Mon May 9 13:17:58 2005
@@ -0,0 +1,566 @@
+/*
+ * 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;
+
+import org.apache.beehive.controls.api.bean.AnnotationConstraints;
+import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+import javax.naming.NamingException;
+import javax.naming.Context;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.sql.SQLData;
+import java.util.Calendar;
+
+/**
+ * Simplifies access to a relational database from your Java code using SQL commands.
+ * The Jdbc Control handles the work of connecting to, sending queries to, and ResultSet mapping from
+ * the database. You don't need to know how to use JDBC in order to use the Jdbc Control, just basic SQL.
+ * <p/>
+ * To use a Jdbc Control create a .jcx file (java file with a .jcx extension) which extends this interface.
+ * Add annotations to the jcx to tell the Jdbc Control how to connect to your database instance (either
+ * ConnectionDataSource or ConnectionDriver), then add methods which include SQL annotations to access the database.
+ */
+@ControlInterface( checkerClass = JdbcControlChecker.class )
+public interface JdbcControl {
+
+
+ /**
+ * Returns a database connection to the server associated
+ * with the control. It is typically not necessary to call this method
+ * when using the control.
+ *
+ * @return A Connection a database.
+ */
+ public Connection getConnection() throws SQLException;
+
+ /**
+ * Sets the Calendar instance that should be used when setting and getting
+ * {@link java.sql.Date Date}, {@link java.sql.Time Time}, and
+ * {@link java.sql.Timestamp Timestamp} values.
+ *
+ * @see java.sql.ResultSet#getDate(int, Calendar) java.sql.ResultSet#getDate(int, Calendar)
+ * @see java.sql.ResultSet#getTime(int, Calendar) java.sql.ResultSet#getTime(int, Calendar)
+ * @see java.sql.ResultSet#getTimestamp(int, Calendar) java.sql.ResultSet#getTimestamp(int, Calendar)
+ * @see java.sql.PreparedStatement#setDate(int, java.sql.Date, Calendar) java.sql.PreparedStatement#setDate(int, Date, Calendar)
+ * @see java.sql.PreparedStatement#setTime(int, java.sql.Time, Calendar) java.sql.PreparedStatement#setTime(int, Time, Calendar)
+ * @see java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, Calendar) java.sql.PreparedStatement#setTimestamp(int, Timestamp, Calendar)
+ */
+ public void setDataSourceCalendar(Calendar cal);
+
+ /**
+ * Gets the Calendar instance used when setting and getting
+ * {@link java.sql.Date Date}, {@link java.sql.Time Time}, and
+ * {@link java.sql.Timestamp Timestamp} values. This is the Calendar
+ * set by the setDataSourceCalendar method.
+ *
+ * @return The Calendar instance.
+ */
+ public Calendar getDataSourceCalendar();
+
+
+
+
+// ********************************************************************************************************************
+// ********************************************************************************************************************
+// Class-level Database Connection Annotations and Supporting Constructs
+// ********************************************************************************************************************
+// ********************************************************************************************************************
+
+
+ /**
+ * Abstract base class for a user defined Jndi Context factory which can be used
+ * as a value for the jndiContextFactory member of the ConnectionDataSource
+ * annotation.
+ */
+ public static abstract class JndiContextFactory {
+
+ /**
+ * Get a JNDI InitialContext instance.
+ *
+ * @return InitialContext instance
+ * @throws NamingException if context could not be found.
+ */
+ public abstract Context getContext() throws NamingException;
+ }
+
+ /**
+ * Class-level annotation for making a DataSource available for use with the Jdbc Control. Either this annotation or
+ * the ConnectionDriver annotation must be set for a jcx which extends the JdbcControl interface.
+ */
+ @PropertySet(prefix = "ConnectionDataSource")
+ @Inherited
+ @AnnotationConstraints.AllowExternalOverride
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface ConnectionDataSource {
+
+ /**
+ * The jndi name of the DataSource. This is a required element for this annotation.
+ */
+ @AnnotationMemberTypes.JndiName(resourceType = AnnotationMemberTypes.JndiName.ResourceType.DATASOURCE)
+ String jndiName();
+
+ /**
+ * The name of a class which implements the IJndiContextFactory interface. This is an optional element of this annotation.
+ */
+ @AnnotationMemberTypes.Optional
+ Class<? extends JndiContextFactory> jndiContextFactory() default DefaultJndiContextFactory.class;
+ }
+
+
+ /**
+ * Class-level annotation for making a ConnectionDriver available for use with the Jdbc Control. Either this
+ * annotation or the ConnectionDataSource annotation must be set for a jcx which extends the JdbcControl interface.
+ * See java.sql.DatabaseConnection for additional information about the elements of this annotation.
+ */
+ @PropertySet(prefix = "ConnectionDriver")
+ @Inherited
+ @AnnotationConstraints.AllowExternalOverride
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface ConnectionDriver {
+
+ /**
+ * A String containing the fully qualified name of the database driver class. Required element.
+ */
+ String databaseDriverClass();
+
+ /**
+ * A String containing the database URL to connect to. Required element.
+ */
+ String databaseURL();
+
+ /**
+ * A String containing the user name to connect to the database as. Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ String userName() default "";
+
+ /**
+ * A String containing the password associated with userName. Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ String password() default "";
+
+ /**
+ * A String containing a comma seperated list of name/value pairs for the DatabaseConnection. Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ String properties() default "";
+ }
+
+
+ /**
+ * Class level annotation used to set options on the JDBC connnection.
+ */
+ @PropertySet(prefix = "ConnectionOptions")
+ @Inherited
+ @AnnotationConstraints.AllowExternalOverride
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface ConnectionOptions {
+
+ /**
+ * If set to true, database connection will optimize for read only queries, writes still permitted.
+ * Optional, defaults to false.
+ */
+ @AnnotationMemberTypes.Optional
+ boolean readOnly() default false;
+
+ /**
+ * Specifies ResultSet holdability for the connection. May be overridden at method level.
+ * Optional, defaults to jdbc driver's default setting.
+ */
+ @AnnotationMemberTypes.Optional
+ HoldabilityType resultSetHoldability() default HoldabilityType.DRIVER_DEFAULT;
+
+ /**
+ * Specifies type mappings for SQL user defined types (UDTs). Any type mappings set here will be used
+ * by the underlying JDBC Connection for UDT type mappings. These mappings can be overridden by using
+ * the SQL annotations methodTypeMappers element. Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ TypeMapper[] typeMappers() default {};
+ }
+
+ /**
+ * Class / method level annotation for mapping SQL user defined types (UDTs) to and from java objects.
+ * The mapper class element must implement the java.sql.SQLData interface.
+ */
+ @PropertySet(prefix = "TypeMapper")
+ @Inherited
+ @AnnotationConstraints.AllowExternalOverride
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.METHOD})
+ public @interface TypeMapper {
+ String UDTName();
+ Class<? extends SQLData> mapperClass();
+ }
+
+
+
+
+// ********************************************************************************************************************
+// ********************************************************************************************************************
+// SQL Method-level Annotation and Supporting Constructs
+// ********************************************************************************************************************
+// ********************************************************************************************************************
+
+ /**
+ * This constant can be used as the value for the maxRows element of the SQL annotation.
+ * It indicates that all rows should be returned (i.e. no limit)
+ */
+ public final int MAXROWS_ALL = 0;
+
+ /**
+ * The default fetch size for result sets, indicates the database should determine the fetch size.
+ */
+ public final int DEFAULT_FETCH_SIZE = 0;
+
+ /**
+ * Default value for the iteratorElementType element of the
+ * SQL annotation. It signals that no type has been defined for the method
+ * (common if the method return type isn't itself an iterator)
+ */
+ public interface UndefinedIteratorType {
+ }
+
+ /**
+ * Default value for the resultSetMapper element of the
+ * SQL annotation. It signals that no type has been defined for the method.
+ */
+ public interface UndefinedResultSetMapper {
+ }
+
+ /**
+ * Enumeration of supported types of scrolling ResultSets
+ */
+ public enum ScrollType {
+ DRIVER_DEFAULT (-1, -1),
+ FORWARD_ONLY (ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY),
+ SCROLL_INSENSITIVE (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY),
+ SCROLL_SENSITIVE (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY),
+ FORWARD_ONLY_UPDATABLE (ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE),
+ SCROLL_INSENSITIVE_UPDATABLE (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE),
+ SCROLL_SENSITIVE_UPDATABLE (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
+
+ private final int _type;
+ private final int _concurrencyType;
+
+ ScrollType(int scrollType, int concurrencyType) {
+ _type = scrollType;
+ _concurrencyType = concurrencyType;
+ }
+
+ public int getType() { return _type; }
+
+ public int getConcurrencyType() { return _concurrencyType; }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ if (_type == ResultSet.TYPE_FORWARD_ONLY) {
+ sb.append("Foward Only, ");
+ } else if (_type == ResultSet.TYPE_SCROLL_INSENSITIVE) {
+ sb.append("Scroll Insensitive, ");
+ } else if (_type == ResultSet.TYPE_SCROLL_SENSITIVE) {
+ sb.append("Scroll Sensitive, ");
+ } else {
+ sb.append("Jdbc Driver Default Direction");
+ }
+
+ if (_concurrencyType == ResultSet.CONCUR_READ_ONLY) {
+ sb.append("Read Only");
+ } else if (_concurrencyType == ResultSet.CONCUR_UPDATABLE) {
+ sb.append("Updatable");
+ } else {
+ sb.append("Jdbc Driver Default");
+ }
+ return sb.toString();
+ }
+ }
+
+ /**
+ * Enumeration of supported fetch directions.
+ */
+ public enum FetchDirection {
+ FORWARD (ResultSet.FETCH_FORWARD),
+ REVERSE (ResultSet.FETCH_REVERSE),
+ UNKNOWN (ResultSet.FETCH_UNKNOWN);
+
+ private final int _direction;
+
+ FetchDirection(int direction) {
+ _direction = direction;
+ }
+
+ public int getDirection() { return _direction; }
+ }
+
+ /**
+ * Enumeration of supported fetch directions.
+ */
+ public enum HoldabilityType {
+ DRIVER_DEFAULT (0),
+ HOLD_CURSORS (ResultSet.HOLD_CURSORS_OVER_COMMIT),
+ CLOSE_CURSORS (ResultSet.CLOSE_CURSORS_AT_COMMIT);
+
+ private final int _holdability;
+
+ HoldabilityType(int holdability) {
+ _holdability = holdability;
+ }
+
+ public int getHoldability() { return _holdability; }
+
+ public String toString() {
+ if (_holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT) {
+ return "HOLD_CURSORS_OVER_COMMIT";
+ } else if (_holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT) {
+ return "CLOSE_CURSORS_AT_COMMIT";
+ } else {
+ return "Default driver holdability";
+ }
+ }
+ }
+
+ /**
+ * Method-level annotation for methods in a jcx which wish to access a database instance.
+ */
+ @PropertySet(prefix = "SQL")
+ @Inherited
+ @Retention(RetentionPolicy.RUNTIME)
+ @AnnotationConstraints.AllowExternalOverride
+ @Target({ElementType.METHOD})
+ public @interface SQL {
+
+ /**
+ * The SQL statement to send to the database. Required annotation element.
+ */
+ String statement();
+
+
+ /**
+ * Maximum array length.
+ * This element has no effect on the call unless the method return type is an array.
+ * Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ int arrayMaxLength() default 1024;
+
+
+ /**
+ * Max number of ResultSet rows to return.
+ * If used with arrayMaxLength the smaller value is used.
+ * Optional element, default value is no limit on number of rows returned.
+ */
+ @AnnotationMemberTypes.Optional
+ int maxRows() default MAXROWS_ALL;
+
+
+ /**
+ * Execute the SQL statement as a batch update.
+ * Methods which have this element set to true must return an array of ints.
+ * Optional element, defaults to false.
+ */
+ @AnnotationMemberTypes.Optional
+ boolean batchUpdate() default false;
+
+
+ /**
+ * Specify the fetch size for the ResultSet. Optional element, defaults to 0.
+ */
+ @AnnotationMemberTypes.Optional
+ int fetchSize() default DEFAULT_FETCH_SIZE;
+
+
+ /**
+ * Specify the fetch direction for the ResultSEt. Optional element, defaults to FORWARD.
+ */
+ @AnnotationMemberTypes.Optional
+ FetchDirection fetchDirection() default FetchDirection.FORWARD;
+
+
+ /**
+ * Return the generated key values generated by the SQL statement. Optional element, defaults to false.
+ */
+ @AnnotationMemberTypes.Optional
+ boolean getGeneratedKeys() default false;
+
+
+ /**
+ * Specify generated key columns by column names to return when the getGeneratedKeys element is true.
+ * May only be set if getGeneratedKeys is set to true, otherwise a compile time error is generated.
+ * Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ String[] generatedKeyColumnNames() default {};
+
+
+ /**
+ * Specify generated key columns by column number to return when the getGeneratedKeys element is true.
+ * May only be set if getGeneratedKeys is set to true, otherwise a compile time error is generated
+ * Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ int[] generatedKeyColumnIndexes() default {};
+
+
+ /**
+ * Specify the holdability type for the annotated method. Overrides the holability annotation element
+ * of the ConnectionOptions annotation. The holdability type will be in effect for the duration of this
+ * method call. Optional, defaults to DRIVER_DEFAULT.
+ */
+ @AnnotationMemberTypes.Optional
+ HoldabilityType resultSetHoldabilityOverride() default HoldabilityType.DRIVER_DEFAULT;
+
+
+ /**
+ * Specifies type mappings for SQL user defined types (UDTs). Any type mappings set here will be used
+ * by the underlying JDBC Connection for UDT type mappings. These type mappings will REPLACE any set on
+ * the JDBC connection for the duration of the method call. Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ TypeMapper[] typeMappersOverride() default {};
+
+
+ /**
+ * Specify the type of element to be interated over when the method's return type is java.util.Iterator.
+ * Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ Class iteratorElementType() default UndefinedIteratorType.class;
+
+
+ /**
+ * Specify a custom result set mapper for the ResultSet generated by the SQL statement.
+ * ResultSet mappers must extend the ResultSetMapper abstract base class. If a value is specified
+ * it will be used to map the ResultSet of the query to the return type of the method.
+ * See org.apache.beehive.controls.system.jdbc.ResultSetMapper for additional information.
+ * Optional element.
+ */
+ @AnnotationMemberTypes.Optional
+ Class resultSetMapper() default UndefinedResultSetMapper.class;
+
+
+ /**
+ * Specify that the ResultSet returned by the method is scrollable. Valid only for methods which
+ * return a ResultSet, otherwise a compile-time error will occur. Valid element values
+ * are defined by the ScrollType enumeration.
+ * Optional element, defaults to JDBC driver's default setting.
+ */
+ @AnnotationMemberTypes.Optional
+ ScrollType scrollableResultSet() default ScrollType.DRIVER_DEFAULT;
+ } // SQL annotation declaration
+
+
+// ********************************************************************************************************************
+// ********************************************************************************************************************
+// Inner Classes
+// ********************************************************************************************************************
+// ********************************************************************************************************************
+
+ /**
+ * Nested class used for specifing parameters for a callable statement. If a method in a .jcx takes an array of
+ * SQLParameter, the JdbcControl treats the SQL as a CallableStatement and inserts values into the statement from
+ * the SQLParameter array. After the CallableStatement executes, results are mapped into OUT type parameters found
+ * int the SQLParameter array.
+ * NOTE: To invoke a callable statement which does not take any arguments, an SQLParameter array of size zero must
+ * be passed to the JDBCControl method.
+ */
+ public static class SQLParameter {
+ /**
+ * IN direction constant.
+ */
+ public static final int IN = 1;
+ /**
+ * OUT direction constant.
+ */
+ public static final int OUT = 2;
+ /**
+ * IN and OUT directions constant.
+ */
+ public static final int INOUT = IN | OUT;
+
+ /**
+ * Parameter value. For parameters of type OUT this value should be set to null.
+ */
+ public Object value = null;
+
+ /**
+ * Parameter SQL data type. See java.sql.Types.
+ */
+ public int type = Types.NULL;
+
+ /**
+ * Parameter direction.
+ */
+ public int dir = IN;
+
+ /**
+ * Create a new SQLParameter with the specified value.
+ *
+ * @param value The parameter value.
+ */
+ public SQLParameter(Object value) {
+ this.value = value;
+ }
+
+ /**
+ * Create a new SQLParameter with the specified value and SQL data type.
+ *
+ * @param value The parameter value.
+ * @param type SQL data type.
+ */
+ public SQLParameter(Object value, int type) {
+ this(value);
+ this.type = type;
+ }
+
+ /**
+ * Create a new SQLParameter with the specified value, SQL data type and direction.
+ *
+ * @param value The parameter value.
+ * @param type SQL data type.
+ * @param dir IN / OUT or INOUT
+ */
+ public SQLParameter(Object value, int type, int dir) {
+ this(value, type);
+ this.dir = dir;
+ }
+
+ /**
+ * Clone this parameter.
+ *
+ * @return A copy of this parameter.
+ */
+ public Object clone() {
+ return new SQLParameter(value, type, dir);
+ }
+ }
+}