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 [1/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/

Author: ekoneil
Date: Mon May  9 13:17:58 2005
New Revision: 169351

URL: http://svn.apache.org/viewcvs?rev=169351&view=rev
Log:
Initial move of the system controls from ControlHaus to Apache.

This includes the source code and tests for four system controls (jdbc, jms, ejb, webservice).  These are not yet wired into the beehive/trunk/build.xml file but will be so shortly.

The package name is now "org.apache.beehive.controls.system.[jdbc|jms|ejb|webservice]" and the license is ASF 2.0.

Thanks to Chad Schoettger for helping with the build integration.

BB: self
DRT: none


Added:
    incubator/beehive/trunk/system-controls/
    incubator/beehive/trunk/system-controls/ant/
    incubator/beehive/trunk/system-controls/ant/javadoc.xml
    incubator/beehive/trunk/system-controls/ant/systemcontrols.properties
    incubator/beehive/trunk/system-controls/build.xml
    incubator/beehive/trunk/system-controls/external/
    incubator/beehive/trunk/system-controls/external/commons/
    incubator/beehive/trunk/system-controls/external/commons/commons-cli-1.0.jar   (with props)
    incubator/beehive/trunk/system-controls/external/commons/commons-collections.jar   (with props)
    incubator/beehive/trunk/system-controls/external/ejb/
    incubator/beehive/trunk/system-controls/external/ejb/geronimo-spec-j2ee-1.4-rc2.jar   (with props)
    incubator/beehive/trunk/system-controls/external/jms/
    incubator/beehive/trunk/system-controls/external/jms/geronimo-spec-jms-1.0-M1.jar   (with props)
    incubator/beehive/trunk/system-controls/src/
    incubator/beehive/trunk/system-controls/src/ejb/
    incubator/beehive/trunk/system-controls/src/ejb/build.xml
    incubator/beehive/trunk/system-controls/src/ejb/org/
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControl.java
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlAssembler.java
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.jcs
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBInfo.java
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EntityEJBControl.java
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EntityEJBControlImpl.jcs
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/SessionEJBControl.java
    incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/SessionEJBControlImpl.jcs
    incubator/beehive/trunk/system-controls/src/ejb/schema/
    incubator/beehive/trunk/system-controls/src/ejb/schema/config.xsdconfig
    incubator/beehive/trunk/system-controls/src/ejb/schema/ejb-jar_2_1.xsd
    incubator/beehive/trunk/system-controls/src/ejb/schema/j2ee_1_4.xsd
    incubator/beehive/trunk/system-controls/src/ejb/schema/j2ee_web_services_client_1_1.xsd
    incubator/beehive/trunk/system-controls/src/ejb/schema/jsp_2_0.xsd
    incubator/beehive/trunk/system-controls/src/ejb/schema/web-app_2_4.xsd
    incubator/beehive/trunk/system-controls/src/jdbc/
    incubator/beehive/trunk/system-controls/src/jdbc/build.xml
    incubator/beehive/trunk/system-controls/src/jdbc/org/
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultIteratorResultSetMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultJndiContextFactory.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultObjectResultSetMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultResultSetMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultRowSetResultSetMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/DefaultXmlObjectResultSetMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControl.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlChecker.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/ResultSetHashMap.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/ResultSetIterator.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/ResultSetMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/RowMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/RowMapperFactory.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/RowToHashMapMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/RowToMapMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/RowToObjectMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/RowToXmlObjectMapper.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/TypeMappingsFactory.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/JdbcFragment.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/LiteralFragment.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/ParseException.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SimpleCharStream.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlFragment.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlGrammar.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlGrammar.jj
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlGrammarConstants.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlGrammarTokenManager.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlParser.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/Token.java
    incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/TokenMgrError.java
    incubator/beehive/trunk/system-controls/src/jms/
    incubator/beehive/trunk/system-controls/src/jms/build.xml
    incubator/beehive/trunk/system-controls/src/jms/org/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/JMSControl.java
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/impl/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/impl/JMSControlImpl.jcs
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/JndiControl.java
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/impl/
    incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.jcs
    incubator/beehive/trunk/system-controls/src/webservice/
    incubator/beehive/trunk/system-controls/src/webservice/build.xml
    incubator/beehive/trunk/system-controls/src/webservice/org/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ExtensionMaker.java
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/
    incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java
    incubator/beehive/trunk/system-controls/systemcontrols-imports.xml
    incubator/beehive/trunk/system-controls/test/
    incubator/beehive/trunk/system-controls/test/ant/
    incubator/beehive/trunk/system-controls/test/ant/build.xml
    incubator/beehive/trunk/system-controls/test/ant/junitCore.xml
    incubator/beehive/trunk/system-controls/test/ant/test-imports.xml
    incubator/beehive/trunk/system-controls/test/conf/
    incubator/beehive/trunk/system-controls/test/conf/junitLogCfg.xml
    incubator/beehive/trunk/system-controls/test/conf/junitLogCfgVerbose.xml
    incubator/beehive/trunk/system-controls/test/src/
    incubator/beehive/trunk/system-controls/test/src/jdbc/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/build.xml
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DataSourceConnectionCtrl.jcx
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrl.jcx
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlAuth.jcx
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/DriverManagerConnectionCtrlProps.jcx
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/TestTypeMapper.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/ErrorsTestCtrl.jcx
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ResultsTestCtrl.jcx
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/TxTestCtrl.jcx
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/badusers/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/badusers/badusers.xsd
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/users/
    incubator/beehive/trunk/system-controls/test/src/jdbc/controls/schemas/users/users.xsd
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/README.txt
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/application/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/application/application.xml
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/build.properties
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/build.xml
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/apache/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/apache/beehive/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/containertest/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/containertest/TestJdbcControlContainer.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/WEB-INF/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/WEB-INF/cactus-web.xml
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/WEB-INF/web.xml
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/conf/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/conf/Catalina/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/conf/Catalina/localhost/
    incubator/beehive/trunk/system-controls/test/src/jdbc/jdbc-container/webapp/conf/Catalina/localhost/context.xml
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/build.xml
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/dbconnection/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/dbconnection/DBConnectionTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/errors/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/errors/ErrorPathsTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/DBMultiRowResultsTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/DBSingleRowResultsTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/JdbcTypesTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/StoredProcsDBResultsTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/TxResultsTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/XmlBeanResultsTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/SqlParserTest.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/StoredProcedures.java
    incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/TestContextInitializer.java

Added: incubator/beehive/trunk/system-controls/ant/javadoc.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/ant/javadoc.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/ant/javadoc.xml (added)
+++ incubator/beehive/trunk/system-controls/ant/javadoc.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/SystemControls/DocBuild" default="usage" basedir=".">
+
+    <import file="../systemcontrols-imports.xml"/>
+
+	<property name="docs.build.dir" value="${build.dir}/docs"/>
+	<property name="docs.temp" value="${docs.build.dir}/temp"/>
+
+	<available file="${build.lib.dir}" type="dir" property="resources.present"/>
+
+	<path id="javadoc.classpath">
+		<fileset dir="${build.lib.dir}" includes="*.jar"/>
+		<path refid="commons-codec.dependency.path"/>
+		<path refid="webservices.dependency.path"/>
+        <path refid="ejb.dependency.path"/>
+        <pathelement path="${classes.dir}/ejb-control-xbean"/>
+        <path refid="xbean.dependency.path"/>
+		<path refid="log4j.dependency.path"/>
+		<path refid="servlet.dependency.path"/>
+		<path refid="controls.dependency.path"/>
+		<path refid="tools.dependency.path"/>
+		<path refid="ant-jar.dependency.path"/>
+	</path>
+	
+	<target name="usage">
+		<echo message="================================================================================"/>
+		<echo message="|                                  Usage                                       |"/>
+		<echo message="================================================================================"/>
+		<echo message="build - Cleans and builds all doc, copies the result to the forrest site.    "/>
+		<echo message="clean - Deletes the built netui docs and associated temp files."/>
+		<echo message="generate-class-ref - Generates the Page Flow class reference, using the standard Javadoc doclet."/>
+		<echo message="copy-to-forrest - Copies the built netui docs to the forrest site."/>
+		<echo message="================================================================================"/>
+		<echo message="|                                                                              |"/>
+		<echo message="================================================================================"/>
+	</target>
+	
+	<target name="build" depends="check-for-resources" description="Generates Javadoc for all core classes and tags, copies all docs to the build directory for distribution, also copies all docs to the forrest directory.">
+	    <antcall target="clean"/>
+		<antcall target="generate-class-ref"/>
+		<fixcrlf srcDir="${build.dir}/docs/apidocs" includes="**/*.html"/>
+	</target>
+	
+	<target name="clean">
+		<delete dir="${docs.temp}" failonerror="false"/>
+		<delete dir="${build.dir}/docs" failonerror="false"/>
+		<delete dir="${docs.dir}/temp" failonerror="false"/>
+	</target>
+	
+	<!-- The 'use' attribute is currently set to 'false' because of Java bug 5055723.
+         This bug will be fixed for the general release of JDK5.
+         Track the bug at: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5055723
+         When the fix arrives in JDK5, set use="true". -->
+	<target name="generate-class-ref">
+		<javadoc destdir="${build.dir}/docs/apidocs/classref_systemcontrols"
+                 maxmemory="256M" windowtitle="System Controls API Documentation"
+                 doctitle="System Controls API Documentation" version="true"
+                 author="false" use="false" additionalparam="-breakiterator -noqualifier all -notimestamp"
+                 useexternalfile="true" classpathref="javadoc.classpath" source="1.5">
+
+			<packageset dir="${src.dir}/jdbc"/>
+			<packageset dir="${src.dir}/webservice"/>
+			<packageset dir="${src.dir}/ejb"/>
+			<packageset dir="${src.dir}/jms"/>
+		</javadoc>
+	</target>
+	
+	<target name="check-for-resources" unless="resources.present">
+		<ant dir="../../" target="deploy"/>
+	</target>
+	
+</project>

Added: incubator/beehive/trunk/system-controls/ant/systemcontrols.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/ant/systemcontrols.properties?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/ant/systemcontrols.properties (added)
+++ incubator/beehive/trunk/system-controls/ant/systemcontrols.properties Mon May  9 13:17:58 2005
@@ -0,0 +1,38 @@
+#
+# common.properties -- an Ant properties file that
+#   contains properties that are read-only in
+#   a user's development environment.
+#
+sc.home=${beehive.home}/system-controls
+sc.ant.dir=${sc.home}/ant
+test.dir=${sc.home}/test
+build.dir=${sc.home}/build
+docs.dir=${sc.home}/docs
+src.dir=${sc.home}/src
+external.dir=${sc.home}/external
+
+classes.dir=${build.dir}/classes
+gen.src.dir=${build.dir}/gensrc
+build.lib.dir=${build.dir}/jars
+
+javadoc.dir=${build.dir}/javadoc
+javadoc.module.dir=${javadoc.dir}/modules
+
+# ---------------------------------------------------------------------------------
+#
+# System Controls build artifact JAR and resource names 
+#
+# ---------------------------------------------------------------------------------
+
+# System Controls JAR file names
+jdbccontrol.jar.name=beehive-jdbc-control.jar
+jmscontrol.jar.name=beehive-jms-control.jar
+ejbcontrol.jar.name=beehive-ejb-control.jar
+wsmcontrol.jar.name=beehive-webservice-control.jar
+
+#compile options
+compile.debug=true
+compile.deprecation=off
+compile.optimize=off
+compile.source=1.5
+

Added: incubator/beehive/trunk/system-controls/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/build.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/build.xml (added)
+++ incubator/beehive/trunk/system-controls/build.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<!-- 
+  Build file for the System Controls project.
+-->
+<project name="System Controls Build" default="build" basedir=".">
+
+    <import file="systemcontrols-imports.xml"/>
+
+    <target name="clean" description="Cleans all system controls build products.">
+        <delete dir="./build/"/>
+    </target>
+
+    <target name="build" depends="prepare" description="Compiles and builds all of the system controls.">
+
+        <echo message="--------------------------------------------------"/>
+        <echo message="|      System Controls build starting            |"/>
+        <echo message="--------------------------------------------------"/>
+
+        <ant dir="src/ejb" target="build" inheritAll="false"/>
+        <ant dir="src/jdbc" target="build" inheritAll="false"/>
+        <ant dir="src/jms" target="build" inheritAll="false"/>
+        <ant dir="src/webservice" target="build" inheritAll="false"/>
+
+        <echo message="--------------------------------------------------"/>
+        <echo message="|      System Controls build ending              |"/>
+        <echo message="--------------------------------------------------"/>
+    </target>
+
+    <target name="docs" description="Generate system controls Javadoc.">
+        <ant dir="ant" target="build" antfile="javadoc.xml" inheritAll="false"/>
+    </target>
+
+    <target name="drt" description="Runs the System Controls DRTs">
+        <echo message="|      System Controls DRT starting                        |"/>
+        <ant dir="${basedir}/test/ant/" target="drt" inheritAll="false">
+            <property name="drt.cc.mode" value="true"/>
+        </ant>
+        <echo message="|      System Controls DRT ending                          |"/>
+    </target>
+
+    <target name="prepare">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.lib.dir}"/>
+        <mkdir dir="${classes.dir}"/>
+    </target>
+
+</project>

