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/06/14 23:14:49 UTC
svn commit: r190657 [16/23] - in /incubator/beehive/trunk/system-controls:
./ ant/ samples/ejb/
samples/ejb/client/org/apache/beehive/controls/system/ejb/sample/client/
samples/ejb/control/org/apache/beehive/controls/system/ejb/sample/control/
samples/ejb/ejb/META-INF/
samples/ejb/ejb/org/apache/beehive/controls/system/ejb/sample/bean/
samples/jdbc/jdbcControlSample/ samples/jdbc/jdbcControlSample/META-INF/
samples/jdbc/jdbcControlSample/WEB-INF/
samples/jdbc/jdbcControlSample/WEB-INF/src/
samples/jdbc/jdbcControlSample/WEB-INF/src/controls/
samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/
samples/jdbc/jdbcControlSample/WEB-INF/src/shared/ samples/jms/
samples/jms/src/org/apache/beehive/controls/system/jms/samples/
samples/webservice/amazon/ samples/webservice/amazon/junit/
samples/webservice/amazon/schemas/ samples/webservice/common/src/test/
samples/webservice/google/ samples/webservice/google/junit/model/
samples/webservice/google/rpc_schemas/ samples/webservice/google/servlet/
samples/webservice/wsm_samples_client/
samples/webservice/wsm_samples_client/junit/
samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/
samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/
samples/webservice/xmlbeans/ samples/webservice/xmlbeans/junit/ src/ejb/
src/ejb/org/apache/beehive/controls/system/ejb/ src/ejb/schema/ src/jdbc/
src/jdbc/org/apache/beehive/controls/system/jdbc/
src/jdbc/org/apache/beehive/controls/system/jdbc/parser/ src/jms/
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/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/ant/ test/conf/ test/src/jdbc/controls/
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/badusers/
test/src/jdbc/controls/schemas/users/ test/src/jdbc/jdbc-container/
test/src/jdbc/jdbc-container/application/
test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/containertest/
test/src/jdbc/jdbc-container/webapp/WEB-INF/
test/src/jdbc/jdbc-container/webapp/conf/Catalina/localhost/
test/src/jdbc/junitTests/
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/
test/src/webservice/ test/src/webservice/jcxgen-tests/
test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/
test/src/webservice/schemas/ test/src/webservice/servers/webapp/WEB-INF/
test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/
test/src/webservice/servers/webapp/WEB-INF/src/web/
test/src/webservice/servers/webapp/WEB-INF/webservices/web/complex/
test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/dlwservice/
Propchange: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlGrammarTokenManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlParser.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlParser.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlParser.java (original)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlParser.java Tue Jun 14 14:14:42 2005
@@ -1,84 +1,84 @@
-/*
- * 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.parser;
-
-import org.apache.beehive.controls.api.ControlException;
-
-import java.util.HashMap;
-import java.io.StringReader;
-
-/**
- * The SqlParser class is a thread-safe class which parses a string containing a SQL statement
- * with JdbcControl substitituion delimiters. It is important to note that the SQL is not parsed/validated - only
- * the sections within the SQL string which are delimited by '{' and '}' are parsed.
- * <p/>
- * Parsing is accomplished using the JavaCC grammar file <tt>SqlGrammer.jj</tt>. As the string is parsed it is broken
- * into fragments by the parser. Any portion of the string which is not between '{' and '}' delimiters becomes a
- * <tt>LiteralFragment</tt>. The portions of the SQL string which fall between the start and end delimiters are categorized as
- * either <tt>JdbcFragment</tt>, <tt>ReflectionFragment</tt>, or <tt>SqlSubstitutionFragment</tt>.
- * <p/>
- * Fragments which subclass <tt>SqlFragmentContainer</tt> may contain other fragments as children. Fragements subclassed
- * from <tt>SqlFragment</tt> my not contain child fragments. Upon completion of parsing a <tt>SqlStatement</tt> is
- * returned to the caller. The <tt>SqlStatement</tt> contains the heirarchary of fragments which have been derived
- * from the orignal SQL string.
- * <p/>
- * The parser will also cache all <tt>SqlStatements</tt> which contain non-volitale SQL. Only <tt>SqlEscapeFragments</tt>
- * contain volitile SQL at this point.
- */
-public final class SqlParser {
-
- // maintain a cache of SQLStatements which have already been parsed
- private HashMap<String, SqlStatement> _cachedSqlStatements;
-
- /**
- * Create a new instance of the SqlParser.
- */
- public SqlParser() {
- _cachedSqlStatements = new HashMap<String, SqlStatement>();
- }
-
- /**
- * Parse the sql and return an SqlStatement.
- *
- * @param sql A String contianing the sql to parse.
- * @return A SqlStatement instance.
- */
- public SqlStatement parse(String sql) {
-
- // does a cached parse result exist for this statement?
- if (_cachedSqlStatements.containsKey(sql)) {
- return _cachedSqlStatements.get(sql);
- }
-
- SqlGrammar _parser = new SqlGrammar(new StringReader(sql));
- SqlStatement parsed = null;
- try {
- parsed = _parser.parse();
- } catch (ParseException e) {
- throw new ControlException("Error parsing SQL statment." + e.getMessage(), e);
- } catch (TokenMgrError tme) {
- throw new ControlException("Error parsing SQL statment. " + tme.getMessage(), tme);
- }
-
- if (parsed.isCacheable()) {
- _cachedSqlStatements.put(sql, parsed);
- }
- return parsed;
- }
-}
+/*
+ * 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.parser;
+
+import org.apache.beehive.controls.api.ControlException;
+
+import java.util.HashMap;
+import java.io.StringReader;
+
+/**
+ * The SqlParser class is a thread-safe class which parses a string containing a SQL statement
+ * with JdbcControl substitituion delimiters. It is important to note that the SQL is not parsed/validated - only
+ * the sections within the SQL string which are delimited by '{' and '}' are parsed.
+ * <p/>
+ * Parsing is accomplished using the JavaCC grammar file <tt>SqlGrammer.jj</tt>. As the string is parsed it is broken
+ * into fragments by the parser. Any portion of the string which is not between '{' and '}' delimiters becomes a
+ * <tt>LiteralFragment</tt>. The portions of the SQL string which fall between the start and end delimiters are categorized as
+ * either <tt>JdbcFragment</tt>, <tt>ReflectionFragment</tt>, or <tt>SqlSubstitutionFragment</tt>.
+ * <p/>
+ * Fragments which subclass <tt>SqlFragmentContainer</tt> may contain other fragments as children. Fragements subclassed
+ * from <tt>SqlFragment</tt> my not contain child fragments. Upon completion of parsing a <tt>SqlStatement</tt> is
+ * returned to the caller. The <tt>SqlStatement</tt> contains the heirarchary of fragments which have been derived
+ * from the orignal SQL string.
+ * <p/>
+ * The parser will also cache all <tt>SqlStatements</tt> which contain non-volitale SQL. Only <tt>SqlEscapeFragments</tt>
+ * contain volitile SQL at this point.
+ */
+public final class SqlParser {
+
+ // maintain a cache of SQLStatements which have already been parsed
+ private HashMap<String, SqlStatement> _cachedSqlStatements;
+
+ /**
+ * Create a new instance of the SqlParser.
+ */
+ public SqlParser() {
+ _cachedSqlStatements = new HashMap<String, SqlStatement>();
+ }
+
+ /**
+ * Parse the sql and return an SqlStatement.
+ *
+ * @param sql A String contianing the sql to parse.
+ * @return A SqlStatement instance.
+ */
+ public SqlStatement parse(String sql) {
+
+ // does a cached parse result exist for this statement?
+ if (_cachedSqlStatements.containsKey(sql)) {
+ return _cachedSqlStatements.get(sql);
+ }
+
+ SqlGrammar _parser = new SqlGrammar(new StringReader(sql));
+ SqlStatement parsed = null;
+ try {
+ parsed = _parser.parse();
+ } catch (ParseException e) {
+ throw new ControlException("Error parsing SQL statment." + e.getMessage(), e);
+ } catch (TokenMgrError tme) {
+ throw new ControlException("Error parsing SQL statment. " + tme.getMessage(), tme);
+ }
+
+ if (parsed.isCacheable()) {
+ _cachedSqlStatements.put(sql, parsed);
+ }
+ return parsed;
+ }
+}
Propchange: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java (original)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java Tue Jun 14 14:14:42 2005
@@ -1,522 +1,522 @@
-/*
- * 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.parser;
-
-import org.apache.beehive.controls.api.ControlException;
-import org.apache.beehive.controls.api.context.ControlBeanContext;
-import org.apache.beehive.controls.system.jdbc.JdbcControl;
-import org.apache.beehive.controls.system.jdbc.TypeMappingsFactory;
-
-import javax.sql.RowSet;
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.Calendar;
-
-/**
- * Represents a fully parsed SQL statement. SqlStatements can be used to generated a java.sql.PreparedStatement.
- */
-public final class SqlStatement extends SqlFragmentContainer implements Serializable {
-
- private static final TypeMappingsFactory _tmf = TypeMappingsFactory.getInstance();
- private boolean _callableStatement = false;
- private boolean _cacheableStatement = true;
-
- //
- // set from SQL annotation element values
- //
- private boolean _batchUpdate;
- private boolean _getGeneratedKeys;
- private String[] _genKeyColumnNames;
- private int _fetchSize;
- private int _maxArray;
- private int _maxRows;
- private int[] _genKeyColumnIndexes;
- private JdbcControl.ScrollType _scrollType;
- private JdbcControl.FetchDirection _fetchDirection;
- private JdbcControl.HoldabilityType _holdability;
-
- /**
- * Create a new SqlStatement.
- */
- SqlStatement() {
- super();
- }
-
- /**
- * Append a SqlFragment to the end of this statement.
- *
- * @param frag SqlFragment to append.
- */
- void addChild(SqlFragment frag) {
- super.addChild(frag);
-
- if (frag.isDynamicFragment()) {
- _cacheableStatement = false;
- }
- }
-
-
- /**
- * Can the PreparedStatement generated by this class be cached?
- *
- * @return true if this statement can be cached by the SqlParser.
- */
- boolean isCacheable() { return _cacheableStatement; }
-
-
- /**
- * Does this statement generate a callable or prepared statement?
- *
- * @return true if this statement generates callable statement.
- */
- public boolean isCallableStatement() { return _callableStatement; }
-
- /**
- * Does this statement do a batch update?
- *
- * @return true if this statement should be executed as a batch update.
- */
- public boolean isBatchUpdate() { return _batchUpdate; }
-
- /**
- * Does this statement return generatedKeys?
- *
- * @return true if getGeneratedKeys set to true.
- */
- public boolean getsGeneratedKeys() { return _getGeneratedKeys; }
-
- /**
- * Generates the PreparedStatement the SQL statement.
- *
- * @param context ControlBeanContext instance.
- * @param connection Connection to database.
- * @param calendar Calendar instance which can be used to resolve date/time values.
- * @param method Method the SQL is associated with.
- * @param arguments Method parameters.
- * @return The PreparedStatement generated by this statement.
- * @throws SQLException If PreparedStatement cannot be created.
- */
- public PreparedStatement createPreparedStatement(ControlBeanContext context, Connection connection,
- Calendar calendar, Method method, Object[] arguments)
- throws SQLException {
-
- PreparedStatement preparedStatement = null;
- loadSQLAnnotationStatmentOptions(context, method);
- checkJdbcSupport(connection.getMetaData());
-
- _callableStatement = setCallableStatement(arguments);
-
- try {
- final String sql = getPreparedStatementText(context, method, arguments);
-
- //
- // is this a request for generatedKeys ?
- //
- if (_getGeneratedKeys) {
-
- if (_callableStatement) {
- throw new ControlException("getGeneratedKeys not supported for CallableStatements");
- }
-
- if (_genKeyColumnNames.length > 0) {
- preparedStatement = connection.prepareStatement(sql, _genKeyColumnNames);
- } else if (_genKeyColumnIndexes.length > 0) {
- preparedStatement = connection.prepareStatement(sql, _genKeyColumnIndexes);
- } else {
- preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
- }
-
- } else {
-
- if (_holdability == JdbcControl.HoldabilityType.DRIVER_DEFAULT) {
- if (_scrollType == JdbcControl.ScrollType.DRIVER_DEFAULT) {
- preparedStatement = (_callableStatement) ? connection.prepareCall(sql) : connection.prepareStatement(sql);
- } else {
- preparedStatement = (_callableStatement)
- ? connection.prepareCall(sql, _scrollType.getType(), _scrollType.getConcurrencyType())
- : connection.prepareStatement(sql, _scrollType.getType(), _scrollType.getConcurrencyType());
- }
- } else {
- preparedStatement = (_callableStatement)
- ? connection.prepareCall(sql, _scrollType.getType(), _scrollType.getConcurrencyType(), _holdability.getHoldability())
- : connection.prepareStatement(sql, _scrollType.getType(), _scrollType.getConcurrencyType(), _holdability.getHoldability());
- }
- }
-
- //
- // If the method argument is of type SQLParameter, treat this statement as a CallableStatement,
- //
- if (_callableStatement) {
- for (SqlFragment sf : _children) {
- if (sf.hasParamValue()) {
- throw new ControlException("Cannot use parameter substution and SQLParameter array in the same method.");
- }
- }
- JdbcControl.SQLParameter[] params = (JdbcControl.SQLParameter[]) arguments[0];
- if (params == null) {
- return preparedStatement;
- }
- for (int i = 0; i < params.length; i++) {
- JdbcControl.SQLParameter p = params[i];
- if (p.dir != JdbcControl.SQLParameter.OUT) {
- Object value = params[i].value;
- setPreparedStatementParameter(preparedStatement, i + 1, value, params[i].type, calendar);
- }
-
- if (p.dir != JdbcControl.SQLParameter.IN) {
- ((CallableStatement) preparedStatement).registerOutParameter(i + 1, params[i].type);
- }
- }
-
-
- //
- // special handling for batch updates
- //
- } else if (_batchUpdate) {
- doBatchUpdate(preparedStatement, arguments, calendar);
-
-
- //
- // standard case, not a batch or callable
- //
- } else {
- int pIndex = 1;
- for (SqlFragment sf : _children) {
- if (sf.hasParamValue()) {
- Object values[] = sf.getParameterValues(context, method, arguments);
- for (Object value : values) {
- setPreparedStatementParameter(preparedStatement, pIndex++, value, sf.getParamSqlDataType(), calendar);
- }
- }
- }
- }
- } catch (SQLException e) {
- if (preparedStatement != null) preparedStatement.close();
- throw e;
- }
-
- preparedStatement.setFetchDirection(_fetchDirection.getDirection());
- preparedStatement.setFetchSize(_fetchSize);
- preparedStatement.setMaxRows(computeMaxRows(method));
-
- return preparedStatement;
- }
-
- /**
- * Generates the PreparedStatement the SQL statement.
- *
- * @param context ControlBeanContext instance.
- * @param connection Connection to database.
- * @param method Method the SQL is associated with.
- * @param arguments Method parameters.
- * @return The PreparedStatement generated by this statement.
- */
- public String createPreparedStatementString(ControlBeanContext context, Connection connection,
- Method method, Object[] arguments) {
-
- final boolean callableStatement = setCallableStatement(arguments);
- StringBuilder sqlString = new StringBuilder(getPreparedStatementText(context, method, arguments));
-
- if (callableStatement) {
- JdbcControl.SQLParameter[] params = (JdbcControl.SQLParameter[]) arguments[0];
- if (params == null) {
- return sqlString.toString();
- }
-
- sqlString.append(" Params: {");
- for (int i = 0; i < params.length; i++) {
- if (i > 0) { sqlString.append(params[i].value.toString()); }
- }
- sqlString.append("}");
-
- } else if (_batchUpdate) {
- sqlString.append(" Params: batch update.");
-
- } else {
- sqlString.append(" Params: {");
- boolean first = true;
- for (SqlFragment sf : _children) {
- if (sf.hasParamValue()) {
- Object values[] = sf.getParameterValues(context, method, arguments);
- for (Object value : values) {
-
- if (!first) sqlString.append(", "); else first = false;
- sqlString.append(value);
- }
- }
- }
- sqlString.append("}");
- }
- return sqlString.toString();
- }
-
-
- // /////////////////////////////////////////////////// PRIVATE METHODS ///////////////////////////////////////////
-
- /**
- * Sets the specified parameter in the prepared statement.
- *
- * @param ps A PreparedStatement.
- * @param i index of parameter to set.
- * @param value value of the parameter.
- * @param sqlType SQL type of value.
- * @param cal A calendar instance used to resolve date/time values.
- * @throws SQLException If the parameter cannot be set.
- */
- private void setPreparedStatementParameter(PreparedStatement ps, int i, Object value, int sqlType, Calendar cal)
- throws SQLException {
-
- if (sqlType == Types.NULL) {
- sqlType = _tmf.getSqlType(value);
- }
-
- if (value == null) {
- ps.setNull(i, Types.NULL == sqlType ? Types.VARCHAR : sqlType);
- return;
- }
-
- switch (sqlType) {
-
- case Types.VARCHAR:
- if (!(value instanceof String)) value = value.toString();
- break;
-
- case Types.BOOLEAN:
- if (value instanceof Boolean) {
- ps.setBoolean(i, ((Boolean) value).booleanValue());
- return;
- }
- break;
-
- case Types.TIMESTAMP:
- if (value instanceof java.util.Calendar) {
- Calendar calValue = (Calendar) value;
-
-// @todo: validate it is correct to comment out call to deprectated method
-// if (cal == null) {
-// /* NOTE: drivers are inconsistent in their handling of setTimestamp(i,date,cal)
-// * so we won't use that, unless the user calls setCalendar().
-// * I'm going with the theory that it makes sense to store
-// * the time relative to the Calendar's timezone rather than
-// * the system timezone otherwise, using a Calendar would be a no-op.
-// */
-// value = new java._sql.Timestamp(calValue.get(Calendar.YEAR) - 1900,
-// calValue.get(Calendar.MONTH),
-// calValue.get(Calendar.DATE),
-// calValue.get(Calendar.HOUR_OF_DAY),
-// calValue.get(Calendar.MINUTE),
-// calValue.get(Calendar.SECOND),
-// calValue.get(Calendar.MILLISECOND));
-// } else {
- value = new java.sql.Timestamp(calValue.getTimeInMillis());
-// }
- } else if (java.util.Date.class.equals(value.getClass())) {
- // some drivers don't like java.util.Date
- value = new java.sql.Timestamp(((java.util.Date) value).getTime());
- }
-
- if (value instanceof java.sql.Timestamp) {
- if (cal == null)
- ps.setTimestamp(i, (java.sql.Timestamp) value);
- else
- ps.setTimestamp(i, (java.sql.Timestamp) value, cal);
- return;
- }
- break;
-
- case Types.DATE:
- if (value instanceof java.util.Calendar) {
- /* NOTE: see note above
- Calendar cal = (Calendar)value;
- value = new java._sql.Date(cal.getTimeInMillis());
- ps.setDate(i, (java._sql.Date)value, cal);
- return;
- */
- Calendar calValue = (Calendar) value;
-
- // @todo: validate that commenting out deprected method is correct behavior
-// if (cal == null) {
-// value = new java._sql.Date(calValue.get(Calendar.YEAR - 1900),
-// calValue.get(Calendar.MONTH),
-// calValue.get(Calendar.DATE));
-// } else {
- value = new java.sql.Date(calValue.getTimeInMillis());
-// }
- } else if (value.getClass() == java.util.Date.class) {
- // some drivers don't like java.util.Date
- value = new java.sql.Date(((java.util.Date) value).getTime());
- }
-
- if (value instanceof java.sql.Date) {
- if (cal == null) {
- ps.setDate(i, (java.sql.Date) value);
- } else {
- ps.setDate(i, (java.sql.Date) value, cal);
- }
- return;
- }
- break;
-
- case Types.TIME:
- if (value instanceof java.sql.Time) {
- if (cal == null) {
- ps.setTime(i, (java.sql.Time) value);
- } else {
- ps.setTime(i, (java.sql.Time) value, cal);
- }
- return;
- }
- break;
- }
-
- if (sqlType == Types.NULL) {
- ps.setObject(i, value);
- } else {
- ps.setObject(i, value, sqlType);
- }
- }
-
- /**
- * Determine if this SQL will generate a callable or prepared statement.
- *
- * @param args The method's argument list which this SQL annotation was assocatied with.
- * @return true if this statement will generated a CallableStatement
- */
- private boolean setCallableStatement(Object[] args) {
-
- // CallableStatement vs. PreparedStatement
- if (args != null && args.length == 1 && args[0] != null) {
- Class argClass = args[0].getClass();
- if (argClass.isArray() && JdbcControl.SQLParameter.class.isAssignableFrom(argClass.getComponentType())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Build a prepared statement for a batch update.
- *
- * @param ps The PreparedStatement object.
- * @param args The parameter list of the jdbccontrol method.
- * @param cal A Calendar instance used to resolve date/time values.
- * @throws SQLException If a batch update cannot be performed.
- */
- private void doBatchUpdate(PreparedStatement ps, Object[] args, Calendar cal) throws SQLException {
-
- final int[] sqlTypes = new int[args.length];
- final Object[] objArrays = new Object[args.length];
-
- // build an array of type values and object arrays
- for (int i = 0; i < args.length; i++) {
- sqlTypes[i] = _tmf.getSqlType(args[i].getClass().getComponentType());
- objArrays[i] = TypeMappingsFactory.toObjectArray(args[i]);
- }
-
- final int rowCount = ((Object[]) objArrays[0]).length;
- for (int i = 0; i < rowCount; i++) {
- for (int j = 0; j < args.length; j++) {
- setPreparedStatementParameter(ps, j + 1, ((Object[]) objArrays[j])[i], sqlTypes[j], cal);
- }
- ps.addBatch();
- }
- }
-
- /**
- * Load element values from the SQL annotation which apply to Statements.
- *
- * @param context ControlBeanContext instance.
- * @param method Annotated method.
- */
- private void loadSQLAnnotationStatmentOptions(ControlBeanContext context, Method method) {
-
- final JdbcControl.SQL methodSQL = (JdbcControl.SQL) context.getMethodPropertySet(method, JdbcControl.SQL.class);
-
- _batchUpdate = methodSQL.batchUpdate();
- _getGeneratedKeys = methodSQL.getGeneratedKeys();
- _genKeyColumnNames = methodSQL.generatedKeyColumnNames();
- _genKeyColumnIndexes = methodSQL.generatedKeyColumnIndexes();
- _scrollType = methodSQL.scrollableResultSet();
- _fetchDirection = methodSQL.fetchDirection();
- _fetchSize = methodSQL.fetchSize();
- _maxRows = methodSQL.maxRows();
- _maxArray = methodSQL.arrayMaxLength();
-
- _holdability = methodSQL.resultSetHoldabilityOverride();
- }
-
- /**
- * Checks that all statement options specified in annotation are supported by the database.
- *
- * @param metaData
- * @throws SQLException
- */
- private void checkJdbcSupport(DatabaseMetaData metaData) throws SQLException {
-
- if (_getGeneratedKeys && !metaData.supportsGetGeneratedKeys()) {
- throw new ControlException("The database does not support getGeneratedKeys.");
- }
-
- if (_batchUpdate && !metaData.supportsBatchUpdates()) {
- throw new ControlException("The database does not support batchUpdates.");
- }
-
- if (_scrollType != JdbcControl.ScrollType.DRIVER_DEFAULT
- && !metaData.supportsResultSetConcurrency(_scrollType.getType(), _scrollType.getConcurrencyType())) {
- throw new ControlException("The database does not support the ResultSet concurrecy type: " + _scrollType.toString());
- }
-
- if (_holdability != JdbcControl.HoldabilityType.DRIVER_DEFAULT
- && !metaData.supportsResultSetHoldability(_holdability.getHoldability())) {
- throw new ControlException("The database does not support the ResultSet holdability type: " + _holdability.toString());
- }
- }
-
- /**
- * The much maligned method for computing the maximum number of ResultSet rows this statement should return.
- * The values of maxRows and arrayMaxLength are enforced at compile-time by the JdbcControlChecker to be the
- * following: MAXROWS_ALL <= maxRows, 0 < arrayMaxLength
- *
- * @param method The annotated method.
- * @return max number of resultSet rows to return from the query.
- */
- private int computeMaxRows(Method method) {
-
- Class returnType = method.getReturnType();
-
- final boolean isArray = returnType.isArray();
- final boolean isRowSet = returnType.equals(RowSet.class);
-
- int maxSet = _maxRows;
- if (isArray && _maxArray != JdbcControl.MAXROWS_ALL) {
- maxSet = _maxRows == JdbcControl.MAXROWS_ALL ? _maxArray + 1 : Math.min(_maxArray + 1, _maxRows);
- } else if (isRowSet && _maxRows > 0) {
- maxSet = _maxRows + 1;
- }
-
- return maxSet;
- }
-}
+/*
+ * 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.parser;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.system.jdbc.JdbcControl;
+import org.apache.beehive.controls.system.jdbc.TypeMappingsFactory;
+
+import javax.sql.RowSet;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+import java.util.Calendar;
+
+/**
+ * Represents a fully parsed SQL statement. SqlStatements can be used to generated a java.sql.PreparedStatement.
+ */
+public final class SqlStatement extends SqlFragmentContainer implements Serializable {
+
+ private static final TypeMappingsFactory _tmf = TypeMappingsFactory.getInstance();
+ private boolean _callableStatement = false;
+ private boolean _cacheableStatement = true;
+
+ //
+ // set from SQL annotation element values
+ //
+ private boolean _batchUpdate;
+ private boolean _getGeneratedKeys;
+ private String[] _genKeyColumnNames;
+ private int _fetchSize;
+ private int _maxArray;
+ private int _maxRows;
+ private int[] _genKeyColumnIndexes;
+ private JdbcControl.ScrollType _scrollType;
+ private JdbcControl.FetchDirection _fetchDirection;
+ private JdbcControl.HoldabilityType _holdability;
+
+ /**
+ * Create a new SqlStatement.
+ */
+ SqlStatement() {
+ super();
+ }
+
+ /**
+ * Append a SqlFragment to the end of this statement.
+ *
+ * @param frag SqlFragment to append.
+ */
+ void addChild(SqlFragment frag) {
+ super.addChild(frag);
+
+ if (frag.isDynamicFragment()) {
+ _cacheableStatement = false;
+ }
+ }
+
+
+ /**
+ * Can the PreparedStatement generated by this class be cached?
+ *
+ * @return true if this statement can be cached by the SqlParser.
+ */
+ boolean isCacheable() { return _cacheableStatement; }
+
+
+ /**
+ * Does this statement generate a callable or prepared statement?
+ *
+ * @return true if this statement generates callable statement.
+ */
+ public boolean isCallableStatement() { return _callableStatement; }
+
+ /**
+ * Does this statement do a batch update?
+ *
+ * @return true if this statement should be executed as a batch update.
+ */
+ public boolean isBatchUpdate() { return _batchUpdate; }
+
+ /**
+ * Does this statement return generatedKeys?
+ *
+ * @return true if getGeneratedKeys set to true.
+ */
+ public boolean getsGeneratedKeys() { return _getGeneratedKeys; }
+
+ /**
+ * Generates the PreparedStatement the SQL statement.
+ *
+ * @param context ControlBeanContext instance.
+ * @param connection Connection to database.
+ * @param calendar Calendar instance which can be used to resolve date/time values.
+ * @param method Method the SQL is associated with.
+ * @param arguments Method parameters.
+ * @return The PreparedStatement generated by this statement.
+ * @throws SQLException If PreparedStatement cannot be created.
+ */
+ public PreparedStatement createPreparedStatement(ControlBeanContext context, Connection connection,
+ Calendar calendar, Method method, Object[] arguments)
+ throws SQLException {
+
+ PreparedStatement preparedStatement = null;
+ loadSQLAnnotationStatmentOptions(context, method);
+ checkJdbcSupport(connection.getMetaData());
+
+ _callableStatement = setCallableStatement(arguments);
+
+ try {
+ final String sql = getPreparedStatementText(context, method, arguments);
+
+ //
+ // is this a request for generatedKeys ?
+ //
+ if (_getGeneratedKeys) {
+
+ if (_callableStatement) {
+ throw new ControlException("getGeneratedKeys not supported for CallableStatements");
+ }
+
+ if (_genKeyColumnNames.length > 0) {
+ preparedStatement = connection.prepareStatement(sql, _genKeyColumnNames);
+ } else if (_genKeyColumnIndexes.length > 0) {
+ preparedStatement = connection.prepareStatement(sql, _genKeyColumnIndexes);
+ } else {
+ preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
+ }
+
+ } else {
+
+ if (_holdability == JdbcControl.HoldabilityType.DRIVER_DEFAULT) {
+ if (_scrollType == JdbcControl.ScrollType.DRIVER_DEFAULT) {
+ preparedStatement = (_callableStatement) ? connection.prepareCall(sql) : connection.prepareStatement(sql);
+ } else {
+ preparedStatement = (_callableStatement)
+ ? connection.prepareCall(sql, _scrollType.getType(), _scrollType.getConcurrencyType())
+ : connection.prepareStatement(sql, _scrollType.getType(), _scrollType.getConcurrencyType());
+ }
+ } else {
+ preparedStatement = (_callableStatement)
+ ? connection.prepareCall(sql, _scrollType.getType(), _scrollType.getConcurrencyType(), _holdability.getHoldability())
+ : connection.prepareStatement(sql, _scrollType.getType(), _scrollType.getConcurrencyType(), _holdability.getHoldability());
+ }
+ }
+
+ //
+ // If the method argument is of type SQLParameter, treat this statement as a CallableStatement,
+ //
+ if (_callableStatement) {
+ for (SqlFragment sf : _children) {
+ if (sf.hasParamValue()) {
+ throw new ControlException("Cannot use parameter substution and SQLParameter array in the same method.");
+ }
+ }
+ JdbcControl.SQLParameter[] params = (JdbcControl.SQLParameter[]) arguments[0];
+ if (params == null) {
+ return preparedStatement;
+ }
+ for (int i = 0; i < params.length; i++) {
+ JdbcControl.SQLParameter p = params[i];
+ if (p.dir != JdbcControl.SQLParameter.OUT) {
+ Object value = params[i].value;
+ setPreparedStatementParameter(preparedStatement, i + 1, value, params[i].type, calendar);
+ }
+
+ if (p.dir != JdbcControl.SQLParameter.IN) {
+ ((CallableStatement) preparedStatement).registerOutParameter(i + 1, params[i].type);
+ }
+ }
+
+
+ //
+ // special handling for batch updates
+ //
+ } else if (_batchUpdate) {
+ doBatchUpdate(preparedStatement, arguments, calendar);
+
+
+ //
+ // standard case, not a batch or callable
+ //
+ } else {
+ int pIndex = 1;
+ for (SqlFragment sf : _children) {
+ if (sf.hasParamValue()) {
+ Object values[] = sf.getParameterValues(context, method, arguments);
+ for (Object value : values) {
+ setPreparedStatementParameter(preparedStatement, pIndex++, value, sf.getParamSqlDataType(), calendar);
+ }
+ }
+ }
+ }
+ } catch (SQLException e) {
+ if (preparedStatement != null) preparedStatement.close();
+ throw e;
+ }
+
+ preparedStatement.setFetchDirection(_fetchDirection.getDirection());
+ preparedStatement.setFetchSize(_fetchSize);
+ preparedStatement.setMaxRows(computeMaxRows(method));
+
+ return preparedStatement;
+ }
+
+ /**
+ * Generates the PreparedStatement the SQL statement.
+ *
+ * @param context ControlBeanContext instance.
+ * @param connection Connection to database.
+ * @param method Method the SQL is associated with.
+ * @param arguments Method parameters.
+ * @return The PreparedStatement generated by this statement.
+ */
+ public String createPreparedStatementString(ControlBeanContext context, Connection connection,
+ Method method, Object[] arguments) {
+
+ final boolean callableStatement = setCallableStatement(arguments);
+ StringBuilder sqlString = new StringBuilder(getPreparedStatementText(context, method, arguments));
+
+ if (callableStatement) {
+ JdbcControl.SQLParameter[] params = (JdbcControl.SQLParameter[]) arguments[0];
+ if (params == null) {
+ return sqlString.toString();
+ }
+
+ sqlString.append(" Params: {");
+ for (int i = 0; i < params.length; i++) {
+ if (i > 0) { sqlString.append(params[i].value.toString()); }
+ }
+ sqlString.append("}");
+
+ } else if (_batchUpdate) {
+ sqlString.append(" Params: batch update.");
+
+ } else {
+ sqlString.append(" Params: {");
+ boolean first = true;
+ for (SqlFragment sf : _children) {
+ if (sf.hasParamValue()) {
+ Object values[] = sf.getParameterValues(context, method, arguments);
+ for (Object value : values) {
+
+ if (!first) sqlString.append(", "); else first = false;
+ sqlString.append(value);
+ }
+ }
+ }
+ sqlString.append("}");
+ }
+ return sqlString.toString();
+ }
+
+
+ // /////////////////////////////////////////////////// PRIVATE METHODS ///////////////////////////////////////////
+
+ /**
+ * Sets the specified parameter in the prepared statement.
+ *
+ * @param ps A PreparedStatement.
+ * @param i index of parameter to set.
+ * @param value value of the parameter.
+ * @param sqlType SQL type of value.
+ * @param cal A calendar instance used to resolve date/time values.
+ * @throws SQLException If the parameter cannot be set.
+ */
+ private void setPreparedStatementParameter(PreparedStatement ps, int i, Object value, int sqlType, Calendar cal)
+ throws SQLException {
+
+ if (sqlType == Types.NULL) {
+ sqlType = _tmf.getSqlType(value);
+ }
+
+ if (value == null) {
+ ps.setNull(i, Types.NULL == sqlType ? Types.VARCHAR : sqlType);
+ return;
+ }
+
+ switch (sqlType) {
+
+ case Types.VARCHAR:
+ if (!(value instanceof String)) value = value.toString();
+ break;
+
+ case Types.BOOLEAN:
+ if (value instanceof Boolean) {
+ ps.setBoolean(i, ((Boolean) value).booleanValue());
+ return;
+ }
+ break;
+
+ case Types.TIMESTAMP:
+ if (value instanceof java.util.Calendar) {
+ Calendar calValue = (Calendar) value;
+
+// @todo: validate it is correct to comment out call to deprectated method
+// if (cal == null) {
+// /* NOTE: drivers are inconsistent in their handling of setTimestamp(i,date,cal)
+// * so we won't use that, unless the user calls setCalendar().
+// * I'm going with the theory that it makes sense to store
+// * the time relative to the Calendar's timezone rather than
+// * the system timezone otherwise, using a Calendar would be a no-op.
+// */
+// value = new java._sql.Timestamp(calValue.get(Calendar.YEAR) - 1900,
+// calValue.get(Calendar.MONTH),
+// calValue.get(Calendar.DATE),
+// calValue.get(Calendar.HOUR_OF_DAY),
+// calValue.get(Calendar.MINUTE),
+// calValue.get(Calendar.SECOND),
+// calValue.get(Calendar.MILLISECOND));
+// } else {
+ value = new java.sql.Timestamp(calValue.getTimeInMillis());
+// }
+ } else if (java.util.Date.class.equals(value.getClass())) {
+ // some drivers don't like java.util.Date
+ value = new java.sql.Timestamp(((java.util.Date) value).getTime());
+ }
+
+ if (value instanceof java.sql.Timestamp) {
+ if (cal == null)
+ ps.setTimestamp(i, (java.sql.Timestamp) value);
+ else
+ ps.setTimestamp(i, (java.sql.Timestamp) value, cal);
+ return;
+ }
+ break;
+
+ case Types.DATE:
+ if (value instanceof java.util.Calendar) {
+ /* NOTE: see note above
+ Calendar cal = (Calendar)value;
+ value = new java._sql.Date(cal.getTimeInMillis());
+ ps.setDate(i, (java._sql.Date)value, cal);
+ return;
+ */
+ Calendar calValue = (Calendar) value;
+
+ // @todo: validate that commenting out deprected method is correct behavior
+// if (cal == null) {
+// value = new java._sql.Date(calValue.get(Calendar.YEAR - 1900),
+// calValue.get(Calendar.MONTH),
+// calValue.get(Calendar.DATE));
+// } else {
+ value = new java.sql.Date(calValue.getTimeInMillis());
+// }
+ } else if (value.getClass() == java.util.Date.class) {
+ // some drivers don't like java.util.Date
+ value = new java.sql.Date(((java.util.Date) value).getTime());
+ }
+
+ if (value instanceof java.sql.Date) {
+ if (cal == null) {
+ ps.setDate(i, (java.sql.Date) value);
+ } else {
+ ps.setDate(i, (java.sql.Date) value, cal);
+ }
+ return;
+ }
+ break;
+
+ case Types.TIME:
+ if (value instanceof java.sql.Time) {
+ if (cal == null) {
+ ps.setTime(i, (java.sql.Time) value);
+ } else {
+ ps.setTime(i, (java.sql.Time) value, cal);
+ }
+ return;
+ }
+ break;
+ }
+
+ if (sqlType == Types.NULL) {
+ ps.setObject(i, value);
+ } else {
+ ps.setObject(i, value, sqlType);
+ }
+ }
+
+ /**
+ * Determine if this SQL will generate a callable or prepared statement.
+ *
+ * @param args The method's argument list which this SQL annotation was assocatied with.
+ * @return true if this statement will generated a CallableStatement
+ */
+ private boolean setCallableStatement(Object[] args) {
+
+ // CallableStatement vs. PreparedStatement
+ if (args != null && args.length == 1 && args[0] != null) {
+ Class argClass = args[0].getClass();
+ if (argClass.isArray() && JdbcControl.SQLParameter.class.isAssignableFrom(argClass.getComponentType())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Build a prepared statement for a batch update.
+ *
+ * @param ps The PreparedStatement object.
+ * @param args The parameter list of the jdbccontrol method.
+ * @param cal A Calendar instance used to resolve date/time values.
+ * @throws SQLException If a batch update cannot be performed.
+ */
+ private void doBatchUpdate(PreparedStatement ps, Object[] args, Calendar cal) throws SQLException {
+
+ final int[] sqlTypes = new int[args.length];
+ final Object[] objArrays = new Object[args.length];
+
+ // build an array of type values and object arrays
+ for (int i = 0; i < args.length; i++) {
+ sqlTypes[i] = _tmf.getSqlType(args[i].getClass().getComponentType());
+ objArrays[i] = TypeMappingsFactory.toObjectArray(args[i]);
+ }
+
+ final int rowCount = ((Object[]) objArrays[0]).length;
+ for (int i = 0; i < rowCount; i++) {
+ for (int j = 0; j < args.length; j++) {
+ setPreparedStatementParameter(ps, j + 1, ((Object[]) objArrays[j])[i], sqlTypes[j], cal);
+ }
+ ps.addBatch();
+ }
+ }
+
+ /**
+ * Load element values from the SQL annotation which apply to Statements.
+ *
+ * @param context ControlBeanContext instance.
+ * @param method Annotated method.
+ */
+ private void loadSQLAnnotationStatmentOptions(ControlBeanContext context, Method method) {
+
+ final JdbcControl.SQL methodSQL = (JdbcControl.SQL) context.getMethodPropertySet(method, JdbcControl.SQL.class);
+
+ _batchUpdate = methodSQL.batchUpdate();
+ _getGeneratedKeys = methodSQL.getGeneratedKeys();
+ _genKeyColumnNames = methodSQL.generatedKeyColumnNames();
+ _genKeyColumnIndexes = methodSQL.generatedKeyColumnIndexes();
+ _scrollType = methodSQL.scrollableResultSet();
+ _fetchDirection = methodSQL.fetchDirection();
+ _fetchSize = methodSQL.fetchSize();
+ _maxRows = methodSQL.maxRows();
+ _maxArray = methodSQL.arrayMaxLength();
+
+ _holdability = methodSQL.resultSetHoldabilityOverride();
+ }
+
+ /**
+ * Checks that all statement options specified in annotation are supported by the database.
+ *
+ * @param metaData
+ * @throws SQLException
+ */
+ private void checkJdbcSupport(DatabaseMetaData metaData) throws SQLException {
+
+ if (_getGeneratedKeys && !metaData.supportsGetGeneratedKeys()) {
+ throw new ControlException("The database does not support getGeneratedKeys.");
+ }
+
+ if (_batchUpdate && !metaData.supportsBatchUpdates()) {
+ throw new ControlException("The database does not support batchUpdates.");
+ }
+
+ if (_scrollType != JdbcControl.ScrollType.DRIVER_DEFAULT
+ && !metaData.supportsResultSetConcurrency(_scrollType.getType(), _scrollType.getConcurrencyType())) {
+ throw new ControlException("The database does not support the ResultSet concurrecy type: " + _scrollType.toString());
+ }
+
+ if (_holdability != JdbcControl.HoldabilityType.DRIVER_DEFAULT
+ && !metaData.supportsResultSetHoldability(_holdability.getHoldability())) {
+ throw new ControlException("The database does not support the ResultSet holdability type: " + _holdability.toString());
+ }
+ }
+
+ /**
+ * The much maligned method for computing the maximum number of ResultSet rows this statement should return.
+ * The values of maxRows and arrayMaxLength are enforced at compile-time by the JdbcControlChecker to be the
+ * following: MAXROWS_ALL <= maxRows, 0 < arrayMaxLength
+ *
+ * @param method The annotated method.
+ * @return max number of resultSet rows to return from the query.
+ */
+ private int computeMaxRows(Method method) {
+
+ Class returnType = method.getReturnType();
+
+ final boolean isArray = returnType.isArray();
+ final boolean isRowSet = returnType.equals(RowSet.class);
+
+ int maxSet = _maxRows;
+ if (isArray && _maxArray != JdbcControl.MAXROWS_ALL) {
+ maxSet = _maxRows == JdbcControl.MAXROWS_ALL ? _maxArray + 1 : Math.min(_maxArray + 1, _maxRows);
+ } else if (isRowSet && _maxRows > 0) {
+ maxSet = _maxRows + 1;
+ }
+
+ return maxSet;
+ }
+}
Propchange: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java (original)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java Tue Jun 14 14:14:42 2005
@@ -1,140 +1,140 @@
-/*
- * 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.parser;
-
-import org.apache.beehive.controls.api.context.ControlBeanContext;
-import org.apache.beehive.controls.system.jdbc.TypeMappingsFactory;
-
-import java.lang.reflect.Method;
-
-/**
- * Represents a fragement from the SQL annotation's statement member which begins with '{sql:'.
- * Substitution fragements are unique in that they are fully evaluated BEFORE a PreparedStatement
- * is generated.
- * <p/>
- * Supported 'sql:' escapes are subst and fn. subst is the default mode, and will be used if 'sql: '
- * is specified.
- *
- * The <tt>fn</tt> variant of this construct has a very ridgid syntax at this point. It must conform to:
- *
- * <pre>
- * {sql:fn in(x,{y})}
- * </pre>
- *
- * where the '{y}' could also be some literal term.
- */
-public class SqlSubstitutionFragment extends SqlFragmentContainer {
-
- /**
- * Constructor for subst or function with no param substitution
- *
- * @param child An child which is contained in this fragment.
- */
- SqlSubstitutionFragment(SqlFragment child) {
- super();
- addChild(child);
- }
-
- /**
- * Constructor for a function which includes a ReflectionFragment
- *
- * @param lf A LiteralFragment which contains the text up to the parameter substitution.
- * @param rf The ReflectionFragment containing the parameter substitution
- * @param lff A LiteralFragment which contains any text which occures after the parameter substitution.
- */
- SqlSubstitutionFragment(LiteralFragment lf, ReflectionFragment rf, LiteralFragment lff) {
- super();
- addChild(lf);
- addChild(rf);
- addChild(lff);
- }
-
- /**
- * Always true for this fragment type
- * @return true
- */
- boolean isDynamicFragment() { return true; }
-
- /**
- * Always false for this fragment type, since all param values are resolved
- * before the prepared statement is created.
- * @return false
- */
- boolean hasParamValue() { return false; }
-
- /**
- * Return the text for a PreparedStatement from this fragment.
- *
- * @param context A ControlBeanContext instance
- * @param m The annotated method
- * @param args The method parameters
- * @return A String containing the value of this fragment and its children
- */
- String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) {
-
- StringBuilder sb = new StringBuilder();
- for (SqlFragment frag : _children) {
- if (frag.hasParamValue()) {
- Object[] pValues = frag.getParameterValues(context, m, args);
- for (Object o : pValues) {
- sb.append(processSqlParams(o));
- }
- } else {
- sb.append(frag.getPreparedStatementText(context, m, args));
- }
- }
- return sb.toString();
- }
-
-
-// ////////////////////////////////////////////// Private Methods //////////////////////////////////////////////
-
-
- /**
- * Check for the cases of a null or array type param value. If array type build a string of the array values
- * seperated by commas.
- *
- * @param value
- * @return
- */
- private String processSqlParams(Object value) {
-
- Object[] arr = null;
- if (value != null) {
- arr = TypeMappingsFactory.toObjectArray(value);
- }
-
- if (value == null || (arr != null && arr.length == 0)) {
- return "";
- } else if (arr != null) {
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < arr.length; i++) {
- if (i > 0) {
- result.append(',');
- result.append(arr[i].toString());
- } else {
- result.append(arr[i].toString());
- }
- }
- return result.toString();
- } else {
- return value.toString();
- }
- }
-}
+/*
+ * 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.parser;
+
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.system.jdbc.TypeMappingsFactory;
+
+import java.lang.reflect.Method;
+
+/**
+ * Represents a fragement from the SQL annotation's statement member which begins with '{sql:'.
+ * Substitution fragements are unique in that they are fully evaluated BEFORE a PreparedStatement
+ * is generated.
+ * <p/>
+ * Supported 'sql:' escapes are subst and fn. subst is the default mode, and will be used if 'sql: '
+ * is specified.
+ *
+ * The <tt>fn</tt> variant of this construct has a very ridgid syntax at this point. It must conform to:
+ *
+ * <pre>
+ * {sql:fn in(x,{y})}
+ * </pre>
+ *
+ * where the '{y}' could also be some literal term.
+ */
+public class SqlSubstitutionFragment extends SqlFragmentContainer {
+
+ /**
+ * Constructor for subst or function with no param substitution
+ *
+ * @param child An child which is contained in this fragment.
+ */
+ SqlSubstitutionFragment(SqlFragment child) {
+ super();
+ addChild(child);
+ }
+
+ /**
+ * Constructor for a function which includes a ReflectionFragment
+ *
+ * @param lf A LiteralFragment which contains the text up to the parameter substitution.
+ * @param rf The ReflectionFragment containing the parameter substitution
+ * @param lff A LiteralFragment which contains any text which occures after the parameter substitution.
+ */
+ SqlSubstitutionFragment(LiteralFragment lf, ReflectionFragment rf, LiteralFragment lff) {
+ super();
+ addChild(lf);
+ addChild(rf);
+ addChild(lff);
+ }
+
+ /**
+ * Always true for this fragment type
+ * @return true
+ */
+ boolean isDynamicFragment() { return true; }
+
+ /**
+ * Always false for this fragment type, since all param values are resolved
+ * before the prepared statement is created.
+ * @return false
+ */
+ boolean hasParamValue() { return false; }
+
+ /**
+ * Return the text for a PreparedStatement from this fragment.
+ *
+ * @param context A ControlBeanContext instance
+ * @param m The annotated method
+ * @param args The method parameters
+ * @return A String containing the value of this fragment and its children
+ */
+ String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) {
+
+ StringBuilder sb = new StringBuilder();
+ for (SqlFragment frag : _children) {
+ if (frag.hasParamValue()) {
+ Object[] pValues = frag.getParameterValues(context, m, args);
+ for (Object o : pValues) {
+ sb.append(processSqlParams(o));
+ }
+ } else {
+ sb.append(frag.getPreparedStatementText(context, m, args));
+ }
+ }
+ return sb.toString();
+ }
+
+
+// ////////////////////////////////////////////// Private Methods //////////////////////////////////////////////
+
+
+ /**
+ * Check for the cases of a null or array type param value. If array type build a string of the array values
+ * seperated by commas.
+ *
+ * @param value
+ * @return
+ */
+ private String processSqlParams(Object value) {
+
+ Object[] arr = null;
+ if (value != null) {
+ arr = TypeMappingsFactory.toObjectArray(value);
+ }
+
+ if (value == null || (arr != null && arr.length == 0)) {
+ return "";
+ } else if (arr != null) {
+ StringBuilder result = new StringBuilder();
+ for (int i = 0; i < arr.length; i++) {
+ if (i > 0) {
+ result.append(',');
+ result.append(arr[i].toString());
+ } else {
+ result.append(arr[i].toString());
+ }
+ }
+ return result.toString();
+ } else {
+ return value.toString();
+ }
+ }
+}
Propchange: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/Token.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/Token.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/Token.java (original)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/Token.java Tue Jun 14 14:14:42 2005
@@ -1,81 +1,81 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
-package org.apache.beehive.controls.system.jdbc.parser;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token {
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /**
- * beginLine and beginColumn describe the position of the first character
- * of this token; endLine and endColumn describe the position of the
- * last character of this token.
- */
- public int beginLine, beginColumn, endLine, endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * Returns the image.
- */
- public String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simlpy add something like :
- *
- * case MyParserConstants.ID : return new IDToken();
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use it in your lexical actions.
- */
- public static final Token newToken(int ofKind)
- {
- switch(ofKind)
- {
- default : return new Token();
- }
- }
-
-}
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+package org.apache.beehive.controls.system.jdbc.parser;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken();
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind)
+ {
+ switch(ofKind)
+ {
+ default : return new Token();
+ }
+ }
+
+}
Propchange: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/Token.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/TokenMgrError.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/TokenMgrError.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/TokenMgrError.java (original)
+++ incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/TokenMgrError.java Tue Jun 14 14:14:42 2005
@@ -1,133 +1,133 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
-package org.apache.beehive.controls.system.jdbc.parser;
-
-public class TokenMgrError extends Error
-{
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occured.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt wass made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their espaced (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexicl error
- * curLexState : lexical state in which this error occured
- * errorLine : line number when the error occured
- * errorColumn : column number when the error occured
- * errorAfter : prefix that was seen before this error occured
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- public TokenMgrError() {
- }
-
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+package org.apache.beehive.controls.system.jdbc.parser;
+
+public class TokenMgrError extends Error
+{
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
Propchange: incubator/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/parser/TokenMgrError.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/src/jms/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jms/build.xml?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jms/build.xml (original)
+++ incubator/beehive/trunk/system-controls/src/jms/build.xml Tue Jun 14 14:14:42 2005
@@ -1,54 +1,54 @@
-<?xml version="1.0" ?>
-
-<project name="jms-control" default="build" basedir=".">
-
- <import file="../../systemcontrols-imports.xml"/>
-
- <property name="module.name" value="jms-control"/>
- <property name="module.dir" location="${src.dir}/jms"/>
-
- <path id="module.classpath">
- <path refid="ejb.dependency.path"/>
- <path refid="controls.dependency.path"/>
- <path refid="velocity.dependency.path"/>
- <path refid="log4j.dependency.path"/>
- <path refid="xbean.dependency.path"/>
- </path>
-
- <!-- =================================================================== -->
- <!-- clean - cleans the Jdbc Control -->
- <!-- =================================================================== -->
- <target name="clean" description="Clean the JMS control build area.">
- <delete dir="${classes.dir}/${module.name}"/>
- <delete dir="${gen.src.dir}/${module.name}"/>
- <delete file="${build.lib.dir}/${jmscontrol.jar.name}"/>
- </target>
-
-
- <!-- =================================================================== -->
- <!-- build - build the Jms Control -->
- <!-- =================================================================== -->
- <target name="build" description="Builds the JMS control.">
-
- <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}/${jmscontrol.jar.name}" basedir="${classes.dir}/${module.name}">
- <manifest>
- <attribute name="Extension-Name" value="Beehive JMS Control"/>
- <attribute name="Specification-Title" value="Beehive JMS Control"/>
- <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
- <attribute name="Specification-Version" value="${beehive.version}"/>
- <attribute name="Implementation-Title" value="Beehive JMS Control"/>
- <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
- <attribute name="Implementation-Version" value="${beehive.version}"/>
- <attribute name="Web-Service-Control-Version" value="${beehive.version}"/>
- </manifest>
- </control-jar>
- </target>
-</project>
+<?xml version="1.0" ?>
+
+<project name="jms-control" default="build" basedir=".">
+
+ <import file="../../systemcontrols-imports.xml"/>
+
+ <property name="module.name" value="jms-control"/>
+ <property name="module.dir" location="${src.dir}/jms"/>
+
+ <path id="module.classpath">
+ <path refid="ejb.dependency.path"/>
+ <path refid="controls.dependency.path"/>
+ <path refid="velocity.dependency.path"/>
+ <path refid="log4j.dependency.path"/>
+ <path refid="xbean.dependency.path"/>
+ </path>
+
+ <!-- =================================================================== -->
+ <!-- clean - cleans the Jdbc Control -->
+ <!-- =================================================================== -->
+ <target name="clean" description="Clean the JMS control build area.">
+ <delete dir="${classes.dir}/${module.name}"/>
+ <delete dir="${gen.src.dir}/${module.name}"/>
+ <delete file="${build.lib.dir}/${jmscontrol.jar.name}"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- build - build the Jms Control -->
+ <!-- =================================================================== -->
+ <target name="build" description="Builds the JMS control.">
+
+ <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}/${jmscontrol.jar.name}" basedir="${classes.dir}/${module.name}">
+ <manifest>
+ <attribute name="Extension-Name" value="Beehive JMS Control"/>
+ <attribute name="Specification-Title" value="Beehive JMS Control"/>
+ <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
+ <attribute name="Specification-Version" value="${beehive.version}"/>
+ <attribute name="Implementation-Title" value="Beehive JMS Control"/>
+ <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
+ <attribute name="Implementation-Version" value="${beehive.version}"/>
+ <attribute name="Web-Service-Control-Version" value="${beehive.version}"/>
+ </manifest>
+ </control-jar>
+ </target>
+</project>
Propchange: incubator/beehive/trunk/system-controls/src/jms/build.xml
------------------------------------------------------------------------------
svn:eol-style = native