teiid SVN: r1098 - in trunk/client-jdbc/src: main/resources/META-INF/services and 4 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-07 15:18:35 -0400 (Tue, 07 Jul 2009)
New Revision: 1098
Added:
trunk/client-jdbc/src/test/java/org/
trunk/client-jdbc/src/test/java/org/teiid/
trunk/client-jdbc/src/test/java/org/teiid/jdbc/
trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
Modified:
trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java
trunk/client-jdbc/src/main/resources/META-INF/services/java.sql.Driver
Log:
TEIID-701
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java 2009-07-07 18:28:08 UTC (rev 1097)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java 2009-07-07 19:18:35 UTC (rev 1098)
@@ -52,13 +52,11 @@
import com.metamatrix.jdbc.util.MMJDBCURL;
/**
- * <p> The java.sql.DriverManager class uses this class to connect to MetaMatrix.
- * The Driver Manager maintains a pool of TeiidDriver objects, which it could use
- * to connect to MetaMatrix. The TeiidDriver class has a static initializer, which
- * is used to instantiate and register itsef with java.sql.DriverManager. The
+ * <p> The java.sql.DriverManager class uses this class to connect to Teiid Server or Teiid Embedded.
+ * The TeiidDriver class has a static initializer, which
+ * is used to instantiate and register itself with java.sql.DriverManager. The
* DriverManager's <code>getConnection</code> method calls <code>connect</code>
- * method on available registered drivers. The first driver to recognise the given
- * url is used to obtain a connection.</p>
+ * method on available registered drivers. </p>
*/
public final class TeiidDriver extends BaseDriver {
Modified: trunk/client-jdbc/src/main/resources/META-INF/services/java.sql.Driver
===================================================================
--- trunk/client-jdbc/src/main/resources/META-INF/services/java.sql.Driver 2009-07-07 18:28:08 UTC (rev 1097)
+++ trunk/client-jdbc/src/main/resources/META-INF/services/java.sql.Driver 2009-07-07 19:18:35 UTC (rev 1098)
@@ -1,2 +1 @@
-com.metamatrix.jdbc.MMDriver
-com.metamatrix.jdbc.EmbeddedDriver
\ No newline at end of file
+org.teiid.jdbc.TeiidDriver
\ No newline at end of file
Added: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java (rev 0)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2009-07-07 19:18:35 UTC (rev 1098)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.jdbc;
+
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.jdbc.BaseDataSource;
+import com.metamatrix.jdbc.api.ExecutionProperties;
+
+public class TestTeiidDriver extends TestCase {
+ TeiidDriver drv = new TeiidDriver();
+ public String localhost = "localhost"; //$NON-NLS-1$
+
+ public TestTeiidDriver(String name) {
+ super(name);
+
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ /** Valid format of urls*/
+ public void testAcceptsURL1() throws Exception {
+ assertNotNull(drv);
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:metamatrix:jvdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mms://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
+
+ assertTrue(!drv.acceptsURL("jdbc:metamatrix:jvdb@localhost:1234")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@localhost:1234")); //$NON-NLS-1$
+
+ //DQP type
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
+
+ assertTrue(!drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;txnAutoWrap=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ }
+
+ /** Invalid format of urls*/
+ public void testAcceptsURL2() throws Exception {
+ assertNotNull(drv);
+ assertTrue(!drv.acceptsURL("jdbc:matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("metamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc&matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc;metamatrix:test")); //$NON-NLS-1$
+ }
+
+ public void testParseURL() throws SQLException{
+ Properties p = new Properties();
+ TeiidDriver.getInstance().parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
+ assertTrue(p.getProperty(MMURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234")); //$NON-NLS-1$
+ assertEquals(3, p.size());
+ }
+
+ public void testParseURL2() throws SQLException {
+ Properties p = new Properties();
+ TeiidDriver.getInstance().parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
+ assertTrue(p.getProperty(MMURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals(BaseDataSource.DEFAULT_APP_NAME));
+ assertEquals(5, p.size());
+ }
+
+ public void testParseURL3() throws SQLException{
+ Properties p = new Properties();
+ TeiidDriver.getInstance().parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;txnAutoWrap=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
+ assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$
+ assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("YES")); //$NON-NLS-1$
+ assertTrue(p.getProperty(MMURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals("Client")); //$NON-NLS-1$
+ assertEquals(7, p.size());
+ }
+
+ public void testGetPropertyInfo1() throws Exception {
+ DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb@mm://localhost:12345", null); //$NON-NLS-1$
+
+ assertEquals(6, info.length);
+ assertEquals(true, info[0].required);
+ assertEquals("VirtualDatabaseName", info[0].name); //$NON-NLS-1$
+ assertEquals("vdb", info[0].value); //$NON-NLS-1$
+ }
+
+}
Property changes on: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
teiid SVN: r1097 - in trunk/adminshell/src/main/resources: scripts and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-07 14:28:08 -0400 (Tue, 07 Jul 2009)
New Revision: 1097
Modified:
trunk/adminshell/src/main/resources/commands/mparse.bsh
trunk/adminshell/src/main/resources/scripts/server.bsh
trunk/adminshell/src/main/resources/scripts/util.bsh
Log:
TEIID-698: reducing the noise of exceptions generated during the admin api calls to simple error message.
Modified: trunk/adminshell/src/main/resources/commands/mparse.bsh
===================================================================
--- trunk/adminshell/src/main/resources/commands/mparse.bsh 2009-07-07 16:47:45 UTC (rev 1096)
+++ trunk/adminshell/src/main/resources/commands/mparse.bsh 2009-07-07 18:28:08 UTC (rev 1097)
@@ -12,7 +12,7 @@
mmstr="execute(\""+orig_str.substring(0,orig_str.length()-1)+"\");";
record = true;
}
- else if (str.matches("(help|exit|dir|pwd)\\(?\\)?")) {
+ else if (str.matches("(help|exit|quit|dir|pwd)\\(?\\)?")) {
idx = str.indexOf("(");
if (idx == -1) {
mmstr = str+"();";
Modified: trunk/adminshell/src/main/resources/scripts/server.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/server.bsh 2009-07-07 16:47:45 UTC (rev 1096)
+++ trunk/adminshell/src/main/resources/scripts/server.bsh 2009-07-07 18:28:08 UTC (rev 1097)
@@ -46,7 +46,7 @@
url = url + ";" + optional_url;
}
com.metamatrix.jdbc.api.Connection mmConn = connectDriver(user_driver, url);
- currentContext().internalAdmin = mmConn.getAdminAPI();
+ currentContext().internalAdmin = createExceptionHandlingProxy(mmConn.getAdminAPI());
currentContext().internalPrompt = contextName+"["+vdb+"@"+host+"] $ ";
return mmConn;
}
@@ -85,7 +85,7 @@
newContext(contextName);
com.metamatrix.jdbc.api.Connection mmConn = connectDriver(driver, url);
currentContext().internalPrompt = contextName+"["+extractVDBName(url)+"@"+extractHost(url)+"] $ ";
- currentContext().internalAdmin = mmConn.getAdminAPI();
+ currentContext().internalAdmin = createExceptionHandlingProxy(mmConn.getAdminAPI());
return mmConn;
}
else {
@@ -107,7 +107,7 @@
newContext(contextName);
//url is in "server URL format": connect via ServerAdminFactory
- currentContext().internalAdmin = ServerAdminFactory.getInstance().createAdmin(username, password.toCharArray(), url);
+ currentContext().internalAdmin = createExceptionHandlingProxy(ServerAdminFactory.getInstance().createAdmin(username, password.toCharArray(), url));
currentContext().internalPrompt = currentConnectionName()+"["+url+"] $ ";
} else {
@@ -116,7 +116,7 @@
//url is in "jdbc URL format": connect via MMServerConnection
currentContext().internalConnection = connectDriver("org.teiid.jdbc.TeiidDriver", url, username, password);
- currentContext().internalAdmin = currentContext().internalConnection.getAdminAPI();
+ currentContext().internalAdmin = createExceptionHandlingProxy(currentContext().internalConnection.getAdminAPI());
}
}
Modified: trunk/adminshell/src/main/resources/scripts/util.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/util.bsh 2009-07-07 16:47:45 UTC (rev 1096)
+++ trunk/adminshell/src/main/resources/scripts/util.bsh 2009-07-07 18:28:08 UTC (rev 1097)
@@ -1,9 +1,11 @@
import java.io.*;
import org.teiid.adminapi.*;
import com.metamatrix.core.util.*;
+import java.lang.reflect.*;
debug=false;
+
getBshPrompt() {
if (currentContext().internalPrompt == void || currentContext().internalPrompt == null) {
return "admin $ ";
@@ -165,6 +167,37 @@
return "";
}
+class ExceptionHandler implements InvocationHandler{
+ Object impl;
+ ExceptionHandler(Object obj){
+ impl=obj;
+ }
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ try {
+ return method.invoke(impl, args);
+ } catch (InvocationTargetException e) {
+ Throwable ex = e;
+ while (ex instanceof InvocationTargetException) {
+ ex = e.getTargetException();
+ }
+ if (ex instanceof AdminException) {
+ print("Error:"+ex.getMessage());
+ }
+ } catch(AdminComponentException e) {
+ print(e.getClass().getName() +" Error:"+e.getMessage());
+ } catch (AdminProcessingException e) {
+ print(e.getClass().getName() +" Error:"+e.getMessage());
+ } catch(Throwable t) {
+ print(t.getClass().getName() +" Error:"+e.getMessage());
+ }
+ return null;
+ }
+}
+
+Object createExceptionHandlingProxy(Object obj) {
+ return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new ExceptionHandler(obj));
+}
+
quit(){
exit();
}
15 years, 5 months
teiid SVN: r1096 - in trunk: embedded/src/main/java/com/metamatrix/platform/security/authorization/service and 7 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-07 12:47:45 -0400 (Tue, 07 Jul 2009)
New Revision: 1096
Removed:
trunk/embedded/src/main/java/com/metamatrix/platform/PlatformPlugin.java
trunk/embedded/src/main/java/com/metamatrix/platform/util/
trunk/embedded/src/main/resources/com/metamatrix/platform/
Modified:
trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java
trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java
trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java
trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties
trunk/engine/src/main/java/com/metamatrix/query/util/ErrorMessageKeys.java
Log:
TEIID-704: The message was missing in the i18n.properties file. Also, removed all the PlatformPlugin and moved all the messages to EmbeddedPlugin.
Deleted: trunk/embedded/src/main/java/com/metamatrix/platform/PlatformPlugin.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/PlatformPlugin.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/PlatformPlugin.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.platform;
-
-import java.util.ResourceBundle;
-
-import com.metamatrix.core.BundleUtil;
-
-/*
- * TODO: remove me
- *
- */
-
-public class PlatformPlugin {
-
- public static final String PLUGIN_ID = "com.metamatrix.platform" ; //$NON-NLS-1$
- private static final String BUNDLE_NAME = PLUGIN_ID + ".i18n"; //$NON-NLS-1$
- public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,BUNDLE_NAME,ResourceBundle.getBundle(BUNDLE_NAME));
-
-
-}
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -29,7 +29,6 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -44,7 +43,6 @@
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.api.exception.security.InvalidPrincipalException;
import com.metamatrix.api.exception.security.MembershipServiceException;
@@ -56,11 +54,11 @@
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.LRUCache;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.service.AuditMessage;
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.dqp.util.LogConstants;
-import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.AuthorizationActions;
import com.metamatrix.platform.security.api.AuthorizationPermission;
import com.metamatrix.platform.security.api.AuthorizationPolicy;
@@ -74,7 +72,6 @@
import com.metamatrix.platform.security.api.StandardAuthorizationActions;
import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
import com.metamatrix.platform.security.util.RolePermissionFactory;
-import com.metamatrix.platform.util.ErrorMessageKeys;
import com.metamatrix.server.util.ServerAuditContexts;
import com.metamatrix.vdb.runtime.VDBKey;
@@ -202,7 +199,7 @@
}
}
} catch (InvalidPrincipalException e) {
- throw new AuthorizationMgmtException(e, PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_AUTHORIZATION_0020));
+ throw new AuthorizationMgmtException(e, DQPEmbeddedPlugin.Util.getString("AuthorizationServiceImpl.invalid_session")); //$NON-NLS-1$
}
if (results.isEmpty()) {
@@ -233,15 +230,14 @@
AuthorizationRealm aRealm = aPerm.getRealm();
if ( theRealm != null ) {
if ( ! theRealm.equals(aRealm) ) {
- throw new AuthorizationMgmtException(ErrorMessageKeys.SEC_AUTHORIZATION_0078,
- PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_AUTHORIZATION_0078));
+ throw new AuthorizationMgmtException(DQPEmbeddedPlugin.Util.getString("AuthorizationServiceImpl.wrong_realms ")); //$NON-NLS-1$
}
} else {
theRealm = aRealm;
}
}
if ( theRealm == null ) {
- throw new AuthorizationMgmtException(PlatformPlugin.Util.getString("AuthorizationServiceImpl.Authorization_Realm_is_null")); //$NON-NLS-1$
+ throw new AuthorizationMgmtException(DQPEmbeddedPlugin.Util.getString("AuthorizationServiceImpl.Authorization_Realm_is_null")); //$NON-NLS-1$
}
return theRealm;
}
@@ -474,8 +470,7 @@
} catch (InvalidPrincipalException e) {
throw e;
} catch (MetaMatrixSecurityException e) {
- String msg = PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_AUTHORIZATION_0035);
- throw new AuthorizationMgmtException(e, ErrorMessageKeys.SEC_AUTHORIZATION_0035, msg);
+ throw new AuthorizationMgmtException(e, DQPEmbeddedPlugin.Util.getString("AuthorizationServiceImpl.error_seraching_policies")); //$NON-NLS-1$
}
return allPrincipals;
}
@@ -487,7 +482,7 @@
return true;
}
} catch (MembershipServiceException e) {
- LogManager.logError(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, e, PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_AUTHORIZATION_0075));
+ LogManager.logError(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, e, DQPEmbeddedPlugin.Util.getString("AuthorizationServiceImpl.failed_to_get_groups")); //$NON-NLS-1$
}
return false;
}
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -59,8 +59,8 @@
import com.metamatrix.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.core.util.StringUtil;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.BasicMetaMatrixPrincipal;
import com.metamatrix.platform.security.api.Credentials;
import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
@@ -71,7 +71,6 @@
import com.metamatrix.platform.security.api.service.SuccessfulAuthenticationToken;
import com.metamatrix.platform.security.membership.spi.MembershipDomain;
import com.metamatrix.platform.security.membership.spi.MembershipSourceException;
-import com.metamatrix.platform.util.ErrorMessageKeys;
/**
* This class serves as the primary implementation of the
@@ -154,7 +153,7 @@
adminCredentials = env.getProperty(ADMIN_PASSWORD);
if (adminCredentials == null || adminCredentials.length() == 0) {
- throw new ApplicationInitializationException(PlatformPlugin.Util.getString("MembershipServiceImpl.Root_password_required")); //$NON-NLS-1$
+ throw new ApplicationInitializationException(DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Root_password_required")); //$NON-NLS-1$
}
String property = env.getProperty(ADMIN_HOSTS);
@@ -167,7 +166,7 @@
//TODO: my caller should have already decrypted this for me
adminCredentials = CryptoUtil.stringDecrypt(adminCredentials);
} catch (CryptoException err) {
- LogManager.logCritical(LogConstants.CTX_MEMBERSHIP, err, PlatformPlugin.Util.getString("MembershipServiceImpl.Root_password_decryption_failed")); //$NON-NLS-1$
+ LogManager.logCritical(LogConstants.CTX_MEMBERSHIP, err, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Root_password_decryption_failed")); //$NON-NLS-1$
throw new ApplicationInitializationException(err);
}
}
@@ -189,7 +188,7 @@
continue;
}
MembershipDomain newDomain = createDomain(domainName, domainProps);
- LogManager.logInfo(LogConstants.CTX_MEMBERSHIP, PlatformPlugin.Util.getString("MSG.014.407.0005", domainName)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_MEMBERSHIP, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.loaded", domainName)); //$NON-NLS-1$
if(newDomain!=null) {
this.domains.add(new MembershipDomainHolder(newDomain, domainName));
}
@@ -220,12 +219,10 @@
try {
domain = (MembershipDomain) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
} catch (Throwable e) {
- String msg = PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0023, className);
- throw new ApplicationInitializationException(e, ErrorMessageKeys.SEC_MEMBERSHIP_0023, msg);
+ throw new ApplicationInitializationException(e, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.failed_to_create", className)); //$NON-NLS-1$
}
} else {
- String msg = PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0024, domainName);
- throw new ApplicationInitializationException(ErrorMessageKeys.SEC_MEMBERSHIP_0024, msg);
+ throw new ApplicationInitializationException(DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.unable_to_create", domainName)); //$NON-NLS-1$
}
properties.setProperty(DOMAIN_NAME, domainName);
@@ -254,7 +251,7 @@
try {
domainHolder.getMembershipDomain().shutdown();
} catch ( Exception e ) {
- LogManager.logError(LogConstants.CTX_MEMBERSHIP, e, ErrorMessageKeys.SEC_MEMBERSHIP_0026);
+ LogManager.logError(LogConstants.CTX_MEMBERSHIP, e, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.error_shuting_down ")); //$NON-NLS-1$
}
}
this.domains.clear();
@@ -296,7 +293,7 @@
credential = new Credentials(CryptoUtil.stringDecrypt(password).toCharArray());
} catch (CryptoException err) {
//just log and allow the normal authentication flow
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.Decrypt_failed", username); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Decrypt_failed", username); //$NON-NLS-1$
LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, err, msg);
}
}
@@ -310,11 +307,11 @@
if (isSecurityEnabled && allowedAddresses != null) {
String address = DQPWorkContext.getWorkContext().getClientAddress();
if (address == null) {
- LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, PlatformPlugin.Util.getString("MembershipServiceImpl.unknown_host")); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.unknown_host")); //$NON-NLS-1$
return new FailedAuthenticationToken();
}
if (!allowedAddresses.matcher(address).matches() && !address.equals(this.hostAddress.getHostAddress())) {
- LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, PlatformPlugin.Util.getString("MembershipServiceImpl.invalid_host", address, allowedAddresses.pattern())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.invalid_host", address, allowedAddresses.pattern())); //$NON-NLS-1$
return new FailedAuthenticationToken();
}
}
@@ -350,26 +347,26 @@
}
return new SuccessfulAuthenticationToken(auth.getPayload(), baseUsername + MembershipServiceInterface.AT + domain);
}
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.Null_authentication", entry.getDomainName(), username ); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Null_authentication", entry.getDomainName(), username ); //$NON-NLS-1$
LogManager.logError(LogConstants.CTX_MEMBERSHIP, msg);
return new FailedAuthenticationToken();
} catch (LogonException le) {
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.Logon_failed", entry.getDomainName(), username ); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Logon_failed", entry.getDomainName(), username ); //$NON-NLS-1$
LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, le, msg);
return new FailedAuthenticationToken();
} catch (InvalidUserException e) {
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.Invalid_user", entry.getDomainName(), username ); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Invalid_user", entry.getDomainName(), username ); //$NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, e, msg);
} catch (UnsupportedCredentialException e) {
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.Unsupported_credentials", entry.getDomainName(), username ); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Unsupported_credentials", entry.getDomainName(), username ); //$NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, e, msg);
} catch (MembershipSourceException e) {
//just skip this domain for now
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.source_exception", entry.getDomainName()); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.source_exception", entry.getDomainName()); //$NON-NLS-1$
LogManager.logError(LogConstants.CTX_MEMBERSHIP, e, msg);
}
}
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.Failed_authentication", username ); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Failed_authentication", username ); //$NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, msg);
return new FailedAuthenticationToken();
}
@@ -497,7 +494,7 @@
// If baseName is null, or domain cannot be uniquely determined throw exception
if (baseName==null || userDomains.size() != 1) {
- throw new InvalidPrincipalException(ErrorMessageKeys.SEC_MEMBERSHIP_0031,PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0031, name));
+ throw new InvalidPrincipalException(DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.invalid_principal", name)); //$NON-NLS-1$
}
MembershipDomainHolder domain = (MembershipDomainHolder) userDomains.iterator().next();
@@ -514,15 +511,15 @@
return new BasicMetaMatrixPrincipal(name, MetaMatrixPrincipal.TYPE_GROUP);
}
} catch ( InvalidPrincipalException e ) {
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.principal_does_not_exist", name, domain.getDomainName()); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.principal_does_not_exist", name, domain.getDomainName()); //$NON-NLS-1$
LogManager.logError(LogConstants.CTX_MEMBERSHIP, e, msg);
throw new InvalidPrincipalException(msg);
} catch (Throwable e) {
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.source_exception", domain.getDomainName()); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.source_exception", domain.getDomainName()); //$NON-NLS-1$
LogManager.logError(LogConstants.CTX_MEMBERSHIP, e, msg);
throw new MembershipServiceException(msg);
}
- throw new InvalidPrincipalException(PlatformPlugin.Util.getString("MembershipServiceImpl.principal_does_not_exist", name, domain.getDomainName())); //$NON-NLS-1$
+ throw new InvalidPrincipalException(DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.principal_does_not_exist", name, domain.getDomainName())); //$NON-NLS-1$
}
private Set<String> getDomainSpecificGroups(Set<String> groups, String domainName) {
@@ -576,7 +573,7 @@
try {
result.addAll( getDomainSpecificGroups(domain.getMembershipDomain().getGroupNames(), domain.getDomainName()) );
} catch (Throwable e) {
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.source_exception", domain.getDomainName()); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.source_exception", domain.getDomainName()); //$NON-NLS-1$
LogManager.logError(LogConstants.CTX_MEMBERSHIP, e, msg);
throw new MembershipServiceException(msg);
}
@@ -626,7 +623,7 @@
try {
return getDomainSpecificGroups(dHolder.getMembershipDomain().getGroupNames(), domainName);
} catch (Throwable e) {
- String msg = PlatformPlugin.Util.getString("MembershipServiceImpl.source_exception", dHolder.getDomainName()); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.source_exception", dHolder.getDomainName()); //$NON-NLS-1$
LogManager.logError(LogConstants.CTX_MEMBERSHIP, e, msg);
throw new MembershipServiceException(msg);
}
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -50,7 +50,7 @@
import com.metamatrix.api.exception.security.UnsupportedCredentialException;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
-import com.metamatrix.platform.PlatformPlugin;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.platform.security.api.Credentials;
import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
import com.metamatrix.platform.security.api.service.SuccessfulAuthenticationToken;
@@ -143,7 +143,7 @@
ldapURL = getPropertyValue(props, LDAP_URL, null);
if (ldapURL == null) {
- throw new MembershipSourceException(PlatformPlugin.Util.getString("LDAPMembershipDomain.Required_property", LDAP_URL)); //$NON-NLS-1$
+ throw new MembershipSourceException(DQPEmbeddedPlugin.Util.getString("LDAPMembershipDomain.Required_property", LDAP_URL)); //$NON-NLS-1$
}
usersRootContexts = buildContexts(USERS_ROOT_CONTEXT,
@@ -164,7 +164,7 @@
if (props.getProperty(USERS_MEMBER_OF_ATTRIBUTE, "").trim().length() == 0 //$NON-NLS-1$
&& props.getProperty(GROUPS_GROUP_MEMBER_ATTRIBUTE, "").trim().length() == 0) { //$NON-NLS-1$
- LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, PlatformPlugin.Util.getString("LDAPMembershipDomain.Require_memberof_property", domainName ) ); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, DQPEmbeddedPlugin.Util.getString("LDAPMembershipDomain.Require_memberof_property", domainName ) ); //$NON-NLS-1$
}
// Create the root context.
@@ -198,7 +198,7 @@
String rootContextsStr = props.getProperty(rootContextsProp, null);
if (rootContextsStr == null) {
- throw new MembershipSourceException(PlatformPlugin.Util.getString("LDAPMembershipDomain.Required_property", rootContextsProp)); //$NON-NLS-1$
+ throw new MembershipSourceException(DQPEmbeddedPlugin.Util.getString("LDAPMembershipDomain.Required_property", rootContextsProp)); //$NON-NLS-1$
}
String searchFilterStr = props.getProperty(searchFilterProp);
@@ -286,13 +286,13 @@
domainName, "authenticateUser username", username, "applicationName", applicationName}); //$NON-NLS-1$ //$NON-NLS-2$
if (username == null) {
- throw new UnsupportedCredentialException(PlatformPlugin.Util.getString("LDAPMembershipDomain.No_annonymous", domainName)); //$NON-NLS-1$
+ throw new UnsupportedCredentialException(DQPEmbeddedPlugin.Util.getString("LDAPMembershipDomain.No_annonymous", domainName)); //$NON-NLS-1$
}
UserEntry ue = getUserEntry(username, false);
if (credential == null) {
- throw new UnsupportedCredentialException(PlatformPlugin.Util.getString("LDAPMembershipDomain.No_annonymous", domainName)); //$NON-NLS-1$
+ throw new UnsupportedCredentialException(DQPEmbeddedPlugin.Util.getString("LDAPMembershipDomain.No_annonymous", domainName)); //$NON-NLS-1$
}
Hashtable connenv = new Hashtable();
@@ -350,7 +350,7 @@
try {
return new InitialDirContext((Hashtable)adminContext.clone());
} catch (AuthenticationException err) {
- throw new MembershipSourceException(err, PlatformPlugin.Util.getString("LDAPMembershipDomain.Admin_credentials", domainName)); //$NON-NLS-1$
+ throw new MembershipSourceException(err, DQPEmbeddedPlugin.Util.getString("LDAPMembershipDomain.Admin_credentials", domainName)); //$NON-NLS-1$
} catch (NamingException err) {
throw new MembershipSourceException(err);
}
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -50,10 +50,10 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.core.util.ArgCheck;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.metadata.runtime.exception.VirtualDatabaseDoesNotExistException;
import com.metamatrix.metadata.runtime.exception.VirtualDatabaseException;
-import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.Credentials;
import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
@@ -63,8 +63,6 @@
import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
import com.metamatrix.platform.security.api.service.SessionListener;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.util.ErrorMessageKeys;
-import com.metamatrix.platform.util.LogMessageKeys;
import com.metamatrix.platform.util.ProductInfoConstants;
/**
@@ -99,10 +97,10 @@
for (MetaMatrixSessionInfo info : sessionCache.values()) {
try {
if (currentTime - info.getLastPingTime() > ServerConnection.PING_INTERVAL * 5) {
- LogManager.logInfo(LogConstants.CTX_SESSION, PlatformPlugin.Util.getString( "SessionServiceImpl.keepaliveFailed", info.getSessionID())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SESSION, DQPEmbeddedPlugin.Util.getString( "SessionServiceImpl.keepaliveFailed", info.getSessionID())); //$NON-NLS-1$
closeSession(info.getSessionID());
} else if (sessionTimeLimit > 0 && currentTime - info.getTimeCreated() > sessionTimeLimit) {
- LogManager.logInfo(LogConstants.CTX_SESSION, PlatformPlugin.Util.getString( "SessionServiceImpl.expireSession", info.getSessionID())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SESSION, DQPEmbeddedPlugin.Util.getString( "SessionServiceImpl.expireSession", info.getSessionID())); //$NON-NLS-1$
closeSession(info.getSessionID());
}
} catch (Exception e) {
@@ -117,7 +115,7 @@
LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {"closeSession", sessionID}); //$NON-NLS-1$
MetaMatrixSessionInfo info = this.sessionCache.remove(sessionID);
if (info == null) {
- throw new InvalidSessionException(ErrorMessageKeys.SEC_SESSION_0027, PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_SESSION_0027, sessionID));
+ throw new InvalidSessionException(DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.invalid_session", sessionID)); //$NON-NLS-1$
}
if (info.getProductInfo(ProductInfoConstants.VIRTUAL_DB) != null) {
try {
@@ -161,9 +159,9 @@
throw new SessionServiceException(e);
} catch (VirtualDatabaseException e) {
if (vdbVersion == null) {
- throw new SessionServiceException(e,PlatformPlugin.Util.getString("SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database", new Object[] {vdbName})); //$NON-NLS-1$
+ throw new SessionServiceException(e,DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database", new Object[] {vdbName})); //$NON-NLS-1$
}
- throw new SessionServiceException(e,PlatformPlugin.Util.getString("SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database_{0}_of_version_{1}", new Object[] {vdbName, vdbVersion})); //$NON-NLS-1$
+ throw new SessionServiceException(e,DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database_{0}_of_version_{1}", new Object[] {vdbName, vdbVersion})); //$NON-NLS-1$
} catch (MetaMatrixComponentException e) {
throw new SessionServiceException(e);
}
@@ -173,7 +171,7 @@
}
if (sessionMaxLimit > 0 && getActiveSessionsCount() >= sessionMaxLimit) {
- throw new SessionServiceException(LogMessageKeys.SEC_SESSION_0067,PlatformPlugin.Util.getString(LogMessageKeys.SEC_SESSION_0067, new Object[] {new Long(sessionMaxLimit)}));
+ throw new SessionServiceException(DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.reached_max_sessions", new Object[] {new Long(sessionMaxLimit)})); //$NON-NLS-1$
}
long creationTime = System.currentTimeMillis();
@@ -207,9 +205,7 @@
authenticatedToken = this.membershipService.authenticateUser(userName,
credentials, trustedToken, applicationName);
}catch (MetaMatrixSecurityException e) {
- String msg = PlatformPlugin.Util
- .getString(
- "SessionServiceImpl.Membership_service_could_not_authenticate_user", new Object[] { userName }); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.Membership_service_could_not_authenticate_user", new Object[] { userName }); //$NON-NLS-1$
SessionServiceException se = new SessionServiceException(e, msg);
throw se;
}
@@ -220,7 +216,7 @@
// level issue.
if (!authenticatedToken.isAuthenticated()) {
Object[] params = new Object[] { userName };
- String msg = PlatformPlugin.Util.getString("SessionServiceImpl.The_username_0_and/or_password_are_incorrect", params); //$NON-NLS-1$
+ String msg = DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.The_username_0_and/or_password_are_incorrect", params); //$NON-NLS-1$
throw new MetaMatrixAuthenticationException(msg);
}
@@ -246,7 +242,7 @@
try {
return membershipService.getPrincipal(new MetaMatrixPrincipalName(sessionInfo.getUserName(), MetaMatrixPrincipal.TYPE_USER));
} catch (MetaMatrixSecurityException e) {
- throw new SessionServiceException(e, LogMessageKeys.SEC_SESSION_0043,PlatformPlugin.Util.getString(LogMessageKeys.SEC_SESSION_0043,sessionInfo.getUserName()));
+ throw new SessionServiceException(e, DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.failed_to_getprincipal",sessionInfo.getUserName())); //$NON-NLS-1$
}
}
@@ -274,16 +270,14 @@
}
@Override
- public boolean terminateSession(MetaMatrixSessionID terminatedSessionID,
- MetaMatrixSessionID adminSessionID) throws
- AuthorizationException, SessionServiceException {
+ public boolean terminateSession(MetaMatrixSessionID terminatedSessionID,MetaMatrixSessionID adminSessionID) throws AuthorizationException, SessionServiceException {
Object[] params = {adminSessionID, terminatedSessionID};
- LogManager.logInfo(LogConstants.CTX_SESSION, PlatformPlugin.Util.getString( "SessionServiceImpl.terminateSession", params)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SESSION, DQPEmbeddedPlugin.Util.getString( "SessionServiceImpl.terminateSession", params)); //$NON-NLS-1$
try {
closeSession(terminatedSessionID);
return true;
} catch (InvalidSessionException e) {
- LogManager.logWarning(LogConstants.CTX_SESSION,e,PlatformPlugin.Util.getString(LogMessageKeys.SEC_SESSION_0034, new Object[] {e.getMessage()}));
+ LogManager.logWarning(LogConstants.CTX_SESSION,e,DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.invalid_session", new Object[] {e.getMessage()})); //$NON-NLS-1$
return false;
}
}
@@ -299,7 +293,7 @@
throws InvalidSessionException {
MetaMatrixSessionInfo info = this.sessionCache.get(sessionID);
if (info == null) {
- throw new InvalidSessionException(ErrorMessageKeys.SEC_SESSION_0027, PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_SESSION_0027, sessionID));
+ throw new InvalidSessionException(DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.invalid_session", sessionID)); //$NON-NLS-1$
}
return info;
}
Modified: trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -41,8 +41,8 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.dqp.client.ResultsFuture;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.jdbc.api.ConnectionProperties;
-import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.Credentials;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
@@ -97,7 +97,7 @@
// Check if both credentials AND session token are used - if so, this is an error
if(connProps.containsKey(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD)) {
- throw new LogonException(PlatformPlugin.Util.getString("LogonImpl.Invalid_use_of_credentials_and_token")); //$NON-NLS-1$
+ throw new LogonException(DQPEmbeddedPlugin.Util.getString("LogonImpl.Invalid_use_of_credentials_and_token")); //$NON-NLS-1$
}
// Parse credentials and store CredentialMap as session token
Modified: trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -47,7 +47,7 @@
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.ReflectionHelper;
import com.metamatrix.dqp.client.ResultsFuture;
-import com.metamatrix.platform.PlatformPlugin;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
@@ -86,7 +86,7 @@
final ServiceInvocationStruct serviceStruct = (ServiceInvocationStruct)message.getContents();
Object instance = server.getClientService(serviceStruct.targetClass);
if (instance == null) {
- throw new ComponentNotFoundException(PlatformPlugin.Util.getString("ServerWorkItem.Component_Not_Found", serviceStruct.targetClass)); //$NON-NLS-1$
+ throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("ServerWorkItem.Component_Not_Found", serviceStruct.targetClass)); //$NON-NLS-1$
}
if (!(instance instanceof ILogon)) {
DQPWorkContext workContext = this.socketClientInstance.getWorkContext();
@@ -161,7 +161,7 @@
} else if (e instanceof AdminProcessingException) {
logProcessingException(e, context);
} else {
- LogManager.logError(context, e, PlatformPlugin.Util.getString("ServerWorkItem.Received_exception_processing_request", this.socketClientInstance.getWorkContext().getConnectionID())); //$NON-NLS-1$
+ LogManager.logError(context, e, DQPEmbeddedPlugin.Util.getString("ServerWorkItem.Received_exception_processing_request", this.socketClientInstance.getWorkContext().getConnectionID())); //$NON-NLS-1$
}
return new ExceptionHolder(e);
@@ -174,7 +174,7 @@
}
StackTraceElement elem = cause.getStackTrace()[0];
LogManager.logDetail(context, e, "Processing exception for session", this.socketClientInstance.getWorkContext().getConnectionID()); //$NON-NLS-1$
- LogManager.logWarning(context, PlatformPlugin.Util.getString("ServerWorkItem.processing_error", e.getMessage(), this.socketClientInstance.getWorkContext().getConnectionID(), e.getClass().getName(), elem)); //$NON-NLS-1$
+ LogManager.logWarning(context, DQPEmbeddedPlugin.Util.getString("ServerWorkItem.processing_error", e.getMessage(), this.socketClientInstance.getWorkContext().getConnectionID(), e.getClass().getName(), elem)); //$NON-NLS-1$
}
}
\ No newline at end of file
Modified: trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.net.InetAddress;
-import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.Properties;
@@ -31,12 +30,11 @@
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.queue.WorkerPoolStats;
-import com.metamatrix.common.util.ApplicationInfo;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
import com.metamatrix.platform.vm.controller.SocketListenerStats;
@@ -74,15 +72,15 @@
SSLConfiguration helper = new SSLConfiguration();
helper.init(this.props);
- LogManager.logDetail(LogConstants.CTX_SERVER, PlatformPlugin.Util.getString("SocketVMController.1", new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SERVER, DQPEmbeddedPlugin.Util.getString("SocketTransport.1", new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
this.listener = new SocketListener(socketPort, bindAddress, this.clientServices, inputBufferSize, outputBufferSize, maxThreads, helper.getServerSSLEngine(), helper.isClientEncryptionEnabled(), this.sessionSerice);
} catch (UnknownHostException e) {
- throw new MetaMatrixRuntimeException(e, PlatformPlugin.Util.getString("SocketVMController.2",new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
+ throw new MetaMatrixRuntimeException(e, DQPEmbeddedPlugin.Util.getString("SocketTransport.2",new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
} catch (IOException e) {
- throw new MetaMatrixRuntimeException(e, PlatformPlugin.Util.getString("SocketVMController.2",new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
+ throw new MetaMatrixRuntimeException(e, DQPEmbeddedPlugin.Util.getString("SocketTransport.2",new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
} catch (GeneralSecurityException e) {
- throw new MetaMatrixRuntimeException(e, PlatformPlugin.Util.getString("SocketVMController.2",new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
+ throw new MetaMatrixRuntimeException(e, DQPEmbeddedPlugin.Util.getString("SocketTransport.2",new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
}
}
Modified: trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties
===================================================================
--- trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-07-07 16:47:45 UTC (rev 1096)
@@ -210,4 +210,60 @@
ServerSecurityAdminImpl.not_implemented=This feature not available.
failed_to_load_admin_roles=Failed to load Admin role permissions
-admin_roles_not_defined=Admin Role permissions are not defined. Refer to admin-roles.properties file
\ No newline at end of file
+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.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.
+AuthorizationServiceImpl.Authorization_Realm_is_null=The requested Authorization Realm is null
+
+# membership service
+MembershipServiceImpl.loaded = Loaded membership domain: "{0}".
+MembershipServiceImpl.failed_to_create = Unable to create membership domain {0}
+MembershipServiceImpl.unable_to_create = Unable to create membership domain "{0}". Factory class not found in environment properties.
+MembershipServiceImpl.invalid_principal = The principal "{0}" is invalid.
+MembershipServiceImpl.Null_authentication=Domain {0} returned a null authentication result for user {1}
+MembershipServiceImpl.Invalid_user=Domain {0} indicated that user {1} was not valid
+MembershipServiceImpl.Unsupported_credentials=Domain {0} indicated that the credentials were not supported
+MembershipServiceImpl.Failed_authentication={0} could not be authenticated in any domain
+MembershipServiceImpl.Root_password_required=password is required for super user
+MembershipServiceImpl.Root_password_decryption_failed=super password could not be decrypted
+MembershipServiceImpl.principal_does_not_exist=The principal ''{0}'' does not exist in domain ''{1}''
+MembershipServiceImpl.Decrypt_failed=Could not decrypt the encrypted password for user ''{0}''
+MembershipServiceImpl.source_exception=Membership Domain ''{0}'' failed to perform the desired operation, please check the settings for this domain
+MembershipServiceImpl.load_error=Could not load file ''{0}'' from the classpath, the file system, or as a URL.
+MembershipServiceImpl.unknown_host=Did not allow root user authentication attempt, since root logons are restricted and could not determine the remote host.
+MembershipServiceImpl.invalid_host=Could not authenticate root user, since the client address {0} is not in the allowed values {1}
+MembershipServiceImpl.error_shuting_down = Error shutting down domain after ''killService'' method received.
+MembershipServiceImpl.Logon_failed=log on failed for user {1} on the domain {0}
+
+LDAPMembershipDomain.No_annonymous=Annonymous user authentications are not allowed in domain {0}
+LDAPMembershipDomain.Required_property=Required property {0} was missing.
+LDAPMembershipDomain.Admin_credentials=Admin DN and/or password supplied for LDAP Membership Domain {0} are invalid.
+LDAPMembershipDomain.Require_memberof_property=Users in LDAP Membership Domain {0} will not appear as members of any group since user's memberOf and group's memberOf attributes are both unspecified.
+
+
+# session service
+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}
+SessionServiceImpl.Unexpected_error_finding_latest_version_of_Virtual_Database_{0}_of_version_{1}=Unexpected error finding latest version of Virtual Database {0} of version {1}
+SessionServiceImpl.Membership_service_could_not_authenticate_user=Membership service could not authenticate user "{0}"
+SessionServiceImpl.The_username_0_and/or_password_are_incorrect=The username "{0}" and/or password and/or payload token could not be authenticated by any membership domain.
+SessionServiceImpl.terminateSession = Admin [{0}] is terminating this session: {1}.
+
+
+LogonImpl.Invalid_use_of_credentials_and_token=Conflicting use of both client session token and credentials.
+
+ServerWorkItem.Received_exception_processing_request=Unexpected exception for session {0}
+ServerWorkItem.processing_error=Processing exception ''{0}'' for session {1}. Exception type {2} throw from {3}. Enable detail logging to see the entire stacktrace.
+ServerWorkItem.Component_Not_Found=Component not found: {0}
+
+SocketTransport.1=Bound to address {1} listening on port {2}
+SocketTransport.2=Problem starting server binding to address {0} and listening on port {1}
Modified: trunk/engine/src/main/java/com/metamatrix/query/util/ErrorMessageKeys.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/util/ErrorMessageKeys.java 2009-07-06 21:17:43 UTC (rev 1095)
+++ trunk/engine/src/main/java/com/metamatrix/query/util/ErrorMessageKeys.java 2009-07-07 16:47:45 UTC (rev 1096)
@@ -31,7 +31,6 @@
*
* <p>Error messages for query project (015) to address internationalization.</p>
*
- * @author <a href="mailto:jcunningham@metamatrix.com">Jeff Cunningham</a>
*/
public class ErrorMessageKeys {
15 years, 5 months
teiid SVN: r1095 - in trunk: build/kit-embedded/deploy and 6 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-06 17:17:43 -0400 (Mon, 06 Jul 2009)
New Revision: 1095
Added:
trunk/build/kit-embedded/deploy/admin-roles.properties
trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AdminAuthorizationPolicyProvider.java
Modified:
trunk/build/kit-embedded/deploy.properties
trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties
trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
Log:
TEIID-665: Adding the configuration option to define the admin roles for the user groups.
Added: trunk/build/kit-embedded/deploy/admin-roles.properties
===================================================================
--- trunk/build/kit-embedded/deploy/admin-roles.properties (rev 0)
+++ trunk/build/kit-embedded/deploy/admin-roles.properties 2009-07-06 21:17:43 UTC (rev 1095)
@@ -0,0 +1,18 @@
+# This file defines admin role grants for each user "group" in the system.
+# based on the this permission the user will be able to call the admin
+# function calls into the system. The following format needs to be used
+# define the permissions
+
+# role1 = groupA, groupB
+# role2 = groupB, groupC
+
+# for group names check your membership provider configuration.
+
+# This role grants full permissions to any configuration, runtime-management and monitoring of the system
+Admin.SystemAdmin=
+
+# This role grants runtime-management and monitoring of the system
+Admin.ProductAdmin=
+
+# This role grants only monitoring of the system.
+Admin.ReadOnlyAdmin=
Property changes on: trunk/build/kit-embedded/deploy/admin-roles.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/build/kit-embedded/deploy.properties
===================================================================
--- trunk/build/kit-embedded/deploy.properties 2009-07-02 21:38:17 UTC (rev 1094)
+++ trunk/build/kit-embedded/deploy.properties 2009-07-06 21:17:43 UTC (rev 1095)
@@ -119,6 +119,7 @@
# Enable entitlements (data, admin)
entitlements.enabled=false
+entitlements.adminRolesFile=./deploy/admin-roles.properties
#
Modified: trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java 2009-07-02 21:38:17 UTC (rev 1094)
+++ trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java 2009-07-06 21:17:43 UTC (rev 1095)
@@ -29,7 +29,9 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
import java.util.Set;
+import java.util.StringTokenizer;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -47,6 +49,7 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.platform.security.util.RolePermissionFactory;
/**
* The class build the Policies from the xml file or converts the policies to xml file for importing and exporting of the policy
@@ -93,20 +96,15 @@
docBuilder.setErrorHandler(new ErrorHandler() {
public void warning(SAXParseException arg0) throws SAXException {
- LogManager.logWarning(LogConstants.CTX_AUTHORIZATION,
- arg0,
- SecurityPlugin.Util.getString("AuthorizationPolicyFactory.parsing_warning", //$NON-NLS-1$
- arg0.getMessage()));
+ LogManager.logWarning(LogConstants.CTX_AUTHORIZATION,arg0,SecurityPlugin.Util.getString("AuthorizationPolicyFactory.parsing_warning", arg0.getMessage())); //$NON-NLS-1$
}
public void error(SAXParseException arg0) throws SAXException {
- throw new SAXException(SecurityPlugin.Util.getString("AuthorizationPolicyFactory.parsing_error", //$NON-NLS-1$
- arg0.getMessage()), arg0);
+ throw new SAXException(SecurityPlugin.Util.getString("AuthorizationPolicyFactory.parsing_error", arg0.getMessage()), arg0); //$NON-NLS-1$
}
public void fatalError(SAXParseException arg0) throws SAXException {
- throw new SAXException(SecurityPlugin.Util.getString("AuthorizationPolicyFactory.parsing_error", //$NON-NLS-1$
- arg0.getMessage()), arg0);
+ throw new SAXException(SecurityPlugin.Util.getString("AuthorizationPolicyFactory.parsing_error", arg0.getMessage()), arg0); //$NON-NLS-1$
}
});
@@ -242,4 +240,33 @@
return baos.toString().toCharArray();
}
+
+ /**
+ * The properties will have format of
+ * role1 = group1, group2
+ * role2 = group3
+ *
+ * @param roles
+ * @return
+ */
+ public static Collection<AuthorizationPolicy> buildAdminPolicies(Properties roleMap) {
+ List<AuthorizationPolicy> result = new ArrayList<AuthorizationPolicy>();
+ Set keys = roleMap.keySet();
+
+ for(Object key:keys) {
+ String role = (String)key;
+ AuthorizationPolicyID policyID = new AuthorizationPolicyID(role, role);
+ AuthorizationPolicy policy = new AuthorizationPolicy(policyID);
+
+ // allowed groups
+ StringTokenizer st = new StringTokenizer(roleMap.getProperty(role), ","); //$NON-NLS-1$
+ while (st.hasMoreTokens()) {
+ String group = st.nextToken();
+ MetaMatrixPrincipalName member = new MetaMatrixPrincipalName(group, MetaMatrixPrincipal.TYPE_GROUP);
+ policy.addPrincipal(member);
+ }
+ result.add(policy);
+ }
+ return result;
+ }
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-07-02 21:38:17 UTC (rev 1094)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-07-06 21:17:43 UTC (rev 1095)
@@ -25,6 +25,7 @@
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -36,6 +37,7 @@
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
import com.google.inject.name.Names;
import com.metamatrix.cache.CacheFactory;
import com.metamatrix.cache.jboss.JBossCacheFactory;
@@ -54,9 +56,9 @@
import com.metamatrix.dqp.embedded.services.EmbeddedMetadataService;
import com.metamatrix.dqp.embedded.services.EmbeddedTransactionService;
import com.metamatrix.dqp.embedded.services.EmbeddedVDBService;
-import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
+import com.metamatrix.platform.security.api.AuthorizationPolicy;
+import com.metamatrix.platform.security.authorization.service.AdminAuthorizationPolicyProvider;
import com.metamatrix.platform.security.authorization.service.AuthorizationServiceImpl;
import com.metamatrix.platform.security.membership.service.MembershipServiceImpl;
import com.metamatrix.platform.security.session.service.SessionServiceImpl;
@@ -93,6 +95,7 @@
bind(DQPContextCache.class).in(Scopes.SINGLETON);
bind(DQPCore.class).in(Scopes.SINGLETON);
+ bind(new TypeLiteral<Collection<AuthorizationPolicy>>(){}).annotatedWith(Names.named("AdminRoles")).toProvider(AdminAuthorizationPolicyProvider.class).in(Scopes.SINGLETON); //$NON-NLS-1$
configureServices();
Added: trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AdminAuthorizationPolicyProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AdminAuthorizationPolicyProvider.java (rev 0)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AdminAuthorizationPolicyProvider.java 2009-07-06 21:17:43 UTC (rev 1095)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package com.metamatrix.platform.security.authorization.service;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Properties;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import com.google.inject.name.Named;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.protocol.URLHelper;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.service.AuthorizationService;
+import com.metamatrix.platform.security.api.AuthorizationPolicy;
+import com.metamatrix.platform.security.api.AuthorizationPolicyFactory;
+
+@Singleton
+public class AdminAuthorizationPolicyProvider implements Provider<Collection<AuthorizationPolicy>> {
+
+ @Inject @Named("DQPProperties")
+ Properties props;
+
+ @Inject @Named("BootstrapURL")
+ private URL dqpURL;
+
+ @Override
+ public Collection<AuthorizationPolicy> get() {
+ String fileName = this.props.getProperty(AuthorizationService.ADMIN_ROLES_FILE);
+
+ if (fileName != null) {
+ try {
+ URL url = URLHelper.buildURL(this.dqpURL, fileName);
+ Properties roles = PropertiesUtils.loadFromURL(url);
+ return AuthorizationPolicyFactory.buildAdminPolicies(roles);
+ }catch(IOException e) {
+ LogManager.logError(LogConstants.CTX_AUTHORIZATION, e, DQPEmbeddedPlugin.Util.getString("failed_to_load_admin_roles")); //$NON-NLS-1$
+ }
+ }
+ else {
+ LogManager.logDetail(LogConstants.CTX_AUTHORIZATION, DQPEmbeddedPlugin.Util.getString("admin_roles_not_defined")); //$NON-NLS-1$
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+}
Property changes on: trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AdminAuthorizationPolicyProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-07-02 21:38:17 UTC (rev 1094)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-07-06 21:17:43 UTC (rev 1095)
@@ -40,6 +40,7 @@
import org.xml.sax.SAXException;
import com.google.inject.Inject;
+import com.google.inject.name.Named;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -100,11 +101,12 @@
protected MembershipServiceInterface membershipService;
protected VDBService vdbService;
protected LRUCache<VDBKey, Collection<AuthorizationPolicy>> policyCache = new LRUCache<VDBKey, Collection<AuthorizationPolicy>>();
- private Collection<AuthorizationPolicy> adminPolicies;
- // Permission factory is reusable and threadsafe
+ // Permission factory is reusable and thread safe
private static final BasicAuthorizationPermissionFactory PERMISSION_FACTORY = new BasicAuthorizationPermissionFactory();
+ Collection<AuthorizationPolicy> adminPolicies;
+
/*
* @see com.metamatrix.common.application.ApplicationService#initialize(java.util.Properties)
*/
@@ -263,8 +265,7 @@
}
}
- private boolean matchesPrincipal(Set<MetaMatrixPrincipalName> principals,
- AuthorizationPolicy policy) {
+ private boolean matchesPrincipal(Set<MetaMatrixPrincipalName> principals, AuthorizationPolicy policy) {
for (MetaMatrixPrincipalName principal : principals) {
if (policy.getPrincipals().contains(principal)) {
return true;
@@ -279,7 +280,7 @@
return true;
}
- Collection policies;
+ Collection<AuthorizationPolicy> policies;
try {
policies = getPoliciesForPrincipal(new MetaMatrixPrincipalName(session.getUsername(), MetaMatrixPrincipal.TYPE_USER), realm);
} catch (InvalidPrincipalException e) {
@@ -298,14 +299,11 @@
}
}
- for (Iterator i = policies.iterator(); i.hasNext();) {
- AuthorizationPolicy policy = (AuthorizationPolicy) i.next();
- if (applicablePolicies.contains(policy.getAuthorizationPolicyID()
- .getDisplayName())) {
+ for (AuthorizationPolicy policy:policies) {
+ if (applicablePolicies.contains(policy.getAuthorizationPolicyID().getDisplayName())) {
return true;
}
}
-
return false;
}
@@ -350,18 +348,14 @@
return result;
}
- if (realm.getSubRealmName() != null) {
- Collection<AuthorizationPolicy> policies = getPoliciesInRealm(realm);
- for (AuthorizationPolicy policy : policies) {
- if (matchesPrincipal(principals, policy)) {
- result.add(policy);
- continue;
- }
- }
- } else {
- //TODO: looking for admin roles
+ Collection<AuthorizationPolicy> policies = getPoliciesInRealm(realm);
+
+ for (AuthorizationPolicy policy : policies) {
+ if (matchesPrincipal(principals, policy)) {
+ result.add(policy);
+ continue;
+ }
}
-
return result;
}
@@ -370,35 +364,51 @@
Collection<AuthorizationPolicy> policies = null;
+ VDBKey key = null;
+
if (realm.getSubRealmName() != null) {
- VDBKey key = new VDBKey(realm.getSuperRealmName(), realm.getSubRealmName());
- synchronized (this.policyCache) {
- policies = this.policyCache.get(key);
- if (policies == null) {
- try {
- VDBArchive vdb = vdbService.getVDB(realm.getSuperRealmName(), realm.getSubRealmName());
- if (vdb.getDataRoles() == null) {
- policies = Collections.emptyList();
- }
- else {
- policies = AuthorizationPolicyFactory.buildPolicies(vdb.getName(), vdb.getVersion(), vdb.getDataRoles());
- }
- } catch (SAXException e) {
- throw new AuthorizationMgmtException(e);
- } catch (IOException e) {
- throw new AuthorizationMgmtException(e);
- } catch (ParserConfigurationException e) {
- throw new AuthorizationMgmtException(e);
- } catch (MetaMatrixComponentException e) {
- throw new AuthorizationMgmtException(e);
- }
- this.policyCache.put(key, policies);
+ // get data roles for the user
+ key = new VDBKey(realm.getSuperRealmName(), realm.getSubRealmName());
+ synchronized (this.policyCache) {
+ policies = this.policyCache.get(key);
+ if (policies == null ) {
+ policies = getDataPolicies(realm);
}
- }
- }
-
+ this.policyCache.put(key, policies);
+ }
+ }
+ else {
+ // get admin roles
+ policies = getAdminPolicies();
+ }
return policies;
}
+
+ private Collection<AuthorizationPolicy> getDataPolicies(AuthorizationRealm realm) throws AuthorizationMgmtException {
+ Collection<AuthorizationPolicy> policies = null;
+ try {
+ VDBArchive vdb = vdbService.getVDB(realm.getSuperRealmName(), realm.getSubRealmName());
+ if (vdb.getDataRoles() == null) {
+ policies = Collections.emptyList();
+ }
+ else {
+ policies = AuthorizationPolicyFactory.buildPolicies(vdb.getName(), vdb.getVersion(), vdb.getDataRoles());
+ }
+ } catch (SAXException e) {
+ throw new AuthorizationMgmtException(e);
+ } catch (IOException e) {
+ throw new AuthorizationMgmtException(e);
+ } catch (ParserConfigurationException e) {
+ throw new AuthorizationMgmtException(e);
+ } catch (MetaMatrixComponentException e) {
+ throw new AuthorizationMgmtException(e);
+ }
+ return policies;
+ }
+
+ private Collection<AuthorizationPolicy> getAdminPolicies() {
+ return adminPolicies;
+ }
public void updatePoliciesInRealm(AuthorizationRealm realm, Collection<AuthorizationPolicy> policies) throws AuthorizationMgmtException {
@@ -422,7 +432,8 @@
}
}
else {
- // update admin roles.
+ // there is no admin API way to update the Admin Roles.
+ this.adminPolicies = policies;
}
}
@@ -547,10 +558,10 @@
this.membershipService = membershipService;
}
-// @Inject
-// public void setAdminPolicies(Collection<AuthorizationPolicy> adminPolicies) {
-// this.adminPolicies = adminPolicies;
-// }
+ @Inject
+ public void setAdminPolicies(@Named("AdminRoles") Collection<AuthorizationPolicy> adminPolicies) {
+ this.adminPolicies = adminPolicies;
+ }
public void setUseEntitlements(boolean useEntitlements) {
this.useEntitlements = useEntitlements;
Modified: trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties
===================================================================
--- trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-07-02 21:38:17 UTC (rev 1094)
+++ trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-07-06 21:17:43 UTC (rev 1095)
@@ -207,4 +207,7 @@
ServerSecurityAdminImpl.vdbName_can_not_be_null=Supplied VDB name is null
ServerSecurityAdminImpl.vdbVersion_can_not_be_null=Supplied VDB version is null
ServerSecurityAdminImpl.no_vdb_exists=No VDB with name {0}.{1} deployed in the system.
-ServerSecurityAdminImpl.not_implemented=This feature not available.
\ No newline at end of file
+ServerSecurityAdminImpl.not_implemented=This feature not available.
+
+failed_to_load_admin_roles=Failed to load Admin role permissions
+admin_roles_not_defined=Admin Role permissions are not defined. Refer to admin-roles.properties file
\ No newline at end of file
Modified: trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java 2009-07-02 21:38:17 UTC (rev 1094)
+++ trunk/embedded/src/test/java/com/metamatrix/platform/security/api/TestAuthorizationPolicyFactory.java 2009-07-06 21:17:43 UTC (rev 1095)
@@ -33,6 +33,8 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
+import java.util.Set;
import junit.framework.TestCase;
@@ -89,10 +91,10 @@
//add doc to test against
char[] result = AuthorizationPolicyFactory.exportPolicies(policies);
- String expected = FileUtil.read(new FileReader(UnitTestUtil.getTestDataPath()+File.separator+"permissions.xml"));
- String actual = new String(result).replaceAll("\r\n", "\n");
+ String expected = FileUtil.read(new FileReader(UnitTestUtil.getTestDataPath()+File.separator+"permissions.xml")); //$NON-NLS-1$
+ String actual = new String(result).replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(expected, actual); //$NON-NLS-1$
+ assertEquals(expected, actual);
}
public void testImport() throws Exception {
@@ -119,9 +121,9 @@
}
char[] result = AuthorizationPolicyFactory.exportPolicies(roles);
- String expected = FileUtil.read(new FileReader(UnitTestUtil.getTestDataPath() + "/permissions2.xml"));
- String actual = new String(result).replaceAll("\r\n", "\n");
- assertEquals(expected, actual); //$NON-NLS-1$
+ String expected = FileUtil.read(new FileReader(UnitTestUtil.getTestDataPath() + "/permissions2.xml")); //$NON-NLS-1$
+ String actual = new String(result).replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(expected, actual);
}
public void testParsingFails() throws Exception {
@@ -135,4 +137,27 @@
}
+ public void testAdminRoles() {
+ Properties p = new Properties();
+ p.setProperty("Admin.SystemAdmin", "GroupA, GroupB"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("Admin.ProductAdmin", "GroupB"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("Admin.ReadOnlyAdmin", "");//$NON-NLS-1$ //$NON-NLS-2$
+
+ Collection<AuthorizationPolicy> policies = AuthorizationPolicyFactory.buildAdminPolicies(p);
+
+ assertEquals(3, policies.size());
+
+ for (AuthorizationPolicy policy: policies) {
+ if (policy.getAuthorizationPolicyID().getName().equalsIgnoreCase("Admin.SystemAdmin")) { //$NON-NLS-1$
+ Set<MetaMatrixPrincipalName> principals = policy.getPrincipals();
+ assertEquals(2, principals.size());
+ }
+ else if (policy.getAuthorizationPolicyID().getName().equalsIgnoreCase("Admin.ProductAdmin")) { //$NON-NLS-1$
+ Set<MetaMatrixPrincipalName> principals = policy.getPrincipals();
+ assertEquals(1, principals.size());
+ assertEquals(new MetaMatrixPrincipalName("GroupB", MetaMatrixPrincipal.TYPE_GROUP), principals.iterator().next()); //$NON-NLS-1$
+ }
+ }
+ }
+
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-07-02 21:38:17 UTC (rev 1094)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-07-06 21:17:43 UTC (rev 1095)
@@ -58,6 +58,7 @@
public static final String DEFAULT_WSDL_USERNAME = CoreConstants.DEFAULT_ANON_USERNAME;
public static final String ENTITELEMENTS_ENABLED = "entitlements.enabled"; //$NON-NLS-1$
+ public static final String ADMIN_ROLES_FILE = "entitlements.adminRolesFile"; //$NON-NLS-1$
/**
* Determine which of a set of resources a connection does not have permission to
15 years, 5 months
teiid SVN: r1094 - in trunk: embedded/src/main/java/com/metamatrix/dqp/embedded/services and 8 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-02 17:38:17 -0400 (Thu, 02 Jul 2009)
New Revision: 1094
Added:
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionListener.java
Removed:
trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java
trunk/embedded/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java
trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java
trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
Log:
TEIID-703, TEIID-666
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -30,7 +30,6 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
@@ -55,7 +54,7 @@
import com.metamatrix.admin.objects.MMSystem;
import com.metamatrix.admin.objects.MMVDB;
import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.api.exception.security.SessionServiceException;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ComponentTypeDefn;
import com.metamatrix.common.config.api.ConnectorBinding;
@@ -72,8 +71,10 @@
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
import com.metamatrix.platform.security.api.SessionToken;
import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
import com.metamatrix.platform.util.ProductInfoConstants;
import com.metamatrix.server.serverapi.RequestInfo;
@@ -168,6 +169,10 @@
ConfigurationService getConfigurationService() {
return (ConfigurationService)getManager().findService(DQPServiceNames.CONFIGURATION_SERVICE);
}
+
+ SessionServiceInterface getSessionService() {
+ return (SessionServiceInterface)getManager().findService(DQPServiceNames.SESSION_SERVICE);
+ }
protected Object convertToAdminObjects(Object src) {
return convertToAdminObjects(src,null);
@@ -243,8 +248,8 @@
com.metamatrix.common.queue.WorkerPoolStats stats = (com.metamatrix.common.queue.WorkerPoolStats)src;
return Util.convertStats(stats, stats.getQueueName());
}
- else if (src != null && src instanceof DQPWorkContext) {
- DQPWorkContext conn = (DQPWorkContext)src;
+ else if (src != null && src instanceof MetaMatrixSessionInfo) {
+ MetaMatrixSessionInfo conn = (MetaMatrixSessionInfo)src;
return convertConnection(conn);
}
else if (src != null && src instanceof com.metamatrix.common.config.api.ExtensionModule) {
@@ -273,14 +278,16 @@
return module;
}
- private Session convertConnection(DQPWorkContext src) {
- MMSession session = new MMSession(new String[] {src.getSessionId().toString()});
- session.setVDBName(src.getVdbName());
- session.setVDBVersion(src.getVdbVersion());
- session.setApplicationName(src.getAppName());
- session.setIPAddress(src.getClientAddress());
+ private Session convertConnection(MetaMatrixSessionInfo src) {
+ MMSession session = new MMSession(new String[] {src.getSessionID().toString()});
+ session.setVDBName(src.getProductInfo(ProductInfoConstants.VIRTUAL_DB));
+ session.setVDBVersion(src.getProductInfo(ProductInfoConstants.VDB_VERSION));
+ session.setApplicationName(src.getApplicationName());
+ session.setIPAddress(src.getClientIp());
session.setHostName(src.getClientHostname());
session.setUserName(src.getUserName());
+ session.setLastPingTime(src.getLastPingTime());
+ session.setCreated(new Date(src.getTimeCreated()));
return session;
}
@@ -445,11 +452,11 @@
* @return
* @since 4.3
*/
- DQPWorkContext getClientConnection(String identifier) {
- Collection<DQPWorkContext> connections = getConfigurationService().getClientConnections();
- for (DQPWorkContext context:connections) {
- if (context.getSessionId().toString().equals(identifier)) {
- return context;
+ MetaMatrixSessionInfo getClientConnection(String identifier) throws AdminException {
+ Collection<MetaMatrixSessionInfo> sessions = getClientConnections();
+ for (MetaMatrixSessionInfo info:sessions) {
+ if (info.getSessionID().toString().equals(identifier)) {
+ return info;
}
}
return null;
@@ -460,8 +467,13 @@
* @return
* @throws AdminException
*/
- Set<DQPWorkContext> getClientConnections() {
- return getConfigurationService().getClientConnections();
+ Collection<MetaMatrixSessionInfo> getClientConnections() throws AdminException {
+ try {
+ return getSessionService().getActiveSessions();
+ } catch (SessionServiceException e) {
+ // SessionServiceException not in the client known exception (in common-internal)
+ throw new AdminComponentException(e.getMessage(), e.getCause());
+ }
}
boolean matches(String regEx, String value) {
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -25,7 +25,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Set;
import javax.transaction.xa.Xid;
@@ -38,18 +37,17 @@
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;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.message.AtomicRequestID;
import com.metamatrix.dqp.message.RequestID;
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
/**
@@ -209,20 +207,20 @@
public void terminateSession(String identifier)
throws AdminException {
- Set<DQPWorkContext> connections = getClientConnections();
- ArrayList<DQPWorkContext> matchedConnections = new ArrayList<DQPWorkContext>();
+ Collection<MetaMatrixSessionInfo> sessions = getClientConnections();
+ ArrayList<MetaMatrixSessionInfo> matchedConnections = new ArrayList<MetaMatrixSessionInfo>();
- for (DQPWorkContext clientConnection:connections) {
- String id = clientConnection.getSessionId().toString();
+ for (MetaMatrixSessionInfo info:sessions) {
+ String id = info.getSessionID().toString();
if (matches(identifier, id)) {
- matchedConnections.add(clientConnection);
+ matchedConnections.add(info);
}
}
// Double iteration because to avoid concurrent modification of underlying map.
- for (DQPWorkContext clientConnection: matchedConnections) {
+ for (MetaMatrixSessionInfo info: matchedConnections) {
try {
- this.manager.getDQP().terminateConnection(clientConnection.getSessionId().toString());
+ this.manager.getDQP().terminateConnection(info.getSessionID().toString());
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
}
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -30,19 +30,16 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.StringTokenizer;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.SessionServiceException;
import com.metamatrix.common.application.AbstractClassLoaderManager;
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
@@ -74,9 +71,13 @@
import com.metamatrix.dqp.embedded.configuration.VDBConfigurationWriter;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.ConnectorBindingLifeCycleListener;
-import com.metamatrix.dqp.service.ServerConnectionListener;
+import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.VDBLifeCycleListener;
import com.metamatrix.dqp.util.LogConstants;
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
+import com.metamatrix.platform.security.api.service.SessionListener;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+import com.metamatrix.platform.util.ProductInfoConstants;
import com.metamatrix.query.function.FunctionLibraryManager;
import com.metamatrix.query.function.UDFSource;
import com.metamatrix.vdb.runtime.BasicModelInfo;
@@ -109,11 +110,9 @@
// load time constructs
private Map<String, URL> availableVDBFiles = new HashMap<String, URL>();
ConfigurationModelContainer configurationModel;
- private Map<String, Integer> inuseVDBs = new HashMap<String, Integer>();
private ArrayList<VDBLifeCycleListener> vdbLifeCycleListeners = new ArrayList<VDBLifeCycleListener>();
private ArrayList<ConnectorBindingLifeCycleListener> connectorBindingLifeCycleListeners = new ArrayList<ConnectorBindingLifeCycleListener>();
private UDFSource udfSource;
- private HashSet<DQPWorkContext> clientConnections = new HashSet<DQPWorkContext>();
private AbstractClassLoaderManager classLoaderManager = new AbstractClassLoaderManager(Thread.currentThread().getContextClassLoader(), true, true) {
@@ -329,7 +328,7 @@
public void saveVDB(VDBArchive srcVdb, String version) throws MetaMatrixComponentException{
// if the vdb version being saved is DELETED then if nobody using it
- if (srcVdb.getStatus() == VDBStatus.DELETED && canDeleteVDB(srcVdb)) {
+ if (srcVdb.getStatus() == VDBStatus.DELETED && canDeleteVDB(srcVdb.getName(), srcVdb.getVersion())) {
deleteVDB(srcVdb);
return;
}
@@ -1231,75 +1230,45 @@
}
/**
- * @see com.metamatrix.dqp.service.ConfigurationService#getConnectionListener()
+ * @see com.metamatrix.dqp.service.ConfigurationService#getSessionListener()
* @since 4.3.2
*/
- public ServerConnectionListener getConnectionListener() {
- return new ServerConnectionListener() {
+ public SessionListener getSessionListener() {
+ return new SessionListener() {
/**
* A Client Connection to DQP has been added
*/
- public void connectionAdded(DQPWorkContext connection) {
- // Add to parent's collection
- clientConnections.add(connection);
-
- String key = vdbId(connection.getVdbName(), connection.getVdbVersion());
-
- DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connectionAdded", new Object[] {connection.getVdbName(), connection.getVdbVersion(), connection.getSessionId()}); //$NON-NLS-1$
-
- Integer useCount = inuseVDBs.get(key);
- if (useCount == null) {
- inuseVDBs.put(key, new Integer(1));
- }
- else {
- inuseVDBs.put(key, new Integer(useCount.intValue()+1));
- }
+ public void sessionCreated(MetaMatrixSessionInfo connection) {
}
/**
* A Client Connection to DQP has been removed
*/
- public void connectionRemoved(DQPWorkContext connection) {
- // remove from the collection
- clientConnections.remove(connection);
+ public void sessionClosed(MetaMatrixSessionInfo session) {
- String key = vdbId(connection.getVdbName(), connection.getVdbVersion());
-
- DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connectionRemoved", new Object[] {connection.getVdbName(), connection.getVdbVersion(), connection.getSessionId()}); //$NON-NLS-1$
-
- Integer useCount = inuseVDBs.get(key);
- if (useCount == null) {
- // not sure how this got in here..
- }
- else {
- // after decrementing if use count comes to zero we can
- // see if there are any VDBs to delete
- if ((useCount.intValue()-1) == 0) {
- runVDBCleanUp(connection.getVdbName(), connection.getVdbVersion());
- inuseVDBs.remove(key);
- }
- else {
- // if there more users on this vdb then just decrement the counter.
- inuseVDBs.put(key, new Integer((useCount.intValue()-1)));
- }
- }
+ String vdbName = session.getProductInfo(ProductInfoConstants.VIRTUAL_DB);
+ String vdbVersion = session.getProductInfo(ProductInfoConstants.VDB_VERSION);
+ if (canDeleteVDB(vdbName, vdbVersion)) {
+ runVDBCleanUp(vdbName, vdbVersion);
+ }
}
};
}
- @Override
- public Set<DQPWorkContext> getClientConnections() {
- return new HashSet<DQPWorkContext>(clientConnections);
- }
-
/**
* Can the given VDB be deleted
* @param vdb
* @return true vdb can be deleted; false otherwise
*/
- boolean canDeleteVDB(VDBArchive vdb) {
- Integer useCount = inuseVDBs.get(vdbId(vdb));
- return (useCount == null || useCount.intValue() == 0);
+ private boolean canDeleteVDB(String vdbName, String vdbVersion) {
+ try {
+ SessionServiceInterface ssi = (SessionServiceInterface)lookupService(DQPServiceNames.SESSION_SERVICE);
+ Collection<MetaMatrixSessionInfo> active = ssi.getSessionsLoggedInToVDB(vdbName, vdbVersion);
+ return active.isEmpty();
+ } catch (SessionServiceException e) {
+ LogManager.logError(LogConstants.CTX_DQP, e, e.getMessage());
+ }
+ return false;
}
/**
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -32,12 +32,10 @@
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.ArrayList;
import java.util.Date;
import java.util.Properties;
import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.transport.AdminAuthorizationInterceptor;
@@ -75,11 +73,9 @@
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.vm.controller.ProcessStatistics;
import com.metamatrix.platform.vm.controller.SocketListenerStats;
@@ -158,6 +154,9 @@
// used during VDB delete
ConfigurationService configService = (ConfigurationService)findService(DQPServiceNames.CONFIGURATION_SERVICE);
+ SessionServiceInterface sessionService = (SessionServiceInterface)this.dqp.getEnvironment().findService(DQPServiceNames.SESSION_SERVICE);
+ sessionService.register(configService.getSessionListener());
+
//in new class loader - all of these should be created lazily and held locally
this.clientServices = createClientServices(configService);
@@ -180,7 +179,7 @@
ClientServiceRegistry services = new ClientServiceRegistry();
SessionServiceInterface sessionService = (SessionServiceInterface)this.dqp.getEnvironment().findService(DQPServiceNames.SESSION_SERVICE);
- services.registerClientService(ILogon.class, new LogonImpl(sessionService, configService.getClusterName(), configService.getConnectionListener()), com.metamatrix.common.util.LogConstants.CTX_SERVER);
+ services.registerClientService(ILogon.class, new LogonImpl(sessionService, configService.getClusterName()), com.metamatrix.common.util.LogConstants.CTX_SERVER);
Admin roleCheckedServerAdmin = wrapAdminService(Admin.class, getAdminAPI());
services.registerClientService(Admin.class, roleCheckedServerAdmin, com.metamatrix.common.util.LogConstants.CTX_ADMIN);
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -36,7 +36,6 @@
import org.teiid.dqp.internal.process.DQPCore;
import com.google.inject.Inject;
-import com.google.inject.name.Named;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -51,7 +50,6 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.core.util.ArgCheck;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.metadata.runtime.exception.VirtualDatabaseDoesNotExistException;
import com.metamatrix.metadata.runtime.exception.VirtualDatabaseException;
@@ -63,6 +61,7 @@
import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
import com.metamatrix.platform.security.api.service.AuthenticationToken;
import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
+import com.metamatrix.platform.security.api.service.SessionListener;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
import com.metamatrix.platform.util.ErrorMessageKeys;
import com.metamatrix.platform.util.LogMessageKeys;
@@ -89,6 +88,7 @@
private Map<MetaMatrixSessionID, MetaMatrixSessionInfo> sessionCache = new HashMap<MetaMatrixSessionID, MetaMatrixSessionInfo>();
private Timer sessionMonitor;
private AtomicLong idSequence = new AtomicLong();
+ private SessionListener sessionListener;
// -----------------------------------------------------------------------------------
// S E R V I C E - R E L A T E D M E T H O D S
@@ -126,6 +126,9 @@
LogManager.logWarning(LogConstants.CTX_SESSION,e,"Exception terminitating session"); //$NON-NLS-1$
}
}
+ if (this.sessionListener != null) {
+ this.sessionListener.sessionClosed(info);
+ }
}
@Override
@@ -188,6 +191,9 @@
properties.getProperty(MMURL.CONNECTION.CLIENT_HOSTNAME));
newSession.setTrustedToken(trustedToken);
this.sessionCache.put(newSession.getSessionID(), newSession);
+ if (this.sessionListener != null) {
+ this.sessionListener.sessionCreated(newSession);
+ }
return newSession;
}
@@ -356,4 +362,9 @@
return vdbService;
}
+ @Override
+ public void register(SessionListener listener) {
+ this.sessionListener = listener;
+ }
+
}
Modified: trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -41,7 +41,6 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.dqp.client.ResultsFuture;
-import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.jdbc.api.ConnectionProperties;
import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.Credentials;
@@ -57,12 +56,10 @@
private SessionServiceInterface service;
private String clusterName;
- private ServerConnectionListener connListener;
- public LogonImpl(SessionServiceInterface service, String clusterName, ServerConnectionListener connListener) {
+ public LogonImpl(SessionServiceInterface service, String clusterName) {
this.service = service;
this.clusterName = clusterName;
- this.connListener = connListener;
}
public LogonResult logon(Properties connProps) throws LogonException,
@@ -87,7 +84,6 @@
try {
MetaMatrixSessionInfo sessionInfo = service.createSession(user,credential, (Serializable) payload, applicationName, connProps);
MetaMatrixSessionID sessionID = updateDQPContext(sessionInfo);
- this.connListener.connectionAdded(DQPWorkContext.getWorkContext());
LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {"Logon successful for \"", user, "\" - created SessionID \"", "" + sessionID, "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
return new LogonResult(sessionInfo.getSessionToken(), sessionInfo.getProductInfo(), clusterName);
} catch (MetaMatrixAuthenticationException e) {
@@ -150,7 +146,6 @@
public ResultsFuture<?> logoff() throws InvalidSessionException, MetaMatrixComponentException {
try {
this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
- this.connListener.connectionRemoved(DQPWorkContext.getWorkContext());
} catch (SessionServiceException e) {
throw new MetaMatrixComponentException(e);
}
Modified: trunk/embedded/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -10,6 +10,7 @@
import com.metamatrix.platform.security.api.MetaMatrixSessionID;
import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
+import com.metamatrix.platform.security.api.service.SessionListener;
import com.metamatrix.platform.security.api.service.SuccessfulAuthenticationToken;
public class TestSessionServiceImpl extends TestCase {
@@ -19,6 +20,8 @@
MembershipServiceInterface msi = Mockito.mock(MembershipServiceInterface.class);
Mockito.stub(msi.authenticateUser("steve", null, null, "foo")).toReturn(new SuccessfulAuthenticationToken(null, "steve@somedomain")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ssi.setMembershipService(msi);
+ SessionListener listener = Mockito.mock(SessionListener.class);
+ ssi.register(listener);
MetaMatrixSessionID id1 = new MetaMatrixSessionID(1);
try {
@@ -34,6 +37,7 @@
assertEquals(1, ssi.getActiveSessionsCount());
assertEquals(0, ssi.getSessionsLoggedInToVDB("a", "1").size()); //$NON-NLS-1$ //$NON-NLS-2$
+ Mockito.verify(listener, Mockito.times(1)).sessionCreated(info);
ssi.closeSession(id1);
@@ -50,6 +54,7 @@
} catch (InvalidSessionException e) {
}
+ Mockito.verify(listener, Mockito.times(1)).sessionClosed(info);
}
}
Modified: trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -35,8 +35,6 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.teiid.transport.LogonImpl;
-import org.teiid.transport.SocketListener;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.security.LogonException;
@@ -49,7 +47,6 @@
import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
import com.metamatrix.common.comm.platform.socket.client.UrlServerDiscovery;
import com.metamatrix.common.util.crypto.NullCryptor;
-import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
@@ -74,7 +71,7 @@
@Test public void testFailedConnect() throws Exception {
ClientServiceRegistry csr = new ClientServiceRegistry();
SessionServiceInterface sessionService = mock(SessionServiceInterface.class);
- csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster", mock(ServerConnectionListener.class)), "foo"); //$NON-NLS-1$ //$NON-NLS-2$
+ csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster"), "foo"); //$NON-NLS-1$ //$NON-NLS-2$
listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
csr, 1024, 1024, 1, null, true, sessionService);
@@ -145,7 +142,7 @@
if (listener == null) {
SessionServiceInterface sessionService = mock(SessionServiceInterface.class);
ClientServiceRegistry csr = new ClientServiceRegistry();
- csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster", mock(ServerConnectionListener.class)) { //$NON-NLS-1$
+ csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster") { //$NON-NLS-1$
@Override
public LogonResult logon(Properties connProps)
throws LogonException, ComponentNotFoundException {
Modified: trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java
===================================================================
--- trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -23,18 +23,14 @@
package org.teiid.transport;
-import static org.mockito.Mockito.mock;
-
import java.util.Properties;
import junit.framework.TestCase;
import org.mockito.Mockito;
-import org.teiid.dqp.internal.process.DQPWorkContext;
import com.metamatrix.api.exception.security.LogonException;
import com.metamatrix.common.api.MMURL;
-import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.platform.security.api.LogonResult;
import com.metamatrix.platform.security.api.MetaMatrixSessionID;
import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
@@ -59,22 +55,16 @@
Mockito.stub(ssi.createSession(userName, null, null, applicationName,
p)).toReturn(resultInfo);
- ServerConnectionListener listener = mock(ServerConnectionListener.class);
- LogonImpl impl = new LogonImpl(ssi, "fakeCluster", listener); //$NON-NLS-1$
+ LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
LogonResult result = impl.logon(p);
assertEquals(userName, result.getUserName());
assertEquals(new MetaMatrixSessionID(1), result.getSessionID());
- Mockito.verify(listener, Mockito.times(1)).connectionAdded((DQPWorkContext)Mockito.anyObject());
- Mockito.verify(listener, Mockito.times(0)).connectionRemoved((DQPWorkContext)Mockito.anyObject());
-
- impl.logoff();
- Mockito.verify(listener, Mockito.times(1)).connectionRemoved((DQPWorkContext)Mockito.anyObject());
}
public void testCredentials() throws Exception {
SessionServiceInterface ssi = Mockito.mock(SessionServiceInterface.class);
- LogonImpl impl = new LogonImpl(ssi, "fakeCluster", mock(ServerConnectionListener.class)); //$NON-NLS-1$
+ LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
Properties p = new Properties();
p.put(MMURL.CONNECTION.CLIENT_TOKEN_PROP, new Object());
//invalid credentials
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -26,10 +26,7 @@
import java.net.URL;
import java.util.List;
import java.util.Properties;
-import java.util.Set;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.ClassLoaderManager;
@@ -39,6 +36,7 @@
import com.metamatrix.common.config.api.ConnectorBindingType;
import com.metamatrix.common.config.api.ExtensionModule;
import com.metamatrix.common.vdb.api.VDBArchive;
+import com.metamatrix.platform.security.api.service.SessionListener;
@@ -286,7 +284,7 @@
* @throws MetaMatrixComponentException
* @since 4.3.2
*/
- public ServerConnectionListener getConnectionListener();
+ public SessionListener getSessionListener();
/**
@@ -368,12 +366,6 @@
/**
- * This returns the active client connections that have been made to the DQP
- * @return list of connections which are currently available;never null
- */
- public Set<DQPWorkContext> getClientConnections();
-
- /**
* Gets the processor batch size
* @return
* @since 4.3
Deleted: trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.service;
-
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-
-
-/**
- * An implementor of this interface, when registered with the ServerConnection will
- * receive notifications about the connection life cycle events.
- */
-public interface ServerConnectionListener {
- /**
- * A connection has been added to DQP
- * @param connection The client connection instance, never null
- */
- void connectionAdded(DQPWorkContext context);
-
- /**
- * A connection has been removed for DQP
- * @param connection The client connection instance, never null
- */
- void connectionRemoved(DQPWorkContext context);
-
-}
Added: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionListener.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionListener.java (rev 0)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionListener.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.platform.security.api.service;
+
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
+
+public interface SessionListener {
+
+ void sessionCreated(MetaMatrixSessionInfo info);
+
+ void sessionClosed(MetaMatrixSessionInfo info);
+}
Property changes on: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-07-02 19:57:16 UTC (rev 1093)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -105,7 +105,7 @@
* @return The collection of MetaMatrixSessionInfo objects of active users on
* the system - possibly empty, never null.
*/
- Collection getActiveSessions() throws SessionServiceException;
+ Collection<MetaMatrixSessionInfo> getActiveSessions() throws SessionServiceException;
/**
* Get the number of active user sessions on the system.
@@ -142,7 +142,7 @@
* @param VDBVersion The version of the VDB.
* @throws SessionServiceException when transaction with database fails or unexpected exception happens
*/
- Collection getSessionsLoggedInToVDB(String VDBName, String VDBVersion)
+ Collection<MetaMatrixSessionInfo> getSessionsLoggedInToVDB(String VDBName, String VDBVersion)
throws SessionServiceException;
/**
@@ -152,4 +152,10 @@
*/
public void pingServer(MetaMatrixSessionID sessionID) throws InvalidSessionException;
+ /**
+ * Register a session listener
+ * @param listener
+ */
+ public void register(SessionListener listener);
+
}
Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-07-02 19:57:16 UTC (rev 1093)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-07-02 21:38:17 UTC (rev 1094)
@@ -243,7 +243,7 @@
* @throws ConfigurationException
*/
private void registerILogonAPI() throws ConfigurationException, ServiceException {
- this.clientServices.registerClientService(ILogon.class, new LogonImpl(PlatformProxyHelper.getSessionServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL), CurrentConfiguration.getInstance().getClusterName(), null), LogCommonConstants.CTX_LOGON);
+ this.clientServices.registerClientService(ILogon.class, new LogonImpl(PlatformProxyHelper.getSessionServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL), CurrentConfiguration.getInstance().getClusterName()), LogCommonConstants.CTX_LOGON);
}
/**
15 years, 5 months
teiid SVN: r1093 - in trunk: adminshell/src/main/java and 26 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-07-02 15:57:16 -0400 (Thu, 02 Jul 2009)
New Revision: 1093
Added:
trunk/adminshell/src/main/java/org/
trunk/adminshell/src/main/java/org/teiid/
trunk/adminshell/src/main/java/org/teiid/AdminShell.java
trunk/build/assembly/adminshell/
trunk/build/assembly/adminshell/adminshell-dependencies.xml
trunk/build/assembly/adminshell/adminshell-dist.xml
trunk/build/assembly/client-jar.xml
trunk/build/kit-adminshell/
trunk/build/kit-adminshell/COPYRIGHT.txt
trunk/build/kit-adminshell/LICENSE-lgpl-2.1.txt
trunk/build/kit-adminshell/adminshell.bat
trunk/build/kit-adminshell/adminshell.sh
trunk/build/kit-adminshell/connection.properties
trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java
Removed:
trunk/adminshell/src/main/java/com/metamatrix/script/shell/MMAdmin.java
trunk/adminshell/src/main/resources/scripts/dqp.bsh
trunk/adminshell/src/main/resources/scripts/dqpadmin.bsh
trunk/adminshell/src/main/resources/scripts/serveradmin.bsh
trunk/build/assembly/embedded/embedded-client-jar.xml
trunk/build/assembly/server/
trunk/build/kit-server/
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java
Modified:
trunk/adminshell/src/main/resources/commands/load.bsh
trunk/adminshell/src/main/resources/commands/printBanner.bsh
trunk/adminshell/src/main/resources/scripts/adminapi.bsh
trunk/adminshell/src/main/resources/scripts/server.bsh
trunk/adminshell/src/main/resources/scripts/util.bsh
trunk/build/kit-embedded/bin/run.bat
trunk/build/kit-embedded/bin/run.sh
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.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
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServiceRegistry.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java
trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java
trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java
trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
trunk/pom.xml
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
Log:
TEIID-698, TEIID-697: Adding the AdminShell kit to the build. Fixing the error with session reporting through Admin API. Making the session tracking common between embedded and server.
Deleted: trunk/adminshell/src/main/java/com/metamatrix/script/shell/MMAdmin.java
===================================================================
--- trunk/adminshell/src/main/java/com/metamatrix/script/shell/MMAdmin.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/java/com/metamatrix/script/shell/MMAdmin.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.script.shell;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintStream;
-
-import bsh.Capabilities;
-import bsh.EvalError;
-import bsh.Interpreter;
-
-
-/**
- * Invokes the BeanShell window, specifically designed for the metamatrix purposes.
- * The difference with this shell is, it will plug in a customer parser on top the
- * BeanShell, and load up all the MetaMatrix commands.
- */
-public class MMAdmin {
-
- public static void main( String args[] ) throws IOException {
-
- boolean gui = Boolean.getBoolean("gui"); //$NON-NLS-1$
- System.setProperty("metamatrix.config.none", "true"); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (args.length == 0) {
- if ( !Capabilities.classExists( "bsh.util.Util" ) ) //$NON-NLS-1$
- System.out.println("Can't find the BeanShell utilities..."); //$NON-NLS-1$
-
- FileWriter logger = new FileWriter("adminscript.txt", true); //$NON-NLS-1$
- PrintStream out = new FilePrintStream(System.out, "mmadmin.log"); //$NON-NLS-1$
-
- try {
- SimpleParser p = new SimpleParser();
- Interpreter interpreter = new Interpreter(new ReaderInterceptor(p, logger), out, out, true);
- interpreter.eval("importCommands(\"commands\")"); //$NON-NLS-1$
- interpreter.eval("load(\"server\")"); //$NON-NLS-1$
-
- p.setInterpreter(interpreter);
-
- if (Capabilities.haveSwing() && gui) {
- //bsh.util.Util.startSplashScreen();
- interpreter.eval("desktop()"); //$NON-NLS-1$
- interpreter.getOut().flush();
- } else {
- interpreter.run();
- }
- } catch ( EvalError e ) {
- System.err.println("Couldn't start desktop: "+e); //$NON-NLS-1$
- } finally {
- logger.close();
- out.close();
- }
- }
- else {
- // If we running a script file run as it is
- Interpreter.main(args);
- }
- }
-
-}
Copied: trunk/adminshell/src/main/java/org/teiid/AdminShell.java (from rev 1089, trunk/adminshell/src/main/java/com/metamatrix/script/shell/MMAdmin.java)
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/AdminShell.java (rev 0)
+++ trunk/adminshell/src/main/java/org/teiid/AdminShell.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import bsh.Capabilities;
+import bsh.EvalError;
+import bsh.Interpreter;
+
+import com.metamatrix.script.shell.FilePrintStream;
+import com.metamatrix.script.shell.ReaderInterceptor;
+import com.metamatrix.script.shell.SimpleParser;
+
+
+/**
+ * Invokes the BeanShell window, specifically designed for the metamatrix purposes.
+ * The difference with this shell is, it will plug in a customer parser on top the
+ * BeanShell, and load up all the MetaMatrix commands.
+ */
+public class AdminShell {
+
+ public static void main( String args[] ) throws IOException {
+
+ boolean gui = Boolean.getBoolean("gui"); //$NON-NLS-1$
+
+ if (args.length == 0) {
+ if ( !Capabilities.classExists( "bsh.util.Util" ) ) //$NON-NLS-1$
+ System.out.println("Can't find the BeanShell utilities..."); //$NON-NLS-1$
+
+ String teiidHome = System.getenv("TEIID_HOME"); //$NON-NLS-1$
+ if (teiidHome == null) {
+ teiidHome = System.getProperty("user.dir"); //$NON-NLS-1$
+ }
+ File logDir = new File(teiidHome, "log"); //$NON-NLS-1$
+ if (!logDir.exists()) {
+ logDir.mkdirs();
+ }
+
+ FileWriter logger = new FileWriter(teiidHome+"/log/adminscript.txt", true); //$NON-NLS-1$
+ PrintStream out = new FilePrintStream(System.out, teiidHome+"/log/adminshell.log"); //$NON-NLS-1$
+
+ try {
+ SimpleParser p = new SimpleParser();
+ Interpreter interpreter = new Interpreter(new ReaderInterceptor(p, logger), out, out, true);
+ interpreter.eval("importCommands(\"commands\")"); //$NON-NLS-1$
+ interpreter.eval("load(\"server\")"); //$NON-NLS-1$
+
+ p.setInterpreter(interpreter);
+
+ if (Capabilities.haveSwing() && gui) {
+ //bsh.util.Util.startSplashScreen();
+ interpreter.eval("desktop()"); //$NON-NLS-1$
+ interpreter.getOut().flush();
+ } else {
+ interpreter.run();
+ }
+ } catch ( EvalError e ) {
+ System.err.println("Couldn't start desktop: "+e); //$NON-NLS-1$
+ } finally {
+ logger.close();
+ out.close();
+ }
+ }
+ else {
+ // If we running a script file run as it is
+ Interpreter.main(args);
+ }
+ }
+
+}
Modified: trunk/adminshell/src/main/resources/commands/load.bsh
===================================================================
--- trunk/adminshell/src/main/resources/commands/load.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/commands/load.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -12,17 +12,7 @@
sourceInto( getResource("/scripts/context.bsh"), this.caller.namespace );
sourceInto( getResource("/scripts/assert.bsh"), this.caller.namespace );
sourceInto( getResource("/scripts/util.bsh"), this.caller.namespace );
-
- // DQP and server modules
- if (module.equalsIgnoreCase("dqp")) {
- //print("loading module: dqp...");
- sourceInto( getResource("/scripts/dqp.bsh"), this.caller.namespace );
- } else if (module.equalsIgnoreCase("server")) {
- //print("loading module: server...");
- sourceInto( getResource("/scripts/server.bsh"), this.caller.namespace );
- } else {
- print("unknown module: "+module);
- }
+ sourceInto( getResource("/scripts/server.bsh"), this.caller.namespace );
}
Modified: trunk/adminshell/src/main/resources/commands/printBanner.bsh
===================================================================
--- trunk/adminshell/src/main/resources/commands/printBanner.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/commands/printBanner.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -24,12 +24,13 @@
jconsole.println();
} else {
- print("**********************************************************************");
- print(" You are running Admin Shell in interactive mode. To see all ");
- print(" the commands available type 'help();' or 'exit();' to exit the shell.");
- print(" Note: Every comand MUST end with semi-colon [;] and are ");
- print(" always in form 'command([param]*?);'");
- print("**********************************************************************");
+ print("======================================================================");
+ print(" You are running AdminShell in interactive mode. To see all ");
+ print(" the available commands type 'help();' or 'exit();' to exit the shell.");
+ print("\n");
+ print(" Tip: All comands MUST end with semi-colon [;] and are in the form");
+ print(" 'command([param]*?);' then followed by ENTER");
+ print("======================================================================");
print("\n\n");
}
}
Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,8 +1,4 @@
-import com.metamatrix.admin.api.core.*;
-import com.metamatrix.admin.api.objects.*;
-import com.metamatrix.admin.api.embedded.*;
-import com.metamatrix.admin.api.exception.*;
-import com.metamatrix.admin.objects.*;
+import org.teiid.adminapi.*;
import com.metamatrix.core.util.ObjectConverterUtil;
@@ -552,9 +548,9 @@
* The unique identifier for for an {@link AdminObject}.
* @param className
* The class name of the sub-interface of {@link AdminObject} you are setting the property for.
- * All of these sub-interfaces are in package <code>com.metamatrix.admin.api.objects</code>.
+ * All of these sub-interfaces are in package <code>org.teiid.adminapi</code>.
* You may specify either the fully-qualified or unqualified classname.
- * For example "ConnectorBinding" or "com.metamatrix.admin.api.objects.ConnectorBinding".
+ * For example "ConnectorBinding" or "org.teiid.adminapi.ConnectorBinding".
* @param propertyName
* String Property key
* @param propertyValue
@@ -576,9 +572,9 @@
* The unique identifier for for an {@link AdminObject}.
* @param className
* The class name of the sub-interface of {@link AdminObject} you are setting the property for.
- * All of these sub-interfaces are in package <code>com.metamatrix.admin.api.objects</code>.
+ * All of these sub-interfaces are in package <code>org.teiid.adminapi</code>.
* You may specify either the fully-qualified or unqualified classname.
- * For example "ConnectorBinding" or "com.metamatrix.admin.api.objects.ConnectorBinding".
+ * For example "ConnectorBinding" or "org.teiid.adminapi.ConnectorBinding".
* @param properties
* Properties to set.
* @throws AdminException
@@ -680,8 +676,28 @@
}
+/**
+ * Assign {@link ConnectorBinding}s to a {@link VDB}'s Model. If the supplied model does not
+ * support MultiSource bindings, then only the first binding in the supplied array is assigned and
+ * the remainder are ignored.
+ *
+ * @param connectorBindingNames
+ * Names of the ConnectorBindings
+ * @param vdbName
+ * Name of the VDB
+ * @param vdbVersion
+ * Version of the VDB
+ * @param modelName
+ * Name of the Model to map Connector Bindings
+ * @throws AdminException
+ * if there's a system error or if there's a user input error.
+ */
+void assignBindingsToModel(String[] connectorBindingNames, String vdbName, String vdbVersion, String modelName) {
+ debug("Assigning the bindings to model");
+ checkAdmin();
+ currentContext().internalAdmin.assignBindingsToModel(connectorBindingNames, vdbName, vdbVersion, modelName);
+}
-
// *********************************************************************************************
// Monitor Methods
//
@@ -937,6 +953,22 @@
return result;
}
+/**
+ * Get the processes that correspond to the specified identifier pattern.
+ *
+ * @param processIdentifier the unique identifier for for a {@link org.teiid.adminapi.ProcessObject ProcessObject}
+ * in the system or "{@link org.teiid.adminapi.AdminObject#DELIMITER DELIMITER}"
+ * if all Processes are desired.
+ * @return Collection of {@link org.teiid.adminapi.ProcessObject ProcessObject}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+Collection getProcesses(String processIdentifier) {
+ checkAdmin();
+ result =currentContext().internalAdmin.getProcesses(processIdentifier);
+ debug(result);
+ return result;
+}
@@ -949,7 +981,7 @@
/**
* Start Connector Binding
*
- * @param connectorBindingIdentifier identifier for {@link com.metamatrix.admin.api.objects.ConnectorBinding}
+ * @param connectorBindingIdentifier identifier for {@link org.teiid.adminapi.ConnectorBinding}
* <ul>
* <li> <code>"*"</code> - for all connector bindings in the system
* <li> <code>"name*"</code> - for all connector bindings that begin with given name
@@ -967,7 +999,7 @@
/**
* Stop Connector Binding
*
- * @param connectorBindingIdentifier identifier for {@link com.metamatrix.admin.api.objects.ConnectorBinding}
+ * @param connectorBindingIdentifier identifier for {@link org.teiid.adminapi.ConnectorBinding}
* <ul>
* <li> <code>"*"</code> - for all connector bindings in the system
* <li> <code>"name*"</code> - for all connector bindings that begin with given name
@@ -984,7 +1016,7 @@
/**
* Clear the cache or caches specified by the cacheIdentifier.
- * @param cacheIdentifier Cache name identifier {@link com.metamatrix.admin.api.objects.Cache}.
+ * @param cacheIdentifier Cache name identifier {@link org.teiid.adminapi.Cache}.
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
* @since 4.3
@@ -997,7 +1029,7 @@
/**
* Terminate the Session
*
- * @param identifier Session Idenitfier {@link com.metamatrix.admin.api.objects.Session}.
+ * @param identifier Session Idenitfier {@link org.teiid.adminapi.Session}.
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
* @since 4.3
@@ -1011,7 +1043,7 @@
/**
* Cancel Request
*
- * @param identifier The request identifer defined by {@link com.metamatrix.admin.api.objects.Request}
+ * @param identifier The request identifer defined by {@link org.teiid.adminapi.Request}
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
* @since 4.3
@@ -1025,7 +1057,7 @@
/**
* Cancel Source Request
*
- * @param identifier The request identifer defined by {@link com.metamatrix.admin.api.objects.Request}
+ * @param identifier The request identifer defined by {@link org.teiid.adminapi.Request}
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
* @since 4.3
@@ -1087,6 +1119,241 @@
}
/**
+ * Set the log listener to install into MM Query. This log listener will receive all log messages
+ * written by the MM Query at it's current log level and log contexts.
+ *
+ * @param listener The listener component
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+void setLogListener(EmbeddedLogger listener) {
+ checkAdmin();
+ currentContext().internalAdmin.setLogListener(listener);
+}
+
+/**
+ * Stop the MM Query. If millisToWait is >0, then close to incoming queries, wait the time period
+ * for work to stop, then stop the MM Query. Otherwise, stop immediately, aborting all running queries.
+ * the current connection will be disconnected.
+ * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
+ * @throws AdminException
+ * @since 4.3
+ */
+void shutdown(int millisToWait) {
+ checkAdmin();
+ currentContext().internalAdmin.shutdown(millisToWait);
+ disconnect();
+}
+
+/**
+ * Restart System; the current connection will be disconnected.
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+void restart() {
+ checkAdmin();
+ currentContext().internalAdmin.restart();
+ disconnect();
+}
+
+//*********************************************************************************************
+// Security Methods
+//
+//*********************************************************************************************
+
+/**
+ * Get the Collection of administrative role names possessed by the given group, if any.
+ *
+ * @param groupIdentifier
+ * The unique identifier for the {@link Group}. This is group name. A user is a {@link Principal} and a
+ * Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains.
+ * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
+ * @return The Collection of {@link Role}s.
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+Collection getRolesForGroup(String groupIdentifier) {
+ checkAdmin();
+ result = currentContext().internalAdmin.getRolesForGroup(groupIdentifier);
+ debug(result);
+ return result;
+}
+
+/**
+ * Get the group memberships for the given user.
+ *
+ * @param userIdentifier
+ * The unique identifier for the {@link User}. This is generally a user name. A user is a {@link Principal} and a
+ * Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains.
+ * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
+ * @return The collection of groups in which the given user has membership.
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+Collection getGroupsForUser(String userIdentifier) {
+ checkAdmin();
+ result = currentContext().internalAdmin.getGroupsForUser(userIdentifier);
+ debug(result);
+ return result;
+}
+
+/**
+ * Get the group denoted by the given <code>groupIdentifier</code>.
+ *
+ * @param groupIdentifier
+ * The unique identifier for the {@link Group}. This is generally a group name. A group is a {@link Principal} and
+ * a Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains. <br>
+ * Note that by supplying the {@link AdminObject#WILDCARD WILDCARD} identifier, all all users in the system will
+ * retrieved.</br>
+ * @return The Collection of users.
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+Collection getGroups(String groupIdentifier) {
+ checkAdmin();
+ result = currentContext().internalAdmin.getGroups(groupIdentifier);
+ debug(result);
+ return result;
+}
+
+/**
+ * Assign to the given {@link Group} the given Administrative Role.
+ *
+ * @param roleIdentifier
+ * one of {@link AdminRoles}.
+ * @param groupIdentifier
+ * the unique identifier for the Principal. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+void assignRoleToGroup(String roleIdentifier, String groupIdentifier) {
+ checkAdmin();
+ currentContext().internalAdmin.assignRoleToGroup(roleIdentifier, groupIdentifier);
+}
+
+/**
+ * Remove an administrative role from the given {@link Group}.
+ *
+ * @param roleIdentifier
+ * one of {@link AdminRoles}
+ * @param groupIdentifier
+ * the unique identifier for the Principal. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+void removeRoleFromGroup(String roleIdentifier, String groupIdentifier) {
+ checkAdmin();
+ currentContext().internalAdmin.removeRoleFromGroup(roleIdentifier, groupIdentifier);
+}
+
+
+/**
+ * Import the data Roles for given vdb and version into the connected server
+ * @param vdbName - target name of the VDB, the roles to be imported under
+ * @param vdbVersion - target version of the vdb, the roles to be imported under
+ * @param filename - character data array containing the XML file which defines the roles
+ * @param options - options to overwrite in case the matching roles already exist.
+ * @throws AdminException
+ */
+void importDataRoles(String vdbName, String vdbVersion, String filename, int options) {
+ checkAdmin();
+ currentContext().internalAdmin.importDataRoles(vdbName, vdbVersion, readTextFile(filename), new AdminOptions(options));
+}
+
+/**
+ * Import the data Roles for given vdb and version into the connected server
+ * @param vdbName - target name of the VDB, the roles to be imported under
+ * @param vdbVersion - target version of the vdb, the roles to be imported under
+ * @param filename - character data array containing the XML file which defines the roles
+ * @throws AdminException
+ */
+void importDataRoles(String vdbName, String vdbVersion, String filename) {
+ checkAdmin();
+ currentContext().internalAdmin.importDataRoles(vdbName, vdbVersion, readTextFile(filename), null);
+}
+
+
+/**
+ * Export the data roles defined for the given vdb fromthe current system
+ * @param vdbName - Name of the vdb
+ * @param vdbVersion - version of the vdb
+ * @param filename - name of the file to export the contents under.
+ * @return - char[] stream containing the XML contents of the roles.
+ * @throws AdminException
+ */
+void exportDataRoles(String vdbName, String vdbVersion, String fileName) {
+ checkAdmin();
+ contents = currentContext().internalAdmin.exportDataRoles(vdbName, vdbVersion);
+ if (contents != null) {
+ ObjectConverterUtil.write(contents, fileName);
+ }
+ else {
+ throw new AdminProcessingException("Data roles not found for VDB "+ vdbName + " with version "+ vdbVersion);
+ }
+}
+
+
+/**
+ * @param domainprovidername is the name to be assigned to the newly created {@link AuthenticationProvider}
+ * @param providertypename is the type of provider to create.
+ * There are 3 installed provider types and they are:
+ * <ul>
+ * <li> <code>File Membership Domain Provider</code>
+ * <li> <code>LDAP Membership Domain Provider</code>
+ * <li><code>Custom Membership Domain Provider</code>
+ * </ul>
+ * @param properties are the settings specified by the providertype to be used
+ * @throws AdminException
+ * if there's a system error.
+ * @since 5.5.2
+
+void addAuthorizationProvider(String domainprovidername, String providertypename, Properties properties) {
+ checkAdmin();
+ currentContext().internalAdmin.addAuthorizationProvider(domainprovidername, providertypename, properties);
+}
+ */
+
+/**
+ * Returns the active authorization provider domain names, in authentication order.
+ * @return List<String>
+ * @throws AdminException
+ */
+List getDomainNames() {
+ checkAdmin();
+ result = currentContext().internalAdmin.getDomainNames();
+ debug(result);
+ return result;
+}
+
+
+
+/**
+ * Return the {@link Group}s for a given domain. The domain name must be an specified
+ * exactly. See {@link #getActiveDomainNames()} for possible domain names.
+ * @param domainName
+ * @return
+ * @throws AdminException
+ */
+Collection getGroupsForDomain(String domainName){
+ checkAdmin();
+ result = currentContext().internalAdmin.getGroupsForDomain(domainName);
+ debug(result);
+ return result;
+}
+
+
+//*********************************************************************************************
+// Utility Methods
+//
+//*********************************************************************************************
+
+
+/**
* Checks to make sure the given VDB exists in the system
* @param vdbName - name of the VDB
* @return boolean - true if exists; false otherwise
Deleted: trunk/adminshell/src/main/resources/scripts/dqp.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/dqp.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/scripts/dqp.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,90 +0,0 @@
-/**
- * This is connection helper to a MetaMatrix DQP using JDBC
- */
-source(getResource("/scripts/jdbc.bsh"));
-source(getResource("/scripts/dqpadmin.bsh"));
-
-import java.sql.*;
-import java.io.*;
-import java.util.Properties;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-
-/**
- * Connect to DQP
- * @param vdbName - Name of the VDB to connect
- * @param propFile - Properties file
- */
-Connection connect(String vdbName, String propFile) throws SQLException {
- connectDQP(vdbName, propFile);
-}
-
-/**
- * Connect to a DQP.
- * @param url - complete dqp url
- */
-Connection connect(String url) throws SQLException {
- com.metamatrix.jdbc.api.Connection mmConn = connectDriver("com.metamatrix.jdbc.EmbeddedDriver", url);
- currentContext().internalAdmin = mmConn.getAdminAPI();
- currentContext().internalPrompt = "DQP:" + extractVDBName(url) + "$ ";
-
- return mmConn;
-}
-
-
-private Connection connectDQP(String vdbName, String vdbVersion, String configFile) throws SQLException {
- if(vdbName == null) {
- throw new SQLException("VDB name is null");
- }
- if(configFile == null) {
- throw new SQLException("DQP config file is null");
- }
-
- String url = "jdbc:metamatrix:" + vdbName + "@" + configFile;
- if(vdbVersion != null) {
- url += ";version=" + vdbVersion;
- }
-
- c = connect(url);
- currentContext().internalPrompt = "DQP:"+vdbName+"$ ";
- return c;
-}
-
-private Connection connectDQP(String vdbName, String configFile) throws SQLException {
- return connectDQP(vdbName, null, configFile);
-}
-
-/**
- * Disconnect the connection from the server
- */
-void disconnect() {
- closeConnection();
-}
-
-
-//help methods
-
-/**
- * List all of the methods currently available.
- */
-void help() {
- java.util.List urls = new ArrayList();
- urls.add(getResource("/scripts/adminapi.bsh"));
- urls.add(getResource("/scripts/dqpadmin.bsh"));
- urls.add(getResource("/scripts/dqp.bsh"));
- help(urls);
-}
-
-
-/**
- * List the javadoc for method(s) with the specified name.
- *
- * @param methodName
- * Name of the method for which to specify javadoc.
- */
-void help(String methodName) {
- java.util.List urls = new ArrayList();
- urls.add(getResource("/scripts/adminapi.bsh"));
- urls.add(getResource("/scripts/dqpadmin.bsh"));
- urls.add(getResource("/scripts/dqp.bsh"));
- help(urls, methodName);
-}
\ No newline at end of file
Deleted: trunk/adminshell/src/main/resources/scripts/dqpadmin.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/dqpadmin.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/scripts/dqpadmin.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,49 +0,0 @@
-source(getResource("/scripts/adminapi.bsh"));
-
-import java.sql.*;
-import java.io.*;
-import java.util.Properties;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-
-
-//*********************************************************************************************
-//Runtime Methods
-//
-//*********************************************************************************************
-
-/**
- * Stop the DQP. If millisToWait is >0, then close to incoming queries, wait the time period
- * for work to stop, then stop the DQP. Otherwise, stop immediately, aborting all running queries.
- * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
- * @throws AdminException
- * @since 4.3
- */
-void stopDQP(int millisToWait) {
- debug("Stopping DQP in " + vdbFile + " milli seconds.");
- checkAdmin();
- currentContext().internalAdmin.stop(millisToWait);
-}
-
-/**
- * Restart DQP
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void restartDQP() {
- debug("Restarting DQP.");
- checkAdmin();
- currentContext().internalAdmin.restart();
-}
-
-/**
- * Set the log listener to install into the DQP. This log listener will receive all log messages
- * written by the DPQ at it's current log level and log contexts.
- *
- * @param listener The listener component
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void setDQPLogListener(EmbeddedLogger listener) {
- checkAdmin();
- currentContext().internalAdmin.setLogListener(listener);
-}
Modified: trunk/adminshell/src/main/resources/scripts/server.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/server.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/scripts/server.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -3,7 +3,7 @@
*/
source(getResource("/scripts/jdbc.bsh"));
-source(getResource("/scripts/serveradmin.bsh"));
+source(getResource("/scripts/adminapi.bsh"));
import java.sql.*;
@@ -12,12 +12,13 @@
// "connection.properties" those values will replace one below
String user_host = InetAddress.getLocalHost().getHostName();
int user_port = 31000;
-String user_id = "metamatrixadmin";
-String user_pwd = "mm";
+String user_id = "admin";
+String user_pwd = "teiid";
String user_protocol = "mm:"; // colon is important
-String user_driver = "com.metamatrix.jdbc.MMDriver";
-String user_vdb = "BQT";
+String user_driver = "org.teiid.jdbc.TeiidDriver";
+String user_vdb = "admin";
user_optional_url="";
+String connection_prefix="conn";
/**
* Connect to the server using the properties specified in the connection.properties file.
@@ -40,7 +41,7 @@
Connection connect (String host, int port, String vdb, String user, String password, String optional_url) {
String contextName = genConnectionName();
newContext(contextName);
- String url = "jdbc:metamatrix:"+vdb+"@"+user_protocol+"//"+host+":"+port+";user="+user+";password="+password+";ApplicationName="+contextName;
+ String url = "jdbc:teiid:"+vdb+"@"+user_protocol+"//"+host+":"+port+";user="+user+";password="+password+";ApplicationName="+contextName;
if (optional_url != null && optional_url.length() > 0) {
url = url + ";" + optional_url;
}
@@ -50,6 +51,12 @@
return mmConn;
}
+Connection connectEmbedded(String url) throws SQLException {
+ c = connectURL(url, "com.metamatrix.jdbc.EmbeddedDriver");
+ currentContext().internalPrompt = "embedded:["+extractVDBName(url)+"]$ ";
+ return c;
+}
+
/**
* Current Connection Name.
*/
@@ -69,10 +76,14 @@
* @param url - complete url for connection
*/
Connection connect (String url) {
- if (url.startsWith("jdbc:metamatrix:")) {
+ return connectURL(url, user_driver);
+}
+
+private Connection connectURL (String url, String driver) {
+ if (url.startsWith("jdbc:metamatrix:") || url.startsWith("jdbc:teiid:")) {
String contextName = genConnectionName();
newContext(contextName);
- com.metamatrix.jdbc.api.Connection mmConn = connectDriver(user_driver, url);
+ com.metamatrix.jdbc.api.Connection mmConn = connectDriver(driver, url);
currentContext().internalPrompt = contextName+"["+extractVDBName(url)+"@"+extractHost(url)+"] $ ";
currentContext().internalAdmin = mmConn.getAdminAPI();
return mmConn;
@@ -104,7 +115,7 @@
newContext(contextName);
//url is in "jdbc URL format": connect via MMServerConnection
- currentContext().internalConnection = connectDriver("com.metamatrix.jdbc.MMDriver", url, username, password);
+ currentContext().internalConnection = connectDriver("org.teiid.jdbc.TeiidDriver", url, username, password);
currentContext().internalAdmin = currentContext().internalConnection.getAdminAPI();
}
}
@@ -122,10 +133,13 @@
void disconnect() {
closeConnection();
- if (currentContext().internalAdmin != void && currentContext().internalAdmin != null) {
- currentContext().internalAdmin.close();
- currentContext().internalAdmin=null;
- }
+ try {
+ if (currentContext().internalAdmin != void && currentContext().internalAdmin != null) {
+ currentContext().internalAdmin=null;
+ }
+ }catch(e) {
+ //ignore..
+ }
currentContext().internalPrompt = null;
}
@@ -174,7 +188,6 @@
void help() {
java.util.List urls = new ArrayList();
urls.add(getResource("/scripts/adminapi.bsh"));
- urls.add(getResource("/scripts/serveradmin.bsh"));
urls.add(getResource("/scripts/server.bsh"));
urls.add(getResource("/scripts/jdbc.bsh"));
help(urls);
@@ -189,7 +202,6 @@
void help(String methodName) {
java.util.List urls = new ArrayList();
urls.add(getResource("/scripts/adminapi.bsh"));
- urls.add(getResource("/scripts/serveradmin.bsh"));
urls.add(getResource("/scripts/server.bsh"));
urls.add(getResource("/scripts/jdbc.bsh"));
help(urls, methodName);
Deleted: trunk/adminshell/src/main/resources/scripts/serveradmin.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/serveradmin.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/scripts/serveradmin.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,635 +0,0 @@
-source(getResource("/scripts/adminapi.bsh"));
-
-import java.util.Date;
-import java.util.Properties;
-
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.comm.platform.client.ServerAdminFactory;
-import com.metamatrix.common.util.PropertiesUtils;
-
-// ********************************************************************************************
-// Wrappers for methods in the ServerAdmin interface.
-// For the methods of the DQPAdmin and Admin (shared) interfaces, see adminapi.bsh, dqp.bsh.
-// ********************************************************************************************
-
-// Configuration methods
-
-
-
-/**
- * Add a Host with Properties to MetaMatrix System
- *
- * @param hostIdentifier
- * Name of {@link com.metamatrix.admin.api.objects.Host Host} to add
- * @param properties
- * name,value
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void addHost(String hostIdentifier, Properties properties) {
- checkAdmin();
- currentContext().internalAdmin.addHost(hostIdentifier, properties);
-}
-
-
-/**
- * Enable Host in Configuration
- *
- * @param hostIdentifier
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void enableHost(String hostIdentifier) {
- checkAdmin();
- currentContext().internalAdmin.enableHost(hostIdentifier);
-}
-
-/**
- * Disable Host in Configuration
- *
- * @param identifier
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void disableHost(String identifier) {
- checkAdmin();
- currentContext().internalAdmin.disableHost(identifier);
-}
-
-/**
- * Delete Host in Configuration
- * <p>
- * Note that this method may invalidate your connection to the Admin API, if you are connected to the host you are deleting.
- * You may receive an exception on the next call to the API, and then it will recover.
- * As a workaround, you can close your connection and obtain a new connection.
- * @param identifier
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void deleteHost(String identifier) {
- checkAdmin();
- currentContext().internalAdmin.deleteHost(identifier);
-}
-
-
-
-/**
- * Add Process to specified host in the processIdentifier
- *
- * @param processIdentifier
- * Process Identifiers is Host Name.Process Name e.g. "myhost.MetaMatrixProcess"
- * @param properties
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void addProcess(String processIdentifier, Properties properties) {
- checkAdmin();
- currentContext().internalAdmin.addProcess(processIdentifier, properties);
-}
-
-
-/**
- * Enable Process in Configuration
- *
- * @param identifier
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void enableProcess(String identifier) {
- checkAdmin();
- currentContext().internalAdmin.enableProcess(identifier);
-}
-
-/**
- * Disable Process in Configuration
- *
- * @param identifier
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void disableProcess(String identifier) {
- checkAdmin();
- currentContext().internalAdmin.disableProcess(identifier);
-}
-
-/**
- * Delete Process in Configuration
- *
- * <p>
- * Note that this method may invalidate your connection to the Admin API, if you are connected to the process you are deleting.
- * You may receive an exception on the next call to the API, and then it will recover.
- * As a workaround, you can close your connection and obtain a new connection.
- * @param identifier
- * Process Identifer
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void deleteProcess(String identifier) {
- checkAdmin();
- currentContext().internalAdmin.deleteProcess(identifier);
-}
-
-
-/**
- * Deploy the VDB from the MetaMatrix Repository
- *
- * @param name
- * @param version
- * @param repositoryLocation
- * @return status object indicating any warnings.
- * <p>A status code of <code>AdminStatus.CODE_SUCCESS</code> will be returned there are no problems.
- * <p>A status code of <code>AdminStatus.CODE_DECRYPTION_FAILED</code> will be returned if the VDB was added,
- * but some connector binding passwords could not be decrypted.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-VDB addVDB(String name, String version, String repositoryLocation) {
- print("Adding VDB " + vdbName + " from " + repositoryLocation);
- checkAdmin();
- result = currentContext().internalAdmin.addVDB(name, version, repositoryLocation);
- debug(result);
- return result;
-}
-
-/**
- * Import the Configuration from a file in XML format.
- * NOTE: This imports the specified data to the "Next Startup" configuration.
- * The server must be restarted for the new configuration to take effect.
- *
- * @param filename Name of configuration file, in XML format, as exported by {@link #exportConfiguration()}
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void importConfiguration(String filename) {
- checkAdmin();
- currentContext().internalAdmin.importConfiguration(readTextFile(filename));
-}
-
-/**
- * Deassign a {@link ConnectorBinding} from a {@link VDB}'s Model
- *
- * @param connectorBindingName
- * Name of the ConnectorBinding
- * @param vdbName
- * Name of the VDB
- * @param vdbVersion
- * Version of the VDB
- * @param modelName
- * Name of the Model to unmap Connector Binding
- * @throws AdminException
- * if there's a system error or if there's a user input error.
- */
-void deassignBindingFromModel(String connectorBindingName,String vdbName,String vdbVersion,String modelName){
- checkAdmin();
- currentContext().internalAdmin.deassignBindingFromModel(connectorBindingName, vdbName, vdbVersion, modelName);
-}
-
-/**
- * Assign {@link ConnectorBinding}s to a {@link VDB}'s Model. If the supplied model does not
- * support MultiSource bindings, then only the first binding in the supplied array is assigned and
- * the remainder are ignored.
- *
- * @param connectorBindingNames
- * Names of the ConnectorBindings
- * @param vdbName
- * Name of the VDB
- * @param vdbVersion
- * Version of the VDB
- * @param modelName
- * Name of the Model to map Connector Bindings
- * @throws AdminException
- * if there's a system error or if there's a user input error.
- */
-void assignBindingsToModel(String[] connectorBindingNames, String vdbName, String vdbVersion, String modelName) {
- checkAdmin();
- currentContext().internalAdmin.assignBindingsToModel(connectorBindingNames, vdbName, vdbVersion, modelName);
-}
-
-/**
- * Deassign {@link ConnectorBinding}s from a {@link VDB}'s Model. Any of the supplied array of
- * bindings are deassigned from the supplied model.
- *
- * @param connectorBindingNames
- * Names of the ConnectorBindings
- * @param vdbName
- * Name of the VDB
- * @param vdbVersion
- * Version of the VDB
- * @param modelName
- * Name of the Model to unmap Connector Bindings
- * @throws AdminException
- * if there's a system error or if there's a user input error.
- */
-void deassignBindingsFromModel(String[] connectorBindingNames, String vdbName, String vdbVersion, String modelName){
- checkAdmin();
- currentContext().internalAdmin.deassignBindingsFromModel(connectorBindingNames, vdbName, vdbVersion, modelName);
-}
-
-
-
-// Monitoring methods
-
-/**
- * Get the hosts that correspond to the specified identifier pattern.
- *
- * @param hostIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.Host Host}
- * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#DELIMITER DELIMITER}"
- * if all hosts are desired.
- * @return Collection of {@link com.metamatrix.admin.api.objects.Host Host}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-Collection getHosts(String hostIdentifier) {
- checkAdmin();
-
- result = currentContext().internalAdmin.getHosts(hostIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the processes that correspond to the specified identifier pattern.
- *
- * @param processIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.ProcessObject ProcessObject}
- * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#DELIMITER DELIMITER}"
- * if all Processes are desired.
- * @return Collection of {@link com.metamatrix.admin.api.objects.ProcessObject ProcessObject}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-Collection getProcesses(String processIdentifier) {
- checkAdmin();
- result =currentContext().internalAdmin.getProcesses(processIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the Connection Pools that correspond to the specified identifer pattern.
- *
- * @param poolIdentifier the unique poolIdentifier for for a {@link com.metamatrix.admin.api.objects.ConnectionPool ConnectionPool}
- * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#DELIMITER DELIMITER}"
- * if all Connection Pools are desired.
- * @return Collection of {@link com.metamatrix.admin.api.objects.ConnectionPool ConnectionPool}s
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-Collection getConnectionPools(String poolIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getConnectionPools(poolIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the {@link com.metamatrix.admin.api.objects.DQP DQP}s that correspond to the specified identifer pattern.
- *
- * @param dqpIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.DQP DQP}
- * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#DELIMITER DELIMITER}"
- * if all Resources are desired.
- * @return Collection of {@link com.metamatrix.admin.api.objects.DQP DQP}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-Collection getDQPs(String dqpIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getDQPs(dqpIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the Resources that correspond to the specified identifer pattern.
- *
- * @param resourceIdentifier the unique resourceIdentifier for for a {@link com.metamatrix.admin.api.objects.Resource Resource}
- * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#DELIMITER DELIMITER}"
- * if all Resources are desired.
- * @return Collection of {@link com.metamatrix.admin.api.objects.Resource Resource}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-Collection getResources(String resourceIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getResources(resourceIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Export the logs from the MetaMatrix system, az a zipfile
- *
- * @param filename
- * Name of file to write the logs to
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void exportLogs(String fileName) {
- checkAdmin();
- contents = currentContext().internalAdmin.exportLogs();
- if (contents != null) {
- ObjectConverterUtil.write(contents, fileName);
- }
- else {
- throw new AdminProcessingException("Log file is not found for exporting");
- }
-
-}
-
-
-//RuntimeState methods
-
-/**
- * Stop and restart the entire system.
- * @param waitUntilDone If true, this method waits until the operation is finished before returning.
- * This may take a long time to complete. If false, this method returns immediately, even though the operation
- * may not be finished.
- * NOTE: If <code>waitUntilDone</code> is true, this method will wait until the server is able to connect to,
- * but it may not wait until non-essential services are available.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void bounceSystem(boolean waitUntilDone) {
- checkAdmin();
- currentContext().internalAdmin.bounceSystem(waitUntilDone);
-}
-
-/**
- * Synchronize the entire system. Synchronization will attempt to make the
- * runtime state match the configuration.
- * @param waitUntilDone If true, this method waits until the operation is finished before returning.
- * This may take a long time to complete. If false, this method returns immediately, even though the operation
- * may not be finished.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void synchronizeSystem(boolean waitUntilDone) {
- checkAdmin();
- currentContext().internalAdmin.synchronizeSystem(waitUntilDone);
-}
-
-/**
- * Stop the entire system.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void stopSystem() {
- checkAdmin();
- currentContext().internalAdmin.stopSystem();
-}
-
-
-/**
- * Start the Host for this cluster
- * @param hostIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.Host Host}
- * in the system.
- * @param waitUntilDone If true, this method waits until the operation is finished before returning.
- * This may take a long time to complete. If false, this method returns immediately, even though the operation
- * may not be finished.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void startHost(String hostIdentifier, boolean waitUntilDone) {
- checkAdmin();
- currentContext().internalAdmin.startHost(hostIdentifier, waitUntilDone);
-}
-
-/**
- * Stop the Host for this cluster
- * @param hostIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.Host Host}
- * in the system.
- * @param stopNow If true, stop the host forcefully. If false, wait until any pending work is done.
- * @param waitUntilDone If true, this method waits until the operation is finished before returning.
- * This may take a long time to complete. If false, this method returns immediately, even though the operation
- * may not be finished.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void stopHost(String hostIdentifier, boolean stopNow, boolean waitUntilDone) {
- checkAdmin();
- currentContext().internalAdmin.stopHost(hostIdentifier, stopNow, waitUntilDone);
-}
-
-/**
- * Start a Process in the system.
- * @param processIdentifier the unique identifier for for a
- * {@link com.metamatrix.admin.api.objects.ProcessObject ProcessObject} in the system.
- * @param waitUntilDone If true, this method waits until the operation is finished before returning.
- * This may take a long time to complete. If false, this method returns immediately, even though the operation
- * may not be finished.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void startProcess(String processIdentifier, boolean waitUntilDone) {
- checkAdmin();
- currentContext().internalAdmin.startProcess(processIdentifier, waitUntilDone);
-}
-
-/**
- * Stop Process running in the system.
- * @param processIdentifier the unique identifier for for a
- * {@link com.metamatrix.admin.api.objects.ProcessObject ProcessObject} in the system.
- * @param stopNow a <code>boolean</code> value indicating whether to halt the process immediately
- * or let it finish processing first.
- * @param waitUntilDone If true, this method waits until the operation is finished before returning.
- * This may take a long time to complete. If false, this method returns immediately, even though the operation
- * may not be finished.
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void stopProcess(String processIdentifier, boolean stopNow, boolean waitUntilDone) {
- checkAdmin();
- currentContext().internalAdmin.stopProcess(processIdentifier, stopNow, waitUntilDone);
-}
-
-
-//Security methods
-
-/**
- * Get the Collection of administrative role names possessed by the given group, if any.
- *
- * @param groupIdentifier
- * The unique identifier for the {@link Group}. This is group name. A user is a {@link Principal} and a
- * Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains.
- * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @return The Collection of {@link Role}s.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-Collection getRolesForGroup(String groupIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getRolesForGroup(groupIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the Collection of administrative role names possessed by the given user, if any.
- *
- * @param userIdentifier
- * The unique identifier for the {@link User}. This is generally a user name. A user is a {@link Principal} and a
- * Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains.
- * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @return The Collection of <code>String</code> role names.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-Collection getRolesForUser(String userIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getRolesForUser(userIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the group memberships for the given user.
- *
- * @param userIdentifier
- * The unique identifier for the {@link User}. This is generally a user name. A user is a {@link Principal} and a
- * Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains.
- * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @return The collection of groups in which the given user has membership.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-Collection getGroupsForUser(String userIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getGroupsForUser(userIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the group denoted by the given <code>groupIdentifier</code>.
- *
- * @param groupIdentifier
- * The unique identifier for the {@link Group}. This is generally a group name. A group is a {@link Principal} and
- * a Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains. <br>
- * Note that by supplying the {@link AdminObject#WILDCARD WILDCARD} identifier, all all users in the system will
- * retrieved.</br>
- * @return The Collection of users.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-Collection getGroups(String groupIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getGroups(groupIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Assign to the given {@link Group} the given Administrative Role.
- *
- * @param roleIdentifier
- * one of {@link AdminRoles}.
- * @param groupIdentifier
- * the unique identifier for the Principal. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void assignRoleToGroup(String roleIdentifier, String groupIdentifier) {
- checkAdmin();
- currentContext().internalAdmin.assignRoleToGroup(roleIdentifier, groupIdentifier);
-}
-
-/**
- * Remove an administrative role from the given {@link Group}.
- *
- * @param roleIdentifier
- * one of {@link AdminRoles}
- * @param groupIdentifier
- * the unique identifier for the Principal. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void removeRoleFromGroup(String roleIdentifier, String groupIdentifier) {
- checkAdmin();
- currentContext().internalAdmin.removeRoleFromGroup(roleIdentifier, groupIdentifier);
-}
-
-
-/**
- * Import the data Roles for given vdb and version into the connected server
- * @param vdbName - target name of the VDB, the roles to be imported under
- * @param vdbVersion - target version of the vdb, the roles to be imported under
- * @param filename - character data array containing the XML file which defines the roles
- * @param options - options to overwrite in case the matching roles already exist.
- * @throws AdminException
- */
-void importDataRoles(String vdbName, String vdbVersion, String filename, int options) {
- checkAdmin();
- currentContext().internalAdmin.importDataRoles(vdbName, vdbVersion, readTextFile(filename), new AdminOptions(options));
-}
-
-/**
- * Import the data Roles for given vdb and version into the connected server
- * @param vdbName - target name of the VDB, the roles to be imported under
- * @param vdbVersion - target version of the vdb, the roles to be imported under
- * @param filename - character data array containing the XML file which defines the roles
- * @throws AdminException
- */
-void importDataRoles(String vdbName, String vdbVersion, String filename) {
- checkAdmin();
- currentContext().internalAdmin.importDataRoles(vdbName, vdbVersion, readTextFile(filename), null);
-}
-
-
-/**
- * Export the data roles defined for the given vdb fromthe current system
- * @param vdbName - Name of the vdb
- * @param vdbVersion - version of the vdb
- * @param filename - name of the file to export the contents under.
- * @return - char[] stream containing the XML contents of the roles.
- * @throws AdminException
- */
-void exportDataRoles(String vdbName, String vdbVersion, String fileName) {
- checkAdmin();
- contents = currentContext().internalAdmin.exportDataRoles(vdbName, vdbVersion);
- if (contents != null) {
- ObjectConverterUtil.write(contents, fileName);
- }
- else {
- throw new AdminProcessingException("Data roles not found for VDB "+ vdbName + " with version "+ vdbVersion);
- }
-}
-
-
-/**
- * @param domainprovidername is the name to be assigned to the newly created {@link AuthenticationProvider}
- * @param providertypename is the type of provider to create.
- * There are 3 installed provider types and they are:
- * <ul>
- * <li> <code>File Membership Domain Provider</code>
- * <li> <code>LDAP Membership Domain Provider</code>
- * <li><code>Custom Membership Domain Provider</code>
- * </ul>
- * @param properties are the settings specified by the providertype to be used
- * @throws AdminException
- * if there's a system error.
- * @since 5.5.2
- */
-void addAuthorizationProvider(String domainprovidername, String providertypename, Properties properties) {
- checkAdmin();
- currentContext().internalAdmin.addAuthorizationProvider(domainprovidername, providertypename, properties);
-}
-
-
-
-
-
Modified: trunk/adminshell/src/main/resources/scripts/util.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/util.bsh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/adminshell/src/main/resources/scripts/util.bsh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,6 +1,5 @@
import java.io.*;
-import com.metamatrix.admin.api.core.*;
-import com.metamatrix.admin.api.objects.*;
+import org.teiid.adminapi.*;
import com.metamatrix.core.util.*;
debug=false;
@@ -136,21 +135,33 @@
String extractVDBName(url) {
str = "jdbc:metamatrix:";
+ strteiid = "jdbc:teiid:";
if (url.startsWith(str)) {
int at = url.indexOf("@");
if (at != -1) {
return url.substring(str.length(), at);
}
}
+ else if (url.startsWith(strteiid)) {
+ int at = url.indexOf("@");
+ if (at != -1) {
+ return url.substring(strteiid.length(), at);
+ }
+ }
return "";
}
String extractHost(url) {
str = "jdbc:metamatrix:";
+ strteiid = "jdbc:teiid:";
if (url.startsWith(str)) {
int at = url.indexOf("@")+1;
return url.substring(at, url.indexOf(";", at));
}
+ else if (url.startsWith(strteiid)) {
+ int at = url.indexOf("@")+1;
+ return url.substring(at, url.indexOf(";", at));
+ }
return "";
}
Added: trunk/build/assembly/adminshell/adminshell-dependencies.xml
===================================================================
--- trunk/build/assembly/adminshell/adminshell-dependencies.xml (rev 0)
+++ trunk/build/assembly/adminshell/adminshell-dependencies.xml 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,44 @@
+<!--This script builds a JAR for the CDK -->
+<assembly>
+
+ <id>adminshell-dependencies</id>
+
+ <formats>
+ <format>dir</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <baseDirectory>teiid-adminshell</baseDirectory>
+
+ <moduleSets>
+ <moduleSet>
+ <includeSubModules>true</includeSubModules>
+
+ <includes>
+ <include>org.jboss.teiid:teiid-adminshell</include>
+ </includes>
+
+ <binaries>
+ <includeDependencies>true</includeDependencies>
+ <unpack>false</unpack>
+
+ <dependencySets>
+ <dependencySet>
+ <useProjectArtifact>true</useProjectArtifact>
+ <unpack>false</unpack>
+ <useTransitiveDependencies>true</useTransitiveDependencies>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <excludes>
+ <exclude>org.jboss.teiid:teiid-client</exclude>
+ <exclude>org.jboss.teiid:teiid-client-jdbc</exclude>
+ <exclude>org.jboss.teiid:teiid-common-core</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+
+ </binaries>
+
+ </moduleSet>
+ </moduleSets>
+
+</assembly>
\ No newline at end of file
Property changes on: trunk/build/assembly/adminshell/adminshell-dependencies.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/assembly/adminshell/adminshell-dist.xml
===================================================================
--- trunk/build/assembly/adminshell/adminshell-dist.xml (rev 0)
+++ trunk/build/assembly/adminshell/adminshell-dist.xml 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,44 @@
+<!--This script builds a JAR for the CDK -->
+<assembly>
+
+ <id>adminshell-dist</id>
+
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>teiid-adminshell-${version}</baseDirectory>
+
+
+ <fileSets>
+
+ <fileSet>
+ <directory>target/distribution/teiid-${version}-adminshell-dependencies.dir</directory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ <outputDirectory>lib</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>build/kit-adminshell</directory>
+ <outputDirectory>/</outputDirectory>
+ <excludes>
+ <exclude>**/*.foo</exclude>
+ </excludes>
+ </fileSet>
+
+ <fileSet>
+ <directory>target/distribution</directory>
+ <includes>
+ <include>teiid-${version}-client.jar</include>
+ </includes>
+ <outputDirectory>lib</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+
+
+</assembly>
\ No newline at end of file
Property changes on: trunk/build/assembly/adminshell/adminshell-dist.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/assembly/client-jar.xml
===================================================================
--- trunk/build/assembly/client-jar.xml (rev 0)
+++ trunk/build/assembly/client-jar.xml 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,35 @@
+<!--This script builds a JAR for the Embedded Server Installation -->
+<assembly>
+
+ <id>client</id>
+
+ <formats>
+ <format>jar</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <baseDirectory>teiid-client</baseDirectory>
+
+ <moduleSets>
+ <moduleSet>
+ <includeSubModules>true</includeSubModules>
+
+ <includes>
+ <include>org.jboss.teiid:teiid-client</include>
+ <include>org.jboss.teiid:teiid-client-jdbc</include>
+ <include>org.jboss.teiid:teiid-common-core</include>
+ </includes>
+
+ <binaries>
+ <includeDependencies>false</includeDependencies>
+ <unpack>true</unpack>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>:jar:*</include>
+ </includes>
+ </binaries>
+
+ </moduleSet>
+ </moduleSets>
+
+</assembly>
\ No newline at end of file
Property changes on: trunk/build/assembly/client-jar.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/build/assembly/embedded/embedded-client-jar.xml
===================================================================
--- trunk/build/assembly/embedded/embedded-client-jar.xml 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/build/assembly/embedded/embedded-client-jar.xml 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,35 +0,0 @@
-<!--This script builds a JAR for the Embedded Server Installation -->
-<assembly>
-
- <id>client</id>
-
- <formats>
- <format>jar</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
- <baseDirectory>teiid-embedded-client</baseDirectory>
-
- <moduleSets>
- <moduleSet>
- <includeSubModules>true</includeSubModules>
-
- <includes>
- <include>org.jboss.teiid:teiid-client</include>
- <include>org.jboss.teiid:teiid-client-jdbc</include>
- <include>org.jboss.teiid:teiid-common-core</include>
- </includes>
-
- <binaries>
- <includeDependencies>false</includeDependencies>
- <unpack>true</unpack>
- <outputDirectory></outputDirectory>
- <includes>
- <include>:jar:*</include>
- </includes>
- </binaries>
-
- </moduleSet>
- </moduleSets>
-
-</assembly>
\ No newline at end of file
Added: trunk/build/kit-adminshell/COPYRIGHT.txt
===================================================================
--- trunk/build/kit-adminshell/COPYRIGHT.txt (rev 0)
+++ trunk/build/kit-adminshell/COPYRIGHT.txt 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,4 @@
+Portions Copyright (C) 2008-2009 Red Hat, Inc.
+Portions Copyright (C) 2000-2007 MetaMatrix, Inc.
+Portions Copyright (c) 2000, 2003, 2008 IBM Corporation and others.
+Portions Copyright (c) 1997-2000 Sun Microsystems, Inc.
\ No newline at end of file
Property changes on: trunk/build/kit-adminshell/COPYRIGHT.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/kit-adminshell/LICENSE-lgpl-2.1.txt
===================================================================
--- trunk/build/kit-adminshell/LICENSE-lgpl-2.1.txt (rev 0)
+++ trunk/build/kit-adminshell/LICENSE-lgpl-2.1.txt 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
Property changes on: trunk/build/kit-adminshell/LICENSE-lgpl-2.1.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/kit-adminshell/adminshell.bat
===================================================================
--- trunk/build/kit-adminshell/adminshell.bat (rev 0)
+++ trunk/build/kit-adminshell/adminshell.bat 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,78 @@
+@ECHO OFF
+@setlocal
+
+@REM JBoss, Home of Professional Open Source.
+@REM Copyright (C) 2008 Red Hat, Inc.
+@REM Licensed to Red Hat, Inc. under one or more contributor
+@REM license agreements. See the copyright.txt file in the
+@REM distribution for a full listing of individual contributors.
+@REM
+@REM This library is free software; you can redistribute it and/or
+@REM modify it under the terms of the GNU Lesser General Public
+@REM License as published by the Free Software Foundation; either
+@REM version 2.1 of the License, or (at your option) any later version.
+@REM
+@REM This library is distributed in the hope that it will be useful,
+@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+@REM Lesser General Public License for more details.
+@REM
+@REM You should have received a copy of the GNU Lesser General Public
+@REM License along with this library; if not, write to the Free Software
+@REM Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+@REM 02110-1301 USA.
+
+@REM This assumes it's run from its installation directory. It is also assumed there is a java
+@REM executable defined along the PATH
+
+@if not "%ECHO%" == "" echo %ECHO%
+@if "%OS%" == "Windows_NT" setlocal
+
+if "%OS%" == "Windows_NT" (
+ set "DIRNAME=%~dp0%"
+) else (
+ set DIRNAME=.\
+)
+
+pushd %DIRNAME%..
+if "x%TEIID_HOME%" == "x" (
+ set "TEIID_HOME=%CD%"
+)
+popd
+
+set DIRNAME=
+
+if "x%JAVA_HOME%" == "x" (
+ set JAVA=java
+ echo JAVA_HOME is not set. Unexpected results may occur.
+ echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
+) else (
+ set "JAVA=%JAVA_HOME%\bin\java"
+ if exist "%JAVA_HOME%\lib\tools.jar" (
+ set "JAVAC_JAR=%JAVA_HOME%\lib\tools.jar"
+ )
+)
+
+set TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\lib\*;
+
+rem JVM memory allocation pool parameters. Modify as appropriate.
+set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -XX:MaxPermSize=256m
+
+echo ===============================================================================
+echo.
+echo Teiid AdminShell Bootstrap Environment
+echo.
+echo TEIID_HOME: %TEIID_HOME%
+echo.
+echo JAVA: %JAVA%
+echo.
+echo JAVA_OPTS: %JAVA_OPTS%
+echo.
+echo CLASSPATH: %TEIID_CLASSPATH%
+echo.
+echo ===============================================================================
+echo.
+
+"%JAVA%" %JAVA_OPTS% ^
+ -classpath "%TEIID_CLASSPATH%" ^
+ org.teiid.AdminShell %*
Property changes on: trunk/build/kit-adminshell/adminshell.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/kit-adminshell/adminshell.sh
===================================================================
--- trunk/build/kit-adminshell/adminshell.sh (rev 0)
+++ trunk/build/kit-adminshell/adminshell.sh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# JBoss, Home of Professional Open Source.
+# Copyright (C) 2008 Red Hat, Inc.
+# Licensed to Red Hat, Inc. under one or more contributor
+# license agreements. See the copyright.txt file in the
+# distribution for a full listing of individual contributors.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+
+DIRNAME=`dirname $0`
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+linux=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Linux)
+ linux=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$TEIID_HOME" ] &&
+ TEIID_HOME=`cygpath --unix "$TEIID_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Setup TEIID_HOME
+if [ "x$TEIID_HOME" = "x" ]; then
+ # get the full path (without any relative bits)
+ TEIID_HOME=`cd $DIRNAME; pwd`
+fi
+export TEIID_HOME
+
+# Setup the JVM
+if [ "x$JAVA" = "x" ]; then
+ if [ "x$JAVA_HOME" != "x" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+ else
+ JAVA="java"
+ fi
+fi
+
+TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/*"
+
+
+# Print the env settings
+echo "========================================================================="
+echo ""
+echo " Teiid AdminSehll Bootstrap Environment"
+echo ""
+echo " TEIID_HOME = $TEIID_HOME"
+echo " CLASSPATH = $TEIID_CLASSPATH"
+echo " JAVA = $JAVA"
+echo ""
+echo "========================================================================="
+echo ""
+
+$JAVA -cp $TEIID_CLASSPATH -Xmx256m org.teiid.AdminShell $*
\ No newline at end of file
Property changes on: trunk/build/kit-adminshell/adminshell.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/kit-adminshell/connection.properties
===================================================================
--- trunk/build/kit-adminshell/connection.properties (rev 0)
+++ trunk/build/kit-adminshell/connection.properties 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,6 @@
+server.host=localhost
+server.port=31000
+server.username=admin
+server.password=teiid
+#server.optional-url=(optional)
+vdb.name=admin
Property changes on: trunk/build/kit-adminshell/connection.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/build/kit-embedded/bin/run.bat
===================================================================
--- trunk/build/kit-embedded/bin/run.bat 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/build/kit-embedded/bin/run.bat 2009-07-02 19:57:16 UTC (rev 1093)
@@ -64,7 +64,7 @@
:RESTART
"%JAVA%" %JAVA_OPTS% ^
- -classpath "%JBOSS_CLASSPATH%" ^
+ -classpath "%TEIID_CLASSPATH%" ^
-server ^
org.teiid.Server %TEIID_HOME%\deploy.properties %*
Modified: trunk/build/kit-embedded/bin/run.sh
===================================================================
--- trunk/build/kit-embedded/bin/run.sh 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/build/kit-embedded/bin/run.sh 2009-07-02 19:57:16 UTC (rev 1093)
@@ -6,7 +6,6 @@
### ====================================================================== ###
DIRNAME=`dirname $0`
-PROGNAME=`basename $0`
# OS specific support (must be 'true' or 'false').
cygwin=false;
@@ -26,7 +25,7 @@
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
# JPDA options. Uncomment and modify as appropriate to enable remote debugging.
-# JAVA_OPTS=$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
+# JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
if [ "$linux" = "true" ]; then
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-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -44,8 +44,6 @@
ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException;
- public Admin getAdminAPI(Properties connectionProperties) throws AdminException;
-
/**
* Shutdown the connection factory, including the DQP and all its existing connections
*/
Deleted: trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.comm.api;
-
-import com.metamatrix.common.comm.api.ServerConnection;
-
-
-/**
- * An implementor of this interface, when registered with the ServerConnection will
- * receive notifications about the connection life cycle events.
- */
-public interface ServerConnectionListener {
- /**
- * A connection has been added to DQP
- * @param connection The client connection instance, never null
- */
- void connectionAdded(ServerConnection connection);
-
- /**
- * A connection has been removed for DQP
- * @param connection The client connection instance, never null
- */
- void connectionRemoved(ServerConnection connection);
-
-}
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-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -293,11 +293,6 @@
this.maxCachedInstances = maxCachedInstances;
}
- @Override
- public Admin getAdminAPI(Properties connectionProperties) throws AdminException {
- ServerAdminFactory factory = ServerAdminFactory.getInstance();
- return factory.createAdmin(connectionProperties);
- }
@Override
public void shutdown(boolean restart) {
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -31,10 +31,4 @@
* @since 4.3
*/
public interface Admin extends ConfigurationAdmin, MonitoringAdmin, RuntimeStateAdmin, SecurityAdmin {
- /**
- * Closes connection.
- * @since 4.3
- */
- @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
- void close();
}
Modified: trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServiceRegistry.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServiceRegistry.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServiceRegistry.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -34,13 +34,18 @@
import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.dqp.client.ClientSideDQP;
+import com.metamatrix.platform.security.api.ILogon;
public class TestSocketServiceRegistry extends TestCase {
+ interface Foo{
+ void somemethod();
+ }
+
public void testExceptionConversionNoException() throws Exception {
+
+ Method m = Foo.class.getMethod("somemethod", new Class[] {});
- Method m = Admin.class.getMethod("close", new Class[] {});
-
Throwable t = ExceptionUtil.convertException(m, new MetaMatrixComponentException());
assertTrue(t instanceof MetaMatrixRuntimeException);
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -463,7 +463,7 @@
try {
info.setProperty(DQPEmbeddedProperties.BOOTURL, url.toExternalForm());
ServerConnection conn = connectionFactory.createConnection(info);
- return new MMConnection(conn, info, url.toExternalForm(), connectionFactory);
+ return new MMConnection(conn, info, url.toExternalForm());
} catch (CommunicationException e) {
throw MMSQLException.create(e);
} catch (ConnectionException e) {
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -123,9 +123,6 @@
private ClientSideDQP dqp;
protected ServerConnection serverConn;
- private Admin admin;
- ServerConnectionFactory connFactory = null;
-
/**
* <p>MMConnection constructor, tring to establish connection to metamatrix with
* the given URL and properties.</p>
@@ -133,11 +130,10 @@
* @param info contains properies needed to establish a MetaMatrix connection.
* @throws SQLException if the driver cannot establish connection to metamatrix.
*/
- public MMConnection(ServerConnection serverConn, Properties info, String url, ServerConnectionFactory connFactory) {
+ public MMConnection(ServerConnection serverConn, Properties info, String url) {
this.serverConn = serverConn;
this.url = url;
this.dqp = serverConn.getService(ClientSideDQP.class);
- this.connFactory = connFactory;
// set default properties if not overridden
String overrideProp = info.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
@@ -244,14 +240,7 @@
* @since 4.3
*/
public synchronized Admin getAdminAPI() throws SQLException {
- try {
- if (admin == null) {
- admin = connFactory.getAdminAPI(this.propInfo);
- }
- } catch(AdminException e) {
- throw MMSQLException.create(e);
- }
- return admin;
+ return this.serverConn.getService(Admin.class);
}
/**
@@ -318,11 +307,6 @@
// set the status of the connection to closed
closed = true;
}
-
- if (admin != null) {
- admin.close();
- }
-
}
/**
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -143,7 +143,7 @@
ServerConnection serverConn = SocketServerConnectionFactory.getInstance().createConnection(info);
// construct a MMConnection object.
- MMConnection connection = new MMConnection(serverConn, info, url, SocketServerConnectionFactory.getInstance());
+ MMConnection connection = new MMConnection(serverConn, info, url);
return connection;
}
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -147,7 +147,7 @@
ServerConnection serverConn = SocketServerConnectionFactory.getInstance().createConnection(info);
// construct a MMConnection object.
- MMConnection connection = new MMConnection(serverConn, info, url, SocketServerConnectionFactory.getInstance());
+ MMConnection connection = new MMConnection(serverConn, info, url);
return connection;
}
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -60,7 +60,7 @@
productInfo.setProperty(ProductInfoConstants.VIRTUAL_DB, STD_DATABASE_NAME);
productInfo.setProperty(ProductInfoConstants.VDB_VERSION, STD_DATABASE_VERSION);
stub(mock.getLogonResult()).toReturn(new LogonResult(new SessionToken(new MetaMatrixSessionID(1), "metamatrixadmin"), productInfo, "fake")); //$NON-NLS-1$
- return new MMConnection(mock, props, serverUrl, mock(ServerConnectionFactory.class));
+ return new MMConnection(mock, props, serverUrl);
}
public void testGetMetaData() throws Exception {
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -243,8 +243,8 @@
com.metamatrix.common.queue.WorkerPoolStats stats = (com.metamatrix.common.queue.WorkerPoolStats)src;
return Util.convertStats(stats, stats.getQueueName());
}
- else if (src != null && src instanceof ServerConnection) {
- ServerConnection conn = (ServerConnection)src;
+ else if (src != null && src instanceof DQPWorkContext) {
+ DQPWorkContext conn = (DQPWorkContext)src;
return convertConnection(conn);
}
else if (src != null && src instanceof com.metamatrix.common.config.api.ExtensionModule) {
@@ -273,10 +273,14 @@
return module;
}
- private Session convertConnection(ServerConnection src) {
- MMSession session = new MMSession(new String[] {src.getLogonResult().getSessionID().toString()});
- session.setVDBName(src.getLogonResult().getProductInfo(ProductInfoConstants.VIRTUAL_DB));
- session.setVDBVersion(src.getLogonResult().getProductInfo(ProductInfoConstants.VDB_VERSION));
+ private Session convertConnection(DQPWorkContext src) {
+ MMSession session = new MMSession(new String[] {src.getSessionId().toString()});
+ session.setVDBName(src.getVdbName());
+ session.setVDBVersion(src.getVdbVersion());
+ session.setApplicationName(src.getAppName());
+ session.setIPAddress(src.getClientAddress());
+ session.setHostName(src.getClientHostname());
+ session.setUserName(src.getUserName());
return session;
}
@@ -404,7 +408,7 @@
if (bindings != null && !bindings.isEmpty()) {
List names = new ArrayList();
for (int i=0; i<bindings.size();i++) {
- names.add(vdb.getConnectorBindingByName((String)bindings.get(i)));
+ names.add(convertToAdminObject(vdb.getConnectorBindingByName((String)bindings.get(i)), parent));
}
model.setConnectorBindingNames(names);
}
@@ -441,12 +445,11 @@
* @return
* @since 4.3
*/
- ServerConnection getClientConnection(String identifier) {
- Collection<ServerConnection> connections = getConfigurationService().getClientConnections();
- for (Iterator i = connections.iterator(); i.hasNext();) {
- ServerConnection clientConnection = (ServerConnection)i.next();
- if (clientConnection.getLogonResult().getSessionID().toString().equals(identifier)) {
- return clientConnection;
+ DQPWorkContext getClientConnection(String identifier) {
+ Collection<DQPWorkContext> connections = getConfigurationService().getClientConnections();
+ for (DQPWorkContext context:connections) {
+ if (context.getSessionId().toString().equals(identifier)) {
+ return context;
}
}
return null;
@@ -457,7 +460,7 @@
* @return
* @throws AdminException
*/
- Set<ServerConnection> getClientConnections() throws AdminException{
+ Set<DQPWorkContext> getClientConnections() {
return getConfigurationService().getClientConnections();
}
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -22,8 +22,6 @@
package com.metamatrix.dqp.embedded.admin;
-import static org.teiid.dqp.internal.process.Util.convertStats;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -43,20 +41,15 @@
import org.teiid.adminapi.ProcessObject;
import org.teiid.adminapi.SystemObject;
import org.teiid.adminapi.Transaction;
+import org.teiid.dqp.internal.process.DQPWorkContext;
import com.metamatrix.admin.objects.MMAdminObject;
-import com.metamatrix.admin.objects.MMProcess;
-import com.metamatrix.admin.objects.MMQueueWorkerPool;
import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.queue.WorkerPoolStats;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
-import com.metamatrix.platform.vm.controller.ProcessStatistics;
-import com.metamatrix.platform.vm.controller.SocketListenerStats;
import com.metamatrix.server.serverapi.RequestInfo;
@@ -252,16 +245,7 @@
if (identifier == null || !identifier.matches(NUMBER_REGEX)) {
throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$
}
-
- ArrayList goodConections = new ArrayList();
- Set<ServerConnection> connections = getClientConnections();
- for (Iterator i = connections.iterator(); i.hasNext();) {
- ServerConnection connection = (ServerConnection)i.next();
- if (connection.isOpen()) {
- goodConections.add(connection);
- }
- }
- return matchedCollection(identifier, (List)convertToAdminObjects(goodConections));
+ return matchedCollection(identifier, (List)convertToAdminObjects(getClientConnections()));
}
/**
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -38,6 +38,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;
@@ -208,28 +209,23 @@
public void terminateSession(String identifier)
throws AdminException {
- Set<ServerConnection> connections = getClientConnections();
- ArrayList matchedConnections = new ArrayList();
+ Set<DQPWorkContext> connections = getClientConnections();
+ ArrayList<DQPWorkContext> matchedConnections = new ArrayList<DQPWorkContext>();
- for (ServerConnection clientConnection:connections) {
- String id = clientConnection.getLogonResult().getSessionID().toString();
+ for (DQPWorkContext clientConnection:connections) {
+ String id = clientConnection.getSessionId().toString();
if (matches(identifier, id)) {
matchedConnections.add(clientConnection);
}
}
// Double iteration because to avoid concurrent modification of underlying map.
- for (Iterator i = matchedConnections.iterator(); i.hasNext();) {
- ServerConnection clientConnection = (ServerConnection)i.next();
-
+ for (DQPWorkContext clientConnection: matchedConnections) {
try {
- this.manager.getDQP().terminateConnection(clientConnection.getLogonResult().getSessionID().toString());
+ this.manager.getDQP().terminateConnection(clientConnection.getSessionId().toString());
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
}
-
- // Shutdown the connection
- clientConnection.shutdown();
}
}
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -98,7 +98,7 @@
* @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getGroupsForUser(java.lang.String, boolean)
* @since 4.3
*/
- public Collection getGroupsForUser(String userIdentifier) throws AdminException {
+ public Collection<Group> getGroupsForUser(String userIdentifier) throws AdminException {
if (userIdentifier == null) {
throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
}
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -38,6 +38,8 @@
import java.util.Set;
import java.util.StringTokenizer;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -45,8 +47,6 @@
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
@@ -74,9 +74,9 @@
import com.metamatrix.dqp.embedded.configuration.VDBConfigurationWriter;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.ConnectorBindingLifeCycleListener;
+import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.dqp.service.VDBLifeCycleListener;
import com.metamatrix.dqp.util.LogConstants;
-import com.metamatrix.platform.util.ProductInfoConstants;
import com.metamatrix.query.function.FunctionLibraryManager;
import com.metamatrix.query.function.UDFSource;
import com.metamatrix.vdb.runtime.BasicModelInfo;
@@ -113,7 +113,7 @@
private ArrayList<VDBLifeCycleListener> vdbLifeCycleListeners = new ArrayList<VDBLifeCycleListener>();
private ArrayList<ConnectorBindingLifeCycleListener> connectorBindingLifeCycleListeners = new ArrayList<ConnectorBindingLifeCycleListener>();
private UDFSource udfSource;
- private HashSet<ServerConnection> clientConnections = new HashSet<ServerConnection>();
+ private HashSet<DQPWorkContext> clientConnections = new HashSet<DQPWorkContext>();
private AbstractClassLoaderManager classLoaderManager = new AbstractClassLoaderManager(Thread.currentThread().getContextClassLoader(), true, true) {
@@ -1239,15 +1239,13 @@
/**
* A Client Connection to DQP has been added
*/
- public void connectionAdded(ServerConnection connection) {
+ public void connectionAdded(DQPWorkContext connection) {
// Add to parent's collection
clientConnections.add(connection);
- String vdbName = connection.getLogonResult().getProductInfo(ProductInfoConstants.VIRTUAL_DB);
- String vdbVersion = connection.getLogonResult().getProductInfo(ProductInfoConstants.VDB_VERSION);
- String key = vdbId(vdbName, vdbVersion);
+ String key = vdbId(connection.getVdbName(), connection.getVdbVersion());
- DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connectionAdded", new Object[] {vdbName, vdbVersion, connection.getLogonResult().getSessionID()}); //$NON-NLS-1$
+ DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connectionAdded", new Object[] {connection.getVdbName(), connection.getVdbVersion(), connection.getSessionId()}); //$NON-NLS-1$
Integer useCount = inuseVDBs.get(key);
if (useCount == null) {
@@ -1261,15 +1259,13 @@
/**
* A Client Connection to DQP has been removed
*/
- public void connectionRemoved(ServerConnection connection) {
+ public void connectionRemoved(DQPWorkContext connection) {
// remove from the collection
clientConnections.remove(connection);
- String vdbName = connection.getLogonResult().getProductInfo(ProductInfoConstants.VIRTUAL_DB);
- String vdbVersion = connection.getLogonResult().getProductInfo(ProductInfoConstants.VDB_VERSION);
- String key = vdbId(vdbName, vdbVersion);
+ String key = vdbId(connection.getVdbName(), connection.getVdbVersion());
- DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connectionRemoved", new Object[] {vdbName, vdbVersion, connection.getLogonResult().getSessionID()}); //$NON-NLS-1$
+ DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connectionRemoved", new Object[] {connection.getVdbName(), connection.getVdbVersion(), connection.getSessionId()}); //$NON-NLS-1$
Integer useCount = inuseVDBs.get(key);
if (useCount == null) {
@@ -1279,7 +1275,7 @@
// after decrementing if use count comes to zero we can
// see if there are any VDBs to delete
if ((useCount.intValue()-1) == 0) {
- runVDBCleanUp(vdbName, vdbVersion);
+ runVDBCleanUp(connection.getVdbName(), connection.getVdbVersion());
inuseVDBs.remove(key);
}
else {
@@ -1288,15 +1284,12 @@
}
}
}
-
};
}
- /**
- * @see com.metamatrix.dqp.service.ConfigurationService#getClientConnections()
- */
- public Set<ServerConnection> getClientConnections() {
- return new HashSet<ServerConnection>(clientConnections);
+ @Override
+ public Set<DQPWorkContext> getClientConnections() {
+ return new HashSet<DQPWorkContext>(clientConnections);
}
/**
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -55,7 +55,6 @@
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.api.ServerConnectionFactory;
-import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.log.LogManager;
@@ -76,6 +75,7 @@
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
+import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
@@ -96,35 +96,15 @@
private ClientServiceRegistry clientServices;
private String workspaceDirectory;
private boolean init = false;
- private ConnectionListenerList listenerList = new ConnectionListenerList();
private SocketTransport socketTransport;
private JMXUtil jmxServer;
private boolean restart = false;
- private final class ConnectionListenerList extends ArrayList<ServerConnectionListener> implements ServerConnectionListener{
-
- @Override
- public void connectionAdded(ServerConnection connection) {
- for (ServerConnectionListener l: this) {
- l.connectionAdded(connection);
- }
- }
-
- @Override
- public void connectionRemoved(ServerConnection connection) {
- for (ServerConnectionListener l: this) {
- l.connectionRemoved(connection);
- }
- }
- }
-
@Override
public ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
try {
-
initialize(connectionProperties);
- return new LocalServerConnection(connectionProperties, this.clientServices, listenerList);
-
+ return new LocalServerConnection(connectionProperties, this.clientServices);
} catch (ApplicationInitializationException e) {
throw new ConnectionException(e.getCause());
}
@@ -177,7 +157,8 @@
// make the configuration service listen for the connection life-cycle events
// used during VDB delete
ConfigurationService configService = (ConfigurationService)findService(DQPServiceNames.CONFIGURATION_SERVICE);
-
+
+ //in new class loader - all of these should be created lazily and held locally
this.clientServices = createClientServices(configService);
// start socket transport
@@ -186,9 +167,6 @@
this.socketTransport = new SocketTransport(props, this.clientServices, (SessionServiceInterface)findService(DQPServiceNames.SESSION_SERVICE));
this.socketTransport.start();
}
-
- //in new class loader - all of these should be created lazily and held locally
- listenerList.add(configService.getConnectionListener());
this.shutdownThread = new ShutdownWork();
Runtime.getRuntime().addShutdownHook(this.shutdownThread);
@@ -202,14 +180,10 @@
ClientServiceRegistry services = new ClientServiceRegistry();
SessionServiceInterface sessionService = (SessionServiceInterface)this.dqp.getEnvironment().findService(DQPServiceNames.SESSION_SERVICE);
- services.registerClientService(ILogon.class, new LogonImpl(sessionService, configService.getClusterName()), com.metamatrix.common.util.LogConstants.CTX_SERVER);
+ services.registerClientService(ILogon.class, new LogonImpl(sessionService, configService.getClusterName(), configService.getConnectionListener()), com.metamatrix.common.util.LogConstants.CTX_SERVER);
- try {
- Admin roleCheckedServerAdmin = wrapAdminService(Admin.class, getAdminAPI(null));
- services.registerClientService(Admin.class, roleCheckedServerAdmin, com.metamatrix.common.util.LogConstants.CTX_ADMIN);
- } catch (AdminException e) {
- // ignore; exception is not thrown in this case.
- }
+ Admin roleCheckedServerAdmin = wrapAdminService(Admin.class, getAdminAPI());
+ services.registerClientService(Admin.class, roleCheckedServerAdmin, com.metamatrix.common.util.LogConstants.CTX_ADMIN);
services.registerClientService(ClientSideDQP.class, this.dqp, LogConstants.CTX_QUERY_SERVICE);
@@ -391,8 +365,7 @@
}
}
- @Override
- public Admin getAdminAPI(Properties connectionProperties) throws AdminException {
+ private Admin getAdminAPI() {
InvocationHandler handler = new MixinProxy(new Object[] {
new DQPConfigAdminImpl(this),
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -100,6 +100,7 @@
protected MembershipServiceInterface membershipService;
protected VDBService vdbService;
protected LRUCache<VDBKey, Collection<AuthorizationPolicy>> policyCache = new LRUCache<VDBKey, Collection<AuthorizationPolicy>>();
+ private Collection<AuthorizationPolicy> adminPolicies;
// Permission factory is reusable and threadsafe
private static final BasicAuthorizationPermissionFactory PERMISSION_FACTORY = new BasicAuthorizationPermissionFactory();
@@ -420,6 +421,9 @@
this.policyCache.put(key, policies);
}
}
+ else {
+ // update admin roles.
+ }
}
/**
@@ -542,6 +546,11 @@
public void setMembershipService(MembershipServiceInterface membershipService) {
this.membershipService = membershipService;
}
+
+// @Inject
+// public void setAdminPolicies(Collection<AuthorizationPolicy> adminPolicies) {
+// this.adminPolicies = adminPolicies;
+// }
public void setUseEntitlements(boolean useEntitlements) {
this.useEntitlements = useEntitlements;
Modified: trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -36,7 +36,6 @@
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.comm.platform.CommPlatformPlugin;
@@ -51,12 +50,11 @@
private final LogonResult result;
private boolean shutdown;
private DQPWorkContext workContext;
- private ServerConnectionListener listener;
private ClassLoader classLoader;
ClientServiceRegistry clientServices;
- public LocalServerConnection(Properties connectionProperties, ClientServiceRegistry clientServices, ServerConnectionListener listener) throws CommunicationException, ConnectionException{
+ public LocalServerConnection(Properties connectionProperties, ClientServiceRegistry clientServices) throws CommunicationException, ConnectionException{
this.clientServices = clientServices;
@@ -66,12 +64,6 @@
this.result = authenticate(connectionProperties);
- this.listener = listener;
-
- if (this.listener != null) {
- this.listener.connectionAdded(this);
- }
-
this.classLoader = Thread.currentThread().getContextClassLoader();
}
@@ -124,9 +116,6 @@
if (shutdown) {
return;
}
- if (this.listener != null) {
- this.listener.connectionRemoved(this);
- }
this.shutdown = true;
}
Modified: trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -41,6 +41,7 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.dqp.client.ResultsFuture;
+import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.jdbc.api.ConnectionProperties;
import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.Credentials;
@@ -56,10 +57,12 @@
private SessionServiceInterface service;
private String clusterName;
+ private ServerConnectionListener connListener;
- public LogonImpl(SessionServiceInterface service, String clusterName) {
+ public LogonImpl(SessionServiceInterface service, String clusterName, ServerConnectionListener connListener) {
this.service = service;
this.clusterName = clusterName;
+ this.connListener = connListener;
}
public LogonResult logon(Properties connProps) throws LogonException,
@@ -82,13 +85,10 @@
Object payload = connProps.get(MMURL.CONNECTION.CLIENT_TOKEN_PROP);
try {
- MetaMatrixSessionInfo sessionInfo = service.createSession(user,
- credential, (Serializable) payload, applicationName,
- connProps);
- // logon
+ MetaMatrixSessionInfo sessionInfo = service.createSession(user,credential, (Serializable) payload, applicationName, connProps);
MetaMatrixSessionID sessionID = updateDQPContext(sessionInfo);
- LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {
- "Logon successful for \"", user, "\" - created SessionID \"", "" + sessionID, "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ this.connListener.connectionAdded(DQPWorkContext.getWorkContext());
+ LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {"Logon successful for \"", user, "\" - created SessionID \"", "" + sessionID, "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
return new LogonResult(sessionInfo.getSessionToken(), sessionInfo.getProductInfo(), clusterName);
} catch (MetaMatrixAuthenticationException e) {
throw new LogonException(e, e.getMessage());
@@ -150,6 +150,7 @@
public ResultsFuture<?> logoff() throws InvalidSessionException, MetaMatrixComponentException {
try {
this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
+ this.connListener.connectionRemoved(DQPWorkContext.getWorkContext());
} catch (SessionServiceException e) {
throw new MetaMatrixComponentException(e);
}
Modified: trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -49,6 +49,7 @@
import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
import com.metamatrix.common.comm.platform.socket.client.UrlServerDiscovery;
import com.metamatrix.common.util.crypto.NullCryptor;
+import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
@@ -73,7 +74,7 @@
@Test public void testFailedConnect() throws Exception {
ClientServiceRegistry csr = new ClientServiceRegistry();
SessionServiceInterface sessionService = mock(SessionServiceInterface.class);
- csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster"), "foo"); //$NON-NLS-1$ //$NON-NLS-2$
+ csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster", mock(ServerConnectionListener.class)), "foo"); //$NON-NLS-1$ //$NON-NLS-2$
listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
csr, 1024, 1024, 1, null, true, sessionService);
@@ -144,7 +145,7 @@
if (listener == null) {
SessionServiceInterface sessionService = mock(SessionServiceInterface.class);
ClientServiceRegistry csr = new ClientServiceRegistry();
- csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster") { //$NON-NLS-1$
+ csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster", mock(ServerConnectionListener.class)) { //$NON-NLS-1$
@Override
public LogonResult logon(Properties connProps)
throws LogonException, ComponentNotFoundException {
Modified: trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java
===================================================================
--- trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -23,14 +23,18 @@
package org.teiid.transport;
+import static org.mockito.Mockito.mock;
+
import java.util.Properties;
import junit.framework.TestCase;
import org.mockito.Mockito;
+import org.teiid.dqp.internal.process.DQPWorkContext;
import com.metamatrix.api.exception.security.LogonException;
import com.metamatrix.common.api.MMURL;
+import com.metamatrix.dqp.service.ServerConnectionListener;
import com.metamatrix.platform.security.api.LogonResult;
import com.metamatrix.platform.security.api.MetaMatrixSessionID;
import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
@@ -55,16 +59,22 @@
Mockito.stub(ssi.createSession(userName, null, null, applicationName,
p)).toReturn(resultInfo);
- LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
+ ServerConnectionListener listener = mock(ServerConnectionListener.class);
+ LogonImpl impl = new LogonImpl(ssi, "fakeCluster", listener); //$NON-NLS-1$
LogonResult result = impl.logon(p);
assertEquals(userName, result.getUserName());
assertEquals(new MetaMatrixSessionID(1), result.getSessionID());
+ Mockito.verify(listener, Mockito.times(1)).connectionAdded((DQPWorkContext)Mockito.anyObject());
+ Mockito.verify(listener, Mockito.times(0)).connectionRemoved((DQPWorkContext)Mockito.anyObject());
+
+ impl.logoff();
+ Mockito.verify(listener, Mockito.times(1)).connectionRemoved((DQPWorkContext)Mockito.anyObject());
}
public void testCredentials() throws Exception {
SessionServiceInterface ssi = Mockito.mock(SessionServiceInterface.class);
- LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
+ LogonImpl impl = new LogonImpl(ssi, "fakeCluster", mock(ServerConnectionListener.class)); //$NON-NLS-1$
Properties p = new Properties();
p.put(MMURL.CONNECTION.CLIENT_TOKEN_PROP, new Object());
//invalid credentials
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -28,11 +28,11 @@
import java.util.Properties;
import java.util.Set;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.ClassLoaderManager;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
import com.metamatrix.common.config.api.ConnectorBinding;
@@ -371,7 +371,7 @@
* This returns the active client connections that have been made to the DQP
* @return list of connections which are currently available;never null
*/
- public Set<ServerConnection> getClientConnections();
+ public Set<DQPWorkContext> getClientConnections();
/**
* Gets the processor batch size
Copied: trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java (from rev 1089, trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionListener.java)
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java (rev 0)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.dqp.service;
+
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+
+
+/**
+ * An implementor of this interface, when registered with the ServerConnection will
+ * receive notifications about the connection life cycle events.
+ */
+public interface ServerConnectionListener {
+ /**
+ * A connection has been added to DQP
+ * @param connection The client connection instance, never null
+ */
+ void connectionAdded(DQPWorkContext context);
+
+ /**
+ * A connection has been removed for DQP
+ * @param connection The client connection instance, never null
+ */
+ void connectionRemoved(DQPWorkContext context);
+
+}
Property changes on: trunk/engine/src/main/java/com/metamatrix/dqp/service/ServerConnectionListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/pom.xml 2009-07-02 19:57:16 UTC (rev 1093)
@@ -80,13 +80,16 @@
<configuration>
<descriptors>
<descriptor>build/assembly/src.xml</descriptor>
- <!-- <descriptor>build/assembly/bin.xml</descriptor>-->
- <descriptor>build/assembly/embedded/embedded-client-jar.xml</descriptor>
+ <descriptor>build/assembly/client-jar.xml</descriptor>
<descriptor>build/assembly/embedded/embedded-dependencies.xml</descriptor>
<descriptor>build/assembly/embedded/embedded-dist.xml</descriptor>
<descriptor>build/assembly/cdk/cdk-dependencies.xml</descriptor>
<descriptor>build/assembly/cdk/cdk-dist.xml</descriptor>
+ <descriptor>build/assembly/adminshell/adminshell-dependencies.xml</descriptor>
+ <descriptor>build/assembly/adminshell/adminshell-dist.xml</descriptor>
+ <!--
<descriptor>documentation/assembly/docs.xml</descriptor>
+ -->
</descriptors>
<outputDirectory>target/distribution</outputDirectory>
<workDirectory>target/assembly/work</workDirectory>
Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-07-01 19:04:52 UTC (rev 1092)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-07-02 19:57:16 UTC (rev 1093)
@@ -243,7 +243,7 @@
* @throws ConfigurationException
*/
private void registerILogonAPI() throws ConfigurationException, ServiceException {
- this.clientServices.registerClientService(ILogon.class, new LogonImpl(PlatformProxyHelper.getSessionServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL), CurrentConfiguration.getInstance().getClusterName()), LogCommonConstants.CTX_LOGON);
+ this.clientServices.registerClientService(ILogon.class, new LogonImpl(PlatformProxyHelper.getSessionServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL), CurrentConfiguration.getInstance().getClusterName(), null), LogCommonConstants.CTX_LOGON);
}
/**
15 years, 5 months
teiid SVN: r1092 - trunk/common-internal/src/main/java/com/metamatrix/common/config/xml.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-07-01 15:04:52 -0400 (Wed, 01 Jul 2009)
New Revision: 1092
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/ConnectorArchiveImportExportUtility.java
Log:
changing to just use a temp file
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/ConnectorArchiveImportExportUtility.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/ConnectorArchiveImportExportUtility.java 2009-07-01 19:04:16 UTC (rev 1091)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/ConnectorArchiveImportExportUtility.java 2009-07-01 19:04:52 UTC (rev 1092)
@@ -31,7 +31,6 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Properties;
-import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
@@ -54,7 +53,6 @@
import com.metamatrix.common.util.ByteArrayHelper;
import com.metamatrix.common.util.LogConstants;
import com.metamatrix.core.util.FileUtils;
-import com.metamatrix.core.util.TempDirectory;
import com.metamatrix.internal.core.xml.JdomHelper;
@@ -78,7 +76,6 @@
private static final String SHARED = "Shared"; //$NON-NLS-1$
private static final String MANIFEST_XML = "Manifest.xml"; //$NON-NLS-1$
private static final String FWD_SLASH= "/"; //$NON-NLS-1$
- static Random random = new Random();
/**
* The Zip file stream format is look like this.Also onlu used to
@@ -102,12 +99,8 @@
BasicConnectorArchive archive = new BasicConnectorArchive();
- // Create a temporary directory and write zip the zip as this may
- // be serveral mega bytes big
- TempDirectory tempDir = new TempDirectory(System.currentTimeMillis(), random.nextLong());
- tempDir.create();
+ File cafFile = File.createTempFile("ConnectorArchive", ".zip"); //$NON-NLS-1$ //$NON-NLS-2$
try {
- File cafFile = new File(tempDir.getPath(), "ConnectorArchive_"+random.nextLong()+".zip"); //$NON-NLS-1$ //$NON-NLS-2$
FileUtils.write(stream, cafFile);
// First extract all the Connector Types in the zip file
@@ -122,7 +115,7 @@
// finally extract the manifest file
extractManifest(cafFile, archive);
}finally {
- tempDir.remove();
+ cafFile.delete();
}
// before we return validate the archive
15 years, 5 months
teiid SVN: r1091 - trunk/client-jdbc/src/main/java/com/metamatrix/jdbc.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-07-01 15:04:16 -0400 (Wed, 01 Jul 2009)
New Revision: 1091
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
Log:
updating exception message for failed driver loads
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-06-30 21:19:01 UTC (rev 1090)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-07-01 19:04:16 UTC (rev 1091)
@@ -378,7 +378,7 @@
Class<?> clazz = this.classLoader.loadClass(className);
this.connectionFactory = (ServerConnectionFactory)clazz.newInstance();
} catch (Exception e) {
- throw MMSQLException.create(e);
+ throw MMSQLException.create(e, "Could not load the embedded server, please ensure that your classpath is set correctly."); //$NON-NLS-1$
} finally {
Thread.currentThread().setContextClassLoader(current);
}
15 years, 5 months