Added: incubator/beehive/trunk/system-controls/external/commons/commons-cli-1.0.jar
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/external/commons/commons-cli-1.0.jar?rev=169351&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/beehive/trunk/system-controls/external/commons/commons-cli-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/beehive/trunk/system-controls/external/commons/commons-collections.jar
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/external/commons/commons-collections.jar?rev=169351&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/beehive/trunk/system-controls/external/commons/commons-collections.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/beehive/trunk/system-controls/external/ejb/geronimo-spec-j2ee-1.4-rc2.jar
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/external/ejb/geronimo-spec-j2ee-1.4-rc2.jar?rev=169351&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/beehive/trunk/system-controls/external/ejb/geronimo-spec-j2ee-1.4-rc2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/beehive/trunk/system-controls/external/jms/geronimo-spec-jms-1.0-M1.jar
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/external/jms/geronimo-spec-jms-1.0-M1.jar?rev=169351&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/beehive/trunk/system-controls/external/jms/geronimo-spec-jms-1.0-M1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/beehive/trunk/system-controls/src/ejb/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/ejb/build.xml?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/ejb/build.xml (added)
+++ incubator/beehive/trunk/system-controls/src/ejb/build.xml Mon May  9 13:17:58 2005
@@ -0,0 +1,57 @@
+<?xml version="1.0" ?>
+
+<project name="ejb-control" default="build" basedir=".">
+
+    <import file="../../systemcontrols-imports.xml"/>
+    <property name="module.name" value="ejb-control"/>
+    <property name="module.dir" location="${src.dir}/ejb"/>
+
+    <path id="module.classpath">
+        <pathelement path="${classes.dir}/${module.name}-xbean"/>
+        <path refid="controls.dependency.path"/>
+        <path refid="ejb.dependency.path"/>
+        <path refid="velocity.dependency.path"/>
+        <path refid="log4j.dependency.path"/>
+        <path refid="xbean.dependency.path"/>
+        <path refid="tools.dependency.path"/>
+    </path>
+
+    <taskdef name="control-jar"
+        classname="org.apache.beehive.controls.runtime.packaging.ControlJarTask"
+        onerror="report"
+        classpathref="module.classpath"/>
+
+
+    <!-- =================================================================== -->
+    <!-- clean - cleans the Ejb Control                                      -->
+    <!-- =================================================================== -->
+    <target name="clean" description="Deletes all generated files.">
+        <delete dir="${classes.dir}/${module.name}"/>
+        <delete dir="${classes.dir}/${module.name}-xbean"/>
+        <delete dir="${gen.src.dir}/${module.name}"/>
+        <delete file="${build.lib.dir}/${ejbcontrol.jar.name}"/>
+    </target>
+
+    <!-- =================================================================== -->
+    <!-- build - build the Ejb Control                                       -->
+    <!-- =================================================================== -->
+    <target name="build" description="Builds ejb-control sources.">
+
+        <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="${classes.dir}/${module.name}-xbean"/>
+        <mkdir dir="${gen.src.dir}/${module.name}"/>
+
+        <build-schemas srcdir="${module.dir}/schema" destdir="${classes.dir}/${module.name}-xbean"/>
+
+        <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}/${ejbcontrol.jar.name}" basedir="${classes.dir}/${module.name}"/>
+    </target>
+
+</project>

