Author: shawkins
Date: 2010-12-15 14:00:32 -0500 (Wed, 15 Dec 2010)
New Revision: 2782
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/service/TransactionService.java
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties
Log:
TEIID-1387 enforcing that only admin connections can be made over the admin port and vice
versa
Modified: branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -479,7 +479,7 @@
public void terminateSession(String sessionId) {
// sometimes there will not be any atomic requests pending, in that
// situation we still need to clear the master request from our map
- ClientState state = getClientState(sessionId, false);
+ ClientState state = this.clientState.remove(sessionId);
if (state != null) {
for (RequestID reqId : state.getRequests()) {
try {
@@ -488,7 +488,6 @@
LogManager.logWarning(LogConstants.CTX_DQP, err, "Failed to cancel
" + reqId); //$NON-NLS-1$
}
}
- this.clientState.remove(sessionId);
}
try {
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -269,9 +269,6 @@
suspend();
}
}
- else if (this.transactionState == TransactionState.NONE &&
this.transactionContext != null) {
- this.transactionService.closeTransactionContext(this.transactionContext);
- }
sendResultsIfNeeded(null);
} else {
moreWork(false); // If the timeslice expired, then the processor can probably produce
more batches.
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/process/TransactionServerImpl.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -459,10 +459,6 @@
return transactions.getOrCreateTransactionContext(threadId);
}
- public void closeTransactionContext(TransactionContext tc) {
- transactions.removeTransactionContext(tc);
- }
-
/**
* Request level transaction
*/
@@ -494,7 +490,7 @@
}
public void cancelTransactions(String threadId, boolean requestOnly) throws
XATransactionException {
- TransactionContext tc = transactions.getTransactionContext(threadId);
+ TransactionContext tc =
requestOnly?transactions.getTransactionContext(threadId):transactions.removeTransactionContext(threadId);
if (tc == null || tc.getTransactionType() == TransactionContext.Scope.NONE
|| (requestOnly && tc.getTransactionType() !=
TransactionContext.Scope.REQUEST)) {
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/service/TransactionService.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/service/TransactionService.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/service/TransactionService.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -47,8 +47,6 @@
TransactionContext getOrCreateTransactionContext(String threadId);
- void closeTransactionContext(TransactionContext tc);
-
void suspend(TransactionContext context) throws XATransactionException;
void resume(TransactionContext context) throws XATransactionException;
Modified:
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -161,24 +161,30 @@
}
}
}
- /*
- * having only a single clientserviceregistry means that the admin and jdbc ports
are functionally equivalent.
- * this is an undocuemented feature. Designer integration relies on this to use the
same port
- * for admin and preview logic.
- */
+
this.csr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
- this.csr.registerClientService(DQP.class, proxyService(DQP.class, this.dqpCore,
LogConstants.CTX_DQP), LogConstants.CTX_DQP);
- this.csr.registerClientService(Admin.class, proxyService(Admin.class, admin,
LogConstants.CTX_ADMIN_API), LogConstants.CTX_ADMIN_API);
+ DQP dqpProxy = proxyService(DQP.class, this.dqpCore, LogConstants.CTX_DQP);
+ this.csr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
+ Admin adminProxy = proxyService(Admin.class, admin, LogConstants.CTX_ADMIN_API);
+ this.csr.registerClientService(Admin.class, adminProxy,
LogConstants.CTX_ADMIN_API);
+ ClientServiceRegistryImpl jdbcCsr = new ClientServiceRegistryImpl();
+ jdbcCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
+ jdbcCsr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
+
if (this.jdbcSocketConfiguration.getEnabled()) {
- this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, csr,
this.dqpCore.getBufferManager(), offset);
+ this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, jdbcCsr,
this.dqpCore.getBufferManager(), offset);
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_enabled","Teiid JDBC =
",(this.jdbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.jdbcSocketConfiguration.getHostAddress().getHostName()+":"+(this.jdbcSocketConfiguration.getPortNumber()+offset)));
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_not_enabled", "jdbc
connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
+ ClientServiceRegistryImpl adminCsr = new ClientServiceRegistryImpl(Type.Admin);
+ adminCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
+ adminCsr.registerClientService(Admin.class, adminProxy,
LogConstants.CTX_ADMIN_API);
+
if (this.adminSocketConfiguration.getEnabled()) {
- this.adminSocket = new SocketListener(this.adminSocketConfiguration, csr,
this.dqpCore.getBufferManager(), offset);
+ this.adminSocket = new SocketListener(this.adminSocketConfiguration, adminCsr,
this.dqpCore.getBufferManager(), offset);
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_enabled","Teiid Admin",
(this.adminSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.adminSocketConfiguration.getHostAddress().getHostName()+":"+(this.adminSocketConfiguration.getPortNumber()+offset)));
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_not_enabled", "admin
connections")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -186,7 +192,7 @@
if (this.odbcSocketConfiguration.getEnabled()) {
this.vdbRepository.odbcEnabled();
- this.odbcSocket = new ODBCSocketListener(this.odbcSocketConfiguration, csr,
this.dqpCore.getBufferManager(), offset);
+ this.odbcSocket = new ODBCSocketListener(this.odbcSocketConfiguration,
this.dqpCore.getBufferManager(), offset);
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("odbc_enabled","Teiid ODBC - SSL=",
(this.odbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"ON":"OFF")+"
Host = "+this.odbcSocketConfiguration.getHostAddress().getHostName()+" Port =
"+(this.odbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
} else {
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("odbc_not_enabled")); //$NON-NLS-1$
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
---
branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -103,7 +103,7 @@
closeSession(info.getSessionId());
}
} catch (Exception e) {
- LogManager.logDetail(LogConstants.CTX_SECURITY, e, "error running session
monitor, unable to monitor: " + info.getSessionId()); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, e, "error running session
monitor, unable to monitor:", info.getSessionId()); //$NON-NLS-1$
}
}
}
@@ -192,7 +192,7 @@
newSession.setLoginContext(loginContext);
newSession.setSecurityContext(securityContext);
newSession.setVdb(vdb);
- LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon
successful for \"", userName, "\" - created SessionID \"",
"" + newSession.getSessionToken().getSessionID(), "\"" });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon
successful for \"", userName, "\" - created SessionID \"",
newSession.getSessionToken().getSessionID(), "\"" }); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
this.sessionCache.put(newSession.getSessionId(), newSession);
return newSession;
}
@@ -279,7 +279,7 @@
SessionMetadata info = getSessionInfo(sessionID);
info.setLastPingTime(System.currentTimeMillis());
this.sessionCache.put(sessionID, info);
- LogManager.logDetail(LogConstants.CTX_SECURITY, "Keep-alive ping received for
session:"+sessionID); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, "Keep-alive ping received for
session:", sessionID); //$NON-NLS-1$
}
@Override
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java
===================================================================
---
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -28,6 +28,10 @@
public interface ClientServiceRegistry {
+ public enum Type {
+ ODBC, JDBC, Admin
+ }
+
<T> T getClientService(Class<T> iface) throws ComponentNotFoundException;
SecurityHelper getSecurityHelper();
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java
===================================================================
---
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -31,7 +31,7 @@
public class ClientServiceRegistryImpl implements ClientServiceRegistry {
-
+
public static class ClientService {
private Object instance;
private String loggingContext;
@@ -57,6 +57,15 @@
private HashMap<String, ClientService> clientServices = new HashMap<String,
ClientService>();
private SecurityHelper securityHelper;
+ private Type type = Type.JDBC;
+
+ public ClientServiceRegistryImpl() {
+
+ }
+
+ public ClientServiceRegistryImpl(Type type) {
+ this.type = type;
+ }
public <T> T getClientService(Class<T> iface) throws
ComponentNotFoundException {
ClientService cs = getClientService(iface.getName());
@@ -66,7 +75,7 @@
public ClientService getClientService(String iface) throws ComponentNotFoundException {
ClientService cs = clientServices.get(iface);
if (cs == null) {
- throw new
ComponentNotFoundException(RuntimePlugin.Util.getString("ServerWorkItem.Component_Not_Found",
iface)); //$NON-NLS-1$
+ throw new
ComponentNotFoundException(RuntimePlugin.Util.getString("ServerWorkItem.Component_Not_Found",
type, iface)); //$NON-NLS-1$
}
return cs;
}
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
===================================================================
---
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java 2010-12-15
16:43:07 UTC (rev 2781)
+++
branches/7.1.x/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java 2010-12-15
19:00:32 UTC (rev 2782)
@@ -33,8 +33,9 @@
public class ODBCSocketListener extends SocketListener {
private ODBCServerRemote.AuthenticationType authType =
ODBCServerRemote.AuthenticationType.CLEARTEXT;
- public ODBCSocketListener(SocketConfiguration config, ClientServiceRegistryImpl csr,
StorageManager storageManager, int portOffset) {
- super(config, csr, storageManager, portOffset);
+ public ODBCSocketListener(SocketConfiguration config, StorageManager storageManager, int
portOffset) {
+ //the clientserviceregistry isn't actually used by ODBC
+ super(config, new ClientServiceRegistryImpl(ClientServiceRegistry.Type.ODBC),
storageManager, portOffset);
}
@Override
Modified: branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-12-15
16:43:07 UTC (rev 2781)
+++ branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-12-15
19:00:32 UTC (rev 2782)
@@ -42,16 +42,16 @@
ServerWorkItem.Received_exception_processing_request=Unexpected exception for session
{0}
ServerWorkItem.processing_error=Processing exception ''{0}'' for session
{1}. Exception type {2} thrown from {3}. Enable more detailed logging to see the entire
stacktrace.
-ServerWorkItem.Component_Not_Found=Component not found: {0}
+ServerWorkItem.Component_Not_Found=Only {0} connections are allowed on this port.
Component not found: {1}
SocketTransport.1=Bound to address {0} listening on port {1}
-LocalTransportHandler.Transport_shutdown=Tranport has been shutdown.
+LocalTransportHandler.Transport_shutdown=Transport has been shutdown.
SocketClientInstance.invalid_sessionkey=Invalid session key used during handshake
SSLAwareChannelHandler.channel_closed=Channel closed
invlaid_vdb_file=Invalid VDB file deployment failed {0}
redeploying_vdb=Re-deploying VDB {0}
-validity_errors_in_vdb=VDB has validaity errors; failed to deploy - {0}
+validity_errors_in_vdb=VDB has validity errors; failed to deploy - {0}
vdb_save_failed=Failed to save metadata for VDB {0}
vdb_delete_failed=Failed to delete the cached metadata files due to:
vdb_deployed=VDB "{0}" deployed in {1} state.