diff --git a/ojc-core/jdbcbc/jdbcbcimpl/nbactions.xml b/ojc-core/jdbcbc/jdbcbcimpl/nbactions.xml
deleted file mode 100755
index 5658d512b..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/nbactions.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
- clean
-
- *
-
-
- clean
-
-
- true
-
-
-
- build
-
- *
-
-
- install
-
-
- true
-
-
-
- test
-
- *
-
-
- package
-
-
- false
-
-
-
- rebuild
-
- *
-
-
- clean
- install
-
-
- true
-
-
-
- CUSTOM-testreport
- testreport
-
- surefire-report:report-only
-
-
- true
-
-
-
- CUSTOM-allreports
- allreports
-
- site
-
-
- true
-
-
-
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/pom.xml b/ojc-core/jdbcbc/jdbcbcimpl/pom.xml
deleted file mode 100755
index 00f45c4f7..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/pom.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-
-
-
- build-common
- open-jbi-components
- 1.1
- ../../build-common
-
- 4.0.0
- open-jbi-components
- jdbcbcimpl
- jdbcbcimpl
- ${jdbcbc.artifact.version}
- jdbcbcimpl description
-
-
-
- maven-surefire-plugin
-
-
-
- **/com/sun/jbi/jdbcbc/RuntimeConfigurationTest.java
-
-
-
-
-
-
-
- open-jbi-components
- componentsl
-
-
- net.sf.hulp.meas
- net.sf.hulp.meas.itf
-
-
- wsdl4j
- wsdl4j
-
-
- open-jbi-components
- qos
-
-
- open-jbi-components
- common-util
-
-
-
- jmock
- jmock
- test
-
-
- jmock
- jmock-cglib
- test
-
-
-
-
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/EndpointBean.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/EndpointBean.java
deleted file mode 100755
index 147d7d625..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/EndpointBean.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)EndpointBean.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import com.sun.jbi.eManager.provider.EndpointStatus;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import com.sun.jbi.jdbcbc.model.runtime.DBConnectionInfo;
-
-
-/**
-* author
-*EndPointBean
-**/
-public class EndpointBean implements Serializable {
- static final long serialVersionUID = 42L;
- public static final String SERVICE_NAME = "servicename";
- public static final String FULL_SERVICE_NAME = "fullservicename";
- public static final String ENDPOINT_NAME = "endpointname";
- public static final String ENDPOINT_TYPE = "endpointtype";
- public static final String OPERATION = "operation";
- public static final String ENDPOINT_REFERENCE = "endpointreference";
- public static final String URL_CONTEXT = "urlcontext";
- public static final String URL_PORT = "urlport";
- public static final String MESSAGE_EXCHANGE_PATTERN = "mep";
- public static final String ENDPOINT_URL = "endpointurl";
- public static final String WSDL_FILE = "wsdlfile";
- public static final String JDBC_DATABASE_JNDI_NAME = "jndiName";
- public static final String JDBC_TRANSACTION_REQUIRED = "transactionRequired";
-
- public static final String JDBC_DATABASE_DRIVER_CLASS = "driverClassName";
- public static final String JDBC_DATABASE_URL = "dbURL";
- public static final String JDBC_DATABASE_USER = "userName";
- public static final String JDBC_DATABASE_PASSWORD = "password";
- public static final String JDBC_DATABASE_NAME = "databaseName";
- public static final String STATUS = "status";
- public static final String DESCRIPTOR = "descriptor";
-
- // A map from the operation name to the meta data (in msg type, out msg type, soap action, faults, etc)
- public static final String OPERATION_NAME_TO_META_DATA = "operationnametometadata";
- public static final String ENDPOINT_TYPE_INBOUND = "inbound";
- public static final String ENDPOINT_TYPE_OUTBOUND = "outbound";
- public static final String STATUS_SHUTDOWN = "SHUTDOWN";
- public static final String STATUS_STOPPED = "STOPPED";
- public static final String STATUS_RUNNING = "RUNNING";
- private final HashMap mConfigTable;
- private transient String mDeploymentId;
- private transient String mTriggerName = null;
- private String mTableName = null;
- private EndpointStatus mEndpointStatus;
- private List mrecordList = new ArrayList();
- private DBConnectionInfo mDBConnectionInfo;
-
- // throttling related info
- int maxConcurrencyLimit;
-
- public EndpointBean() {
- //mConfigTable = null;
- mConfigTable = new HashMap();
- }
-
- protected void setDeploymentId(final String asId) {
- mDeploymentId = asId;
- }
-
- public String getDeploymentId() {
- return mDeploymentId;
- }
-
- public void setEndpointStatus(final EndpointStatus val) {
- mEndpointStatus = val;
- }
-
- public EndpointStatus getEndpointStatus() {
- return mEndpointStatus;
- }
-
- /**
- * Get the unique name of this endpoint instance
- * @return
- */
- public String getUniqueName() {
- final String serviceName = getValue(EndpointBean.SERVICE_NAME);
- final String endpointName = getValue(EndpointBean.ENDPOINT_NAME);
- final String endpointType = getValue(EndpointBean.ENDPOINT_TYPE);
-
- return EndpointBean.getUniqueName(serviceName, endpointName, endpointType);
- }
-
- /**
- * Utility method to create the unique names with explicit arguments
- * @param aServiceName
- * @param aEndpointName
- * @param aEndpointType
- * @return
- */
- public static String getUniqueName(final String aServiceName,
- final String aEndpointName, final String aEndpointType) {
- if ((aServiceName != null) && (aEndpointName != null) &&
- (aEndpointType != null)) {
- return aServiceName + "," + aEndpointName + "," + aEndpointType;
- } else {
- return null;
- }
- }
-
- public void setValue(final String key, String value) {
- if (key == null) {
- return;
- }
-
- if (value == null) {
- value = "";
- }
-
- mConfigTable.put(key, value);
- }
-
- public void setValueObj(final String key, final Object value) {
- if (key == null) {
- return;
- }
-
- mConfigTable.put(key, value);
- }
-
- public String getValue(final String key) {
- if (key == null) {
- return null;
- } else {
- return (String) mConfigTable.get(key);
- }
- }
-
- public Object getValueObj(final String key) {
- return mConfigTable.get(key);
- }
-
- public void setProcessList(final List recordList) {
- mrecordList = recordList;
- }
-
- public List getProcessList() {
- return mrecordList;
- }
-
- public void setTriggerName(final String triggerName) {
- mTriggerName = triggerName;
- }
-
- public void setTableName(final String tableName) {
- mTableName = tableName;
- }
-
- public String getTriggerName() {
- return mTriggerName;
- }
-
- public String getTableName() {
- return mTableName;
- }
-
- public void setDBInfo(DBConnectionInfo dbInfo){
- this.mDBConnectionInfo = dbInfo;
- }
-
- public DBConnectionInfo getDBInfo(){
- return this.mDBConnectionInfo;
- }
-
- public void setMaxConcurrencyLimit(int maxConcurrencyLimit){
- this.maxConcurrencyLimit = maxConcurrencyLimit;
- }
-
- public int getMaxConcurrencyLimit(){
- return this.maxConcurrencyLimit;
- }
-
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/FaultException.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/FaultException.java
deleted file mode 100755
index 77ca5d46a..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/FaultException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)FaultException.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import javax.jbi.messaging.MessagingException;
-
-
-/**
- * Contains the information to reply with a fault
- */
-public class FaultException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String mFaultCode;
- private String mFaultString;
- private String mFaultActor;
- private String mDetail;
-
- /** Creates a new instance of HttpException */
- public FaultException() {
- super();
- }
-
- protected FaultException(final MessagingException ex) {
- // default
- mFaultCode = "Server";
- //mFaultString;
- //mFaultActor;
- mDetail = ex.getMessage();
- }
-
- protected String getFaultCode() {
- return mFaultCode;
- }
-
- protected String getFaultString() {
- return mFaultString;
- }
-
- protected String getFaultActor() {
- return mFaultActor;
- }
-
- protected String getDetail() {
- return mDetail;
- }
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/InboundMessageProcessor.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/InboundMessageProcessor.java
deleted file mode 100755
index 2e45ae593..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/InboundMessageProcessor.java
+++ /dev/null
@@ -1,961 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)InboundMessageProcessor.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jbi.component.ComponentContext;
-import javax.jbi.messaging.DeliveryChannel;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.InOnly;
-import javax.jbi.messaging.InOut;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessageExchangeFactory;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-import javax.sql.XAConnection;
-import javax.transaction.Status;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import com.sun.jbi.internationalization.Messages;
-import com.sun.jbi.jdbcbc.model.metadata.DBMetaData;
-import com.sun.jbi.jdbcbc.model.runtime.DBConnectionInfo;
-import com.sun.jbi.jdbcbc.model.runtime.DatabaseModel;
-import com.sun.jbi.jdbcbc.model.runtime.DatabaseModelImpl;
-import com.sun.jbi.jdbcbc.model.runtime.Db2DataAccess;
-import com.sun.jbi.jdbcbc.model.runtime.DerbyDataAccess;
-import com.sun.jbi.jdbcbc.model.runtime.OracleDataAccess;
-import com.sun.jbi.jdbcbc.model.runtime.SqlServerDataAccess;
-import com.sun.jbi.jdbcbc.transaction.TransactionHelper;
-import com.sun.jbi.jdbcbc.transaction.XidImpl;
-import com.sun.jbi.nms.exchange.ExchangePattern;
-
-import com.sun.jbi.common.qos.messaging.MessagingChannel;
-import com.sun.jbi.common.qos.redelivery.Redelivery;
-import com.sun.jbi.common.qos.redelivery.RedeliveryStatus;
-
-
-/**
- * author : Venkat P Process requests received from the External Database
- */
-public class InboundMessageProcessor implements Runnable, MessageExchangeReplyListener, RedeliveryListener {
- private static final String DERBY_PROD_NAME = "DERBY";
-
- private static final String ORACLE_PROD_NAME = "ORACLE";
-
- private static final String SQLSERVER_PROD_NAME = "SQLSERVER";
-
- private static final String DB2_PROD_NAME = "DB2";
-
- private static final String JDBC_PROD_NAME = "JDBC";
-
- private XidImpl xid = null;
-
- private TransactionHelper mTxHelper = null;
-
- // private boolean mtxFlag;
-
- XAResource xaResource = null;
-
- //private TransactionManager mTxManager = null;
-
- private static final Messages mMessages = Messages.getMessages(InboundMessageProcessor.class);
-
- private static final Logger mLogger = Messages.getLogger(InboundMessageProcessor.class);
-
- @SuppressWarnings("unchecked")
- private static final Map mInboundExchanges = Collections.synchronizedMap(new HashMap());
-
- private static Map exchangeIDToMeta = Collections.synchronizedMap(new HashMap());
-
-
- Map mEndpoint;
-
- EndpointBean epb;
-
- DocumentBuilder mDocBuilder;
-
- //private DeliveryChannel mChannel;
- private MessagingChannel mChannel;
-
- private MessageExchange mExchange;
-
- private ComponentContext mContext;
-
- private MessageExchangeFactory mMsgExchangeFactory;
-
- private ServiceEndpoint mServiceEndpoint;
-
- private final QName mOperation;
-
- private AtomicBoolean mMonitor;
-
- private String mPKName = null;
-
- private String mSelectSQL = null;
-
- private String mMarkColumnName = null;
-
- private String mMarkColumnValue = null;
-
- private String mPKType = null;
-
- private String mFlagColumnType = null;
-
- private String mTable = null;
-
- private String mSchemaName = null;
-
- DBConnectionInfo dbConnectionInfo;
-
- private String mXAEnabled = null;
-
- // private DBMetaData mdbMetaData = null;
- private DatabaseModel dbDataAccessObject = null;
-
- PreparedStatement ps = null;
-
- Connection connection = null;
-
- Connection con = null;
-
- XAConnection xaConnection = null;
-
-
- private String mTableName = null;
-
- private String mPollingPostProcessing = null;
-
- private String mMoveRowToTableName = null;
-
- private int mPollMilliSeconds = 10000;
-
-
- // Settings for custom reliability header extensions
- public static final String CUSTOM_RELIABILITY_MESSAGE_ID_PROPERTY = "com.stc.jbi.messaging.messageid"; // NOI18N
- public static final String CUSTOM_RELIABILITY_HEADER_NAMESPACE_URI = "http://schemas.stc.com/ws/2005/07/custrm"; // NOI18N
- public static final String CUSTOM_RELIABILITY_HEADER_LOCAL_NAME = "MessageID"; // NOI18N
-
- /**
- * JBI message exchange properties for message grouping and sequencing (new CRMP)
- */
- public static final String CRMP_GROUP_ID = "com.sun.jbi.messaging.groupid";
- public static final String CRMP_MESSAGE_ID = "com.sun.jbi.messaging.messageid";
-
- ReplyListener replyListener;
-
- public InboundMessageProcessor(final MessagingChannel chnl, final EndpointBean endpoint,
- final ComponentContext context, final QName opname) throws ParserConfigurationException {
- mChannel = chnl;
- epb = endpoint;
- mContext = context;
- replyListener = new ReplyListenerImpl(endpoint);
- mOperation = opname;
- mMonitor = new AtomicBoolean(false);
- mTxHelper = new TransactionHelper();
- dbConnectionInfo = new DBConnectionInfo();
- final DocumentBuilderFactory docBuilderFact = DocumentBuilderFactory.newInstance();
- mDocBuilder = docBuilderFact.newDocumentBuilder();
- //mTxManager = (TransactionManager) context.getTransactionManager();
-
- }
-
- /**
- * @return
- */
- public static Map getInboundExchanges() {
- return InboundMessageProcessor.mInboundExchanges;
- }
-
- /**
- *
- */
- //@Override
- public void run() {
- if (mLogger.isLoggable(Level.INFO)) {
- mLogger.log(Level.INFO, "SQLSE_R00629.IMP_EP_status");
- }
-
- do {
- try {
- execute();
- } catch (final Exception ex) {
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00659.IMP_ERROR_WHILE_EXECUTING_SQL"), ex);
- }
-
- if (mLogger.isLoggable(Level.FINE)) {
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_R00660.IMP_FINISHED_EXECUTING_SQL"));
- }
-
- try {
- Thread.sleep(mPollMilliSeconds);
- } catch (final Exception e) {
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00661.IMP_THREAD_SLEEP_ABRUPTED"), e);
- }
- } while (mMonitor.get() != Boolean.TRUE);
- }
-
- /**
- * @throws MessagingException
- * @throws Exception
- */
- public void execute() throws MessagingException, Exception {
- String exchangeId = null;
-
- try {
- if (mMsgExchangeFactory == null) {
- mMsgExchangeFactory = mChannel.createExchangeFactory();
- }
-
- mExchange = mMsgExchangeFactory.createInOnlyExchange();
-
- if (mServiceEndpoint == null) {
- mServiceEndpoint = locateServiceEndpoint();
- epb.setValueObj(EndpointBean.ENDPOINT_REFERENCE, mServiceEndpoint);
- }
-
- if (mServiceEndpoint == null) {
- throw new MessagingException(mMessages.getString("SQLSE_E00643.IMP_Failed_locate_EP"));
- }
-
- exchangeId = mExchange.getExchangeId();
-
- final QName serviceName = (QName) epb.getValueObj(EndpointBean.FULL_SERVICE_NAME);
- final String epntName = epb.getValue(EndpointBean.ENDPOINT_NAME);
-
- if (mLogger.isLoggable(Level.FINE)) {
- mLogger.fine("Getting bean for" + serviceName + epntName);
- }
-
- mExchange.setEndpoint(mServiceEndpoint);
- mExchange.setOperation(mOperation);
-
- // Adding re-delivery/re-try support
- // we are sending instead of the client context to the ReplyListener
- // the EndpointBean
- MessageExchangeSupport.addReplyListener(mExchange.getExchangeId(), replyListener, epb);
- MessageExchangeSupport.addRedeliveryListener(mExchange.getExchangeId(), this, epb);
-
-
- final String status = epb.getValue(EndpointBean.STATUS);
-
- if (! status.equalsIgnoreCase(EndpointBean.STATUS_RUNNING)) {
- final String endName = epb.getValue(EndpointBean.ENDPOINT_NAME);
-
- if (mLogger.isLoggable(Level.INFO)) {
- mLogger.log(Level.INFO, "SQLSE_W00630.IMP_EP_NOT_RUNNING", new Object[] { endName,
- mExchange.getExchangeId() });
- }
- } else {
-
- switch (ExchangePattern.valueOf(mExchange)) {
- case IN_OUT:
- mLogger.log(Level.INFO, "SQLSE_R00631.IMP_Received_INOUT", mExchange.getExchangeId());
- processInOut(mExchange, epb);
- break;
- case IN_ONLY:
- mLogger.log(Level.INFO, "SQLSE_R00632.IMP_Received_INONLY", mExchange.getExchangeId());
- processInOnly(mExchange, epb);
- break;
- default:
- mLogger.log(Level.INFO, "SQLSE_E00633.IMP_Invalid_pattern", mExchange.getExchangeId());
- return;
- }
- }
- } catch (final MessagingException ex) {
- InboundMessageProcessor.mInboundExchanges.remove(exchangeId);
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00662.IMP_ERROR_WHILE_EXECUTING_MEP"), exchangeId);
- throw ex;
- } catch (final Exception e) {
- InboundMessageProcessor.mInboundExchanges.remove(exchangeId);
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00662.IMP_ERROR_WHILE_EXECUTING_MEP"), exchangeId);
- throw e;
- }
- }
-
- /**
- * @param exchange
- * @param epb
- */
- public void processInOut(final MessageExchange exchange, final EndpointBean epb) {
- }
-
- /**
- * @param exchange
- * @param epb
- */
- public void processInOnly(final MessageExchange exchange, final EndpointBean epb) throws Exception {
- String exchangeId = null;
- ResultSet rs = null;
- String jndiName = null;
-
- try {
- epb.getEndpointStatus().incrementReceivedRequests();
-
- NormalizedMessage inMsg = mExchange.createMessage();
- exchangeId = exchange.getExchangeId();
-
- final Map operationNameToMetaData = (Map) epb.getValueObj(EndpointBean.OPERATION_NAME_TO_META_DATA);
- final OperationMetaData meta = (OperationMetaData) operationNameToMetaData.get(exchange.getOperation().getLocalPart());
-
- if (meta == null) {
- throw new MessagingException(InboundMessageProcessor.mMessages.getString("SQLSE_E00634.IMP_Invalid_Operation",
- new Object[] { exchange.getOperation() }));
- }
-
- mPollMilliSeconds = meta.getJDBCSql().getPollMilliSeconds();
- mSelectSQL = meta.getJDBCSql().getSql();
- /*mPKName = Qualified(meta.getJDBCSql().getPKName());
- mMarkColumnName = Qualified(meta.getJDBCSql().getMarkColumnName());
- mMarkColumnValue = meta.getJDBCSql().getMarkColumnValue();
- mTableName = Qualified(meta.getJDBCSql().getTableName());
- mPollingPostProcessing = meta.getJDBCSql().getPollingPostProcessing();
- mMoveRowToTableName = Qualified(meta.getJDBCSql().getMoveRowToTableName());
- */
- mPKName = meta.getJDBCSql().getPKName();
- mMarkColumnName = meta.getJDBCSql().getMarkColumnName();
- mMarkColumnValue = meta.getJDBCSql().getMarkColumnValue();
- mTableName = meta.getJDBCSql().getTableName();
- mPollingPostProcessing = meta.getJDBCSql().getPollingPostProcessing();
- mMoveRowToTableName = meta.getJDBCSql().getMoveRowToTableName();
- mXAEnabled = meta.getJDBCSql().getTransaction();
- jndiName = epb.getValue(EndpointBean.JDBC_DATABASE_JNDI_NAME);
-
- // createNewDataSource(mXAEnabled,jndiName,epb);
-
- if (mXAEnabled.equalsIgnoreCase("XATransaction")) {
- // mtxFlag = startTrasaction();
- getTransactionManager().begin();
- }
-
- dbDataAccessObject = getDataAccessObject(meta);
- mSelectSQL = dbDataAccessObject.generateSelectQuery(mSelectSQL, mTableName);
- epb.setTableName(mTableName);
-
- connection = getDatabaseConnection(jndiName);
- Transaction tx = getTransactionManager().getTransaction();
- if (isSelectStatement(mSelectSQL)) {
- rs = executeInboundSQLSelect(epb, meta, connection, mTableName, mSelectSQL);
-
- if (rs != null) {
- final JDBCNormalizer normalizer = new JDBCNormalizer();
- inMsg = normalizer.normalizeSelectInbound(rs, exchange, meta, epb, mPKName);
-
- final List tempList = epb.getProcessList();
- if (!(tempList.isEmpty())) {
- // mTxHelper.handleInbound(exchange);
- exchange.setMessage(inMsg, "in");
-
- if (tx != null) {
- mExchange.setProperty(MessageExchange.JTA_TRANSACTION_PROPERTY_NAME, tx);
- getTransactionManager().suspend();
- }
- mChannel.send(exchange);
- epb.getEndpointStatus().incrementSentRequests();
- // mTableExistsFlag = new Object();
- InboundMessageProcessor.mInboundExchanges.put(exchangeId, new ListenerMeta(
- System.currentTimeMillis(), this));
- } else {
- if (tx != null) {
- try {
- tx.commit();
- } catch (Exception ex) {
- mLogger.log(Level.SEVERE,
- "SQLSE_E00656.IMP_XA_TX_COMMIT_FAILED",
- new Object[] { "commit", ex });
- throw ex;
- }
- } else {
- if (mXAEnabled.equalsIgnoreCase("XATransaction")) {
- mLogger.log(Level.WARNING,
- "SQLSE_W00654.IMP_XA_TX_NOT_FOUND_IN_MSG_XCHANGE",
- new Object[] { exchange.getExchangeId() });
- }
- }
- }
- // mTableExistsFlag = new Object();
- }
- }
- } catch (final Exception ex) {
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00663.IMP_ERROR_WHILE_PROCESSING_MEP"), ex);
- Transaction tx = getTransactionManager().getTransaction();
- if(tx != null ) {
- tx.rollback();
- }
- } finally {
- try {
- if (rs != null) {
- rs.close();
- }
- if (connection != null) {
- connection.close();
- }
- } catch (final SQLException se) {
- mLogger.log(Level.SEVERE,mMessages.getString("SQLSE_E00628.OMP_Cleanup_Failure"),se);
- }
- }
- }
-
-
-
- public ResultSet executeInboundSQLSelect(final EndpointBean eBean,
- final OperationMetaData opMetaData,
- Connection connection,
- final String mTableName,
- String lSelectSQL) throws MessagingException {
- ResultSet rs = null;
- try {
- mLogger.log(Level.INFO, "Executing sql . " + lSelectSQL);
-
- if ((mMarkColumnName == null) || (mMarkColumnName.equals(""))) {
- // do nothing
- } else {
- if(mFlagColumnType != null){
- if (mFlagColumnType.equalsIgnoreCase("LONGVARCHAR") || mFlagColumnType.equalsIgnoreCase("CHAR")
- || mFlagColumnType.equalsIgnoreCase("VARCHAR")) {
- /*lSelectSQL = lSelectSQL.concat(" where " + mTableName + "." + mMarkColumnName + " != " + "'"
- + mMarkColumnValue + "'" + "or" + mTableName + "." + mMarkColumnName + "is NULL");*/
- lSelectSQL = lSelectSQL.concat(" where " + mMarkColumnName + " != " + "'"
- + mMarkColumnValue + "'" + "or " + mMarkColumnName + " is NULL");
- } else {
- lSelectSQL = lSelectSQL.concat(" where " + mMarkColumnName + " != "
- + mMarkColumnValue + "or " + mMarkColumnName + " is NULL");
- }
- }else{
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00638.IMP_Error_IVALID_ColumnName") + mMarkColumnName;
- throw new MessagingException(msg, new NamingException());
- }
- }
- ps = connection.prepareStatement(lSelectSQL);
- rs = ps.executeQuery();
- }
- catch (final SQLException ex) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00639.IMP_Failed_Executing_SQL") + lSelectSQL;
- throw new MessagingException(msg, ex);
- } catch (final Exception ex) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00639.IMP_Failed_Executing_SQL") + lSelectSQL;
- throw new MessagingException(msg, ex);
- }
- return rs;
- }
-
- /**
- * @return
- * @throws MessagingException
- */
- public DatabaseModel getDataAccessObject(OperationMetaData meta) throws MessagingException {
- DatabaseModel objDataAccess = null;
- String jndiName = null;
- String prdtName = null;
- String catalog = null;
- ResultSet rs = null;
- jndiName = epb.getValue(EndpointBean.JDBC_DATABASE_JNDI_NAME);
-
- try {
- connection = getDatabaseConnection(jndiName);
- prdtName = DBMetaData.getDBType(connection);
-
- rs = connection.getMetaData().getColumns(catalog, mSchemaName, mTable, "%");
-
- int noofColCounter = -1;
- // if(rs==null){
- // final String msg = InboundMessageProcessor.mMessages.getString("IMP_Table_NotExist");
- // throw new MessagingException(msg, new NamingException());
- // }
- while (rs.next()) {
- noofColCounter++;
- final String colName = rs.getString("COLUMN_NAME");
- if (colName.equalsIgnoreCase(meta.getJDBCSql().getPKName())) {
- final String defaultValue = rs.getString("COLUMN_DEF");
- final int sqlTypeCode = rs.getInt("DATA_TYPE");
- final String sqlType = DBMetaData.getSQLTypeDescription(sqlTypeCode);
- mPKType = sqlType;
- }
- if (colName.equalsIgnoreCase(meta.getJDBCSql().getMarkColumnName())) {
- final String defaultValue = rs.getString("COLUMN_DEF");
- final int sqlTypeCode = rs.getInt("DATA_TYPE");
- final String sqlType = DBMetaData.getSQLTypeDescription(sqlTypeCode);
- mFlagColumnType = sqlType;
- }
- }
- if(noofColCounter < 0 ){
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00636.IMP_Table_NotExist");
- throw new MessagingException(msg, new NamingException());
- }
- if (mPKType == null) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00637.IMP_PrimaryKey_Error");
- throw new MessagingException(msg, new NamingException());
- }
- if (prdtName.equalsIgnoreCase(InboundMessageProcessor.DERBY_PROD_NAME)) {
- return objDataAccess = DerbyDataAccess.getInstance();
- } else if (prdtName.equalsIgnoreCase(InboundMessageProcessor.ORACLE_PROD_NAME)) {
- return objDataAccess = OracleDataAccess.getInstance();
- } else if (prdtName.equalsIgnoreCase(InboundMessageProcessor.DB2_PROD_NAME)) {
- return objDataAccess = Db2DataAccess.getInstance();
- } else if (prdtName.equalsIgnoreCase(InboundMessageProcessor.SQLSERVER_PROD_NAME)) {
- return objDataAccess = SqlServerDataAccess.getInstance();
- } else if (prdtName.equalsIgnoreCase(InboundMessageProcessor.JDBC_PROD_NAME)) {
- return objDataAccess = DatabaseModelImpl.getInstance();
- } else {
- return objDataAccess = new DatabaseModelImpl();
- }
- } catch (final NamingException ex) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00635.IMP_Error_Lookup") + jndiName;
- throw new MessagingException(msg, ex);
- } catch (final SQLException ex) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00639.IMP_Failed_Executing_SQL");
- throw new MessagingException(msg, ex);
- } catch (final Exception ex) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00639.IMP_Failed_Executing_SQL");
- throw new MessagingException(msg, ex);
- } finally {
- try {
- if (rs != null) {
- rs.close();
- }
- if (connection != null) {
- connection.close();
- }
- } catch (final SQLException se) {
- mLogger.log(Level.INFO,
- InboundMessageProcessor.mMessages.getString("SQLSE_E00628.OMP_Cleanup_Failure"),se);
- }
- }
- }
-
- /**
- * @return
- */
- public ServiceEndpoint locateServiceEndpoint() {
- ServiceEndpoint activatedEndpoint = null;
- final QName serviceName = (QName) epb.getValueObj(EndpointBean.FULL_SERVICE_NAME);
- final String endpointName = epb.getValue(EndpointBean.ENDPOINT_NAME);
- activatedEndpoint = mContext.getEndpoint(serviceName, endpointName);
-
- if (activatedEndpoint != null) {
- mLogger.log(Level.INFO, "IMP_locate_EP", new Object[] { serviceName, endpointName });
- }
-
- return (activatedEndpoint);
- }
-
- public String Qualified(String str) {
- int len = 0;
-
- if ((str != null) && (!str.equals(""))) {
- final int i = str.indexOf(".");
-
- if (i > 0) {
- len = str.length();
- mTable = str.substring(i + 1, len);
- mSchemaName = str.substring(0, i);
- str = "\"" + mSchemaName + "\"" + "." + "\"" + mTable + "\"";
-
- return str;
- }
-
- return "\"" + str + "\"";
- }
-
- return str;
- }
-
- /**
- * @param exchange
- * @throws Exception
- */
- //@Override
- public synchronized void processReplyMessage(final MessageExchange exchange) throws Exception {
- String sql = null;
- String jndiName = null;
- Transaction tx = null;
- boolean isTransacted = exchange.isTransacted();
-
- if (!(exchange instanceof InOnly) && !(exchange instanceof InOut)) {
- mLogger.log(Level.SEVERE, "SQLSE_E00647.IMP_Unsupported_exchange_pattern",
- exchange.getPattern().toString());
- throw new Exception("SQLSE_E00647.IMP_Unsupported_exchange_pattern");
- }
-
- final String messageId = exchange.getExchangeId();
- try {
- if (InboundMessageProcessor.mInboundExchanges.containsKey(messageId)) {
- // Any status other than 'DONE' is considered an error
- if (exchange.getStatus() != ExchangeStatus.DONE) {
- final String msgError = "Error occured while getting DONE Response ";
- throw new Exception(msgError);
- }
-
- if (exchange.getStatus() == ExchangeStatus.DONE) {
- try {
- jndiName = epb.getValue(EndpointBean.JDBC_DATABASE_JNDI_NAME);
- if (isTransacted && exchange instanceof InOnly) {
- tx = (Transaction) exchange.getProperty(MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
- try {
- // we have to resume the suspended transaction
- resumeThreadTx(tx);
- } catch (Exception ex) {
- // for in-only there's no sending of status back to nmr
- // failure will be logged
- mLogger.log(Level.WARNING, "SQLSE_E00651.IMP_RESUME_FAILED",
- new Object[] { ex.getLocalizedMessage() });
- }
- try {
- if (tx.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
- try {
- // As we are the initiator for tx we have to rollback
- rollbackThreadTx(exchange);
- } catch (Exception ex) {
- // for in-only there's no sending of status back to nmr
- // failure will be logged
- mLogger.log(Level.WARNING, "SQLSE_E00652.IMP_ROLLBACK_FAILED",
- new Object[] { ex.getLocalizedMessage() });
- }
- }
- } catch (Exception ex) {
- mLogger.log(Level.INFO, "IMP_POST_PROCESS_FAILED",
- new Object[] { ex.getLocalizedMessage() });
- }
- }
- connection = getDatabaseConnection(jndiName);
- if (isTransacted && exchange instanceof InOnly) {
- connection.setAutoCommit(false);
- }
- final List records = epb.getProcessList();
- for (final Iterator it = records.iterator(); it.hasNext();) {
- String pkNameRet = (String) it.next();
- if (mPKType.equalsIgnoreCase("LONGVARCHAR") || mPKType.equalsIgnoreCase("CHAR")
- || mPKType.equalsIgnoreCase("VARCHAR")) {
- pkNameRet = "'" + pkNameRet + "'";
- }
- if (mPollingPostProcessing.equalsIgnoreCase("Delete")) {
- sql = dbDataAccessObject.createQualifiedQuery(mTableName, mMoveRowToTableName,
- mMarkColumnName, mMarkColumnValue, mPKName, "DELETE", mFlagColumnType);
- sql = sql + "=" + pkNameRet;
- mLogger.log(Level.INFO, "Executing sql . " + sql);
- ps = connection.prepareStatement(sql);
-
- final int delcount = ps.executeUpdate();
- mLogger.log(Level.SEVERE, "Records deleted are:" + delcount);
- } else if (mPollingPostProcessing.equalsIgnoreCase("MarkColumn")) {
- sql = dbDataAccessObject.createQualifiedQuery(mTableName, mMoveRowToTableName,
- mMarkColumnName, mMarkColumnValue, mPKName, "UPDATE", mFlagColumnType);
- sql = sql + "=" + pkNameRet;
- mLogger.log(Level.INFO, "Executing sql . " + sql);
- ps = connection.prepareStatement(sql);
-
- final int count = ps.executeUpdate();
- mLogger.log(Level.SEVERE, "Records updated are " + count);
- } else if (mPollingPostProcessing.equalsIgnoreCase("CopyRow")) {
-
- sql = dbDataAccessObject.createQualifiedQuery(mTableName, mMoveRowToTableName,
- mMarkColumnName, mMarkColumnValue, mPKName, "INSERT", mFlagColumnType);
- sql = sql + "=" + pkNameRet;
- mLogger.log(Level.INFO, "Executing sql . " + sql);
- ps = connection.prepareStatement(sql);
-
- final int count = ps.executeUpdate();
- mLogger.log(Level.SEVERE, "Records updated are " + count);
-
- sql = dbDataAccessObject.createQualifiedQuery(mTableName, mMoveRowToTableName,
- mMarkColumnName, mMarkColumnValue, mPKName, "UPDATE", mFlagColumnType);
- sql = sql + "=" + pkNameRet;
- mLogger.log(Level.INFO, "Executing sql . " + sql);
- ps = connection.prepareStatement(sql);
-
- final int updatecount = ps.executeUpdate();
- mLogger.log(Level.SEVERE, "Records updated are " + updatecount);
-
- } else if (mPollingPostProcessing.equalsIgnoreCase("MoveRow")) {
- sql = dbDataAccessObject.createQualifiedQuery(mTableName, mMoveRowToTableName,
- mMarkColumnName, mMarkColumnValue, mPKName, "INSERT", mFlagColumnType);
- sql = sql + "=" + pkNameRet;
- mLogger.log(Level.INFO, "Executing sql . " + sql);
- ps = connection.prepareStatement(sql);
-
- final int count = ps.executeUpdate();
- mLogger.log(Level.SEVERE, "Records updated are " + count);
-
- sql = dbDataAccessObject.createQualifiedQuery(mTableName, mMoveRowToTableName,
- mMarkColumnName, mMarkColumnValue, mPKName, "DELETE", mFlagColumnType);
- sql = sql + "=" + pkNameRet;
- mLogger.log(Level.INFO, "Executing sql . " + sql);
- ps = connection.prepareStatement(sql);
-
- final int delcount = ps.executeUpdate();
- mLogger.log(Level.SEVERE, "Records deleted are:" + delcount);
- } // else if
- }
- if (isTransacted && exchange instanceof InOnly) {
- try {
- // As we are the initiator for tx we have to commit
- commitThreadTx(exchange);
- } catch (Exception ex) {
- // for in-only there's no sending of status back to nmr
- // failure will be logged
- mLogger.log(Level.WARNING, "SQLSE_E00657.IMP_COMMIT_FAILED",
- new Object[] { ex.getLocalizedMessage() });
- }
- }
-
- } catch (final SQLException ex) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00639.IMP_Failed_Executing_SQL")
- + sql;
- mLogger.log(Level.SEVERE, msg, new Object[] {ex.getLocalizedMessage()});
- if (isTransacted && exchange instanceof InOnly) {
- try {
- // As we are the initiator for tx we have to rollback
- rollbackThreadTx(exchange);
- } catch (Exception exception) {
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00653.IMP_XA_TX_ROLLBACK_FAILED"), exception);
- }
- }
- } catch (final Exception ex) {
- final String msg = InboundMessageProcessor.mMessages.getString("SQLSE_E00639.IMP_Failed_Executing_SQL");
- mLogger.log(Level.SEVERE, msg, new Object[] {ex.getLocalizedMessage()});
- if (isTransacted && exchange instanceof InOnly) {
- try {
- // As we are the initiator for tx we have to rollback
- rollbackThreadTx(exchange);
- } catch (Exception exception) {
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00653.IMP_XA_TX_ROLLBACK_FAILED"), exception);
- }
- }
-
- }
- } else {
- mLogger.log(Level.SEVERE, "IMP_MXCH_BAD_STATUS", new Object[] { exchange.getStatus().toString(),
- messageId });
- if (isTransacted && exchange instanceof InOnly) {
- try {
- // As we are the initiator for tx we have to rollback
- rollbackThreadTx(exchange);
- } catch (Exception ex) {
- // for in-only there's no sending of status back to nmr
- mLogger.log(Level.SEVERE, mMessages.getString("SQLSE_E00653.IMP_XA_TX_ROLLBACK_FAILED"), ex);
- }
- }
- }
-
- if (mLogger.isLoggable(Level.INFO)) {
- mLogger.log(Level.INFO, "SQLSE_E00648.IMP_Remove_exchange_msg_id", messageId);
- }
- } else {
- mLogger.log(Level.SEVERE, "SQLSE_E00646.IMP_Invalid_reply_msgId", messageId);
- }
- } finally {
- InboundMessageProcessor.mInboundExchanges.remove(messageId);
- try {
- if(ps != null) {
- ps.close();
- }
- if(connection != null) {
- connection.close();
- }
-
- } catch (final SQLException se) {
- mLogger.log(Level.INFO, mMessages.getString("SQLSE_E00628.OMP_Cleanup_Failure"),se);
- }
- }
- }
-
- // suspend thread transactional context
- private void resumeThreadTx(Transaction tx) throws Exception {
- if (tx != null) {
- ((TransactionManager) mContext.getTransactionManager()).resume(tx);
- mLogger.log(Level.INFO, " ", new Object[] { tx.toString() });
- }
- }
-
- private void rollbackThreadTx(MessageExchange msgXChange) throws Exception {
- if (msgXChange.isTransacted()) {
- Transaction tx = (Transaction) msgXChange.getProperty(MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
- if (tx != null) {
- try {
- tx.rollback();
- } catch (Exception ex) {
- mLogger.log(Level.SEVERE, "SQLSE_E00653.IMP_XA_TX_ROLLBACK_FAILED", new Object[] { ex.getLocalizedMessage() });
- throw ex;
- }
- } else {
- if (mXAEnabled.equalsIgnoreCase("XATransaction")) {
- mLogger.log(Level.WARNING, "SQLSE_W00654.IMP_XA_TX_NOT_FOUND_IN_MSG_XCHANGE",
- new Object[] { msgXChange.getExchangeId() });
- }
- }
- }
- }
-
- private void commitThreadTx(MessageExchange msgXChange) throws Exception {
- if (msgXChange.isTransacted()) {
- Transaction tx = (Transaction) msgXChange.getProperty(MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
- if (tx != null) {
- try {
- tx.commit();
- } catch (Exception ex) {
- mLogger.log(Level.SEVERE, "SQLSE_E00656.IMP_XA_TX_COMMIT_FAILED", new Object[] { "commit", ex });
- throw ex;
- }
- } else {
- if (mXAEnabled.equalsIgnoreCase("XATransaction")) {
- mLogger.log(Level.WARNING, "SQLSE_W00654.IMP_XA_TX_NOT_FOUND_IN_MSG_XCHANGE",
- new Object[] { msgXChange.getExchangeId() });
- }
- }
- }
- }
-
- /**
- * @param jndiName
- * @return
- * @throws javax.naming.NamingException
- */
- private Object getDataSourceFromContext(final String jndiName) throws javax.naming.NamingException {
- final Context c = mContext.getNamingContext();
-
- return c.lookup(jndiName);
- }
-
- /**
- * @param jndiName
- * @return
- * @throws Exception
- */
- private Connection getDatabaseConnection(final String jndiName) throws SQLException, NamingException {
- return ((DataSource) getDataSourceFromContext(jndiName)).getConnection();
- }
-
- /**
- * @param prepStmtSQLText
- * @return
- */
- private boolean isSelectStatement(final String prepStmtSQLText) {
- prepStmtSQLText.trim();
-
- final StringTokenizer tok = new StringTokenizer(prepStmtSQLText);
-
- if (tok.hasMoreTokens()) {
- final String firstTok = (String) tok.nextToken();
-
- if (firstTok.equalsIgnoreCase("select")) {
- return true;
- }
- }
-
- return false;
- }
-
- protected void stopReceiving() {
- mLogger.log(Level.INFO, "SQLSE_R00644.IMP_Inbound_stopped");
- mMonitor.set(Boolean.TRUE);
- }
-
- private TransactionManager getTransactionManager() {
- return (TransactionManager)mContext.getTransactionManager();
- }
-
- public void setMessageExchangeId(String messageExchangeId, Object retryMetaData) {
- exchangeIDToMeta.put(messageExchangeId, retryMetaData);
- }
-
- public void onRedelivery(MessageExchange exchange) throws MessagingException {
- NormalizedMessage inMsg;
- EndpointBean operationMetaData = (EndpointBean) exchangeIDToMeta.remove(exchange.getExchangeId());
- String groupId = (String)exchange.getProperty(CRMP_GROUP_ID);
- String messageId = (String)exchange.getProperty(CRMP_MESSAGE_ID);
-
- // remove the listener associated with the exchange ID
- MessageExchangeSupport.removeRedeliveryListener(exchange.getExchangeId());
- try{
- switch (ExchangePattern.valueOf(exchange)) {
- case IN_OUT:
- if (mLogger.isLoggable(Level.FINE)) {
- mLogger.log(Level.FINE, "Resending the InOut exchange with group ID '"
- + groupId + "' and message ID '" + messageId + "'...");
- }
- inMsg = ((InOut)exchange).getInMessage();
- InOut inout = mMsgExchangeFactory.createInOutExchange();
- // make sure that the message id has is the same
- inout.setProperty(CRMP_GROUP_ID, groupId);
- inout.setProperty(CRMP_MESSAGE_ID, messageId);
- //processInOut(inout, inMsg, operationMetaData);
- processInOut(inout,operationMetaData);
- break;
- case IN_ONLY:
- if (mLogger.isLoggable(Level.FINE)) {
- mLogger.log(Level.FINE, "Resending the InOnly exchange with group ID '"
- + groupId + "' and message ID '" + messageId + "'...");
- }
- inMsg = ((InOnly)exchange).getInMessage();
- InOnly inonly = mMsgExchangeFactory.createInOnlyExchange();
- // make sure that the message id has is the same
- inonly.setProperty(CRMP_GROUP_ID, groupId);
- inonly.setProperty(CRMP_MESSAGE_ID, messageId);
- //processInOnly(inonly, inMsg, operationMetaData);
- processInOnly(inonly,operationMetaData);
- break;
- default:
- if (mLogger.isLoggable(Level.FINE)) {
- mLogger.log(Level.FINE, "Retry handler receives an unsupported exchange pattern: "
- +ExchangePattern.valueOf(exchange) + ". Ignoring the retry attempt...");
- }
- break;
- }
- }catch(Exception e){
- mLogger.log(Level.SEVERE, "Failed in retry handler",
- e.getMessage());
- throw new MessagingException(e);
- }
- }
-
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/InboundReceiver.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/InboundReceiver.java
deleted file mode 100755
index 3c8c50d4e..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/InboundReceiver.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)InboundReceiver.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import com.sun.jbi.common.qos.messaging.MessagingChannel;
-import com.sun.jbi.internationalization.Messages;
-import com.sun.jbi.jdbcbc.extensions.JDBCOperationInput;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.jbi.component.ComponentContext;
-import javax.jbi.messaging.*;
-import javax.management.AttributeChangeNotification;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.xml.namespace.QName;
-
-
-/**
- * Wait for responses/requests from the service engine and
- * use thread pools to process them.
- *
- * Thir receiver not only processes "Inbound" requests initiated by the
- * Service engine, but also responses to requests this adapter has sent the SE.
- */
-class InboundReceiver {
- private static final Messages mMessages = Messages.getMessages(InboundReceiver.class);
- private static final Logger mLogger = Messages.getLogger(InboundReceiver.class);
-
- // Pool settings for processing SE "Inbound" requests initated by the SE.
- private int mInboundCorePoolSize;
- private final int mInboundKeepAliveTime = 60 * 10;
- private final TimeUnit mInboundTimeUnit = TimeUnit.SECONDS;
-
- // By using an unbounded queue the max pool size becomes irrelevant
- private final int mInboundMaxPoolSize = Integer.MAX_VALUE;
- private ThreadPoolExecutor mInboundPooledExecutor;
- private final MessagingChannel mChannel;
- private final ComponentContext mContext;
-
- // This is removed since never used
- //private final Map mEndpoints;
- private final Map mActivatedInboundMsgProcs;
-
- /**
- *
- */
- private final NotificationListener listener = new NotificationListener() {
- //@Override
- public void handleNotification(Notification notification, Object obj) {
- if (notification instanceof AttributeChangeNotification) {
- AttributeChangeNotification attrNotif = (AttributeChangeNotification) notification;
- String attrName = attrNotif.getAttributeName();
-
- if (attrName.equals("Threads")) {
- Integer newVal = (Integer) (attrNotif.getNewValue());
- setThreads(newVal.intValue());
- }
- }
- }
- };
-
- /**
- * Construct a receiver for a given binding channel and the relevant endpoints
- * @param bc the binding channel to receive from
- * @param endpoints EndointBean instances with information about the endpoints
- */
- protected InboundReceiver(final MessagingChannel bc, final Map endpoints,
- final RuntimeConfiguration runtimeConfig, final ComponentContext context) {
- mChannel = bc;
- mContext = context;
-
- // Apply existing configuration
- final Integer threadCount = runtimeConfig.getThreads();
-
- if (threadCount != null) {
- setThreads(threadCount.intValue());
- }
-
- // Subscribe for changes to the configuration
- runtimeConfig.addNotificationListener(listener, null, null);
-
- mInboundPooledExecutor = new ThreadPoolExecutor(mInboundCorePoolSize,
- mInboundMaxPoolSize, mInboundKeepAliveTime, mInboundTimeUnit,
- new LinkedBlockingQueue(), Executors.privilegedThreadFactory());
- mInboundPooledExecutor.prestartAllCoreThreads();
- mActivatedInboundMsgProcs = Collections.synchronizedMap(new HashMap());
-
- //mEndpoints = endpoints;
- }
-
- /**
- * Construct a receiver for a given binding channel and the relevant endpoints
- * @param bc the binding channel to receive from
- * @param endpoints EndointBean instances with information about the endpoints
- */
- /*public InboundReceiver(final DeliveryChannel bc, final Map endpoints,
- final SQLSERuntimeConfiguration runtimeConfig, final ComponentContext context) {
- mChannel = bc;
- mContext = context;
-
- // Apply existing configuration
- final Integer threadCount = runtimeConfig.getThreads();
-
- if (threadCount != null) {
- setThreads(threadCount.intValue());
- }
-
- // Subscribe for changes to the configuration
- runtimeConfig.addNotificationListener(listener, null, null);
-
- mInboundPooledExecutor = new ThreadPoolExecutor(mInboundCorePoolSize,
- mInboundMaxPoolSize, mInboundKeepAliveTime, mInboundTimeUnit,
- new LinkedBlockingQueue(), Executors.privilegedThreadFactory());
- mInboundPooledExecutor.prestartAllCoreThreads();
- mActivatedInboundMsgProcs = Collections.synchronizedMap(new HashMap());
-
- //mEndpoints = endpoints;
- }*/
-
- /**
- * Main receiver loop to process replies and requests of SEs
- */
- protected void addInboundMessageProcessor(final EndpointBean endpoint)
- throws FaultException, MessagingException {
- synchronized (mActivatedInboundMsgProcs) {
- mLogger.log(Level.INFO, mMessages.getString("SQLSE_C00601.IR_Started"));
-
- final Definition defwsdl = (Definition) endpoint.getValueObj(EndpointBean.DESCRIPTOR);
- final String serviceName = endpoint.getValue(EndpointBean.SERVICE_NAME);
- final String endpointName = endpoint.getValue(EndpointBean.ENDPOINT_NAME);
-
- List jdbcOper = new ArrayList();
- jdbcOper = getJDBCOperations(defwsdl, serviceName, endpointName);
-
- for (final Iterator it = jdbcOper.iterator(); it.hasNext();) {
- final QName opname = (QName) it.next();
- final String key = endpointName + serviceName + opname.toString();
-
- if (!mActivatedInboundMsgProcs.containsKey(key)) {
- try {
- final InboundMessageProcessor proc = new InboundMessageProcessor(mChannel,
- endpoint, mContext, opname);
- final Thread task = new Thread(proc);
- task.start();
- // Store the thread in the map
- mActivatedInboundMsgProcs.put(key, proc);
- } catch (final Exception e) {
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_E00602.IR_Exception") +
- e.getMessage());
- }
- }
- } // for
-
- InboundReceiver.mLogger.log(Level.INFO, InboundReceiver.mMessages.getString("SQLSE_C00603.IR_Shutdown"));
- }
- }
-
- /**
- * Stops and removes the inbound message processor for each
- * File binding operation per the given end point.
- *
- * @param endpoint A service end point.
- */
- protected void removeInboundMessageProcessor(final EndpointBean endpoint) {
- synchronized (mActivatedInboundMsgProcs) {
- mLogger.log(Level.INFO, mMessages.getString("SQLSE_C00604.IR_Remove"));
-
- final Definition defwsdl = (Definition) endpoint.getValueObj(EndpointBean.DESCRIPTOR);
- final String serviceName = endpoint.getValue(EndpointBean.SERVICE_NAME);
- final String endpointName = endpoint.getValue(EndpointBean.ENDPOINT_NAME);
- List jdbcOper = new ArrayList();
- jdbcOper = getJDBCOperations(defwsdl, serviceName, endpointName);
-
- for (final Iterator it = jdbcOper.iterator(); it.hasNext();) {
- final QName opname = (QName) it.next();
- final String key = endpointName + serviceName + opname.toString();
-
- if (mActivatedInboundMsgProcs.containsKey(key)) {
- final InboundMessageProcessor proc = mActivatedInboundMsgProcs.get(key);
- // Stop the inbound message processor thread
- proc.stopReceiving();
- // proc.deleteTableTigger(endpoint);
- // Remove the thread from the map
- mActivatedInboundMsgProcs.remove(key);
- } // if
- } // for
-
- mLogger.log(Level.INFO, mMessages.getString("SQLSE_C00603.IR_Shutdown"));
- }
- }
-
- /**
- * Set the number or processing threads to use
- */
- protected void setThreads(final int threadCount) {
- mInboundCorePoolSize = threadCount;
-
- if (mInboundPooledExecutor != null) {
- mInboundPooledExecutor.setCorePoolSize(threadCount);
- }
- }
-
- /**
- * Stop the receiver thread.
- */
- protected void stopReceiving() {
- mLogger.log(Level.INFO, mMessages.getString("SQLSE_C00605.IR_Stop"));
- }
-
- /**
- *
- * @param def
- * @param serviceName
- * @param endpointName
- * @return
- */
- protected List getJDBCOperations(final Definition def, final String serviceName,
- final String endpointName) {
- final List jdbcOperations = new ArrayList();
- JDBCOperationInput jdbcOperationInput = null;
- final Binding binding = getBinding(def, serviceName, endpointName);
-
- if (binding != null) {
- final List bindingOperations = binding.getBindingOperations();
- final Iterator extIter = (bindingOperations == null) ? null
- : bindingOperations.iterator();
-
- while ((extIter != null) && extIter.hasNext()) {
- final BindingOperation oper = (BindingOperation) extIter.next();
- jdbcOperationInput = getJDBCOperationInput(oper.getBindingInput());
-
- if (jdbcOperationInput.getOperationType()
- .equals(JDBCOperations.OPERATION_TYPE_POLL.toString())) {
- jdbcOperations.add(QName.valueOf(oper.getName()));
- }
- }
- }
-
- return jdbcOperations;
- }
-
- /**
- *
- * @param def
- * @param serviceName
- * @param endpointName
- * @return
- */
- protected Binding getBinding(final Definition def, final String serviceName,
- final String endpointName) {
- final Service svc = def.getService(QName.valueOf(serviceName));
-
- if (svc == null) {
- return null;
- }
-
- final Port port = svc.getPort(QName.valueOf(endpointName).getLocalPart());
-
- if (port == null) {
- return null;
- } else {
- return port.getBinding();
- }
- }
-
- /**
- *
- * @param bindingInput
- * @return
- */
- protected JDBCOperationInput getJDBCOperationInput(final BindingInput bindingInput) {
- JDBCOperationInput operationInput = null;
-
- final List extElems = bindingInput.getExtensibilityElements();
-
- // Look for jdbc:input entries
- final Iterator extIter = (extElems == null) ? null : extElems.iterator();
-
- while ((extIter != null) && extIter.hasNext()) {
- final ExtensibilityElement ee = (ExtensibilityElement) extIter.next();
-
- if (JDBCOperationInput.class.isInstance(ee)) {
- operationInput = (JDBCOperationInput) ee;
-
- break;
- }
- }
-
- return operationInput;
- }
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCBindingDeployer.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCBindingDeployer.java
deleted file mode 100755
index 2f23476a9..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCBindingDeployer.java
+++ /dev/null
@@ -1,1146 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)JDBCBindingDeployer.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.jbi.component.ComponentContext;
-import javax.jbi.component.ServiceUnitManager;
-import javax.jbi.management.DeploymentException;
-import javax.jbi.messaging.MessagingException;
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Operation;
-import javax.wsdl.OperationType;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.xml.resolver.CatalogManager;
-import org.apache.xml.resolver.tools.CatalogResolver;
-import org.xml.sax.EntityResolver;
-import com.ibm.wsdl.factory.WSDLFactoryImpl;
-import com.sun.jbi.eManager.provider.EndpointStatus;
-import com.sun.jbi.eManager.provider.StatusProviderHelper;
-import com.sun.jbi.eManager.provider.StatusReporting;
-import com.sun.jbi.internationalization.Messages;
-import com.sun.jbi.jdbcbc.extensions.JDBCAddress;
-import com.sun.jbi.jdbcbc.extensions.JDBCBinding;
-import com.sun.jbi.jdbcbc.extensions.JDBCExtensionRegistry;
-import com.sun.jbi.jdbcbc.extensions.JDBCOperation;
-import com.sun.jbi.jdbcbc.extensions.JDBCOperationInput;
-import com.sun.jbi.jdbcbc.extensions.JDBCOperationOutput;
-import com.sun.jbi.jdbcbc.util.Configuration.PortMap;
-import com.sun.jbi.management.descriptor.EndpointIdentifier;
-import com.sun.jbi.management.descriptor.SUDescriptorSupport;
-import com.sun.jbi.management.message.DefaultJBITaskMessageBuilder;
-import com.sun.jbi.management.message.JBITaskMessageBuilder;
-
-import org.apache.xml.resolver.CatalogManager;
-import org.apache.xml.resolver.tools.CatalogResolver;
-import org.xml.sax.EntityResolver;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jbi.component.ComponentContext;
-import javax.jbi.component.ServiceUnitManager;
-import javax.jbi.management.DeploymentException;
-import javax.jbi.messaging.MessagingException;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Operation;
-import javax.wsdl.OperationType;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-// Additional imports for replacing the ibm WSDL factory to Sun extensions
-import com.sun.wsdl4j.ext.impl.WSDLFactoryEx;
-import com.sun.wsdl4j.ext.impl.WSDLReaderEx;
-
-
-/**
- *
- *JDBCBindingDeployer
- */
-public class JDBCBindingDeployer implements ServiceUnitManager {
- private static final Messages mMessages = Messages.getMessages(JDBCBindingDeployer.class);
- private static final Logger mLogger = Messages.getLogger(JDBCBindingDeployer.class);
- private final Map mDeployedIds;
- private final Map mDeployedEndpoints;
- private final ComponentContext mContext;
- private final DeployHelper mHelper;
- private final JDBCBindingLifeCycle mLifeCycle;
-
- /** Creates a new instance of DeployerMBean */
- JDBCBindingDeployer(final ComponentContext context,
- final JDBCBindingLifeCycle lifeCycle) {
- mContext = context;
- mDeployedIds = new HashMap();
- mDeployedEndpoints = new HashMap();
- mHelper = new DeployHelper();
- mLifeCycle = lifeCycle;
- }
-
- /**
- * Initiate a BC Deployment.
- *
- * @param suId -
- * ID of the ASA being deployed
- * @param asaFilePath
- * @return
- * @throws javax.jbi.management.DeploymentException
- *
- */
- //@Override
- public String deploy(final String suId, final String asaFilePath)
- throws DeploymentException {
- String retMsg = null;
- final String taskName = "deploy";
-
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00201.JDBCBD_Deploy_SU",
- new Object[] { suId, asaFilePath });
- }
-
- retMsg = createSuccessMessage(taskName, mContext.getComponentName());
-
- return retMsg;
- }
-
- /**
- * @param suId
- * @param suPath
- * @throws DeploymentException
- */
- //@Override
- public void init(final String suId, final String suPath)
- throws DeploymentException {
- final String taskName = "init";
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00202.JDBCBD_Init_SU",
- new Object[] { suId, suPath });
- }
-
- try {
- // Prepare for start if the deployment hasn't been processed yet.
- if (mDeployedIds.get(suId) == null) {
- final StatusProviderHelper statusProviderHelper = mLifeCycle.getStatusProviderHelper();
- processDeployment(suId, suPath, statusProviderHelper);
- }
-
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00203.JDBCBD_Complete_init_SU", suId);
- }
- } catch (final DeploymentException ex) {
- final String errMsg = JDBCBindingDeployer.mMessages.getString("SQLSE_E00204.JDBCBD_Failed_init_SU",
- ex.getMessage());
- JDBCBindingDeployer.mLogger.log(Level.SEVERE, errMsg);
-
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "JDBCBC_INIT_1", null, errMsg, ex);
- throw new DeploymentException(exMsg, ex);
- }
- }
-
- /**
- * Process a deployment, validating it and preparing to start it..
- *
- * @param suId
- * the name of the Service Unit being initialized.
- * @param path
- * the full path to the Service Unit artifact root directory.
- * @throws javax.jbi.management.DeploymentException
- * if the Service Unit is not deployed, or is in an incorrect
- * state.
- */
- private void processDeployment(final String suId, final String path,
- final StatusProviderHelper statusProviderHelper) throws DeploymentException {
- final String taskName = "processDeployment";
-
- try {
- final File asaDir = new File(path);
- mHelper.deploy(asaDir, suId, mContext, statusProviderHelper);
-
- final EndpointBean[] endPointsArr = mDeployedEndpoints.get(suId);
-
- mLifeCycle.activateEndpoints(endPointsArr);
- setEndpointsStatus(endPointsArr, EndpointBean.STATUS_RUNNING);
- } catch (final FileNotFoundException ex) {
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_PROCESS_2", suId,
- "Processing deployment error: " + ex.getMessage(), ex);
- throw new DeploymentException(exMsg);
- } catch (final IOException ex) {
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_PROCESS_3", suId,
- "Processing deployment error: " + ex.getMessage(), ex);
- throw new DeploymentException(exMsg);
- } catch (final MessagingException ex) {
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_PROCESS_4", suId,
- "Processing deployment error: " + ex.getMessage(), ex);
- throw new DeploymentException(exMsg);
- } catch (final Exception e) {
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_PROCESS_4", suId,
- "Processing deployment error: " + e.getMessage(), e);
- throw new DeploymentException(exMsg);
- }
- }
-
- /**
- * @param suId
- * @throws DeploymentException
- */
- // @Override
- public void start(final String suId) throws DeploymentException {
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00205.JDBCBD_Starting_SU", suId);
- }
-
- final EndpointBean[] endPointsArr = mDeployedEndpoints.get(suId);
- setEndpointsStatus(endPointsArr, EndpointBean.STATUS_RUNNING);
-
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00207.JDBCBD_Complete_start_BC");
- }
- }
-
- /**
- * @param suId
- * @throws DeploymentException
- */
- //@Override
- public void stop(final String suId) throws DeploymentException {
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00208.JDBCBD_Stop_SU", suId);
- }
-
- final EndpointBean[] endPointsArr = mDeployedEndpoints.get(suId);
-
- setEndpointsStatus(endPointsArr, EndpointBean.STATUS_STOPPED);
-
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00210.JDBCBD_Complete_stop_SU", suId);
- }
- }
-
- /**
- * @param suId
- * @throws DeploymentException
- */
- //@Override
- public void shutDown(final String suId) throws DeploymentException {
- final String taskName = "shutDown";
-
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00211.JDBCBD_Shutdown_SU", suId);
- }
-
- final File asaDir = mDeployedIds.get(suId);
-
- if (asaDir == null) {
- JDBCBindingDeployer.mLogger.info("Service unit " + mContext.getComponentName() +
- " is not deployed.");
- } else {
- final EndpointBean[] endPointsArr = mDeployedEndpoints.get(suId);
-
- try {
- mLifeCycle.deactivateEndpoints(endPointsArr);
- } catch (final MessagingException ex) {
- final String errMsg = mMessages.getString("SQLSE_E00212.JDBCBD_Error_shutdown_SU",
- ex.getMessage());
- JDBCBindingDeployer.mLogger.log(Level.SEVERE, errMsg);
-
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "JDBCBC_SHUTDOWN_1", null, errMsg,
- ex);
- throw new DeploymentException(exMsg, ex);
- }
-
- setEndpointsStatus(endPointsArr, EndpointBean.STATUS_SHUTDOWN);
-
- final StatusProviderHelper statusProviderHelper = mLifeCycle.getStatusProviderHelper();
- mHelper.undeploy(suId, asaDir, statusProviderHelper);
- }
- }
-
- /**
- * Cancel a Service Deployment. If the deployment is in use (has
- * dependencies), then this operation may fail.
- *
- * @param name -
- * name of the service unit
- * @param root -
- * root of the service unit
- * @return
- * @throws DeploymentException
- */
- //@Override
- public String undeploy(final String name, final String root) throws DeploymentException {
- String retMsg = null;
- final String taskName = "undeploy";
-
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00213.JDBCBD_Undeploy_SU",
- new Object[] { name, root });
- }
-
- retMsg = createSuccessMessage(taskName, mContext.getComponentName());
-
- return retMsg;
- }
-
- /**
- * Determine the message exchange pattern. For handling 1.1 wsdls, map
- * transmission primitives to the closest message exchange pattern, taking
- * into account the endpoint direction direction inbound: request-response
- * and solicit-response -> in-out one-way and notification -> in-only
- * direction outbound: request-response and solicit-response -> out-in
- * one-way and notification -> out-only
- *
- * @param pm
- * the endpoint configuration from the portmap
- * @param po
- * the binding operation definition from the wsdl
- * @return the message exchange pattern, null if no mapping could be
- * determined.
- */
- private String determineMEP(final PortMap pm, final BindingOperation bo) {
- String mep = null;
- final OperationType type = bo.getOperation().getStyle();
-
- if (pm.getDirection().equals(EndpointBean.ENDPOINT_TYPE_INBOUND)) {
- if (type.equals(OperationType.REQUEST_RESPONSE) ||
- type.equals(OperationType.SOLICIT_RESPONSE)) {
- mep = "inout";
- } else if (type.equals(OperationType.ONE_WAY) ||
- type.equals(OperationType.NOTIFICATION)) {
- mep = "inonly";
- }
- } else {
- if (type.equals(OperationType.REQUEST_RESPONSE) ||
- type.equals(OperationType.SOLICIT_RESPONSE)) {
- mep = "outin";
- } else if (type.equals(OperationType.ONE_WAY) ||
- type.equals(OperationType.NOTIFICATION)) {
- mep = "outonly";
- }
- }
-
- return mep;
- }
-
- /**
- * Keep track of the running status of each endpoint. This allows for quick
- * look-up of the state and provides for extensibility where an individual
- * endpoint could be controlled rather than the whole SU.
- */
- private void setEndpointsStatus(final EndpointBean[] endpoints, final String status) {
- if (endpoints != null) {
- for (EndpointBean element : endpoints) {
- element.setValue(EndpointBean.STATUS, status);
- }
- }
- }
-
- private String createSuccessMessage(final String taskName, final String componentName) {
- final JBITaskMessageBuilder msgBuilder = new DefaultJBITaskMessageBuilder();
- msgBuilder.setComponentName(componentName);
-
- final String retMsg = msgBuilder.createSuccessMessage(taskName);
-
- return retMsg;
- }
-
- private String createExceptionMessage(final String componentName,
- final String taskName, final String status, final String locToken, final String locParam,
- final String locMessage, final Throwable exObj) {
- final JBITaskMessageBuilder msgBuilder = new DefaultJBITaskMessageBuilder();
- msgBuilder.setComponentName(componentName);
-
- final String retMsg = msgBuilder.createExceptionMessage(taskName, locToken,
- locMessage, locParam, exObj);
-
- return retMsg;
- }
-
- /**
- * List all wsdl files in the currentDir and below
- * @author Administrator
- *
- */
- private class DeployHelper {
- private List listWSDLFiles(final File currentDir) {
- final List cumulativeResults = new ArrayList();
- final File[] filesInCurrentDir = currentDir.listFiles();
-
- for (File element : filesInCurrentDir) {
-
- if (element.isFile()) {
-
- if (element.getName().toLowerCase().endsWith(".wsdl")) {
- cumulativeResults.add(element);
- }
- } else if (element.isDirectory()) {
- final List wsdlsInSubDirectories = listWSDLFiles(element);
- cumulativeResults.addAll(wsdlsInSubDirectories);
- }
- }
- return cumulativeResults;
- }
-
- /**
- *
- * @param f
- * @param resolver
- * @return
- * @throws javax.wsdl.WSDLException
- */
- private Definition readWsdl(final File f, final EntityResolver resolver)
- throws javax.wsdl.WSDLException {
- /*final WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- final WSDLReader reader = ((WSDLFactoryImpl) wsdlFactory).newWSDLReader(resolver);
- reader.setExtensionRegistry(new JDBCExtensionRegistry());
-
- final Definition def = reader.readWSDL(f.getAbsolutePath());*/
-
- // above default Implementation changed with current sun extension
- final WSDLFactoryEx wsdlFactory = new WSDLFactoryEx();
- WSDLReaderEx reader = wsdlFactory.newWSDLReaderEx();
- reader.setEntityResolver(resolver);
- reader.setExtensionRegistry(new JDBCExtensionRegistry());
- final Definition def = reader.readWSDL(f.getAbsolutePath());
-
- return def;
- }
-
- /**
- *
- * @param def
- * @param serviceName
- * @param endpointName
- * @return
- */
- private Binding getBinding(final Definition def, final String serviceName,
- final String endpointName) {
- final Service svc = def.getService(QName.valueOf(serviceName));
-
- if (svc == null) {
- return null;
- }
-
- final Port port = svc.getPort(QName.valueOf(endpointName).getLocalPart());
-
- if (port == null) {
- return null;
- } else {
- return port.getBinding();
- }
- }
-
- /**
- *
- * @param def
- * @param portTypeName
- * @param operationName
- * @return
- */
- private Operation getOperation(final Definition def, final String portTypeName,
- final String operationName) {
- Operation operation = null;
- final PortType pType = def.getPortType(QName.valueOf(portTypeName));
-
- if (pType != null) {
- operation = pType.getOperation(operationName, null, null);
- }
-
- return operation;
- }
-
- /**
- *
- * @param def
- * @param serviceName
- * @param endpointName
- * @return
- */
- private JDBCAddress getJDBCAddress(final Definition def, final String serviceName,
- final String endpointName) {
- JDBCAddress address = null;
- final Service svc = def.getService(QName.valueOf(serviceName));
-
- if (svc == null) {
- return null;
- }
-
- final Port port = svc.getPort(QName.valueOf(endpointName).getLocalPart());
-
- if (port != null) {
- final List extElems = port.getExtensibilityElements();
-
- // Look for jdbc:address
- final Iterator extIter = (extElems == null) ? null : extElems.iterator();
-
- while ((extIter != null) && extIter.hasNext() &&
- (address == null)) {
- final ExtensibilityElement ee = (ExtensibilityElement) extIter.next();
-
- if (JDBCAddress.class.isInstance(ee)) {
- address = (JDBCAddress) ee;
- }
- }
- }
-
- return address;
- }
-
- /**
- *
- * @param def
- * @param serviceName
- * @param endpointName
- * @return
- */
- private JDBCBinding getJDBCBinding(final Definition def, final String serviceName,
- final String endpointName) {
- JDBCBinding jdbcBinding = null;
- final Binding binding = getBinding(def, serviceName, endpointName);
-
- if (binding != null) {
- final List extElems = binding.getExtensibilityElements();
-
- // Look for jdbc:binding
- final Iterator extIter = (extElems == null) ? null : extElems.iterator();
-
- while ((extIter != null) && extIter.hasNext() &&
- (jdbcBinding == null)) {
- final ExtensibilityElement ee = (ExtensibilityElement) extIter.next();
-
- if (JDBCBinding.class.isInstance(ee)) {
- jdbcBinding = (JDBCBinding) ee;
- }
- }
- }
-
- return jdbcBinding;
- }
-
- /**
- *
- * @param def
- * @param serviceName
- * @param endpointName
- * @return
- */
- private JDBCOperation[] getJDBCOperations(final Definition def,
- final String serviceName, final String endpointName) {
- final List jdbcOperations = new ArrayList();
- final Binding binding = getBinding(def, serviceName, endpointName);
-
- if (binding != null) {
- final List bindingOperations = binding.getBindingOperations();
- final Iterator operIter = (bindingOperations == null) ? null
- : bindingOperations.iterator();
-
- while ((operIter != null) && operIter.hasNext()) {
- final BindingOperation oper = (BindingOperation) operIter.next();
- final List extElems = oper.getExtensibilityElements();
-
- // Look for file:operation entries
- final Iterator extIter = (extElems == null) ? null
- : extElems.iterator();
-
- while ((extIter != null) && extIter.hasNext()) {
- final ExtensibilityElement ee = (ExtensibilityElement) extIter.next();
-
- if (JDBCOperation.class.isInstance(ee)) {
- jdbcOperations.add(ee);
- }
- }
- }
- }
-
- return jdbcOperations.toArray(new JDBCOperation[0]);
- }
-
- /**
- *
- * @param bindingInput
- * @return
- */
- private JDBCOperationInput getJDBCOperationInput(
- final BindingInput bindingInput) {
- JDBCOperationInput operationInput = null;
- final List extElems = bindingInput.getExtensibilityElements();
-
- // Look for jdbc:input entries
- final Iterator extIter = (extElems == null) ? null : extElems.iterator();
-
- while ((extIter != null) && extIter.hasNext()) {
- final ExtensibilityElement ee = (ExtensibilityElement) extIter.next();
-
- if (JDBCOperationInput.class.isInstance(ee)) {
- operationInput = (JDBCOperationInput) ee;
-
- break;
- }
- }
-
- return operationInput;
- }
-
- /**
- *
- * @param bindingOutput
- * @return
- */
- private JDBCOperationOutput getJDBCOperationOutput(
- final BindingOutput bindingOutput) {
- JDBCOperationOutput operationOutput = null;
-
- final List extElems = bindingOutput.getExtensibilityElements();
-
- // Look for jdbc:output entries
- final Iterator extIter = (extElems == null) ? null : extElems.iterator();
-
- while ((extIter != null) && extIter.hasNext()) {
- final ExtensibilityElement ee = (ExtensibilityElement) extIter.next();
-
- if (JDBCOperationOutput.class.isInstance(ee)) {
- operationOutput = (JDBCOperationOutput) ee;
-
- break;
- }
- }
-
- return operationOutput;
- }
-
- /**
- *
- * @param jdbcOperation
- * @param def
- * @param serviceName
- * @param endpointName
- * @return
- */
- private BindingOperation getParentBindingOperation(
- final JDBCOperation jdbcOperation, final Definition def, final String serviceName,
- final String endpointName) {
- BindingOperation bindingOperation = null;
-
- final Binding binding = getBinding(def, serviceName, endpointName);
-
- if (binding != null) {
- final List l = binding.getBindingOperations();
- final Iterator it = l.iterator();
-
- while (it.hasNext()) {
- final BindingOperation bOperation = (BindingOperation) it.next();
- final List exElements = bOperation.getExtensibilityElements();
-
- if ((exElements != null) &&
- exElements.contains(jdbcOperation)) {
- bindingOperation = bOperation;
-
- break;
- }
- }
- }
-
- return bindingOperation;
- }
-
- /**
- *
- * @param asaDir
- * @param id
- * @param compContext
- * @param statusProviderHelper
- * @throws IOException
- * @throws DeploymentException
- * @throws javax.jbi.messaging.MessagingException
- */
- private void deploy(final File asaDir, final String id,
- final ComponentContext compContext,
- final StatusProviderHelper statusProviderHelper)
- throws IOException, DeploymentException,
- javax.jbi.messaging.MessagingException {
- final String taskName = "deploy";
-
- final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder documentBuilder = null;
-
- try {
- documentBuilder = docBuilderFactory.newDocumentBuilder();
- } catch (final Exception ex) {
- final String msg = "Failed to obtain a DOM parser: " +
- ex.getMessage();
- JDBCBindingDeployer.mLogger.severe(msg);
-
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_DEPLOY_HELPER_1", id, msg, null);
- throw new DeploymentException(exMsg);
- }
-
- // read all wsdl files to see if
- final FileToDefinitionInfo[] fileToDefs = readAllDefinitions(asaDir, id,
- taskName, "FBC_DEPLOY_HELPER_4");
-
- final ArrayList endPoints = new ArrayList();
-
- if (SUDescriptorSupport.TEMP_SWITCH_ENABLE_JBI_ROUTING) {
- JDBCBindingDeployer.mLogger.info(
- "About to parse jbi.xml to resolve service end point.");
-
- EndpointIdentifier[] svcs = null;
-
- try {
- final SUDescriptorSupport descSupport = new SUDescriptorSupport(asaDir.getAbsolutePath());
- svcs = descSupport.getServices();
- } catch (final Exception ex) {
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_DEPLOY_12_1", id,
- "Error parsing SU descriptor from" +
- asaDir.getAbsolutePath() + " for " + id, ex);
- throw new DeploymentException(exMsg);
- }
-
- final int len = svcs.length;
-
- for (int i = 0; i < len; i++) {
- Definition matchedDef = null;
- File matchedWSDL = null;
- JDBCBinding jdbcBinding = null;
- JDBCOperation[] jdbcOperations = null;
- final BindingOperation[] bindingOperations = null;
- JDBCAddress jdbcAddress = null;
-
- // Document result = null;
- final EndpointIdentifier epDesc = svcs[i];
-
- for (FileToDefinitionInfo element : fileToDefs) {
- jdbcBinding = getJDBCBinding(element.getDefinition(),
- epDesc.getServiceName().toString(),
- epDesc.getEndpointName());
-
- if (jdbcBinding != null) {
- matchedDef = element.getDefinition();
- // this is the wsdl that contains the service
- // endpoint, save it
- matchedWSDL = element.getFile();
-
- break;
- }
- }
-
- // If no jdbc:binding is defined, the jdbcbc does not
- // service this wsdl
- if (jdbcBinding != null) {
- // Prepare and cache the endpoint descriptor
- /*
- * try { result = documentBuilder.parse(matchedWSDL); }
- * catch (Exception ex) { String msg = "Failed to parse
- * WSDL to prepare endpoint descriptor for " +
- * epDesc.getServiceName().toString() + " " +
- * epDesc.getEndpointName() + ":" + ex.getMessage();
- * String exMsg = createExceptionMessage(mContext
- * .getComponentName(), taskName, "FAILED",
- * "FBC_DEPLOY_HELPER_11", id, msg, ex); throw new
- * DeploymentException(exMsg); }
- */
- jdbcAddress = getJDBCAddress(matchedDef,
- epDesc.getServiceName().toString(),
- epDesc.getEndpointName());
-
- if (jdbcAddress == null) {
- final String msg = "Missing jdbc:address in wsdl for this service " +
- epDesc.getServiceName().toString();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_DEPLOY_HELPER_5",
- id, msg, null);
- throw new DeploymentException(exMsg);
- } else if (jdbcAddress.getJndiName() == null) {
- final String msg = "Missing " +
- JDBCAddress.ATTR_JNDI_NAME +
- " in jdbc:address of wsdl for this service " +
- epDesc.getServiceName().toString();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_DEPLOY_HELPER_6",
- id, msg, null);
- throw new DeploymentException(exMsg);
- }
-
- jdbcOperations = getJDBCOperations(matchedDef,
- epDesc.getServiceName().toString(),
- epDesc.getEndpointName());
-
- if ((jdbcOperations == null) ||
- (jdbcOperations.length == 0)) {
- final String msg = "Missing jdbc:operation definition(s) in wsdl for this service " +
- epDesc.getServiceName().toString();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "FBC_DEPLOY_HELPER_7",
- id, msg, null);
- throw new DeploymentException(exMsg);
- }
-
- // create endpoint bean for each operation
- final EndpointBean bcEndpoint = new EndpointBean();
-
- bcEndpoint.setValueObj(EndpointBean.WSDL_FILE,
- matchedWSDL);
- bcEndpoint.setValueObj(EndpointBean.DESCRIPTOR,
- matchedDef); // result
- bcEndpoint.setValue(EndpointBean.JDBC_DATABASE_JNDI_NAME,
- jdbcAddress.getJndiName());
-
- bcEndpoint.setValue(EndpointBean.JDBC_DATABASE_DRIVER_CLASS,
- jdbcAddress.getDriverClass());
- bcEndpoint.setValue(EndpointBean.JDBC_DATABASE_URL,
- jdbcAddress.getDBUrl());
- bcEndpoint.setValue(EndpointBean.JDBC_DATABASE_USER,
- jdbcAddress.getUserName());
- bcEndpoint.setValue(EndpointBean.JDBC_DATABASE_PASSWORD,
- jdbcAddress.getPassword());
-
- final String endpoint = epDesc.getEndpointName();
- final String endpointNameLocalPart = QName.valueOf(endpoint)
- .getLocalPart();
- bcEndpoint.setValue(EndpointBean.ENDPOINT_NAME,
- endpointNameLocalPart);
- bcEndpoint.setValue(EndpointBean.SERVICE_NAME,
- epDesc.getServiceName().toString());
- bcEndpoint.setValueObj(EndpointBean.FULL_SERVICE_NAME,
- epDesc.getServiceName());
- bcEndpoint.setValue(EndpointBean.STATUS,
- EndpointBean.STATUS_SHUTDOWN);
-
- if (epDesc.isProvider()) {
- bcEndpoint.setValue(EndpointBean.ENDPOINT_TYPE,
- EndpointBean.ENDPOINT_TYPE_OUTBOUND);
- } else {
- bcEndpoint.setValue(EndpointBean.ENDPOINT_TYPE,
- EndpointBean.ENDPOINT_TYPE_INBOUND);
- }
-
- final StatusReporting reporting = statusProviderHelper.getStatusReporter();
- final QName serviceName = (QName) bcEndpoint.getValueObj(EndpointBean.FULL_SERVICE_NAME);
- final String portName = bcEndpoint.getValue(EndpointBean.ENDPOINT_NAME);
- String uniqueName = null;
-
- if (bcEndpoint.getValue(EndpointBean.ENDPOINT_TYPE)
- .equals(EndpointBean.ENDPOINT_TYPE_INBOUND)) {
- uniqueName = statusProviderHelper.createConsumingEndpointIdentifier(serviceName,
- portName);
- reporting.addConsumingEndpoint(uniqueName);
- } else {
- uniqueName = statusProviderHelper.createProvisioningEndpointIdentifier(serviceName,
- portName);
- reporting.addProvisioningEndpoint(uniqueName);
- }
-
- final EndpointStatus stat = reporting.getEndpointStatus(uniqueName);
- bcEndpoint.setEndpointStatus(stat);
- endPoints.add(bcEndpoint);
-
- final Map operationNameToMetaData = new HashMap();
-
- for (final JDBCOperation jdbcOperation : jdbcOperations) {
- // TODO: keep all the info separately in
- // endpointbean.
- final BindingOperation bindingOperation = getParentBindingOperation(jdbcOperation,
- matchedDef,
- epDesc.getServiceName().toString(),
- epDesc.getEndpointName());
-
- if (bindingOperation == null) {
- final String msg = "Misssing binding operation in wsdl for this service " +
- epDesc.getServiceName().toString();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED",
- "FBC_DEPLOY_HELPER_11", id, msg, null);
- throw new DeploymentException(exMsg);
- }
-
- final Binding binding = getBinding(matchedDef,
- epDesc.getServiceName().toString(),
- epDesc.getEndpointName());
- final PortType pt = binding.getPortType();
-
- if (pt == null) {
- final String msg = "Misssing binding portType in wsdl for this service " +
- epDesc.getServiceName().toString() +
- " portType : " + pt.getQName();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED",
- "FBC_DEPLOY_HELPER_12", id, msg, null);
- throw new DeploymentException(exMsg);
- }
-
- final Operation operation = getOperation(matchedDef,
- pt.getQName().toString(),
- bindingOperation.getName());
-
- if (operation == null) {
- final String msg = "Misssing portType operation in wsdl for this service " +
- epDesc.getServiceName().toString() +
- " portType : " + pt.getQName() +
- "operation : " +
- bindingOperation.getName();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED",
- "FBC_DEPLOY_HELPER_13", id, msg, null);
- throw new DeploymentException(exMsg);
- }
-
- JDBCOperationInput jdbcOperationInput = null;
-
- if (bindingOperation.getBindingInput() != null) {
- jdbcOperationInput = getJDBCOperationInput(bindingOperation.getBindingInput());
- }
-
- JDBCOperationOutput jdbcOperationOutput = null;
-
- if (bindingOperation.getBindingOutput() != null) {
- jdbcOperationOutput = getJDBCOperationOutput(bindingOperation.getBindingOutput());
- }
-
- JDBCOperationInput jdbcSql = null;
-
- if (jdbcOperationInput != null) {
- jdbcOperationInput.setJDBCSql(jdbcOperationInput);
- }
- jdbcSql = jdbcOperationInput.getJDBCSql();
-
- final String jdbcSqlStr = jdbcSql.getSql().trim();
-
- if (jdbcSqlStr == null) {
- final String msg = "Missing sql under jdbc:input element in wsdl for this service " +
- epDesc.getServiceName().toString();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED",
- "JDBC_DEPLOY_HELPER_8", id, msg, null);
- throw new DeploymentException(exMsg);
- }
-
- JDBCBindingDeployer.mLogger.info("JDBC binding operation " +
- jdbcOperationInput.getOperationType() +
- " sql " + jdbcSqlStr);
-
- // create operation meta data
- final OperationMetaData opMetaData = new OperationMetaData();
- opMetaData.setBindingOperation(bindingOperation);
- opMetaData.setJDBCOperation(jdbcOperation);
- opMetaData.setJDBCOperationInput(jdbcOperationInput);
- opMetaData.setJDBCSql(jdbcSql);
- opMetaData.setJDBCOperationOutput(jdbcOperationOutput);
- opMetaData.setOperation(operation);
- opMetaData.setDefinition(matchedDef);
- operationNameToMetaData.put(bindingOperation.getName(),
- opMetaData);
- }
-
- bcEndpoint.setValueObj(EndpointBean.OPERATION_NAME_TO_META_DATA,
- operationNameToMetaData);
- }
- }
- }
-
- // todo : should consider what happens if one endpoint fails to
- // activate
- // what type of cleanup should we do?
- final EndpointBean[] endPointsArr = endPoints.toArray(new EndpointBean[0]);
- mDeployedIds.put(id, asaDir);
- mDeployedEndpoints.put(id, endPointsArr);
- }
-
- /**
- *
- * @param asaId
- * @param asaDir
- * @param statusProviderHelper
- * @throws DeploymentException
- */
- private void undeploy(final String asaId, final File asaDir,
- final StatusProviderHelper statusProviderHelper)
- throws DeploymentException {
- final String taskName = "undeploy";
-
- if (JDBCBindingDeployer.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingDeployer.mLogger.log(Level.INFO, "SQLSE_R00213.JDBCBD_Undeploy_SU",
- new Object[] { asaId, asaDir });
- }
-
- try {
- mDeployedIds.remove(asaId);
-
- final EndpointBean[] endpoints = mDeployedEndpoints.remove(asaId);
-
- if (endpoints != null) {
- final StatusReporting reporting = statusProviderHelper.getStatusReporter();
-
- for (EndpointBean element : endpoints) {
- final QName serviceName = (QName) element.getValueObj(EndpointBean.FULL_SERVICE_NAME);
- final String portName = element.getValue(EndpointBean.ENDPOINT_NAME);
- String uniqueName = null;
-
- if (element.getValue(
- EndpointBean.ENDPOINT_TYPE)
- .equals(EndpointBean.ENDPOINT_TYPE_INBOUND)) {
- uniqueName = statusProviderHelper.createConsumingEndpointIdentifier(serviceName,
- portName);
- reporting.removeConsumingEndpoints(new String[] {
- uniqueName
- });
- } else {
- uniqueName = statusProviderHelper.createProvisioningEndpointIdentifier(serviceName,
- portName);
- reporting.removeProvisioningEndpoints(new String[] {
- uniqueName
- });
- }
- }
- }
- } catch (final Exception e) {
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", "JDBCBC_UNDEPLOY_HELPER_1", asaId,
- "Failed to undeploy " + e.getMessage(), e);
- throw new DeploymentException(exMsg, e);
- }
- }
-
- /**
- *
- * @param asaDir
- * @param id
- * @param taskName
- * @param locToken
- * @return
- * @throws DeploymentException
- */
- private FileToDefinitionInfo[] readAllDefinitions(final File asaDir, final String id,
- final String taskName, final String locToken) throws DeploymentException {
- final CatalogManager catalogManager = new CatalogManager();
- catalogManager.setCatalogFiles(asaDir.getAbsolutePath() +
- File.separator + "xml-catalog.xml");
- catalogManager.setRelativeCatalogs(true);
-
- final EntityResolver resolver = new CatalogResolver(catalogManager);
-
- final List wsdls = listWSDLFiles(asaDir);
- final File[] wsdlFiles = wsdls.toArray(new File[0]);
-
- // read all wsdl files to see if
- FileToDefinitionInfo[] fileToDefs = null;
-
- if (wsdlFiles != null) {
- fileToDefs = new FileToDefinitionInfo[wsdlFiles.length];
-
- for (int i = 0; i < wsdlFiles.length; i++) {
- try {
- final Definition def = readWsdl(wsdlFiles[i], resolver);
- fileToDefs[i] = new FileToDefinitionInfo(wsdlFiles[i],
- def);
- } catch (final Exception e) {
- final String msg = "Unable to read WSDL file " +
- wsdlFiles[i] + " : " + e.getMessage();
- final String exMsg = createExceptionMessage(mContext.getComponentName(),
- taskName, "FAILED", locToken, id, msg, e);
- throw new DeploymentException(exMsg, e);
- }
- }
- }
-
- return fileToDefs;
- }
-
- /**
- *
- * @author Administrator
- *
- */
- class FileToDefinitionInfo {
- private File mFile;
- private Definition mDefinition;
-
- private FileToDefinitionInfo(final File file, final Definition definition) {
- mFile = file;
- mDefinition = definition;
- }
-
- private File getFile() {
- return mFile;
- }
-
- private Definition getDefinition() {
- return mDefinition;
- }
- }
- }
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCBindingLifeCycle.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCBindingLifeCycle.java
deleted file mode 100755
index 06a36d3d8..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCBindingLifeCycle.java
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)JDBCBindingLifeCycle.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import com.sun.jbi.configuration.RuntimeConfigurationHelper;
-import com.sun.jbi.eManager.provider.StatusProviderHelper;
-import com.sun.jbi.eManager.provider.StatusProviderMBean;
-import com.sun.jbi.internationalization.Messages;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-
-import org.xml.sax.SAXException;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.jbi.JBIException;
-import javax.jbi.component.Component;
-import javax.jbi.component.ComponentContext;
-import javax.jbi.component.ComponentLifeCycle;
-import javax.jbi.component.ServiceUnitManager;
-import javax.jbi.management.MBeanNames;
-import javax.jbi.messaging.DeliveryChannel;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.xml.sax.SAXException;
-import com.sun.jbi.configuration.RuntimeConfigurationHelper;
-import com.sun.jbi.eManager.provider.StatusProviderHelper;
-import com.sun.jbi.eManager.provider.StatusProviderMBean;
-import com.sun.jbi.internationalization.Messages;
-import com.sun.jbi.common.qos.messaging.MessagingChannel;
-import com.sun.jbi.common.qos.messaging.BaseMessagingChannel;
-import com.sun.jbi.jdbcbc.util.AlertsUtil;
-import com.sun.jbi.alerter.NotificationEvent;
-
-/**
- * BC life cycle implementation of the jbi framework
- *
- */
-public class JDBCBindingLifeCycle implements ComponentLifeCycle, Component {
- private static final Messages mMessages = Messages.getMessages(JDBCBindingLifeCycle.class);
- public static Logger mLogger = Messages.getLogger(JDBCBindingLifeCycle.class);
- private static final Map initializedLifeCycles = new HashMap();
- public static final String SHORT_DISPLAY_NAME = "JDBC BC";
- private JDBCComponentContext mContext = JDBCComponentContext.getInstance();
- private OutboundReceiver mOutboundReceiver;
- private InboundReceiver mInboundReceiver;
- private Thread mOutboundReceiverThread;
- Map mEndpoints = new HashMap();
- Map mEndpointMapping = new HashMap();
- private ObjectName mExtensionMBeanName;
- private MessagingChannel mChannel;
- private ObjectName mDeployerMBeanName;
- private JDBCBindingDeployer mDeployer;
- private StatusProviderHelper mStatusProviderHelper;
- private RuntimeConfiguration mRuntimeConfig;
- private RuntimeConfigurationHelper mRuntimeConfigHelper;
-
- public JDBCBindingLifeCycle() {
- }
-
- /**
- *
- * @return
- */
- //@Override
- public ComponentLifeCycle getLifeCycle() {
- return this;
- }
-
- /**
- *
- * @return
- */
- //@Override
- public ServiceUnitManager getServiceUnitManager() {
- return mDeployer;
- }
-
- /**
- *
- * @return
- */
- private ObjectName getDeploymentMBeanName() {
- return mDeployerMBeanName;
- }
-
- /**
- *
- * @return
- */
- //@Override
- public ObjectName getExtensionMBeanName() {
- return mExtensionMBeanName;
- }
-
- /**
- *
- * @param jbiContext
- * @throws JBIException
- */
- //@Override
- public void init(final ComponentContext jbiContext) throws JBIException {
- if (jbiContext == null) {
- throw new JBIException("Component Context is null");
- }
-
- mContext.setContext(jbiContext);
- Messages.registerContext(jbiContext);
- JDBCBindingLifeCycle.mLogger = Messages.getLogger(JDBCBindingLifeCycle.class);
- JDBCBindingLifeCycle.initializedLifeCycles.put(mContext.getContext().getComponentName(), this);
-
- final MBeanServer mbServer = jbiContext.getMBeanServer();
- final MBeanNames mbnHndl = jbiContext.getMBeanNames();
- mDeployer = new JDBCBindingDeployer(mContext.getContext(), this);
-
- final String componentName = jbiContext.getComponentName();
-
- try {
- mStatusProviderHelper = new StatusProviderHelper(JDBCBindingLifeCycle.SHORT_DISPLAY_NAME,
- StatusProviderMBean.COMPONENT_TYPE_BINDING,
- jbiContext.getComponentName(), jbiContext.getMBeanServer());
- mStatusProviderHelper.registerMBean();
-
- if (JDBCBindingLifeCycle.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingLifeCycle.mLogger.log(Level.INFO, "SQLSE_R00102.JDBCBLC_Register_mbean", componentName);
- }
- } catch (final Exception ex) {
- JDBCBindingLifeCycle.mLogger.log(Level.WARNING, "SQLSE_E00103.JDBCBLC_Failed_register_mbean", ex);
- throw new JBIException(JDBCBindingLifeCycle.mMessages.getString(
- "SQLSE_E00103.JDBCBLC_Failed_register_mbean"), ex);
- }
-
- try {
- mRuntimeConfig = new RuntimeConfiguration(mContext.getContext().getWorkspaceRoot());
- mRuntimeConfigHelper = new RuntimeConfigurationHelper(RuntimeConfigurationHelper.COMPONENT_TYPE_BINDING,
- jbiContext.getComponentName(), jbiContext.getMBeanServer());
- mRuntimeConfigHelper.registerMBean(mRuntimeConfig);
-
- if (JDBCBindingLifeCycle.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingLifeCycle.mLogger.log(Level.INFO, "SQLSE_R00104.JDBCBLC_Register_config_mbean",
- componentName);
- }
- } catch (final Exception ex) {
- JDBCBindingLifeCycle.mLogger.log(Level.WARNING,
- JDBCBindingLifeCycle.mMessages.getString("SQLSE_E00105.JDBCBLC_Failed_register_config_mbean"), ex);
- throw new JBIException(JDBCBindingLifeCycle.mMessages.getString(
- "SQLSE_E00105.JDBCBLC_Failed_register_config_mbean"), ex);
- }
-
- try {
- //mChannel = mContext.getDeliveryChannel();
- mChannel = new BaseMessagingChannel(mContext.getContext());
- mContext.setBindingChannel(mChannel);
- } catch(MessagingException me) {
- String text = mMessages.getString("JDBCBC-E00141.No_binding_channel", me.getLocalizedMessage());
- mLogger.log(Level.SEVERE, text, me);
- AlertsUtil.getAlerter().critical(text,
- JDBCBindingLifeCycle.SHORT_DISPLAY_NAME,
- null,
- AlertsUtil.getServerType(),
- AlertsUtil.COMPONENT_TYPE_BINDING,
- NotificationEvent.OPERATIONAL_STATE_RUNNING,
- NotificationEvent.EVENT_TYPE_ALERT,
- "JDBCBC-E00141");
- throw me;
- }
-
- //try {
- mChannel = mContext.getBindingChannel();
- //} catch (final MessagingException me) {
- // JDBCBindingLifeCycle.mLogger.log(Level.SEVERE, "SQLSE_E00106.JDBCBLC_No_Dev_Channel", me.getMessage());
- // throw me;
- //}
-
- try {
- startOutbound();
- } catch (final Exception ex) {
- JDBCBindingLifeCycle.mLogger.log(Level.SEVERE,
- JDBCBindingLifeCycle.mMessages.getString("SQLSE_E00107.JDBCBLC_Failed_start_outbound",
- ex.getMessage()), ex);
- throw new JBIException(JDBCBindingLifeCycle.mMessages.getString(
- "SQLSE_E00107.JDBCBLC_Failed_start_outbound", ex.getMessage()), ex);
- }
-
- try {
- startInbound();
- } catch (final Exception ex) {
- JDBCBindingLifeCycle.mLogger.log(Level.SEVERE,
- JDBCBindingLifeCycle.mMessages.getString("JDBCBLC_Failed_start_inbound",
- ex.getMessage()), ex);
- throw new JBIException(JDBCBindingLifeCycle.mMessages.getString(
- "SQLSE_E00108.JDBCBLC_Failed_start_inbound", ex.getMessage()), ex);
- }
- }
-
- /**
- *
- * @throws JBIException
- */
- //@Override
- public void shutDown() throws JBIException {
- JDBCBindingLifeCycle.mLogger.info("SQLSE_R00109.JDBCBLC_Shutdown_JDBCBC");
-
- try {
- stopOutbound();
- stopInbound();
- } catch (final Exception ex) {
- JDBCBindingLifeCycle.mLogger.log(Level.WARNING,
- "Failed to stop the outbound receiver: " + ex.getMessage(), ex);
- throw new JBIException("Failed to stop the outbound receiver: " +
- ex.getMessage(), ex);
- }
-
- if (mChannel != null) {
- mChannel.close();
- }
-
- try {
- mStatusProviderHelper.unregisterMBean();
- } catch (final Exception ex) {
- JDBCBindingLifeCycle.mLogger.log(Level.WARNING,
- JDBCBindingLifeCycle.mMessages.getString("SQLSE_E00110.JDBCBLC_Failed_stop_outbound",
- ex.getMessage()), ex);
- throw new JBIException(JDBCBindingLifeCycle.mMessages.getString(
- "JDBCBLC_Failed_stop_outbound", ex.getMessage()), ex);
- }
-
- try {
- mRuntimeConfigHelper.unregisterMBean();
- } catch (final Exception ex) {
- JDBCBindingLifeCycle.mLogger.log(Level.WARNING,
- JDBCBindingLifeCycle.mMessages.getString("SQLSE_E00110.JDBCBLC_Failed_unregister_mbean",
- mContext.getContext().getComponentName()), ex);
- throw new JBIException(JDBCBindingLifeCycle.mMessages.getString(
- "JDBCBLC_Failed_unregister_mbean",
- mContext.getContext().getComponentName()), ex);
- }
-
- JDBCBindingLifeCycle.initializedLifeCycles.remove(mContext.getContext().getComponentName());
- mLogger.log(Level.SEVERE,mMessages.getString("SQLSE_E00113.JDBCBLC_Failed_Complete_JDBCBC_shutdown"));
- }
-
- /**
- *
- * @throws JBIException
- */
- //@Override
- public void start() throws JBIException {
- if (JDBCBindingLifeCycle.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingLifeCycle.mLogger.info("SQLSE_R00114.JDBCBLC_JDBCBC_started");
- }
- }
-
- /**
- *
- * @throws JBIException
- */
- //@Override
- public void stop() throws JBIException {
- if (JDBCBindingLifeCycle.mLogger.isLoggable(Level.INFO)) {
- JDBCBindingLifeCycle.mLogger.info("SQLSE_R00118.JDBCBLC_stopped");
- }
- }
-
- /**
- *
- * @param endpoint
- * @param exchange
- * @return
- */
- //@Override
- public boolean isExchangeWithConsumerOkay(final ServiceEndpoint endpoint,
- final MessageExchange exchange) {
- // TODO: check whether operation on endpoint actually exists.
- return true;
- }
-
- /**
- *
- * @param endpoint
- * @param exchange
- * @return
- */
- //@Override
- public boolean isExchangeWithProviderOkay(final ServiceEndpoint endpoint,
- final MessageExchange exchange) {
- // In FileBC Currently no "inbound" is supported
- return false;
- }
-
- /**
- *
- * @param endpoint
- * @return
- */
- //@Override
- public Document getServiceDescription(final ServiceEndpoint endpoint) {
- Document result = null;
-
- // TODO: The document returned should be a stand-alone document (no imports or includes)
- // TODO: consider whether it should only return the abstract wsdl concerning the endpoint
- // TODO: Beware for service engines that they HAVE TO include a specific binding type defined for Service Engines
- final String uniqueName = EndpointBean.getUniqueName(endpoint.getServiceName()
- .toString(),
- endpoint.getEndpointName(), EndpointBean.ENDPOINT_TYPE_OUTBOUND);
- final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
- final DocumentBuilder documentBuilder = null;
- final EndpointBean foundEndpoint = mEndpoints.get(uniqueName);
-
- if (foundEndpoint == null) {
- JDBCBindingLifeCycle.mLogger.info("Endpoint " + uniqueName +
- " could not be located in this binding component.");
- } else {
- try {
- final File matchedWSDL = (File) foundEndpoint.getValueObj(EndpointBean.WSDL_FILE);
- result = documentBuilder.parse(matchedWSDL);
- } catch (final SAXException ex) {
- mLogger.log(Level.SEVERE,"Endpoint " + result +
- "Cannot get the getServiceDescription Exception in SAXException",ex);
- } catch (final IOException exIO) {
- mLogger.log(Level.SEVERE,"Endpoint " + result +
- "Cannot get the getServiceDescription Exception in IOException",exIO);
-
- // throw exIO;
- } catch (final Exception exception) {
- mLogger.log(Level.SEVERE,"Endpoint " + result +
- "Cannot get the getServiceDescription Exception in Exception",exception);
-
- //throw exception;
- }
- }
-
- return result;
- }
-
- /**
- *
- * @param fragment
- * @return
- */
- //@Override
- public ServiceEndpoint resolveEndpointReference(final DocumentFragment fragment) {
- // Currently we do not support dynamic endpoints
- return null;
- }
-
- /**
- *
- * @return
- */
- public StatusProviderHelper getStatusProviderHelper() {
- return mStatusProviderHelper;
- }
-
- /**
- *
- * @param componentName
- * @return
- */
- public static JDBCBindingLifeCycle getInstanceForId(final String componentName) {
- return JDBCBindingLifeCycle.initializedLifeCycles.get(componentName);
- }
-
- /**
- *
- * @return
- */
- public MessagingChannel getMessagingChannel() {
- return mChannel;
- }
-
- public DeliveryChannel getDeliveryChannel(){
- return mContext.getBindingChannel();
- }
-
- /**
- *
- * @param context
- * @return
- */
- public EndpointBean getEndpointBeanForContext(final String context) {
- return (EndpointBean) mEndpointMapping.get(context);
- }
-
- /**
- *
- * @param endpoints
- * @throws MessagingException
- * @throws java.lang.Exception
- */
- public void activateEndpoints(final EndpointBean[] endpoints) throws MessagingException , Exception {
- JDBCBindingLifeCycle.mLogger.info("Activating endpoints");
-
- EndpointBean currEndpoint = null;
-
- for (EndpointBean element : endpoints) {
- currEndpoint = element;
-
- final String uniqueName = currEndpoint.getUniqueName();
-
- if(!mEndpoints.containsKey(uniqueName)) {
- mEndpoints.put(uniqueName, currEndpoint);
- } else {
- throw new Exception( mMessages.getString("SQLSE_E00120.JDBCBLC_Failed_deploy_EndPoint"));
- }
-
- // mEndpoints.put(uniqueName, currEndpoint);
-
- // For inbound endpoints, build an additional mapping from the URL
- // context to the endpoint
- if (currEndpoint.getValue(EndpointBean.ENDPOINT_TYPE)
- .equals(EndpointBean.ENDPOINT_TYPE_INBOUND)) {
- try {
- mInboundReceiver.addInboundMessageProcessor(currEndpoint);
- } catch (final FaultException ex) {
- mLogger.log(Level.SEVERE, "SQLSE_R00137.SQLSELC_SU_Failed_start_inbound_EP",
- uniqueName + " Reason " + ex.getMessage());
- } catch (final JBIException me) {
- mLogger.severe("Cannot activate endpoint " + uniqueName +
- " Reason " + me.getMessage());
- }
- } else if (EndpointBean.ENDPOINT_TYPE_OUTBOUND.equals(
- currEndpoint.getValue(EndpointBean.ENDPOINT_TYPE))) {
- // Activate an outbound endpoint
- try {
- final QName fullServiceName = (QName) currEndpoint.getValueObj(EndpointBean.FULL_SERVICE_NAME);
- final ServiceEndpoint endpointReference = mContext.getContext().activateEndpoint(fullServiceName,
- currEndpoint.getValue(EndpointBean.ENDPOINT_NAME));
- currEndpoint.setValueObj(EndpointBean.ENDPOINT_REFERENCE,
- endpointReference);
-
- if (mLogger.isLoggable(Level.INFO)) {
- mLogger.log(Level.INFO,"INFO,SQLSE_R00319.SQLSESU_ENDPOINT_ACTIVATED",
- uniqueName);
- }
- } catch (final JBIException me) {
- mLogger.severe("Cannot activate endpoint " + uniqueName +
- " Reason " + me.getMessage());
- }
- }
-
- currEndpoint.setValue(EndpointBean.STATUS,
- EndpointBean.STATUS_RUNNING);
- }
-
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_R00319.SQLSESU_ENDPOINT_ACTIVATED"));
- }
-
- /**
- *
- * @param endpoints
- * @throws MessagingException
- */
- public void deactivateEndpoints(final EndpointBean[] endpoints)
- throws MessagingException {
- EndpointBean currEndpoint = null;
- mLogger.info("Deactivating endpoints");
-
- for (EndpointBean element : endpoints) {
- currEndpoint = element;
-
- final String uniqueName = currEndpoint.getUniqueName();
- mEndpoints.remove(uniqueName);
-
- if (currEndpoint.getValue(EndpointBean.ENDPOINT_TYPE)
- .equals(EndpointBean.ENDPOINT_TYPE_INBOUND)) {
- try {
- final ServiceEndpoint endpointReference = (ServiceEndpoint) currEndpoint.getValueObj(EndpointBean.ENDPOINT_REFERENCE);
- mContext.getContext().deactivateEndpoint(endpointReference);
- } catch (final JBIException me) {
- JDBCBindingLifeCycle.mLogger.severe("Cannot deactivate endpoint " + uniqueName +
- " Reason " + me.getMessage());
- }
-
- mInboundReceiver.removeInboundMessageProcessor(currEndpoint);
- } else {
- try {
- final ServiceEndpoint endpointReference = (ServiceEndpoint) currEndpoint.getValueObj(EndpointBean.ENDPOINT_REFERENCE);
- mContext.getContext().deactivateEndpoint(endpointReference);
- } catch (final JBIException me) {
- mLogger.log(Level.SEVERE,"Cannot deactivate endpoint " + uniqueName +
- " Reason " + me.getMessage());
- }
- }
-
- currEndpoint.setValue(EndpointBean.STATUS,
- EndpointBean.STATUS_STOPPED);
- }
-
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_R00320.SQLSESU_ENDPOINT_DEACTIVATED"));
- }
-
- /**
- *
- * @throws JBIException
- */
- public void startInbound() throws JBIException {
- mInboundReceiver = new InboundReceiver(mChannel, mEndpoints,
- mRuntimeConfig, mContext.getContext());
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_R00116.JDBCBLC_started_inbound"));
- }
-
- /**
- *
- * @throws JBIException
- */
- public void startOutbound() throws JBIException {
- mOutboundReceiver = new OutboundReceiver(mChannel, mEndpoints,
- mRuntimeConfig, mContext);
- mOutboundReceiverThread = new Thread(mOutboundReceiver);
- mOutboundReceiverThread.start();
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_R00117.JDBCBLC_started_outbound"));
- }
-
- public void stopInbound() {
- if (mInboundReceiver != null) {
- mInboundReceiver.stopReceiving();
- }
-
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_R00119.JDBCBLC_stopped_inbound"));
- }
-
- public void stopOutbound() {
- if (mOutboundReceiver != null) {
- mOutboundReceiver.stopReceiving();
- }
-
- mLogger.log(Level.INFO,mMessages.getString("SQLSE_R00118.JDBCBLC_stopped_outbound"));
- }
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCComponentContext.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCComponentContext.java
deleted file mode 100755
index 2a133930f..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCComponentContext.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)JDBCComponentContext.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import com.sun.jbi.common.qos.messaging.MessagingChannel;
-import javax.jbi.component.ComponentContext;
-import javax.jbi.component.ComponentLifeCycle;
-
-/**
- * singleton used to share the component context within the http soap bc
- */
-public class JDBCComponentContext {
-
- private static JDBCComponentContext instance = new JDBCComponentContext();
-
- private ComponentContext context;
- private MessagingChannel channel;
- private ComponentLifeCycle lifeCycle;
-
- /** Creates a new instance of HttpSoapComponentContext */
- private JDBCComponentContext() {
- }
-
- public static JDBCComponentContext getInstance() {
- return instance;
- }
-
- public ComponentContext getContext() {
- return context;
- }
-
- public void setContext(ComponentContext context) {
- this.context = context;
- }
-
-
- /**
- * @return the component lifecycle associated with this context
- * if it has been initialized
- */
- public ComponentLifeCycle getAssociatedLifeCycle() {
- return lifeCycle;
- }
-
- /**
- * Set the component lifecycle associated with this context
- */
- public void setAssociatedLifeCycle(ComponentLifeCycle aLifeCycle) {
- lifeCycle = aLifeCycle;
- }
-
-
-
- /**
- * @return Obtain the channel associated with this context
- * if it has been initialized
- */
- public MessagingChannel getBindingChannel() {
- return channel;
- }
-
- /**
- * Set the initizalied channel associated with this context
- */
- public void setBindingChannel(MessagingChannel aChannel) {
- channel = aChannel;
- }
-
-
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCDenormalizer.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCDenormalizer.java
deleted file mode 100755
index 8547dc261..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCDenormalizer.java
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)JDBCDenormalizer.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import java.io.StringWriter;
-import java.sql.CallableStatement;
-import java.sql.DatabaseMetaData;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-
-import com.sun.jbi.jdbcbc.model.metadata.DBMetaData;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Part;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.stream.StreamResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import com.ibm.wsdl.util.xml.DOMUtils;
-import com.sun.jbi.internationalization.Messages;
-import com.sun.jbi.jdbcbc.extensions.JDBCOperationInput;
-import com.sun.jbi.nms.wsdl11wrapper.HelperFactory;
-import com.sun.jbi.nms.wsdl11wrapper.WrapperParser;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.Scanner;
-import javax.xml.transform.stream.StreamSource;
-
-
-/**
- *
- * JDBCDenormalizer
- *
- */
-public class JDBCDenormalizer {
- private static final Messages mMessages = Messages.getMessages(JDBCDenormalizer.class);
- private static final Logger mLogger = Messages.getLogger(JDBCDenormalizer.class);
- private String dbName=null;
- private String catalog=null;
- private ArrayList outParamIndex = new ArrayList();
- private HashMap outParamTypes = new HashMap();
- private HashMap outParamNames = new HashMap();
- private String mRecordPrefix = null; //113494
-
- /**
- *
- * @param normalizedMessage
- * @param opMetaData
- * @param ps
- * @throws MessagingException
- */
- protected void denormalizeOutbound(final NormalizedMessage normalizedMessage,
- final OperationMetaData opMetaData, final PreparedStatement ps)
- throws MessagingException {
- if (opMetaData != null) {
- final JDBCOperationInput mJdbcOperationInput = opMetaData.getJDBCOperationInput();
- final String operationType = mJdbcOperationInput.getOperationType();
-
- if (JDBCUtil.opList.contains(operationType)) {
- try {
- Element element = transformMessage(normalizedMessage,opMetaData);
- if (element != null) {
- populatePreparedStatement(element,opMetaData,ps);
- }
- } catch (final SQLException ex) {
- final String msg = JDBCDenormalizer.mMessages.getString("SQLSE_E00709.JDBCDN_FailedPopulate_PS");
- throw new MessagingException(msg, ex);
- } catch (final Exception ex) {
- final String msg = JDBCDenormalizer.mMessages.getString("SQLSE_E00709.JDBCDN_FailedPopulate_PS");
- throw new MessagingException(msg, ex);
- }
- }
- }
- }
-
- /**
- *
- * @param normalizedMessage
- * @param opMetaData
- * @param dbmeta
- * @param cs
- * @throws MessagingException
- */
- protected void denormalizeOutboundProc(final NormalizedMessage normalizedMessage,
- final OperationMetaData opMetaData, final DatabaseMetaData dbmeta,final CallableStatement cs)
- throws MessagingException {
- if (opMetaData != null) {
- final JDBCOperationInput mJdbcOperationInput = opMetaData.getJDBCOperationInput();
- final String operationType = mJdbcOperationInput.getOperationType();
-
- if (JDBCUtil.dbOperations[JDBCUtil.dbOperations.length-1].equals(operationType)) {
- try {
- Element element = transformMessage(normalizedMessage,opMetaData);
- if (element != null) {
- populateProcedure(element, opMetaData,dbmeta,cs);
- //registerOutParameters(cs, dbmeta);
- }
- } catch (final SQLException ex) {
- final String msg = JDBCDenormalizer.mMessages.getString(
- "SQLSE_E00711.JDBCDN_FailedPopulate_Proc");
- throw new MessagingException(msg, ex);
- } catch (final Throwable th) {
- final String msg = JDBCDenormalizer.mMessages.getString("SQLSE_E00712.JDBCDN_Failed_Proc");
- throw new MessagingException(msg, th);
- }
- }
- }
- }
-
- /**
- *
- * @param tableElem
- * @param opMetaData
- * @param cs
- * @throws SQLException
- * @throws MessagingException
- * @throws Exception
- */
- @SuppressWarnings("empty-statement")
- private void populateProcedure(final Element tableElem,
- final OperationMetaData opMetaData, final DatabaseMetaData dbmeta,CallableStatement cs)
- throws SQLException, MessagingException, Exception {
- final JDBCOperationInput jdbcSql = opMetaData.getJDBCSql();
- String sqltext = jdbcSql.getSql();
- String procName = getProcName(sqltext);
- String pcatalog = "";
- String pschema = "";
- if(dbName != null) {
- pschema = dbName;
- }
- if(catalog!=null){
- pcatalog = catalog;
- }
- ResultSet rs = null;
- if (jdbcSql != null) {
-
- try {
- rs = dbmeta.getProcedureColumns(pcatalog, pschema, procName, "%");;
- } catch (final SQLException ex) {
- mLogger.log(Level.WARNING, "Could not get Procedure Columns from DBMetaData", ex);
- }
-
- if (rs != null) {
- int i = 0;
- while(rs.next()) {
-// set default type.
- int targetSqlType = java.sql.Types.VARCHAR;
- final String columnName = rs.getString("COLUMN_NAME");
- targetSqlType = rs.getInt("DATA_TYPE");
- int colType = rs.getShort("COLUMN_TYPE");
- String type_Name = rs.getString("TYPE_NAME");
-
- final int columnNumber = i + 1;
- if ( colType == DatabaseMetaData.procedureColumnIn) {
- if ((targetSqlType == 1111) && (type_Name.equals("PL/SQL TABLE"))) {
- targetSqlType = -14;
- }
-
- if ((targetSqlType == 1111) && (type_Name.equals("PL/SQL RECORD"))) {
- targetSqlType = -14;
- }
- final Element columnElem = findMatchingColumnElement(columnName,
- tableElem, mRecordPrefix); //113494
-
- if (columnElem != null) {
- final String value = DOMUtils.getChildCharacterData(columnElem);
-
- if ((value != null) && !value.trim().equals("")) {
- cs.setObject(columnNumber,
- JDBCUtil.convert(value, targetSqlType), targetSqlType);
- }else {
- cs.setNull(columnNumber,targetSqlType);
- }
- }//end of if
- }//end of if
-
- if (colType == DatabaseMetaData.procedureColumnInOut || colType == DatabaseMetaData.procedureColumnOut) {
- try {
- // if the parameter is a cursor type, add its index to the arraylist
- if ((targetSqlType == 1111) && (type_Name.equals("REF CURSOR"))) {
- targetSqlType = -10;
- }
- cs.registerOutParameter(columnNumber, targetSqlType);
- outParamIndex.add(Integer.valueOf(Double.valueOf(columnNumber).intValue()));
- outParamTypes.put(columnNumber, type_Name);
- outParamNames.put(columnNumber, columnName);
- } catch(SQLException e) {
- System.out.println(e.getMessage());
- e.printStackTrace();
- //throw e;
- }
- }
-
- // check if the parameter is RETURN type (i.e. it is a function)
- if (colType == DatabaseMetaData.procedureColumnReturn) {
- try {
- // if the parameter is a cursor type, add its index to the arraylist
- if ((targetSqlType == 1111) && (type_Name.equals("REF CURSOR"))) {
- targetSqlType = -10;
- }
- cs.registerOutParameter(columnNumber, targetSqlType);
- outParamIndex.add(Integer.valueOf(Double.valueOf(columnNumber).intValue()));
- outParamTypes.put(columnNumber, type_Name);
- outParamNames.put(columnNumber, columnName);
- } catch(SQLException e) {
- System.out.println(e.getMessage());
- e.printStackTrace();
-
- //throw e;
- }
- }
-
- i++;
- }//end of While
- }// end of If
- }
- }
-
- /**
- *
- * @param tableElem
- * @param opMetaData
- * @param ps
- * @throws SQLException
- * @throws MessagingException
- * @throws Exception
- */
- private void populatePreparedStatement(final Element tableElem,
- final OperationMetaData opMetaData, final PreparedStatement ps)
- throws SQLException, MessagingException, Exception {
- final JDBCOperationInput jdbcSql = opMetaData.getJDBCSql();
-
- if (jdbcSql != null) {
- ParameterMetaData paramMetaData = null;
-
- try {
- paramMetaData = ps.getParameterMetaData();
- } catch (final SQLException ex) {
- ex.printStackTrace();
- }
-
- //113494 start
- mRecordPrefix = opMetaData.getJDBCSql().getTableName();
- // see if the table name is null (SQL SE)
- // then take the query name as the prefix
- if (mRecordPrefix == null) {
- mRecordPrefix = opMetaData.getJDBCOperationOutput().getName();
- mRecordPrefix = mRecordPrefix.substring(0, mRecordPrefix.indexOf("Response"));
- }
- //113494 end
- if (paramMetaData != null) {
- final int parameters = paramMetaData.getParameterCount();
-
- if (parameters != 0) {// If there are no parameter we do not need to set anything
- // on Prepared statement
- String paramOrder = jdbcSql.getParamOrder();
-
- // changed for SQLSE since the user cannot enter param
- // ordering in sqlprojects.
- // we should generate a default param ordering.
- if (paramOrder == null) {
- paramOrder = getDefaultParameterOrderString(paramMetaData);
- }
-
- final List columns = extractColumns(paramOrder);
-
- if (columns.size() == parameters) {
- for (int i = 0; i < parameters; i++) {
- final String columnName = (String) columns.get(i);
- final int columnNumber = i + 1;
- final Element columnElement = findMatchingColumnElement(
- columnName, tableElem, mRecordPrefix); //113494 Issue
-
- if (columnElement != null) {
- final String value = DOMUtils
- .getChildCharacterData(columnElement);
-
- if ((value != null) && !value.trim().equals("")) {
- // set default type.
- int columnType = java.sql.Types.VARCHAR;
-
- try {
- columnType = paramMetaData
- .getParameterType(columnNumber);
- } catch (final SQLException e) {
- mLogger.log(Level.WARNING, "Driver Does not support getting the Parameter Metadata", e);
- }
-
- ps.setObject(columnNumber, JDBCUtil
- .convert(value, columnType),
- columnType);
- }else{
- // set default type.
- int columnType = java.sql.Types.VARCHAR;
- try {
- columnType = paramMetaData
- .getParameterType(columnNumber);
- } catch (final SQLException e) {
- mLogger.log(Level.WARNING, "Driver Does not support getting the Datatypes", e);
- }
- ps.setNull(columnNumber,columnType);
- }
-
-
- }
- }
- } else {
- final String msg = JDBCDenormalizer.mMessages
- .getString("SQLSE_E00714.JDBCDN_Failed_PS_Param");
- throw new MessagingException(msg);
- }
- }
- }
- }
- }
-
- /**
- *
- * @param dbColumnName
- * @param tableElem
- * @return
- */
- private Element findMatchingColumnElement(final String dbColumnName,
- final Element tableElem, String recordPrefix) { // 113494 Issue
- Element columnElem = null;
- NodeList childNodes = tableElem.getChildNodes();
-
- for (int i = 0; i < childNodes.getLength(); i++) {
- final Node child = childNodes.item(i);
- ///////////////////////////////////
- if ((child instanceof Element) &&
- child.getLocalName().equalsIgnoreCase(recordPrefix + "_Record")) { // 113494 Issue
- columnElem = (Element) child;
- childNodes = columnElem.getChildNodes();
- }
- ///////////////////////////////////
- }
- for (int i = 0; i < childNodes.getLength(); i++) {
- final Node child = childNodes.item(i);
- if ((child instanceof Element) &&
- child.getLocalName().equalsIgnoreCase(dbColumnName)) {
- columnElem = (Element) child;
- break;
- }
- }
- return columnElem;
- }
-
- /**
- *
- * @param paramOrder
- * @return
- */
- private List extractColumns(final String paramOrder) {
- final List columnList = new ArrayList();
-
- if (paramOrder != null) {
- final Scanner tok = new Scanner(paramOrder).useDelimiter("\\s*" + "," + "\\s*");
-
- while (tok.hasNext()) {
- final String column = tok.next();
- columnList.add(column.trim());
- }
- }
-
- return columnList;
- }
-
- /**
- *
- * @param parent
- * @param msgQName
- * @return
- */
- private Element findChildElement(final Element parent, final QName msgQName) {
- final String ns = msgQName.getNamespaceURI();
- final String localName = msgQName.getLocalPart();
- NodeList nl = null;
-
- if ((ns != null) && !ns.trim().equals("")) {
- nl = parent.getElementsByTagNameNS(ns, localName);
- } else {
- nl = parent.getElementsByTagName(localName);
- }
-
- if ((nl != null) && (nl.getLength() > 0)) {
- if (JDBCDenormalizer.mLogger.isLoggable(Level.INFO)) {
- JDBCDenormalizer.mLogger.log(Level.INFO, "found element with name, " +
- localName);
- }
-
- final Element e2 = (Element) nl.item(0);
-
- return e2;
- }
-
- return null;
- }
-
- /**
- *
- * @param root
- * @param elemName
- * @return
- */
- private Element findPart(final Element root, final String elemName) {
- // parts wrappers never have namespace
- final NodeList nl = root.getElementsByTagName(elemName);
-
- if ((nl != null) && (nl.getLength() > 0)) {
- if (JDBCDenormalizer.mLogger.isLoggable(Level.INFO)) {
- JDBCDenormalizer.mLogger.log(Level.INFO, "found element with name, " + elemName);
- }
-
- final Element e2 = (Element) nl.item(0);
-
- return e2;
- }
-
- return null;
- }
-
- /**
- ** Used by SQLSE to get the default parameter ordering.
- * @param pmeta
- * @return
- */
- private String getDefaultParameterOrderString(final ParameterMetaData pmeta) {
- String parameterOrderString = null;
- int numParams = 0;
-
- if (pmeta != null) {
- try {
- numParams = pmeta.getParameterCount();
- } catch (final SQLException sqle) {
- JDBCDenormalizer.mLogger.log(Level.WARNING,
- JDBCDenormalizer.mMessages.getString("JDBCDN_Failed_ParamCount"));
-
- return null;
- }
-
- if (numParams > 0) {
- for (int i = 1; i <= numParams; i++) {
- final String paramname = "param" + String.valueOf(i);
- parameterOrderString = (parameterOrderString == null)
- ? paramname : (parameterOrderString + "," + paramname);
- }
- }
- }
-
- return parameterOrderString;
- }
-
- //register out parameters
-
- private void registerOutParameters(CallableStatement cstmt, final DatabaseMetaData dbmeta)
- throws SQLException, NullPointerException {
- String errMsg = "";
- int colCount = 0;
- boolean isFunction = false;
- boolean hasParameters = true;
- // indicates if the procedure is within a package or standalone
- boolean isPackaged = true;
- ArrayList paramIndices = new ArrayList();
- ArrayList result = new ArrayList();
- int paramIndex=0;
- try {
- ParameterMetaData pmeta = cstmt.getParameterMetaData();
- if (pmeta != null) {
- int numParams = pmeta.getParameterCount();
- if (numParams > 0) {
- // get info for each parameter
- for (int i = 1; i <= numParams; i++) {
- // try to get the sql type info - default to VARCHAR
- String sqlType = "VARCHAR";
- try {
- sqlType = DBMetaData.getSQLTypeDescription(pmeta.getParameterType(i));
- } catch (SQLException e) {
- mLogger.log(Level.WARNING, "Could not get SQL Type Description from DBMetadata", e);
- }
-
- // try to get the java type info - default to String
- /**
- * Changing it to not use metadata class name and instead use the HashMap SQLTOJAVATYPES.
- * Without the change the parameter datatypes java.lang.Double and WSDLGenerator look up list
- * exepects native type double, float, short etc.
- **/
- String javaType = "java.lang.String";
- javaType = DBMetaData.getJavaFromSQLTypeDescription(sqlType);
-
-// added abey for Procedure ResultSet
- try{
- if((pmeta.getParameterType(i)==java.sql.Types.OTHER)&&(pmeta.getParameterTypeName(i).equalsIgnoreCase("REF CURSOR"))){
- sqlType = "RESULTSET";
- javaType = "java.sql.ResultSet";
- }
- }catch (SQLException e) {
- mLogger.log(Level.WARNING, "Could not get Java type information from DBMetadata", e);
- }
-
- // try to get the param type, default to IN
- // always default it since getParameterMode() in data direct 3.3 throws exception
- // and 3.4 return UNKNOWN type
- String paramType = "IN";
-
- try {
- paramType = DBMetaData.getPrepStmtParamTypeDescription(pmeta.getParameterMode((i)));
- } catch (SQLException e) {
- mLogger.log(Level.WARNING, "Could not get PreparedStatement Parameter Description", e);
- }
-
-// set defalut type
- int sqlTypeCode = java.sql.Types.VARCHAR;
- if (paramType.equalsIgnoreCase("INOUT") || paramType.equalsIgnoreCase("OUT")) {
- try {
-
- // if the parameter is a cursor type, add its index to the arraylist
- if ((pmeta.getParameterType(i) == 1111) && (paramType.equals("OTHER"))) {
- sqlTypeCode = java.sql.Types.OTHER;
- }
-
- } catch(SQLException e) {
- mLogger.log(Level.WARNING, "Driver Does not support getting the Datatypes", e);
- }
- }
- if (paramType.equals("RETURN")) {
- try {
- // if the parameter is a cursor type, add its index to the arraylist
- if ((pmeta.getParameterType(i) == 1111) && (paramType.equals("OTHER"))) {
- //sqlTypeCode = java.sql.Types.OTHER;
-
- }
-
- } catch(SQLException e) {
- mLogger.log(Level.WARNING, "Driver Does not support getting the Datatypes", e);
- }
- }
- cstmt.registerOutParameter(paramIndex, sqlTypeCode);
- outParamIndex.add(Integer.valueOf(Double.valueOf(paramIndex).intValue()));
-
-
- }
- }
- }
-
-
-
-
-
- }catch(SQLException e) {
- mLogger.log(Level.WARNING, "Could not get Parameter MetaData", e);
- }
- }
-
- /*
- private String getProcName(String sqlText) {
- String proc_name = "";
- String schema = "";
- final Scanner tok = new Scanner(sqlText).useDelimiter("\\s*" + " " + "\\s*");
-
- while (tok.hasNext()) {
- String column = tok.next();
- int cnt = 0;
- column=column.toLowerCase();
- if(column.endsWith("call")){
- cnt++;
- proc_name=tok.next();
- if(proc_name.contains(".")){
- final Scanner tok1 = new Scanner(proc_name).useDelimiter("\\s*" + "." + "\\s*");
- schema=tok1.next();
- proc_name=tok1.next();
- }
- if(proc_name.contains("(")){
- int i = proc_name.indexOf("(");
- proc_name=proc_name.substring(0, i);
- }
- if(proc_name.contains("}")){
- int i = proc_name.indexOf("}");
- proc_name=proc_name.substring(0, i);
- }
- }
- if(cnt>0)
- break;
- }
- return proc_name;
- }
- */
- private String getProcName(String sqlText) {
- String proc_name = "";
- String schema = "";
- final StringTokenizer tok = new StringTokenizer(sqlText, " ");
-
- while (tok.hasMoreElements()) {
- String column = (String) tok.nextElement();
- int cnt = 0;
- column=column.toLowerCase();
- if(column.endsWith("call")){
- cnt++;
- proc_name=(String)tok.nextElement();
- if(proc_name.contains(".")){
- final StringTokenizer tok1 = new StringTokenizer(proc_name, ".");
- catalog=tok1.nextToken();
- proc_name=tok1.nextToken();
- }
- if(proc_name.contains("(")){
- int i = proc_name.indexOf("(");
- proc_name=proc_name.substring(0, i);
- }
- if(proc_name.contains("}")){
- int i = proc_name.indexOf("}");
- proc_name=proc_name.substring(0, i);
- }
- }
- if(cnt>0)
- break;
- }
- return proc_name;
- }
-
- private final Element transformMessage(final NormalizedMessage normalizedMessage,
- final OperationMetaData opMetaData) throws MessagingException{
- Element element = null;
- try {
- final TransformerFactory tFactory = TransformerFactory.newInstance();
- final Transformer trans = tFactory.newTransformer();
- final Source source = normalizedMessage.getContent();
- final DOMResult result = new DOMResult();
- trans.transform(source, result);
-
- if (source instanceof StreamSource) {
- StreamSource stream = (StreamSource) source;
- InputStream inputStream = stream.getInputStream();
- if (inputStream != null) {
- inputStream.reset();
- }
- Reader reader = stream.getReader();
- if (reader != null) {
- reader.reset();
- }
- }
-
- final Node node = result.getNode();
- final StringWriter strWriter = new StringWriter();
- final StreamResult sResult = new StreamResult(strWriter);
- trans.transform(source, sResult);
-
- if (source instanceof StreamSource) {
- StreamSource stream = (StreamSource) source;
- InputStream inputStream = stream.getInputStream();
- if (inputStream != null) {
- inputStream.reset();
- }
- Reader reader = stream.getReader();
- if (reader != null) {
- reader.reset();
- }
- }
- if (node != null) {
- Document normalDoc = null;
-
- if (node instanceof Document) {
- normalDoc = (Document) node;
- } else {
- normalDoc = ((Element) node).getOwnerDocument();
- }
-
- final Element normalRoot = normalDoc.getDocumentElement();
- //final BindingOperation bindingOperation = opMetaData.getBindingOperation();
- final Operation operation = opMetaData.getOperation();
- final Input input = operation.getInput();
- final Message inputMessage = input.getMessage();
-
- if (HelperFactory.WRAPPER_ENABLED) {
- final WrapperParser wrapperParser = HelperFactory.createParser();
- wrapperParser.parse(normalDoc, inputMessage);
-
- final Map parts = inputMessage.getParts();
- final Iterator it = parts.values().iterator();
-
- while (it.hasNext()) {
- final Part part = (Part) it.next();
-
- if (wrapperParser.hasPart(part.getName())) {
- final QName elementQName = part.getElementName();
-
- if (elementQName == null) {
- final String msgEx = JDBCDenormalizer.mMessages.getString(
- "SQLSE_E00706.JDBCDN_Failed_Denormalize") +
- part.getName() +
- "should have element attribute defined.";
- throw new MessagingException(msgEx);
- }
-
- //Element element = null;
- final NodeList unwrappedList = wrapperParser.getPartNodes(part.getName());
-
- for (int j = 0;
- j < unwrappedList.getLength();
- j++) {
- final Node unwrapped = unwrappedList.item(j);
-
- if ((unwrapped.getNodeType() == Node.ELEMENT_NODE) &&
- (unwrapped.getLocalName() != null) &&
- unwrapped.getLocalName()
- .equals(elementQName.getLocalPart())) {
- element = (Element) unwrapped;
-
- break;
- }
- }
-
- /*if (element != null) {
- populateProcedure(element, opMetaData,
- dbmeta,cs);
- //registerOutParameters(cs);
- } else {
- final String msgEx = JDBCDenormalizer.mMessages.getString(
- "JDBCDN_Failed_Finding_Node") +
- elementQName.getLocalPart() +
- ", in the part wrapper";
- JDBCDenormalizer.mLogger.log(Level.WARNING, msgEx);
- throw new MessagingException(msgEx);
- }*/
- }
- }
- } else {
- final Element messageElement = normalRoot;
-
- if (messageElement != null) {
- final Map parts = inputMessage.getParts();
- final Iterator it = parts.values().iterator();
-
- while (it.hasNext()) {
- final Part part = (Part) it.next();
-
- final Element partElement = findPart(messageElement,
- part.getName());
-
- if (partElement != null) {
- final QName elementQName = part.getElementName();
-
- if (elementQName != null) {
- element = findChildElement(partElement,
- elementQName);
-
- /*if (element != null) {
- populateProcedure(element,
- opMetaData, dbmeta,cs);
- //registerOutParameters(cs);
- }*/
- }
- }
- }
- }
- }
- }
- } catch (final TransformerConfigurationException ex) {
- final String msg = JDBCDenormalizer.mMessages.getString("SQLSE_E00708.JDBCDN_Failed_Convert_NM");
- throw new MessagingException(msg, ex);
- } catch (final TransformerException ex) {
- final String msg = JDBCDenormalizer.mMessages.getString("SQLSE_E00708.JDBCDN_Failed_Convert_NM");
- throw new MessagingException(msg, ex);
- } catch (final Throwable th) {
- final String msg = JDBCDenormalizer.mMessages.getString("SQLSE_E00712.JDBCDN_Failed_Proc");
- throw new MessagingException(msg, th);
- }
- return element;
- }
-
- protected void setDatabaseName(String databaseName){
- dbName = databaseName;
- }
-
- protected ArrayList getOutParamIndex(){
- return outParamIndex;
- }
-
- protected HashMap getOutParamTypes(){
- return outParamTypes;
- }
-
- protected HashMap getOutParamNames(){
- return outParamNames;
- }
-
-}
diff --git a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCNormalizer.java b/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCNormalizer.java
deleted file mode 100755
index 9f03234f6..000000000
--- a/ojc-core/jdbcbc/jdbcbcimpl/src/com/sun/jbi/jdbcbc/JDBCNormalizer.java
+++ /dev/null
@@ -1,969 +0,0 @@
-/*
- * BEGIN_HEADER - DO NOT EDIT
- *
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
- * If applicable add the following below this CDDL HEADER,
- * with the fields enclosed by brackets "[]" replaced with
- * your own identifying information: Portions Copyright
- * [year] [name of copyright owner]
- */
-
-/*
- * @(#)JDBCNormalizer.java
- *
- * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
- *
- * END_HEADER - DO NOT EDIT
- */
-
-package com.sun.jbi.jdbcbc;
-
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.CallableStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.DOMSource;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-import com.sun.jbi.internationalization.Messages;
-import com.sun.jbi.jdbcbc.extensions.JDBCConstants;
-import com.sun.jbi.jdbcbc.extensions.JDBCOperationInput;
-import com.sun.jbi.jdbcbc.extensions.JDBCOperationOutput;
-import com.sun.jbi.jdbcbc.model.metadata.DBMetaData;
-import com.sun.jbi.nms.wsdl11wrapper.HelperFactory;
-import com.sun.jbi.nms.wsdl11wrapper.WrapperBuilder;
-import com.sun.jbi.nms.wsdl11wrapper.WrapperProcessingException;
-import com.sun.jbi.jdbcbc.util.XMLCharUtil;
-import com.sun.jbi.jdbcbc.model.metadata.DBMetaData;
-
-
-/**
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-public class JDBCNormalizer {
- private static final Messages mMessages = Messages.getMessages(JDBCNormalizer.class);
- private static final Logger mLogger = Messages.getLogger(JDBCNormalizer.class);
- private static DocumentBuilder mBuilder = null;
- private WrapperBuilder wrapperBuilder;
- private ArrayList outParamIndex = new ArrayList();
- private HashMap outParamTypes = new HashMap();
- private HashMap outParamNames = new HashMap();
- private String mRecordPrefix = null; //113494
-
-
- /** Creates a new instance of SoapNormalizer
- * @throws javax.jbi.messaging.MessagingException
- */
- public JDBCNormalizer() throws MessagingException {
- try {
- wrapperBuilder = HelperFactory.createBuilder();
- } catch (final WrapperProcessingException ex) {
- throw new MessagingException(JDBCNormalizer.mMessages.getString(
- "SQLSE_E00701.JDBCN_Failed_Create") + ex.getMessage(), ex);
- }
- }
-
- /**
- *
- * @param rowsUpdated
- * @param exchange
- * @param meta
- * @return
- * @throws MessagingException
- */
- public NormalizedMessage normalize(final int rowsUpdated,
- final MessageExchange exchange, final OperationMetaData meta)
- throws MessagingException {
- final NormalizedMessage normalMsg = exchange.createMessage();
-
- try {
- Document normalDoc = JDBCNormalizer.newDocument();
- String returnPartName = null;
- final JDBCOperationOutput jdbcOpOutput = meta.getJDBCOperationOutput();
-
- if (jdbcOpOutput != null) {
- returnPartName = jdbcOpOutput.getReturnPartName();
-
- if (returnPartName == null) {
- final String msgEx = JDBCNormalizer.mMessages.getString("SQLSE_E00702.JDBCN_Failed_NM") +
- "missing " + JDBCOperationOutput.ATTR_RETURN_PART_NAME +
- " attribute in " +
- JDBCConstants.QNAME_OPERATION_OUTPUT;
- throw new MessagingException(msgEx);
- }
- } else {
- final String msgEx = JDBCNormalizer.mMessages.getString("SQLSE_E00702.JDBCN_Failed_NM") +
- "missing " + JDBCConstants.QNAME_OPERATION_OUTPUT;
- throw new MessagingException(msgEx);
- }
-
- if (HelperFactory.WRAPPER_ENABLED) {
- String operationOutputName = null;
- Message msg = null;
- final Output output = meta.getOperation().getOutput();
-
- if (output != null) {
- operationOutputName = output.getName();
- msg = output.getMessage();
-
- if (msg != null) {
- wrapperBuilder.initialize(normalDoc, msg,
- operationOutputName);
-
- final Part part = msg.getPart(returnPartName);
-
- if (part != null) {
- final Element returnPartElement = normalDoc.createElement(returnPartName);
- final Text text = normalDoc.createTextNode("" +
- rowsUpdated);
-
- final QName type = part.getTypeName();
- {
- if (type != null) {
- returnPartElement.appendChild(text);
- wrapperBuilder.addPart(part.getName(), returnPartElement);
- } else {
- final QName element = part.getElementName();
- final Element elementRoot = normalDoc.createElementNS(element.getNamespaceURI(), element.getLocalPart());
- returnPartElement.appendChild(elementRoot);
-
- elementRoot.appendChild(text);
- wrapperBuilder.addPart(part.getName(), elementRoot);
- }
- normalDoc = wrapperBuilder.getResult();
- }
- } else {
- final String msgEx = JDBCNormalizer.mMessages.getString(
- "SQLSE_E00703.JDBCN_Failed_NM_Part") + returnPartName +
- "in message " + msg.getQName();
- throw new MessagingException(msgEx);
- }
- } else {
- final String msgEx = JDBCNormalizer.mMessages.getString(
- "SQLSE_E00704.JDBCN_Failed_NM_WS_OPER") +
- meta.getOperation().getName() +
- " is missing message in its