Added: incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControl.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControl.java (added)
+++ incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControl.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.ejb;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.bean.AnnotationConstraints.MembershipRule;
+import org.apache.beehive.controls.api.bean.AnnotationConstraints.MembershipRuleValues;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+/**
+ * Enterprise Java Bean Control base interface
+ */
+@ControlInterface (defaultBinding="org.apache.beehive.controls.system.ejb.EJBControlImpl")
+public interface EJBControl
+{
+
+    /**
+     * EJBHome specifies the target EJB's home interface for the EJB control
+     * - jndiName specifies the JNDI name of the target EJB's home interface
+     *   (e.g. EJBNameHome).  This value may also be an URL using the "JNDI:" 
+     *   protocol (e.g. jndi://username:password@host:port/EJBNameHome).
+     * - ejbLink specifies the name of the target EJB using the application
+     *   relative path to the EJB JAR.  This syntax causes the runtime to
+     *   use an application scoped name when locating the referenced EJB.  
+     *   The naming syntax is BeanName#EJBJAR (e.g. CreditCard#CustomerData.jar).
+     */
+    @PropertySet
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.FIELD})  // allow override on declaration
+    @MembershipRule(MembershipRuleValues.EXACTLY_ONE)
+    public @interface EJBHome
+    {
+        String jndiName() default "";
+        String ejbLink()  default "";
+    }
+
+    /**
+     * JNDIContextEnv specifies the environment properties for the JNDI context that will
+     * be used to lookup the target EJB.  This attribute is optional.  If you are using 
+     * an URL with the "JNDI:" protocol or if you want to use a JNDI context with the 
+     * default envirnoment properties, you do not need a specify any values for this attribute. 
+     */
+    @PropertySet
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.FIELD})  // allow override on declaration
+    public @interface JNDIContextEnv
+    {
+        @AnnotationMemberTypes.Optional
+        String contextFactory() default "";
+
+        @AnnotationMemberTypes.Optional
+        String providerURL() default "";
+
+        @AnnotationMemberTypes.Optional
+        String principal() default "";
+
+        @AnnotationMemberTypes.Optional
+        String credentials() default "";
+    }
+
+    
+    /**
+     * Returns an instance of the home interface associated with
+     * the target bean component.
+     */
+    public Object getEJBHomeInstance();
+
+    /**
+     * Returns true if the EJB control currently has a target bean instance
+     * upon which bean business interface methods may be invoked.  This will
+     * be true after a successful create() or single select finder method
+     * execution, or in cases where implicit creation or find has occurred
+     * by the control on the control users behalf.  This provides a simple
+     * way to procedurally check the status of explicit or implicit
+     * bean instance creation or find operations.
+     */
+    public boolean  hasEJBBeanInstance();
+
+    /**
+     * Returns the current target instance of the bean business interface
+     * used for business interface method invocations.  This API is
+     * provided for advanced use cases were direct access to the local/
+     * remote interfaces outside of the control is required.  It will
+     * return <code>null</code> if no target instance is currently
+     * selected.
+     */
+    public Object  getEJBBeanInstance();
+
+    /**
+     * Returns the last EJB exception serviced by the EJB control on the
+     * developers behalf.  This can be used to discover or log additional
+     * information, for example when a create or find method is unable to
+     * locate a target bean instance.
+     */
+    public Throwable getEJBException();
+}

