teiid SVN: r1275 - trunk/adminshell/src/main/resources/scripts.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-24 17:11:47 -0400 (Mon, 24 Aug 2009)
New Revision: 1275
Modified:
trunk/adminshell/src/main/resources/scripts/jdbc.bsh
trunk/adminshell/src/main/resources/scripts/server.bsh
trunk/adminshell/src/main/resources/scripts/util.bsh
Log:
TEIID-224: fixing display of exception traces in the admin shell in certain situations.
Modified: trunk/adminshell/src/main/resources/scripts/jdbc.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/jdbc.bsh 2009-08-24 21:09:24 UTC (rev 1274)
+++ trunk/adminshell/src/main/resources/scripts/jdbc.bsh 2009-08-24 21:11:47 UTC (rev 1275)
@@ -198,10 +198,8 @@
}
}
-private boolean interactive() {
- return this.interpreter.get("bsh.interactive").toString().equals("true");
-}
+
int FETCHSIZE=1000;
int MAXROWS=500;
Modified: trunk/adminshell/src/main/resources/scripts/server.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/server.bsh 2009-08-24 21:09:24 UTC (rev 1274)
+++ trunk/adminshell/src/main/resources/scripts/server.bsh 2009-08-24 21:11:47 UTC (rev 1275)
@@ -46,7 +46,9 @@
currentContext().internalAdmin = createExceptionHandlingProxy(mmConn.getAdminAPI());
return mmConn;
} catch(e) {
+ parentContext();
print("Failed to connect: {"+e.getMessage()+"}");
+ debug(e);
return null;
}
}
@@ -82,18 +84,18 @@
if (MMURL.isValidServerURL(url)) {
String contextName = genConnectionName();
newContext(contextName);
-
- //url is in "server URL format": connect via ServerAdminFactory
- currentContext().internalAdmin = createExceptionHandlingProxy(ServerAdminFactory.getInstance().createAdmin(username, password.toCharArray(), url));
- currentContext().internalPrompt = currentConnectionName()+"["+url+"] $ ";
-
+ try {
+ //url is in "server URL format": connect via ServerAdminFactory
+ currentContext().internalAdmin = createExceptionHandlingProxy(ServerAdminFactory.getInstance().createAdmin(username, password.toCharArray(), url));
+ currentContext().internalPrompt = currentConnectionName()+"["+url+"] $ ";
+ } catch(e) {
+ parentContext();
+ print("Failed to connect: {"+e.getMessage()+"}");
+ debug(e);
+ return null;
+ }
} else {
- String contextName = genConnectionName();
- newContext(contextName);
-
- //url is in "jdbc URL format": connect via MMServerConnection
- currentContext().internalConnection = connectDriver("org.teiid.jdbc.TeiidDriver", url, username, password);
- currentContext().internalAdmin = createExceptionHandlingProxy(currentContext().internalConnection.getAdminAPI());
+ print("Wrong syntax for the URL.. connection failed.");
}
}
Modified: trunk/adminshell/src/main/resources/scripts/util.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/util.bsh 2009-08-24 21:09:24 UTC (rev 1274)
+++ trunk/adminshell/src/main/resources/scripts/util.bsh 2009-08-24 21:11:47 UTC (rev 1275)
@@ -129,7 +129,13 @@
for (Object object:msg) {
print(object);
}
- } else {
+ }
+ else if (msg instanceof Throwable) {
+ StringWriter sw = new StringWriter();
+ msg.printStackTrace(new PrintWriter(sw));
+ print(sw.getBuffer().toString());
+ }
+ else {
print(msg);
}
}
@@ -180,9 +186,13 @@
while (ex instanceof InvocationTargetException) {
ex = e.getTargetException();
}
- if (ex instanceof AdminException) {
+ if (interactive()) {
print("Error:"+ex.getMessage());
+ debug(ex);
}
+ else {
+ throw ex;
+ }
} catch(Throwable t) {
msg = t.getMessage();
if (msg != null) {
@@ -197,6 +207,10 @@
return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new ExceptionHandler(obj));
}
+boolean interactive() {
+ return this.interpreter.get("bsh.interactive").toString().equals("true");
+}
+
quit(){
exit();
}
14 years, 8 months
teiid SVN: r1274 - in trunk/runtime/src/main/java/com/metamatrix/dqp/embedded: services and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-24 17:09:24 -0400 (Mon, 24 Aug 2009)
New Revision: 1274
Modified:
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java
Log:
TEIID-779: Fixes for the bugs found during the move of the embedded admin api tests
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-08-24 21:06:57 UTC (rev 1273)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-08-24 21:09:24 UTC (rev 1274)
@@ -258,6 +258,9 @@
return convertExtensionModule(extModule);
}
else {
+ if (src == null) {
+ return null;
+ }
throw new UnsupportedOperationException(DQPEmbeddedPlugin.Util.getString("UnSupported_object_conversion")); //$NON-NLS-1$
}
}
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-08-24 21:06:57 UTC (rev 1273)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-08-24 21:09:24 UTC (rev 1274)
@@ -438,7 +438,6 @@
// holds true when DQP restarted. Also, this will be only the case
// when shared binding is used.
def.addConnectorBinding(existing);
- saveVDB(vdb, vdb.getVersion());
}
}
}
@@ -797,7 +796,11 @@
ArrayList<URL> urlPaths = new ArrayList<URL>();
StringTokenizer st = new StringTokenizer(path, ";"); //$NON-NLS-1$
while(st.hasMoreElements()) {
- urlPaths.add(getFullyQualifiedPath(st.nextToken()));
+ String extPath = st.nextToken();
+ if (!extPath.endsWith("/")) { //$NON-NLS-1$
+ extPath = extPath + "/"; //$NON-NLS-1$
+ }
+ urlPaths.add(getFullyQualifiedPath(extPath));
}
return urlPaths.toArray(new URL[urlPaths.size()]);
}
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java 2009-08-24 21:06:57 UTC (rev 1273)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java 2009-08-24 21:09:24 UTC (rev 1274)
@@ -46,7 +46,6 @@
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.service.VDBLifeCycleListener;
import com.metamatrix.dqp.service.VDBService;
-import com.metamatrix.jdbc.JDBCPlugin;
import com.metamatrix.metadata.runtime.api.VirtualDatabaseDoesNotExistException;
import com.metamatrix.metadata.runtime.api.VirtualDatabaseException;
import com.metamatrix.vdb.runtime.BasicModelInfo;
@@ -327,7 +326,7 @@
// if not already done so.
int status = getVDB(vdbName, vdbVersion).getStatus();
if (status != VDBStatus.ACTIVE) {
- throw new VirtualDatabaseException(JDBCPlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
+ throw new VirtualDatabaseException(DQPEmbeddedPlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion)); //$NON-NLS-1$
}
return vdbVersion;
}
14 years, 8 months
teiid SVN: r1273 - in trunk/runtime/src/main/java: org/teiid/transport and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-24 17:06:57 -0400 (Mon, 24 Aug 2009)
New Revision: 1273
Modified:
trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
Log:
TEIID-666: Session service not being used for "terminateSession". Previously Embedded did not have any session service, so it went directly to the DQP, now that it has session service the calls to terminate must flow through session service.
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-08-24 21:01:26 UTC (rev 1272)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-08-24 21:06:57 UTC (rev 1273)
@@ -99,7 +99,7 @@
@Override
public ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
- return new LocalServerConnection(connectionProperties, this.clientServices);
+ return new LocalServerConnection(connectionProperties, this.clientServices, (SessionServiceInterface)findService(DQPServiceNames.SESSION_SERVICE));
}
/**
@@ -125,7 +125,9 @@
// create the deploy directories
File deployDirectory = new File(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_DEPLOYDIR, "deploy")); //$NON-NLS-1$
props.setProperty(DQPEmbeddedProperties.DQP_DEPLOYDIR, deployDirectory.getCanonicalPath());
- deployDirectory.mkdirs();
+ if (!deployDirectory.exists()) {
+ deployDirectory.mkdirs();
+ }
// if there is no separate vdb-definitions specified then use the deploy directory as the location of the vdb
String vdbDefinitions = props.getProperty(DQPEmbeddedProperties.VDB_DEFINITION);
@@ -136,8 +138,9 @@
// create log directory
File logDirectory = new File(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_LOGDIR, "log")); //$NON-NLS-1$
props.setProperty(DQPEmbeddedProperties.DQP_LOGDIR, logDirectory.getCanonicalPath());
- deployDirectory.mkdirs();
-
+ if (!logDirectory.exists()) {
+ logDirectory.mkdirs();
+ }
} catch (IOException e) {
throw new ApplicationInitializationException(e);
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-08-24 21:01:26 UTC (rev 1272)
+++ trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-08-24 21:06:57 UTC (rev 1273)
@@ -27,9 +27,14 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.teiid.dqp.internal.process.DQPWorkContext;
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.LogonException;
import com.metamatrix.client.ExceptionUtil;
@@ -41,6 +46,7 @@
import com.metamatrix.jdbc.JDBCPlugin;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
public class LocalServerConnection implements ServerConnection {
@@ -49,9 +55,10 @@
private DQPWorkContext workContext;
private ClassLoader classLoader;
ClientServiceRegistry clientServices;
+ SessionServiceInterface sessionService;
- public LocalServerConnection(Properties connectionProperties, ClientServiceRegistry clientServices) throws CommunicationException, ConnectionException{
+ public LocalServerConnection(Properties connectionProperties, ClientServiceRegistry clientServices, SessionServiceInterface sessionService) throws CommunicationException, ConnectionException{
this.clientServices = clientServices;
@@ -62,6 +69,8 @@
this.result = authenticate(connectionProperties);
this.classLoader = Thread.currentThread().getContextClassLoader();
+
+ this.sessionService = sessionService;
}
public synchronized LogonResult authenticate(Properties connProps) throws ConnectionException, CommunicationException {
@@ -86,14 +95,18 @@
return (T) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new InvocationHandler() {
- public Object invoke(Object arg0, Method arg1, Object[] arg2)
- throws Throwable {
+ public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable {
if (!isOpen()) {
throw ExceptionUtil.convertException(arg1, new MetaMatrixComponentException(JDBCPlugin.Util.getString("LocalTransportHandler.session_inactive"))); //$NON-NLS-1$
- }
+ }
ClassLoader current = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
DQPWorkContext.setWorkContext(workContext);
+
+ if (!(iface.equals(ILogon.class))) {
+ sessionService.validateSession(workContext.getSessionId());
+ }
+
try {
return arg1.invoke(clientServices.getClientService(iface), arg2);
} catch (InvocationTargetException e) {
@@ -113,6 +126,23 @@
if (shutdown) {
return;
}
+
+ try {
+ //make a best effort to send the logoff
+ Future<?> writeFuture = getService(ILogon.class).logoff();
+ if (writeFuture != null) {
+ writeFuture.get(5000, TimeUnit.MILLISECONDS);
+ }
+ } catch (InvalidSessionException e) {
+ //ignore
+ } catch (InterruptedException e) {
+ //ignore
+ } catch (ExecutionException e) {
+ //ignore
+ } catch (TimeoutException e) {
+ //ignore
+ }
+
this.shutdown = true;
}
14 years, 8 months
teiid SVN: r1272 - trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-24 17:01:26 -0400 (Mon, 24 Aug 2009)
New Revision: 1272
Modified:
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
Log:
TEIID-666: Session service not being used for "terminateSession". Previously Embedded did not have any session service, so it went directly to the DQP, now that it has session service the calls to terminate must flow through session service.
Modified: trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-08-24 21:00:08 UTC (rev 1271)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-08-24 21:01:26 UTC (rev 1272)
@@ -71,8 +71,7 @@
@Override
//## JDBC4.0-end ##
public ResultsFuture<?> logoff()
- throws InvalidSessionException,
- MetaMatrixComponentException {
+ throws InvalidSessionException {
return null;
}
14 years, 8 months
teiid SVN: r1271 - in trunk: client/src/main/java/com/metamatrix/platform/security/api and 7 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-24 17:00:08 -0400 (Mon, 24 Aug 2009)
New Revision: 1271
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
trunk/runtime/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties
trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java
Log:
TEIID-666: Session service not being used for "terminateSession". Previously Embedded did not have any session service, so it went directly to the DQP, now that it has session service the calls to terminate must flow through session service.
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -255,8 +255,6 @@
writeFuture.get(5000, TimeUnit.MILLISECONDS);
} catch (InvalidSessionException e) {
//ignore
- } catch (MetaMatrixComponentException e) {
- //ignore
} catch (InterruptedException e) {
//ignore
} catch (ExecutionException e) {
Modified: trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -50,7 +50,7 @@
* @throws InvalidSessionException If session has expired or doesn't exist
* @throws ComponentNotFoundException If couldn't find needed service component
*/
- ResultsFuture<?> logoff() throws InvalidSessionException, MetaMatrixComponentException;
+ ResultsFuture<?> logoff() throws InvalidSessionException;
void assertIdentity(SessionToken sessionId) throws InvalidSessionException, MetaMatrixComponentException;
Modified: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -82,8 +82,7 @@
* session
* @throws SessionServiceException
*/
- void closeSession(MetaMatrixSessionID sessionID)
- throws InvalidSessionException, SessionServiceException;
+ void closeSession(MetaMatrixSessionID sessionID) throws InvalidSessionException;
/**
* Terminates the specified session. This is an administrative action.
@@ -97,8 +96,7 @@
* does not have authority to terminate the <code>terminatedSessionID</code> session
* @throws SessionServiceException
*/
- boolean terminateSession(MetaMatrixSessionID terminatedSessionID, MetaMatrixSessionID adminSessionID)
- throws InvalidSessionException, AuthorizationException, SessionServiceException;
+ boolean terminateSession(MetaMatrixSessionID terminatedSessionID, MetaMatrixSessionID adminSessionID);
/**
* Get the collection of active user sessions on the system.
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -158,5 +158,12 @@
public String getClientHostname() {
return clientHostname;
}
-
+
+ public void reset() {
+ setSessionToken(null);
+ setAppName(null);
+ setTrustedPayload(null);
+ setVdbName(null);
+ setVdbVersion(null);
+ }
}
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -37,6 +37,7 @@
import org.teiid.adminapi.EmbeddedLogger;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.RuntimeStateAdmin;
+import org.teiid.dqp.internal.process.DQPWorkContext;
import com.metamatrix.admin.objects.MMRequest;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -217,13 +218,9 @@
}
}
- // Double iteration because to avoid concurrent modification of underlying map.
+ // terminate the sessions.
for (MetaMatrixSessionInfo info: matchedConnections) {
- try {
- this.manager.getDQP().terminateConnection(info.getSessionID().toString());
- } catch (MetaMatrixComponentException e) {
- throw new AdminComponentException(e);
- }
+ getSessionService().terminateSession(info.getSessionID(), DQPWorkContext.getWorkContext().getSessionId());
}
}
Modified: trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -110,8 +110,7 @@
}
@Override
- public void closeSession(MetaMatrixSessionID sessionID)
- throws InvalidSessionException, SessionServiceException{
+ public void closeSession(MetaMatrixSessionID sessionID) throws InvalidSessionException {
LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {"closeSession", sessionID}); //$NON-NLS-1$
MetaMatrixSessionInfo info = this.sessionCache.remove(sessionID);
if (info == null) {
@@ -254,7 +253,7 @@
}
ArrayList<MetaMatrixSessionInfo> results = new ArrayList<MetaMatrixSessionInfo>();
for (MetaMatrixSessionInfo info : this.sessionCache.values()) {
- if (VDBName.equals(info.getProductInfo(ProductInfoConstants.VIRTUAL_DB)) && VDBVersion.equals(info.getProductInfo(ProductInfoConstants.VIRTUAL_DB))) {
+ if (VDBName.equals(info.getProductInfo(ProductInfoConstants.VIRTUAL_DB)) && VDBVersion.equals(info.getProductInfo(ProductInfoConstants.VDB_VERSION))) {
results.add(info);
}
}
@@ -270,7 +269,7 @@
}
@Override
- public boolean terminateSession(MetaMatrixSessionID terminatedSessionID,MetaMatrixSessionID adminSessionID) throws AuthorizationException, SessionServiceException {
+ public boolean terminateSession(MetaMatrixSessionID terminatedSessionID,MetaMatrixSessionID adminSessionID) {
Object[] params = {adminSessionID, terminatedSessionID};
LogManager.logInfo(LogConstants.CTX_SESSION, DQPEmbeddedPlugin.Util.getString( "SessionServiceImpl.terminateSession", params)); //$NON-NLS-1$
try {
@@ -329,6 +328,8 @@
@Override
public void stop() throws ApplicationLifecycleException {
this.sessionMonitor.cancel();
+ this.sessionCache.clear();
+ this.sessionListener = null;
}
@Inject
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -143,23 +143,10 @@
workContext.setVdbVersion(sessionInfo.getProductInfo(ProductInfoConstants.VDB_VERSION));
return sessionID;
}
-
- private void resetDQPContext() {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- workContext.setSessionToken(null);
- workContext.setAppName(null);
- workContext.setTrustedPayload(null);
- workContext.setVdbName(null);
- workContext.setVdbVersion(null);
- }
-
- public ResultsFuture<?> logoff() throws InvalidSessionException, MetaMatrixComponentException {
- try {
- this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
- resetDQPContext();
- } catch (SessionServiceException e) {
- throw new MetaMatrixComponentException(e);
- }
+
+ public ResultsFuture<?> logoff() throws InvalidSessionException {
+ this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
+ DQPWorkContext.getWorkContext().reset();
return null;
}
Modified: trunk/runtime/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/runtime/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-08-24 21:00:08 UTC (rev 1271)
@@ -216,7 +216,7 @@
admin_roles_not_defined=Admin Role permissions are not defined. Refer to admin-roles.properties file
# authorization service
-AuthorizationServiceImpl.invalid_session = The principal with SessionToken <{0}> is invalid.
+AuthorizationServiceImpl.invalid_session=The principal with SessionToken <{0}> is invalid.
AuthorizationServiceImpl.wrong_realms = Permission collection contains requests from different realms.
AuthorizationServiceImpl.error_seraching_policies=An exception occurred while searching for all policy IDs.
AuthorizationServiceImpl.failed_to_get_groups=Can''t get principal''s groups from Membership service.
@@ -249,10 +249,9 @@
# session service
-SessionServiceImpl.invalid_session = The specified session ID "{0}" is invalid. It cannot be found in the userbase.
+SessionServiceImpl.invalid_session=The specified session ID "{0}" is invalid. It cannot be found in the userbase.
SessionServiceImpl.reached_max_sessions = The server has reached the maximum number of sessions of {0} as defined by the property metamatrix.session.max.connections. If more sessions are required, modify this property value in the MetaMatrix Console.
SessionServiceImpl.failed_to_getprincipal = Membership service encountered an error getting the principal for user "{0}".
-SessionServiceImpl.invalid_session = SessionServiceImpl.terminateSession: {0}
SessionServiceImpl.expireSession = Expiring session {0}
SessionServiceImpl.keepaliveFailed = Keepalive failed for session {0}
SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database=Unexpected error finding latest version of Virtual Database {0}
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java 2009-08-24 20:54:32 UTC (rev 1270)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestSocketRemoting.java 2009-08-24 21:00:08 UTC (rev 1271)
@@ -149,8 +149,7 @@
csr.registerClientService(ILogon.class, new ILogon() {
public ResultsFuture<?> logoff()
- throws InvalidSessionException,
- MetaMatrixComponentException {
+ throws InvalidSessionException {
ResultsFuture<?> result = new ResultsFuture<Void>();
result.getResultsReceiver().exceptionOccurred(new MetaMatrixComponentException("some exception")); //$NON-NLS-1$
return result;
14 years, 8 months
teiid SVN: r1270 - in trunk: client/src/main/java/com/metamatrix/common/comm/platform/socket/client and 1 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-24 16:54:32 -0400 (Mon, 24 Aug 2009)
New Revision: 1270
Modified:
trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
Log:
TEIID-795: Added way to check if the connection factory is alive, the embedded profile before making any new connections calls this to make sure the currently configured connection factory is alive, otherwise starts a new connection factory.
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2009-08-24 20:39:42 UTC (rev 1269)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2009-08-24 20:54:32 UTC (rev 1270)
@@ -47,6 +47,12 @@
/**
* Shutdown the connection factory, including the DQP and all its existing connections
*/
- public void shutdown(boolean restart);
+ void shutdown(boolean restart);
+
+ /**
+ * Is the connection factory alive
+ * @return true if alive; false otherwise.
+ */
+ boolean isAlive();
}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-08-24 20:39:42 UTC (rev 1269)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-08-24 20:54:32 UTC (rev 1270)
@@ -294,4 +294,10 @@
// only applies in the Embedded scenario.
}
+ @Override
+ public boolean isAlive() {
+ // only applies in the Embedded scenario.
+ return false;
+ }
+
}
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2009-08-24 20:39:42 UTC (rev 1269)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2009-08-24 20:54:32 UTC (rev 1270)
@@ -160,7 +160,7 @@
*/
private synchronized static EmbeddedTransport getDQPTransport(URL dqpURL) throws SQLException {
EmbeddedTransport transport = currentTransport;
- if (transport == null || !currentTransport.getURL().equals(dqpURL)) {
+ if (transport == null || !transport.isAlive() || !currentTransport.getURL().equals(dqpURL)) {
// shutdown any previous instance; we do encourage single instance in a given VM
shutdown();
try {
@@ -283,7 +283,7 @@
currentTransport = null;
}
}
-
+
/**
* inner class to hold DQP tansportMap object
* @since 4.3
@@ -417,6 +417,10 @@
this.connectionFactory.shutdown(false);
}
+ boolean isAlive() {
+ return this.connectionFactory.isAlive();
+ }
+
/**
* Create a connection to the DQP defined by this transport object based on
* properties supplied
14 years, 8 months
teiid SVN: r1269 - in trunk: client/src/main/java/org/teiid/adminapi and 3 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-24 16:39:42 -0400 (Mon, 24 Aug 2009)
New Revision: 1269
Modified:
trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java
trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java
trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java
trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
Log:
TEIID-672, TEIID-697: There were conflicting ways to define the Logging Levels in the Admin API, one defined by EmbeddedLogger and second by the LogConfiguration. Log4J can return a logging level as NULL, in that case take the parent logger's log level.
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -32,7 +32,7 @@
/**
* @since 4.3
*/
-public class MMLogConfiguration extends MMAdminObject implements LogConfiguration {
+public class MMLogConfiguration implements LogConfiguration {
private static final long serialVersionUID = -4585962928702271706L;
Map<String, Integer> contextMap = null;
@@ -56,7 +56,6 @@
this.contextMap.put(context, logLevel);
}
-
@Override
public String toString() {
return null;
Modified: trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -31,45 +31,6 @@
public interface EmbeddedLogger {
/**
- * Message level value that specifies that no messages are to be recorded.
- */
- public static final int NONE = 0;
-
- /**
- * Message level value that specifies that critical messages are to be recorded.
- */
- public static final int CRITICAL = 1;
-
- /**
- * Message level value that specifies that error messages and critical
- * messages are to be recorded.
- */
- public static final int ERROR = 2;
-
- /**
- * Message level value that specifies that warning, error and critical
- * messages are to be recorded.
- */
- public static final int WARNING = 3;
-
- /**
- * Message level value that specifies that information, warning, error and critical
- * messages are to be recorded.
- */
- public static final int INFO = 4;
-
- /**
- * Message level value that specifies that detailed, information, warning, error and critical
- * messages are to be recorded.
- */
- public static final int DETAIL = 5;
-
- /**
- * Message level value that specifies that all messages are to be recorded.
- */
- public static final int TRACE = 6;
-
- /**
* Logs the given message if the current logging level is >= the logLevel parameter.
* @param logLevel logging level for this message
* @param timestamp timestamp at which this log message was generated
Modified: trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -36,7 +36,7 @@
*
* @since 4.3
*/
-public interface LogConfiguration extends AdminObject {
+public interface LogConfiguration {
/**
* Message level value that specifies that no messages are to be recorded.
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfiguration.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -25,7 +25,8 @@
import java.util.Set;
public interface LogConfiguration {
-
+ public static final String ROOT_CONTEXT = "org.teiid."; //$NON-NLS-1$
+
/**
* Get the current configured Log Level for supplied context
* @param context
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/log/LogConfigurationImpl.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -31,6 +31,8 @@
public class LogConfigurationImpl implements LogConfiguration, Serializable {
+ private static final long serialVersionUID = 4626429149431532292L;
+
Map<String, Integer> contextMap = null;
public LogConfigurationImpl() {
@@ -48,6 +50,7 @@
@Override
public int getLogLevel(String context) {
+ context = fixContext(context);
Integer level = this.contextMap.get(context);
if (level != null) {
return level;
@@ -55,6 +58,13 @@
return MessageLevel.NONE;
}
+ private String fixContext(String context) {
+ if (context.indexOf('.') == -1) {
+ context = ROOT_CONTEXT+context;
+ }
+ return context;
+ }
+
@Override
public void setLogLevel(String context, int logLevel) {
this.contextMap.put(context, logLevel);
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -23,6 +23,7 @@
package com.metamatrix.dqp.embedded.admin;
import org.teiid.adminapi.EmbeddedLogger;
+import org.teiid.adminapi.LogConfiguration;
import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.MessageLevel;
@@ -45,27 +46,27 @@
}
private int convertLevel(int level) {
- int logLevel = EmbeddedLogger.INFO;
+ int logLevel = LogConfiguration.INFO;
switch(level) {
case MessageLevel.WARNING:
- logLevel = EmbeddedLogger.WARNING;
+ logLevel = LogConfiguration.WARNING;
break;
case MessageLevel.ERROR:
- logLevel = EmbeddedLogger.ERROR;
+ logLevel = LogConfiguration.ERROR;
break;
case MessageLevel.DETAIL:
- logLevel = EmbeddedLogger.DETAIL;
+ logLevel = LogConfiguration.DETAIL;
break;
case MessageLevel.TRACE:
- logLevel = EmbeddedLogger.TRACE;
+ logLevel = LogConfiguration.TRACE;
break;
case MessageLevel.NONE:
- logLevel = EmbeddedLogger.NONE;
+ logLevel = LogConfiguration.NONE;
break;
default:
- logLevel = EmbeddedLogger.INFO;
+ logLevel = LogConfiguration.INFO;
}
return logLevel;
}
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -27,10 +27,11 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import com.metamatrix.common.log.LogConfiguration;
import com.metamatrix.core.log.MessageLevel;
class Log4JUtil {
- private static final String ROOT_CONTEXT = "org.teiid."; //$NON-NLS-1$
+ private static final String ROOT_CONTEXT = LogConfiguration.ROOT_CONTEXT;
/**
* Convert {@link MessageLevel} to {@link Level}
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java 2009-08-21 19:44:27 UTC (rev 1268)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java 2009-08-24 20:39:42 UTC (rev 1269)
@@ -49,7 +49,17 @@
@Override
public int getLogLevel(String context) {
Logger log = Log4JUtil.getLogger(context);
- return Log4JUtil.convert2MessageLevel(log.getLevel());
+ Level level = log.getLevel();
+ while (level == null) {
+ log = (Logger)log.getParent();
+ if (log != null) {
+ level = log.getLevel();
+ }
+ else {
+ level = Level.ERROR;
+ }
+ }
+ return Log4JUtil.convert2MessageLevel(level);
}
@Override
14 years, 8 months
teiid SVN: r1268 - trunk/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors.
by teiid-commits@lists.jboss.org
Author: jdoyle
Date: 2009-08-21 15:44:27 -0400 (Fri, 21 Aug 2009)
New Revision: 1268
Modified:
trunk/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java
Log:
Fixing incorrect test assertion.
Modified: trunk/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java
===================================================================
--- trunk/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java 2009-08-21 18:59:08 UTC (rev 1267)
+++ trunk/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java 2009-08-21 19:44:27 UTC (rev 1268)
@@ -116,7 +116,7 @@
IQuery command = (IQuery)translationUtility.parseCommand("select * from Account where not (Name = 'foo' and Stuff = 'bar')"); //$NON-NLS-1$
SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
- assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE NOT ((Account.AccountName = 'foo') AND (Account.Stuff = 'bar'))", visitor.getQuery().toString().trim()); //$NON-NLS-1$
+ assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff, Account.Industry FROM Account WHERE (Account.AccountName != 'foo') OR (Account.Stuff != 'bar')", visitor.getQuery().toString().trim()); //$NON-NLS-1$
}
@Test public void testCountStart() throws Exception {
14 years, 8 months