Added: incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlAssembler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlAssembler.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlAssembler.java (added)
+++ incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlAssembler.java Mon May  9 13:17:58 2005
@@ -0,0 +1,419 @@
+/*
+ * 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.ejb;
+
+import org.apache.beehive.controls.api.assembly.ControlAssembler;
+import org.apache.beehive.controls.api.assembly.ControlAssemblyException;
+import org.apache.beehive.controls.api.assembly.ControlAssemblyContext;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+
+import org.apache.beehive.controls.system.ejb.schemas.j2ee.*;
+
+import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.lang.String;
+
+/**
+ * The EJBControl needs to inject EJB reference entries into the
+ * DD of its containing module for cases where ejb-link is used.
+ */
+public class EJBControlAssembler implements ControlAssembler
+{
+    public void assemble(ControlAssemblyContext cac)
+        throws ControlAssemblyException
+    {
+        System.err.println("EJBControlAssembler.assemble() called");
+
+        Class controlInterface = cac.getControlType();
+        EJBInfo ei = new EJBInfo( controlInterface );
+
+        EJBControl.EJBHome ea = cac.getControlAnnotation(EJBControl.EJBHome.class);
+        if ( ea == null )
+        {
+            System.err.println( "Missing EJBHome annotation on control?!");
+            return;
+        }
+
+        String ejbLinkValue = ea.ejbLink();
+        if ( ejbLinkValue == null || ejbLinkValue.length() == 0 )
+        {
+            // Not using ejb-link, so no ejb-ref injection needed
+            return;
+        }
+
+        if (cac instanceof ControlAssemblyContext.EJBModule)
+        {
+            // insert any required <ejb-ref> entries into the deployment descriptor
+        	updateEJBJar( (ControlAssemblyContext.EJBModule)cac, ei, ejbLinkValue );
+        }
+        else if (cac instanceof ControlAssemblyContext.WebAppModule)
+        {
+        	updateWebApp( (ControlAssemblyContext.WebAppModule)cac, ei, ejbLinkValue );
+        }
+        else
+        {
+            System.err.println("EJBControlAssembler - no work to do, assembly context is not EJB.");
+        }
+    }
+
+    protected void updateEJBJar( ControlAssemblyContext.EJBModule ejbCtx,
+        EJBInfo ei, String ejbLinkValue )
+        throws ControlAssemblyException
+    {
+        System.err.println("EJBControlAssembler.updateEJBJar() called");
+        System.err.println(" ei=" + ei );
+        System.err.println(" ejbLinkValue=" + ejbLinkValue );
+
+        File ejbJarFile = ejbCtx.getEjbJarXml();
+        FileInputStream ejbJarStream = null;
+        try
+        {
+            ejbJarStream = new FileInputStream( ejbJarFile );
+        }
+        catch (FileNotFoundException fnfe)
+        {
+            System.err.println("*** Warning *** EJBControlAssembler aborted: " +
+                "caught FileNotFoundException attempting to read file " +
+                ejbJarFile.getAbsolutePath() + ". Message: " +
+                fnfe.getMessage());
+            return;
+        }
+
+        try
+        {
+            // get name of EJB reference to be inserted
+            String insertedEjbRefName = ei._refName;
+
+            // get the existing <ejb-jar> XBean from the stream
+            EjbJarDocument ejbDoc = EjbJarDocument.Factory.parse(ejbJarStream);
+
+            // copy ejbDoc XmlObject so can makes changes to it
+            ejbDoc = (EjbJarDocument)ejbDoc.copy();
+            EjbJarType ejbJarType = ejbDoc.getEjbJar();
+            EnterpriseBeansType entBeansType = ejbJarType.getEnterpriseBeans();
+
+            // TODO: support Entity & other bean types
+            SessionBeanType[] sessionArray = entBeansType.getSessionArray();
+            for (int i=0; i<sessionArray.length; i++)
+            {
+                SessionBeanType sessionBean = sessionArray[i];
+
+                if (ei._isLocal)
+                	insertEJBLocalRefInEJBJar(sessionBean, ei, ejbLinkValue);
+                else
+                	insertEJBRefInEJBJar(sessionBean, ei, ejbLinkValue);
+
+            }
+
+            // overwrite existing ejb-jar.xml file with new document
+            XmlOptions xmlOpts = new XmlOptions();
+            xmlOpts.setSavePrettyPrint();
+            ejbDoc.save(ejbJarFile, xmlOpts);
+        }
+        catch(IOException ioe)
+        {
+            System.err.println("EJBControlAssembler: caught IOException " +
+                "attempting to write to file " + ejbJarFile.getAbsolutePath() +
+                ". Message: " + ioe.getMessage());
+        }
+        catch(XmlException xe)
+        {
+            System.err.println("EJBControlAssembler: caught XmlException " +
+                "attempting xml manipulations. Message: " +
+                xe.getMessage());
+        }
+        finally
+        {
+            try
+            {
+                if (ejbJarStream != null)
+                {
+                    ejbJarStream.close();
+                }
+            }
+            catch(IOException e)
+            {
+                // do nothing
+            }
+        }
+    }
+
+    protected void insertEJBRefInEJBJar(SessionBeanType sessionBean, EJBInfo ei, String ejbLinkValue)
+    {
+        System.err.println("EJBControlAssembler.insertEJBRefInEJBJar() called");
+        System.err.println("ejbLinkValue =" + ejbLinkValue );
+        EjbRefType[] ejbRefArray = sessionBean.getEjbRefArray();
+        String insertedEjbRefName = ei._refName;
+        XmlCursor ejbJarXmlCursor = null;
+
+        try {
+			for (int j=ejbRefArray.length-1; j>=0; j--)
+			{
+			    EjbRefType ejbRef = ejbRefArray[j];
+			    ejbJarXmlCursor = ejbRef.newCursor();
+			    String ejbRefName = ejbRef.getEjbRefName().getStringValue();
+			    if (insertedEjbRefName.equals(ejbRefName))
+			    {
+			        sessionBean.removeEjbRef(j);
+			        break;
+			    }
+			}
+			// insert a new <ejb-ref> entry and fill in the values
+		    EjbRefType insertedEjbRef = sessionBean.insertNewEjbRef(0);
+
+		    EjbRefNameType ejbRefName = insertedEjbRef.addNewEjbRefName();
+		    ejbRefName.setStringValue(insertedEjbRefName);
+
+		    EjbRefTypeType ejbRefType = insertedEjbRef.addNewEjbRefType();
+		    ejbRefType.setStringValue(ei._beanType);
+
+		    HomeType homeType = insertedEjbRef.addNewHome();
+		    homeType.setStringValue(ei._homeInterface.getName());
+		    RemoteType remoteType = insertedEjbRef.addNewRemote();
+		    remoteType.setStringValue(ei._beanInterface.getName());
+
+		    EjbLinkType ejbLink = insertedEjbRef.addNewEjbLink();
+		    ejbLink.setStringValue(ejbLinkValue);
+		}
+        finally
+        {
+            if (ejbJarXmlCursor != null)
+            {
+                ejbJarXmlCursor.dispose();
+            }
+        }
+
+    }
+
+    protected void insertEJBLocalRefInEJBJar(SessionBeanType sessionBean, EJBInfo ei, String ejbLinkValue)
+    {
+        System.err.println("EJBControlAssembler.insertEJBLocalRefInEJBJar() called");
+        System.err.println("ejbLinkValue =" + ejbLinkValue );
+        EjbLocalRefType[] ejbLocalRefArray = sessionBean.getEjbLocalRefArray();
+        String insertedEjbRefName = ei._refName;
+        XmlCursor ejbJarXmlCursor = null;
+
+        try {
+			for (int j=ejbLocalRefArray.length-1; j>=0; j--)
+			{
+			    EjbLocalRefType ejbLocalRef = ejbLocalRefArray[j];
+			    ejbJarXmlCursor = ejbLocalRef.newCursor();
+			    String ejbRefName = ejbLocalRef.getEjbRefName().getStringValue();
+			    if (insertedEjbRefName.equals(ejbRefName))
+			    {
+			        sessionBean.removeEjbLocalRef(j);
+			        break;
+			    }
+			}
+			// insert a new <ejb-local-ref> entry and fill in the values
+        	EjbLocalRefType insertedEJBLocalRef = sessionBean.insertNewEjbLocalRef(0);
+
+            EjbRefNameType ejbRefName = insertedEJBLocalRef.addNewEjbRefName();
+            ejbRefName.setStringValue(insertedEjbRefName);
+
+            EjbRefTypeType ejbRefType = insertedEJBLocalRef.addNewEjbRefType();
+            ejbRefType.setStringValue(ei._beanType);
+
+            LocalHomeType homeType = insertedEJBLocalRef.addNewLocalHome();
+            homeType.setStringValue(ei._homeInterface.getName());
+            LocalType localType = insertedEJBLocalRef.addNewLocal();
+            localType.setStringValue(ei._beanInterface.getName());
+
+            EjbLinkType ejbLink = insertedEJBLocalRef.addNewEjbLink();
+            ejbLink.setStringValue(ejbLinkValue);
+		}
+        finally
+        {
+            if (ejbJarXmlCursor != null)
+            {
+                ejbJarXmlCursor.dispose();
+            }
+        }
+
+    }
+
+    protected void updateWebApp( ControlAssemblyContext.WebAppModule webAppCcc,
+            EJBInfo ei, String ejbLinkValue )
+            throws ControlAssemblyException
+        {
+	        System.err.println("EJBControlAssembler.updateWebApp() called");
+	        System.err.println("ei =" + ei);
+	        System.err.println("ejbLinkValue =" + ejbLinkValue );
+            File webXmlFile = webAppCcc.getWebXml();
+            FileInputStream webXmlStream = null;
+            try
+            {
+                webXmlStream = new FileInputStream( webXmlFile );
+            }
+            catch (FileNotFoundException fnfe)
+            {
+                System.err.println("EJBControlAssembler: " +
+                        "caught FileNotFoundException attempting to read file " +
+                        webXmlFile.getAbsolutePath() + ". Message: " +
+                        fnfe.getMessage());
+                return;
+            }
+
+            try
+            {
+                // get the existing <web-app> XBean from the stream
+                WebAppDocument webAppDoc = WebAppDocument.Factory.parse(webXmlStream);
+
+                // copy webAppDoc XmlObject so can makes changes to it
+                webAppDoc = (WebAppDocument)webAppDoc.copy();
+                WebAppType webAppType = webAppDoc.getWebApp();
+
+                if (ei._isLocal)
+                	insertEJBLocalRefInWebApp(webAppType, ei, ejbLinkValue);
+                else
+                	insertEJBRefInWebApp(webAppType, ei, ejbLinkValue);
+
+                // overwrite existing web.xml file with new document
+                XmlOptions xmlOpts = new XmlOptions();
+                xmlOpts.setSavePrettyPrint();
+                webAppDoc.save(webXmlFile, xmlOpts);
+            }
+            catch(IOException ioe)
+            {
+                System.err.println("ServiceControlAssembler: caught IOException " +
+                    "attempting to write to file " + webXmlFile.getAbsolutePath() +
+                    ". Message: " + ioe.getMessage());
+            }
+            catch(XmlException xe)
+            {
+                System.err.println("ServiceControlAssembler: caught XmlException " +
+                    "attempting xml manipulations. Message: " +
+                    xe.getMessage());
+            }
+            finally
+            {
+                try
+                {
+                    if (webXmlStream != null)
+                    {
+                        webXmlStream.close();
+                    }
+                }
+                catch(IOException e)
+                {
+                    // do nothing
+                }
+            }
+
+        }
+
+    protected void insertEJBRefInWebApp(WebAppType webAppType, EJBInfo ei, String ejbLinkValue)
+    {
+        System.err.println("EJBControlAssembler.insertEJBRefInWebApp() called");
+        System.err.println("ejbLinkValue =" + ejbLinkValue );
+
+        EjbRefType[] ejbRefArray = webAppType.getEjbRefArray();
+        String insertedEjbRefName = ei._refName;
+        XmlCursor webXmlCursor = null;
+
+        try {
+			for (int j=ejbRefArray.length-1; j>=0; j--)
+			{
+			    EjbRefType ejbRef = ejbRefArray[j];
+			    webXmlCursor = ejbRef.newCursor();
+			    String ejbRefName = ejbRef.getEjbRefName().getStringValue();
+			    if (insertedEjbRefName.equals(ejbRefName))
+			    {
+			    	webAppType.removeEjbRef(j);
+			        break;
+			    }
+			}
+			// insert a new <ejb-ref> entry and fill in the values
+		    EjbRefType insertedEjbRef = webAppType.insertNewEjbRef(0);
+
+		    EjbRefNameType ejbRefName = insertedEjbRef.addNewEjbRefName();
+		    ejbRefName.setStringValue(insertedEjbRefName);
+
+		    EjbRefTypeType ejbRefType = insertedEjbRef.addNewEjbRefType();
+		    ejbRefType.setStringValue(ei._beanType);
+
+		    HomeType homeType = insertedEjbRef.addNewHome();
+		    homeType.setStringValue(ei._homeInterface.getName());
+		    RemoteType remoteType = insertedEjbRef.addNewRemote();
+		    remoteType.setStringValue(ei._beanInterface.getName());
+
+		    EjbLinkType ejbLink = insertedEjbRef.addNewEjbLink();
+		    ejbLink.setStringValue(ejbLinkValue);
+		}
+        finally
+        {
+            if (webXmlCursor != null)
+            {
+                webXmlCursor.dispose();
+            }
+        }
+
+    }
+
+    protected void insertEJBLocalRefInWebApp(WebAppType webAppType, EJBInfo ei, String ejbLinkValue)
+    {
+        System.err.println("EJBControlAssembler.insertEJBLocalRefInWebApp() called");
+        System.err.println("ejbLinkValue =" + ejbLinkValue );
+
+        EjbLocalRefType[] ejbLocalRefArray = webAppType.getEjbLocalRefArray();
+        String insertedEjbRefName = ei._refName;
+        XmlCursor webXmlCursor = null;
+
+        try {
+			for (int j=ejbLocalRefArray.length-1; j>=0; j--)
+			{
+			    EjbLocalRefType ejbLocalRef = ejbLocalRefArray[j];
+			    webXmlCursor = ejbLocalRef.newCursor();
+			    String ejbRefName = ejbLocalRef.getEjbRefName().getStringValue();
+			    if (insertedEjbRefName.equals(ejbRefName))
+			    {
+			    	webAppType.removeEjbLocalRef(j);
+			        break;
+			    }
+			}
+			// insert a new <ejb-local-ref> entry and fill in the values
+        	EjbLocalRefType insertedEJBLocalRef = webAppType.insertNewEjbLocalRef(0);
+
+            EjbRefNameType ejbRefName = insertedEJBLocalRef.addNewEjbRefName();
+            ejbRefName.setStringValue(insertedEjbRefName);
+
+            EjbRefTypeType ejbRefType = insertedEJBLocalRef.addNewEjbRefType();
+            ejbRefType.setStringValue(ei._beanType);
+
+            LocalHomeType homeType = insertedEJBLocalRef.addNewLocalHome();
+            homeType.setStringValue(ei._homeInterface.getName());
+            LocalType localType = insertedEJBLocalRef.addNewLocal();
+            localType.setStringValue(ei._beanInterface.getName());
+
+            EjbLinkType ejbLink = insertedEJBLocalRef.addNewEjbLink();
+            ejbLink.setStringValue(ejbLinkValue);
+		}
+        finally
+        {
+            if (webXmlCursor != null)
+            {
+            	webXmlCursor.dispose();
+            }
+        }
+
+    }
+}

Added: incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.jcs
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.jcs?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.jcs (added)
+++ incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBControlImpl.jcs Mon May  9 13:17:58 2005
@@ -0,0 +1,462 @@
+/*
+ * 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.ejb;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Hashtable;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBObject;
+import javax.ejb.FinderException;
+import javax.ejb.Handle;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.context.ControlBeanContext.LifeCycle;
+import org.apache.beehive.controls.api.context.ResourceContext;
+import org.apache.beehive.controls.api.context.ResourceContext.ResourceEvents;
+import org.apache.beehive.controls.api.events.EventHandler;
+
+import org.apache.beehive.controls.system.ejb.EJBControl.EJBHome;
+import org.apache.beehive.controls.system.ejb.EJBControl.JNDIContextEnv;
+
+/**
+ * The Enterprise Java Bean Control implementation class
+ */
+@ControlImplementation
+abstract public class EJBControlImpl
+    implements EJBControl, Extensible, java.io.Serializable {
+    static final long serialVersionUID = 1L;
+
+    static public final int     SESSION_BEAN      = 1;
+    static public final int     ENTITY_BEAN       = 2;
+
+    static public final String  JNDI_GLOBAL_PREFIX  = "jndi:";
+    static public final String  JNDI_APPSCOPED_PREFIX    = "java:comp/env/";
+
+    @EventHandler(field="context", eventSet=LifeCycle.class, eventName="onCreate")
+    public void onCreate()
+    {
+        // first time initialization
+
+        // assume v2 attributes
+        EJBHome ejbHome = (EJBHome)context.getControlPropertySet(EJBHome.class);
+        if (ejbHome == null)
+        {
+            throw new ControlException("No @EJBHome property is defined");
+        }
+        _jndiName = ejbHome.jndiName();
+        if (_jndiName == null || _jndiName.length() == 0)
+        {
+            String ejbLink = ejbHome.ejbLink();
+            if (ejbLink.length() == 0)
+            {
+                //
+                // Should be caught by the compiler
+                //
+                throw new ControlException(
+                          "Either the jndiName() or ejbLink() member of @EJBHome must be defined.");
+            }
+
+            //
+            // Generate a unique local jndi name to associate w/ the link,
+            // based upon the local control service uri and control id
+            //
+            _jndiName = JNDI_APPSCOPED_PREFIX +
+                        EJBInfo.getEJBRefName(context.getControlInterface());
+        }
+
+        // Obtain the JCX interface and identify the home/remote
+        // interfaces.
+        EJBInfo beanInfo = new EJBInfo(context.getControlInterface());
+        _homeInterface = beanInfo._homeInterface;
+        _beanInterface = beanInfo._beanInterface;
+        _beanType = beanInfo._beanType.equals("Session") ? SESSION_BEAN : ENTITY_BEAN;
+        
+    }
+
+    static protected boolean methodThrows(Method m, Class exceptionClass)
+    {
+        Class [] exceptions = m.getExceptionTypes();
+        for (int j = 0; j < exceptions.length; j++)
+            if (exceptionClass.isAssignableFrom(exceptions[j]))
+                return true;
+        return false;
+    }
+
+    protected boolean isHomeMethod(Method m)
+    {
+         return m.getDeclaringClass().isAssignableFrom(_homeInterface);
+    }
+
+    static protected boolean isCreateMethod(Method m)
+    {
+        return methodThrows(m, CreateException.class);
+    }
+
+    static protected boolean isFinderMethod(Method m)
+    {
+        if (!m.getName().startsWith("find")) // EJB enforced pattern
+            return false;
+        return methodThrows(m, FinderException.class);
+    }
+
+    protected boolean isSelectorMethod(Method m)
+    {
+        if (isHomeMethod(m) &&
+            m.getReturnType().equals(_beanInterface))
+            return true;
+        return false;
+    }
+
+    static protected boolean isRemoveMethod(Method m)
+    {
+        if (!m.getName().equals("remove") ||
+            (m.getParameterTypes().length != 0))
+            return false;
+
+        return true;
+    }
+
+    protected Object homeNarrow(Object obj)
+    {
+        if (javax.ejb.EJBHome.class.isAssignableFrom(_homeInterface))
+            return PortableRemoteObject.narrow(obj, _homeInterface);
+        return obj;
+    }
+
+    protected Object beanNarrow(Object obj)
+    {
+        if (javax.ejb.EJBObject.class.isAssignableFrom(_beanInterface))
+            return PortableRemoteObject.narrow(obj, _beanInterface);
+        return obj;
+    }
+
+    /*
+     * This method is implemented by the appropriate bean type-specific
+     * control to provide auto create/find semantics for bean instances.
+     *
+     * IT SHOULD ALWAYS THROW A RUNTIME EXCEPTION WITH A TYPE-SPECIFIC
+     * ERROR MESSAGE IF RESOLUTION CANNOT TAKE PLACE.  IT SHOULD _NEVER_
+     * HAVE A NON-EXCEPTED RETURN WHERE _beanInstance == null.
+     */
+    abstract protected Object resolveBeanInstance();
+
+    //
+    // Is there is a cached EJB handle associated with this bean, then
+    // is it to restore the associate EJB object reference.
+    //
+    protected Object resolveBeanInstanceFromHandle()
+    {
+        if (_beanHandle == null)
+            return null;
+
+        try
+        {
+            return _beanHandle.getEJBObject();
+        }
+        catch (java.rmi.RemoteException re)
+        {
+            throw new ControlException("Unable to convert EJB handle to object", re);
+        }
+    }
+
+    //
+    // Attempts to save the contents of the current bean reference in persisted
+    // control state.  Returns true if state could be saved, false otherwise
+    //
+    protected boolean saveBeanInstance()
+    {
+        // Nothing to save == success
+        if (_beanInstance == null)
+            return true;
+
+        //
+        // Save using a bean handle, but handles only exist for remote objects.
+        //
+        if (_beanInstance instanceof EJBObject)
+        {
+            try
+            {
+                _beanHandle = ((EJBObject)_beanInstance).getHandle();
+            }
+            catch (java.rmi.RemoteException re)
+            {
+                throw new ControlException("Unable to get bean instance from handle", re);
+            }
+
+            return true;
+        }
+        return false;
+    }
+
+    //
+    // This is called whenever a bean reference is being dropped, and is the
+    // provides an opportunity to reset cached state or release non-persisted
+    // resources associated with the instance.
+    //
+    protected void releaseBeanInstance(boolean alreadyRemoved)
+    {
+        _beanInstance = null;
+        _beanHandle = null;
+    }
+    
+    protected javax.naming.Context getInitialContext() throws NamingException
+    {
+        if (_context == null)
+        {
+	        //If naming context information is provided, then use that to create the initial context
+	        JNDIContextEnv env = (JNDIContextEnv)context.getControlPropertySet(JNDIContextEnv.class);
+	        String value = env.contextFactory();
+	        if (value != null && value.length() > 0)
+	        {
+	            Hashtable ht = new Hashtable();
+	            ht.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, value);
+	            value = env.providerURL();
+	            if (value != null && value.length() > 0)
+	                ht.put(javax.naming.Context.PROVIDER_URL, value);
+	            value = env.principal();
+	            if (value != null && value.length() > 0)
+	                ht.put(javax.naming.Context.SECURITY_PRINCIPAL, value);
+	            value = env.credentials();
+	            if (value != null && value.length() > 0)
+	                ht.put(javax.naming.Context.SECURITY_CREDENTIALS, value);
+	            _context = new InitialContext(ht);
+	        }
+	        else
+	        {
+	            _context = new InitialContext();
+	        }
+        }
+        return _context;
+
+    }
+
+    @EventHandler(field="resourceContext", eventSet=ResourceEvents.class, eventName="onAcquire")
+    public void onAcquire()
+    {
+        // Compute the home instance cache lookup key.  The Service URI must
+        // be taken into account because different services use different
+        // class loaders.  The JNDI home must be taken into account because
+        // it is possible to be a remote client of the same bean type on two
+        // different providers.
+        //
+        if (_homeInstance == null)
+        {
+            // If JNDI name is an URL using a JNDI protocol
+            if (_jndiName.toLowerCase().startsWith(JNDI_GLOBAL_PREFIX))
+            {
+	            URLConnection jndiConn = null;
+	            try
+	            {
+	                URL url = new URL(_jndiName);
+	                jndiConn = url.openConnection();
+	                _homeInstance = jndiConn.getContent();
+	            }
+	            catch (MalformedURLException mue)
+	            {
+	                throw new ControlException(_jndiName +
+	                            " is not a valid JNDI URL", mue);
+	            }
+	            catch (IOException ioe)
+	            {
+	                throw new ControlException("Error during JNDI lookup from "+
+	                                           _jndiName, ioe);
+	            }
+	            finally
+	            {
+	                try { if (jndiConn != null) { /* jndiConn.disconnect();*/ } }
+	                catch (RuntimeException re) { throw re; }
+	                catch (Exception e)
+	                {
+	                }
+	            }
+            }
+            else
+            {
+                try 
+                {
+                    javax.naming.Context ctx = getInitialContext();
+                    _homeInstance = ctx.lookup(_jndiName);
+                }
+                catch (Exception ne)
+                {
+                    throw new ControlException("Error during JNDI lookup from " + _jndiName, ne);
+                }
+            }
+            
+            if (!_homeInterface.isAssignableFrom(_homeInstance.getClass()))
+            {
+                throw new ControlException("JNDI lookup of " + _jndiName +
+                            " failed to return an instance of " +
+                            _homeInterface);
+            }
+        }
+    }
+
+    @EventHandler(field="resourceContext", eventSet=ResourceEvents.class, eventName="onRelease")
+    public void onRelease()
+    {
+        //
+        // If conversational, attempt to save the bean reference,
+        // else always release it if stateless or not persistable.
+        //
+        //if (context.getService().getConversationID() == null ||
+        if (!saveBeanInstance())
+        {
+            releaseBeanInstance(false);
+        }
+    }
+
+    //@EventHandler(field="context", eventSet=LifeCycle.class, eventName="onReset")
+    public void onReset()
+    {
+        _lastException = null;
+        // other work in onRelease(), delivered prior to reset event
+    }
+
+    /**
+     * Extensible.invoke
+     * Handles all extended interface methods (i.e. EJB home and remote
+     * interface invocation)
+     */
+    public Object invoke(Method m, Object[] args) throws Throwable
+    {
+        Object retval = null;
+
+        if (isHomeMethod(m))
+        {
+            try
+            {
+                retval = m.invoke(_homeInstance, args);
+            }
+            catch (Exception e)
+            {
+                Throwable t = e;
+                if (e instanceof InvocationTargetException)
+                    t = ((InvocationTargetException)e).getTargetException();
+
+                _lastException = t;
+
+                throw t;
+            }
+
+            // If the method was successful and returns an instance of
+            // the bean interface class, then reset the target instance.
+            if (isSelectorMethod(m))
+            {
+                releaseBeanInstance(false);
+                retval = beanNarrow(retval);
+                _beanInstance = retval;
+            }
+
+
+            return retval;
+        }
+        else // is remote / bean interface
+        {
+            if (_beanInstance == null)
+                _beanInstance = resolveBeanInstance();
+
+            // By convention, the below cond should never be true.  The bean
+            // type-specific resolve should throw an appropriate exception
+            // that is more specific.  This is a safety net.
+            if (_beanInstance == null)
+            {
+                throw new ControlException("Unable to resolve bean instance");
+            }
+
+            try
+            {
+                return m.invoke(_beanInstance, args);
+            }
+            catch (Exception e)
+            {
+                Throwable t = e;
+                if (e instanceof InvocationTargetException)
+                    t = ((InvocationTargetException)e).getTargetException();
+                _lastException = t;
+
+                throw t;
+            }
+            finally
+            {
+                // Handle remove method properly
+                if (isRemoveMethod(m))
+                    releaseBeanInstance(true);
+            }
+        }
+    }
+
+    /**
+     * EJBControl.getEJBHomeInstance()
+     */
+    public Object getEJBHomeInstance()
+    {
+        return _homeInstance;
+    }
+
+    /**
+     * EJBControl.getEJBBeanInstance()
+     */
+    public boolean hasEJBBeanInstance()
+    {
+        return _beanInstance != null;
+    }
+
+    /**
+     * EJBControl.getEJBBeanInstance()
+     */
+    public Object getEJBBeanInstance()
+    {
+        return _beanInstance;
+    }
+
+    /**
+     * EJBControl.getEJBException()
+     */
+    public Throwable getEJBException()
+    {
+        return _lastException;
+    }
+
+    @Context ControlBeanContext context;
+    @Context ResourceContext resourceContext;
+
+    protected Class  _controlInterface;
+    protected Class  _homeInterface;
+    protected Class  _beanInterface;
+    protected int    _beanType;
+    protected String _jndiName;
+    protected Handle _beanHandle;
+    protected transient javax.naming.Context _context; // don't persist
+    protected transient Throwable _lastException;      // don't persist
+    protected transient Object _beanInstance;          // don't persist
+    protected transient Object _homeInstance;          // don't persist
+}
\ No newline at end of file

Added: incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBInfo.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBInfo.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBInfo.java (added)
+++ incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EJBInfo.java Mon May  9 13:17:58 2005
@@ -0,0 +1,193 @@
+/*
+ * 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.ejb;
+
+import org.apache.beehive.controls.api.ControlException;
+
+import javax.ejb.EJBLocalHome;
+import javax.ejb.FinderException;
+import java.util.HashMap;
+import java.util.Vector;
+import java.lang.reflect.Method;
+
+/**
+ * The EJBInfo class is a support class that derives EJB information by
+ * reflecting on an EJB control interface.  This is implemented by a
+ * static inner class to make this functionality accesible in both static
+ * and non-static contexts
+ */
+public class EJBInfo
+{
+    public String _refName;
+    public Class _homeInterface;
+    public Class _beanInterface;
+    public String _beanType;
+    public boolean _isLocal;
+
+    public String toString()
+    {
+        return "{refname=" + _refName + " home=" + _homeInterface.getName() + " remote=" + _beanInterface.getName() +
+               " type=" + _beanType + " local=" + _isLocal + "}";
+    }
+
+    /**
+     * Derives bean attributes from the control interface
+     */
+    public EJBInfo(Class controlInterface)
+    {
+        _refName = getEJBRefName( controlInterface );
+
+        Class localHome = null;
+        Class localBean = null;
+        Class remoteHome = null;
+        Class remoteBean = null;
+
+        //
+        // To identify the identify home and bean interfaces, we
+        // must reflect the interface hierarchy of the provided
+        // class.
+        //
+        Vector checkList = new Vector();
+        Class [] subintfs = controlInterface.getInterfaces();
+        for (int i = 0; i < subintfs.length; i++)
+            checkList.add(subintfs[i]);
+
+        HashMap derivesFrom = new HashMap();
+        for (int i = 0; i < checkList.size(); i++)
+        {
+            Class intf = (Class)checkList.elementAt(i);
+
+            if (javax.ejb.EJBHome.class.isAssignableFrom(intf))
+                remoteHome = intf;
+            else if (javax.ejb.EJBLocalHome.class.isAssignableFrom(intf))
+                localHome = intf;
+            else if (javax.ejb.EJBObject.class.isAssignableFrom(intf))
+                remoteBean = intf;
+            else if (javax.ejb.EJBLocalObject.class.isAssignableFrom(intf))
+                localBean = intf;
+            else
+            {
+                //
+                // If none of the above, add any new subinterfaces to
+                // the search list.
+                //
+                subintfs = intf.getInterfaces();
+                for (int j = 0; j < subintfs.length; j++)
+                {
+                    if (!checkList.contains(subintfs[j]))
+                    {
+                        checkList.add(subintfs[j]);
+                        derivesFrom.put(subintfs[j], intf);
+                    }
+                }
+            }
+        }
+
+        //
+        // From the located methods, identify the home/bean interfaces.
+        //
+        if (remoteHome != null)
+        {
+            if (localHome != null)
+            {
+                throw new ControlException(controlInterface +
+                                           " extends multiple EJB home interfaces.");
+            }
+            _homeInterface = getRoot(remoteHome, derivesFrom);
+        }
+        else if (localHome != null)
+        {
+            _homeInterface = getRoot(localHome, derivesFrom);
+        }
+        else
+        {
+            throw new ControlException(controlInterface +
+                " does not extend the EJBHome or EJBLocalHome interfaces");
+        }
+
+        if (remoteBean != null)
+        {
+            if (localBean != null)
+            {
+                throw new ControlException("Interface " + controlInterface +
+                            " extends multiple EJB object interfaces.");
+            }
+            _beanInterface = getRoot(remoteBean, derivesFrom);
+        }
+        else if (localBean != null)
+        {
+            _beanInterface = getRoot(localBean, derivesFrom);
+        }
+        else
+        {
+            throw new ControlException("Interface " + controlInterface +
+             " does not extend the EJBObject or EJBLocalObject interfaces");
+        }
+
+        // Identify the bean type via bean interface reflection
+        _beanType = "Session";
+        Method [] homeMethods = _homeInterface.getMethods();
+        for (int i = 0; i < homeMethods.length; i++)
+        {
+            if (isFinderMethod(homeMethods[i]))
+            {
+                _beanType = "Entity";
+                break;
+            }
+        }
+
+        _isLocal = (EJBLocalHome.class.isAssignableFrom(_homeInterface));
+    }
+
+    /**
+     * Unwinds the results of reflecting through the interface inheritance
+     * hierachy to find the original root class from a derived class
+     */
+    public Class getRoot(Class clazz, HashMap derivesFrom)
+    {
+        while (derivesFrom.containsKey(clazz))
+            clazz = (Class)derivesFrom.get(clazz);
+        return clazz;
+    }
+
+    static protected boolean isFinderMethod(Method m)
+    {
+        if (!m.getName().startsWith("find")) // EJB enforced pattern
+            return false;
+        return methodThrows(m, FinderException.class);
+    }
+
+    static protected boolean methodThrows(Method m, Class exceptionClass)
+    {
+        Class [] exceptions = m.getExceptionTypes();
+        for (int j = 0; j < exceptions.length; j++)
+            if (exceptionClass.isAssignableFrom(exceptions[j]))
+                return true;
+        return false;
+    }
+
+    /**
+     * Computes a unique local ejb ref name based upon the JCX class name
+     */
+    static public String getEJBRefName(Class jcxClass)
+    {
+        return jcxClass.getName() + ".jcx";
+    }
+
+}
+

Added: incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EntityEJBControl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EntityEJBControl.java?rev=169351&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EntityEJBControl.java (added)
+++ incubator/beehive/trunk/system-controls/src/ejb/org/apache/beehive/controls/system/ejb/EntityEJBControl.java Mon May  9 13:17:58 2005
@@ -0,0 +1,56 @@
+/*
+ * 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.ejb;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+/**
+ * As part of the EJB control, this interface simplifies access to
+ * entity Enterprise JavaBeans (EJBs). You do not need to call
+ * methods of this interface.
+ * <br/><br/>
+ * The EJB control is actually made up of two main interfaces,
+ * one for access to entity EJBs
+ * and another for access to session EJBs. The presence of these
+ * two interfaces is invisible when you use the EJB control; their
+ * methods are called behind the scenes.
+ * <br/><br/>
+ * Typically, you use the EJB control by adding the control to
+ * a component design (such as a web service or pageflow design),
+ * then calling the methods it provides. Those methods are not
+ * exposed by these control interfaces, but rather
+ * are extensions of the EJB itself that are generated when you add
+ * the EJB control.
+ * <br/><br/>
+ * For more information about using the EJB control, see
+ * <a href="../../../../guide/controls/ejb/navEJBControl.html">EJB Control</a>.
+ */
+@ControlInterface (defaultBinding="org.apache.beehive.controls.system.ejb.EntityEJBControlImpl")
+public interface EntityEJBControl extends EJBControl
+{
+    /**
+     * Supports iteration through a Collection of entity bean instances
+     * returned by a multi-select finder method. This method selects
+     * the next bean instance in the collection as the internal control
+     * instance, and returns the bean instance. The method will return
+     * null if no additional instances remain to be processed.
+     *
+     * @return The next bean instance if any remain; otherwise, null.
+     */
+    public Object  getEJBNextBeanInstance();
+}