teiid SVN: r1090 - in trunk: client/src/main/java/com/metamatrix/admin/api/exception and 43 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-06-30 17:19:01 -0400 (Tue, 30 Jun 2009)
New Revision: 1090
Added:
trunk/client/src/main/java/org/teiid/adminapi/
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java
trunk/client/src/main/java/org/teiid/adminapi/AdminException.java
trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java
trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java
trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java
trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java
trunk/client/src/main/java/org/teiid/adminapi/AdminStatus.java
trunk/client/src/main/java/org/teiid/adminapi/Cache.java
trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java
trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java
trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java
trunk/client/src/main/java/org/teiid/adminapi/DQP.java
trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java
trunk/client/src/main/java/org/teiid/adminapi/Entitlement.java
trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java
trunk/client/src/main/java/org/teiid/adminapi/Group.java
trunk/client/src/main/java/org/teiid/adminapi/Host.java
trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java
trunk/client/src/main/java/org/teiid/adminapi/Model.java
trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/Principal.java
trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java
trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java
trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java
trunk/client/src/main/java/org/teiid/adminapi/Request.java
trunk/client/src/main/java/org/teiid/adminapi/Resource.java
trunk/client/src/main/java/org/teiid/adminapi/Role.java
trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/ScriptsContainer.java
trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/Service.java
trunk/client/src/main/java/org/teiid/adminapi/Session.java
trunk/client/src/main/java/org/teiid/adminapi/SystemObject.java
trunk/client/src/main/java/org/teiid/adminapi/Transaction.java
trunk/client/src/main/java/org/teiid/adminapi/User.java
trunk/client/src/main/java/org/teiid/adminapi/VDB.java
trunk/server/src/main/java/com/metamatrix/admin/api/
trunk/server/src/main/java/com/metamatrix/admin/api/server/
trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerAdmin.java
trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java
trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java
trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerRuntimeStateAdmin.java
trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerSecurityAdmin.java
Removed:
trunk/client/src/main/java/com/metamatrix/admin/api/core/
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/
trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminComponentException.java
trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminException.java
trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminProcessingException.java
trunk/client/src/main/java/com/metamatrix/admin/api/objects/
trunk/client/src/main/java/com/metamatrix/admin/api/server/
Modified:
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/api/Connection.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractMMQueryTestCase.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/AdminApiServerDiscovery.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
trunk/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java
trunk/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestAdminApiServerDiscovery.java
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServiceRegistry.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentTypePropDefn.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLHelperImpl.java
trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinition.java
trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinitionImpl.java
trunk/common-internal/src/main/java/com/metamatrix/vdb/runtime/BasicModelInfo.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.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/jdbc/EmbeddedConnectionFactoryImpl.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
trunk/embedded/src/main/java/org/teiid/Server.java
trunk/embedded/src/main/java/org/teiid/ServerMBean.java
trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.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/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java
trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerSecurityAdminImpl.java
trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/AuthorizationAdminAPIImpl.java
trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ConfigurationAdminAPIImpl.java
trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ExtensionSourceAdminAPIImpl.java
trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java
trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java
trunk/server/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java
trunk/server/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java
trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java
trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java
trunk/server/src/test/java/com/metamatrix/admin/server/IdentifierConstants.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerRuntimeStateAdminImpl.java
Log:
TEIID-697: moved the admin api to single package (core+embedded-server); and bought in some of the needed methods from the server admin api into core one.
Deleted: trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminComponentException.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminComponentException.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminComponentException.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -1,75 +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.admin.api.exception;
-
-
-/**
- * An <code>AdminComponentException</code> is thrown when an error occurs as a
- * result of an internal component error.
- *
- * <p>This exception class is capable of containing multiple exceptions. See
- * {@link AdminException} for details.
- */
-public final class AdminComponentException extends AdminException {
-
- /**
- * No-arg ctor.
- *
- * @since 4.3
- */
- public AdminComponentException() {
- super();
- }
-
- /**
- * Construct with a message.
- * @param msg the error message.
- * @since 4.3
- */
- public AdminComponentException(String msg) {
- super(msg);
- }
-
- public AdminComponentException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Construct with an optional error code and a message.
- * @param code an optional error code
- * @param msg the error message.
- * @since 4.3
- */
- public AdminComponentException(int code, String msg) {
- super(code, msg);
- }
-
- public AdminComponentException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
- public AdminComponentException(int code, String msg, Throwable cause) {
- super(code, msg, cause);
- }
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminException.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminException.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminException.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -1,123 +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.admin.api.exception;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.metamatrix.core.MetaMatrixCoreException;
-
-/**
- * <code>AdminException</code> is the base exception for the admin package. Many *Admin methods throw this
- * exception. Instances will be one of the concrete subtypes:
- * {@link AdminComponentException} or {@link AdminProcessingException}</p>
- *
- * <p><code>AdminException</code>s may contain multiple child exceptions. An example
- * of this could be when performing an admin action results in multiple failures. Admin
- * clients should be aware of this and use the {@link #hasMultiple()} method to
- * determine if they need to check the child exceptions.</p>
- */
-public abstract class AdminException extends MetaMatrixCoreException {
-
- // List of Admin exceptions in
- // case of multiple failure
- private List children;
-
- /**
- * No-arg ctor.
- *
- * @since 4.3
- */
- AdminException() {
- super();
- }
-
- /**
- * Construct with a message.
- * @param msg the error message.
- * @since 4.3
- */
- AdminException(String msg) {
- super(msg);
- }
-
- AdminException(Throwable cause) {
- this(cause.getMessage(), cause);
- }
-
- /**
- * Construct with an optional error code and a message.
- * @param code an optional error code
- * @param msg the error message.
- * @since 4.3
- */
- AdminException(int code, String msg) {
- super(Integer.toString(code), msg);
- }
-
- AdminException(String msg, Throwable cause) {
- super(cause, msg);
- }
-
- AdminException(int code, String msg, Throwable cause) {
- super(cause, Integer.toString(code),msg);
- }
-
- /**
- * Determine whether this exception is representing
- * mutliple component failures.
- * @return <code>true</code> iff this exception contains multiple
- * component failure exceptions.
- * @since 4.3
- */
- public boolean hasMultiple() {
- return (children != null && children.size() > 0);
- }
-
- /**
- * Returns a non-null list of failures (<code>AdminException</code>s), one for each
- * component that failed.
- *
- * <p>The list will have members when {@link #hasMultiple()} returns <code>true</code>.</p>
- * @return The non-null list of failures.
- * @since 4.3
- */
- public List getChildren() {
- return (children != null ? children : Collections.EMPTY_LIST);
- }
-
- /**
- * Add a child <code>AdminException</code> for a particular failure
- * if and action resulted in multiple failures.
- *
- * @param child a specific failure
- * @since 4.3
- */
- public void addChild(AdminException child) {
- if ( children == null ) {
- children = new ArrayList();
- }
- children.add(child);
- }
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminProcessingException.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminProcessingException.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminProcessingException.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -1,76 +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.admin.api.exception;
-
-
-/**
- * An <code>AdminProcessingException</code> indicates that an error occured during processing as a result
- * of user input. This exception is the result of handling an invalid user
- * request, not the result of an internal error.</p>
- *
- * <p>This exception class is capable of containing multiple exceptions. See
- * {@link AdminException} for details.
- */
-public final class AdminProcessingException extends AdminException {
-
- /**
- * No-arg ctor.
- *
- * @since 4.3
- */
- public AdminProcessingException() {
- super();
- }
-
- /**
- * Construct with a message.
- * @param msg the error message.
- * @since 4.3
- */
- public AdminProcessingException(String msg) {
- super(msg);
- }
-
- public AdminProcessingException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Construct with an optional error code and a message.
- * @param code an optional error code
- * @param msg the error message.
- * @since 4.3
- */
- public AdminProcessingException(int code, String msg) {
- super(code, msg);
- }
-
- public AdminProcessingException(String msg, Throwable cause) {
- super(msg);
- }
-
- public AdminProcessingException(int code, String msg, Throwable cause) {
- super(code, msg, cause);
- }
-
-}
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminObject.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -28,11 +28,12 @@
import java.util.List;
import java.util.Properties;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Transaction;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.util.StringUtil;
@@ -101,27 +102,27 @@
static {
- objectTypeMap.put(com.metamatrix.admin.api.objects.Cache.class.getName(), new Integer(OBJECT_TYPE_CACHE));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Service.class.getName(), new Integer(OBJECT_TYPE_SERVICE));
- objectTypeMap.put(com.metamatrix.admin.api.objects.ConnectorBinding.class.getName(), new Integer(OBJECT_TYPE_CONNECTOR_BINDING));
- objectTypeMap.put(com.metamatrix.admin.api.objects.ConnectorType.class.getName(), new Integer(OBJECT_TYPE_CONNECTOR_TYPE));
- objectTypeMap.put(com.metamatrix.admin.api.objects.DQP.class.getName(), new Integer(OBJECT_TYPE_DQP));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Entitlement.class.getName(), new Integer(OBJECT_TYPE_ENTITLEMENT));
- objectTypeMap.put(com.metamatrix.admin.api.objects.ExtensionModule.class.getName(), new Integer(OBJECT_TYPE_EXTENSION_MODULE));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Group.class.getName(), new Integer(OBJECT_TYPE_GROUP));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Host.class.getName(), new Integer(OBJECT_TYPE_HOST));
- objectTypeMap.put(com.metamatrix.admin.api.objects.LogConfiguration.class.getName(), new Integer(OBJECT_TYPE_LOG_CONFIGURATION));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Model.class.getName(), new Integer(OBJECT_TYPE_MODEL));
- objectTypeMap.put(com.metamatrix.admin.api.objects.ProcessObject.class.getName(), new Integer(OBJECT_TYPE_PROCESS_OBJECT));
- objectTypeMap.put(com.metamatrix.admin.api.objects.PropertyDefinition.class.getName(), new Integer(OBJECT_TYPE_PROPERTY_DEFINITION));
- objectTypeMap.put(com.metamatrix.admin.api.objects.QueueWorkerPool.class.getName(), new Integer(OBJECT_TYPE_QUEUE_WORKER_POOL));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Request.class.getName(), new Integer(OBJECT_TYPE_REQUEST));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Resource.class.getName(), new Integer(OBJECT_TYPE_RESOURCE));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Role.class.getName(), new Integer(OBJECT_TYPE_ROLE));
- objectTypeMap.put(com.metamatrix.admin.api.objects.Session.class.getName(), new Integer(OBJECT_TYPE_SESSION));
- objectTypeMap.put(com.metamatrix.admin.api.objects.SystemObject.class.getName(), new Integer(OBJECT_TYPE_SYSTEM_OBJECT));
- objectTypeMap.put(com.metamatrix.admin.api.objects.User.class.getName(), new Integer(OBJECT_TYPE_USER));
- objectTypeMap.put(com.metamatrix.admin.api.objects.VDB.class.getName(), new Integer(OBJECT_TYPE_VDB));
+ objectTypeMap.put(org.teiid.adminapi.Cache.class.getName(), new Integer(OBJECT_TYPE_CACHE));
+ objectTypeMap.put(org.teiid.adminapi.Service.class.getName(), new Integer(OBJECT_TYPE_SERVICE));
+ objectTypeMap.put(org.teiid.adminapi.ConnectorBinding.class.getName(), new Integer(OBJECT_TYPE_CONNECTOR_BINDING));
+ objectTypeMap.put(org.teiid.adminapi.ConnectorType.class.getName(), new Integer(OBJECT_TYPE_CONNECTOR_TYPE));
+ objectTypeMap.put(org.teiid.adminapi.DQP.class.getName(), new Integer(OBJECT_TYPE_DQP));
+ objectTypeMap.put(org.teiid.adminapi.Entitlement.class.getName(), new Integer(OBJECT_TYPE_ENTITLEMENT));
+ objectTypeMap.put(org.teiid.adminapi.ExtensionModule.class.getName(), new Integer(OBJECT_TYPE_EXTENSION_MODULE));
+ objectTypeMap.put(org.teiid.adminapi.Group.class.getName(), new Integer(OBJECT_TYPE_GROUP));
+ objectTypeMap.put(org.teiid.adminapi.Host.class.getName(), new Integer(OBJECT_TYPE_HOST));
+ objectTypeMap.put(org.teiid.adminapi.LogConfiguration.class.getName(), new Integer(OBJECT_TYPE_LOG_CONFIGURATION));
+ objectTypeMap.put(org.teiid.adminapi.Model.class.getName(), new Integer(OBJECT_TYPE_MODEL));
+ objectTypeMap.put(org.teiid.adminapi.ProcessObject.class.getName(), new Integer(OBJECT_TYPE_PROCESS_OBJECT));
+ objectTypeMap.put(org.teiid.adminapi.PropertyDefinition.class.getName(), new Integer(OBJECT_TYPE_PROPERTY_DEFINITION));
+ objectTypeMap.put(org.teiid.adminapi.QueueWorkerPool.class.getName(), new Integer(OBJECT_TYPE_QUEUE_WORKER_POOL));
+ objectTypeMap.put(org.teiid.adminapi.Request.class.getName(), new Integer(OBJECT_TYPE_REQUEST));
+ objectTypeMap.put(org.teiid.adminapi.Resource.class.getName(), new Integer(OBJECT_TYPE_RESOURCE));
+ objectTypeMap.put(org.teiid.adminapi.Role.class.getName(), new Integer(OBJECT_TYPE_ROLE));
+ objectTypeMap.put(org.teiid.adminapi.Session.class.getName(), new Integer(OBJECT_TYPE_SESSION));
+ objectTypeMap.put(org.teiid.adminapi.SystemObject.class.getName(), new Integer(OBJECT_TYPE_SYSTEM_OBJECT));
+ objectTypeMap.put(org.teiid.adminapi.User.class.getName(), new Integer(OBJECT_TYPE_USER));
+ objectTypeMap.put(org.teiid.adminapi.VDB.class.getName(), new Integer(OBJECT_TYPE_VDB));
objectTypeMap.put(Transaction.class.getName(), Integer.valueOf(OBJECT_TYPE_TRANSACTION));
}
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMAdminStatus.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import java.io.Serializable;
+import org.teiid.adminapi.AdminStatus;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.AdminStatus;
/**
@@ -79,7 +80,7 @@
/**
- * @see com.metamatrix.admin.api.objects.AdminStatus#getCode()
+ * @see org.teiid.adminapi.AdminStatus#getCode()
* @since 4.3
*/
public int getCode() {
@@ -87,7 +88,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.AdminStatus#getMessage()
+ * @see org.teiid.adminapi.AdminStatus#getMessage()
* @since 4.3
*/
public String getMessage() {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -1,6 +1,6 @@
package com.metamatrix.admin.objects;
-import com.metamatrix.admin.api.objects.ConnectionPool;
+import org.teiid.adminapi.ConnectionPool;
public class MMConnectionPool extends MMAdminObject implements ConnectionPool {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import java.util.Date;
+import org.teiid.adminapi.ConnectorBinding;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
/**
@@ -220,7 +221,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.ConnectorBinding#getConnectorTypeName()
+ * @see org.teiid.adminapi.ConnectorBinding#getConnectorTypeName()
* @since 4.3
*/
public String getConnectorTypeName() {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,8 +22,9 @@
package com.metamatrix.admin.objects;
+import org.teiid.adminapi.ConnectorType;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.ConnectorType;
/**
* Dataholder for a connector type.
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMDQP.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import java.util.Date;
+import org.teiid.adminapi.DQP;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.DQP;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,8 +22,9 @@
package com.metamatrix.admin.objects;
+import org.teiid.adminapi.ExtensionModule;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.ExtensionModule;
/**
* A simple Extension Modules for the Admin API
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,7 +22,7 @@
package com.metamatrix.admin.objects;
-import com.metamatrix.admin.api.objects.Group;
+import org.teiid.adminapi.Group;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMHost.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,8 +22,9 @@
package com.metamatrix.admin.objects;
+import org.teiid.adminapi.Host;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.Host;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMLogConfiguration.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -26,9 +26,10 @@
import java.util.Map;
import java.util.Set;
-import com.metamatrix.admin.api.objects.LogConfiguration;
+import org.teiid.adminapi.LogConfiguration;
+
/**
* @since 4.3
*/
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -25,8 +25,9 @@
import java.util.ArrayList;
import java.util.List;
+import org.teiid.adminapi.Model;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.Model;
/**
*/
@@ -69,7 +70,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Model#getConnectorBindingNames()
+ * @see org.teiid.adminapi.Model#getConnectorBindingNames()
* @since 4.3
*/
public List getConnectorBindingNames() {
@@ -77,7 +78,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Model#isPhysical()
+ * @see org.teiid.adminapi.Model#isPhysical()
* @since 4.3
*/
public boolean isPhysical() {
@@ -85,7 +86,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Model#isVisible()
+ * @see org.teiid.adminapi.Model#isVisible()
* @since 4.3
*/
public boolean isVisible() {
@@ -93,7 +94,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Model#getModelType()
+ * @see org.teiid.adminapi.Model#getModelType()
* @since 4.3
*/
public String getModelType() {
@@ -101,7 +102,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Model#getModelURI()
+ * @see org.teiid.adminapi.Model#getModelURI()
* @since 4.3
*/
public String getModelURI() {
@@ -109,7 +110,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Model#supportsMultiSourceBindings()
+ * @see org.teiid.adminapi.Model#supportsMultiSourceBindings()
* @since 4.3
*/
public boolean supportsMultiSourceBindings() {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMPrincipal.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,7 +22,7 @@
package com.metamatrix.admin.objects;
-import com.metamatrix.admin.api.objects.Principal;
+import org.teiid.adminapi.Principal;
/**
@@ -60,7 +60,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Principal#getType()
+ * @see org.teiid.adminapi.Principal#getType()
* @since 4.3
*/
public int getType() {
@@ -68,7 +68,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Principal#getTypeLabel()
+ * @see org.teiid.adminapi.Principal#getTypeLabel()
* @since 4.3
*/
public String getTypeLabel() {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,10 +24,11 @@
import java.net.InetAddress;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.ProcessObject;
+import org.teiid.adminapi.QueueWorkerPool;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.ProcessObject;
-import com.metamatrix.admin.api.objects.QueueWorkerPool;
/**
* Data holder for information about a Process.
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -25,8 +25,9 @@
import java.util.ArrayList;
import java.util.Collection;
+import org.teiid.adminapi.PropertyDefinition;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.PropertyDefinition;
/**
@@ -87,7 +88,7 @@
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getValue()
+ * @see org.teiid.adminapi.PropertyDefinition#getValue()
* @since 4.3
*/
public String getValue() {
@@ -95,7 +96,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getAllowedValues()
+ * @see org.teiid.adminapi.PropertyDefinition#getAllowedValues()
* @since 4.3
*/
public Collection getAllowedValues() {
@@ -103,7 +104,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getDefaultValue()
+ * @see org.teiid.adminapi.PropertyDefinition#getDefaultValue()
* @since 4.3
*/
public Object getDefaultValue() {
@@ -111,7 +112,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getDescription()
+ * @see org.teiid.adminapi.PropertyDefinition#getDescription()
* @since 4.3
*/
public String getDescription() {
@@ -119,7 +120,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getDisplayName()
+ * @see org.teiid.adminapi.PropertyDefinition#getDisplayName()
* @since 4.3
*/
public String getDisplayName() {
@@ -127,7 +128,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getPropertyType()
+ * @see org.teiid.adminapi.PropertyDefinition#getPropertyType()
* @since 4.3
*/
public String getPropertyType() {
@@ -135,7 +136,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getPropertyTypeClassName()
+ * @see org.teiid.adminapi.PropertyDefinition#getPropertyTypeClassName()
* @since 4.3
*/
public String getPropertyTypeClassName() {
@@ -144,7 +145,7 @@
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#getRequiresRestart()
+ * @see org.teiid.adminapi.PropertyDefinition#getRequiresRestart()
* @since 4.3
*/
public RestartType getRequiresRestart() {
@@ -152,7 +153,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#isExpert()
+ * @see org.teiid.adminapi.PropertyDefinition#isExpert()
* @since 4.3
*/
public boolean isExpert() {
@@ -160,7 +161,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#isMasked()
+ * @see org.teiid.adminapi.PropertyDefinition#isMasked()
* @since 4.3
*/
public boolean isMasked() {
@@ -168,7 +169,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#isModifiable()
+ * @see org.teiid.adminapi.PropertyDefinition#isModifiable()
* @since 4.3
*/
public boolean isModifiable() {
@@ -176,7 +177,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.PropertyDefinition#isRequired()
+ * @see org.teiid.adminapi.PropertyDefinition#isRequired()
* @since 4.3
*/
public boolean isRequired() {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,8 +22,9 @@
package com.metamatrix.admin.objects;
+import org.teiid.adminapi.QueueWorkerPool;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.QueueWorkerPool;
/**
* Dataholder for all the statistics gathered about a worker pool.
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import java.util.Date;
+import org.teiid.adminapi.Request;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.Request;
import com.metamatrix.core.util.DateUtil;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,8 +22,9 @@
package com.metamatrix.admin.objects;
+import org.teiid.adminapi.Resource;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.Resource;
/**
* Dataholder for a resource.
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,9 +24,10 @@
import java.util.Properties;
-import com.metamatrix.admin.api.objects.Role;
+import org.teiid.adminapi.Role;
+
/**
* @since 4.3
*/
@@ -52,7 +53,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.AdminObject#getIdentifier()
+ * @see org.teiid.adminapi.AdminObject#getIdentifier()
* @since 4.3
*/
public String getIdentifier() {
@@ -60,7 +61,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.AdminObject#getName()
+ * @see org.teiid.adminapi.AdminObject#getName()
* @since 4.3
*/
public String getName() {
@@ -70,7 +71,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.AdminObject#getProperties()
+ * @see org.teiid.adminapi.AdminObject#getProperties()
* @since 4.3
*/
public Properties getProperties() {
@@ -78,7 +79,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.AdminObject#getPropertyValue(java.lang.String)
+ * @see org.teiid.adminapi.AdminObject#getPropertyValue(java.lang.String)
* @since 4.3
*/
public String getPropertyValue(String name) {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMScriptsContainer.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -30,12 +30,13 @@
import java.util.Iterator;
import java.util.Map;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.ScriptsContainer;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.objects.ScriptsContainer;
import com.metamatrix.core.util.FileUtils;
@@ -58,7 +59,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.ScriptsContainer#getFileNames()
+ * @see org.teiid.adminapi.ScriptsContainer#getFileNames()
* @since 4.3
*/
public Collection getFileNames() {
@@ -66,7 +67,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.ScriptsContainer#saveAllToDirectory(java.lang.String, AdminOptions)
+ * @see org.teiid.adminapi.ScriptsContainer#saveAllToDirectory(java.lang.String, AdminOptions)
* @since 4.3
*/
public void saveAllToDirectory(String directoryLocation, AdminOptions options) throws AdminException {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,9 +24,10 @@
import java.util.Date;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Service;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.Service;
/**
@@ -199,7 +200,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.Service#getComponentTypeName()
+ * @see org.teiid.adminapi.Service#getComponentTypeName()
* @since 6.1
*/
public String getComponentTypeName() {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import java.util.Date;
+import org.teiid.adminapi.Session;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.Session;
import com.metamatrix.core.util.DateUtil;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMSystem.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import java.util.Date;
+import org.teiid.adminapi.SystemObject;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.SystemObject;
import com.metamatrix.core.util.DateUtil;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMUser.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,7 +22,7 @@
package com.metamatrix.admin.objects;
-import com.metamatrix.admin.api.objects.User;
+import org.teiid.adminapi.User;
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -25,9 +25,10 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
+
+import org.teiid.adminapi.VDB;
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.VDB;
import com.metamatrix.core.util.HashCodeUtil;
/**
@@ -208,7 +209,7 @@
}
/**
- * @see com.metamatrix.admin.api.objects.VDB#hasMaterializedViews()
+ * @see org.teiid.adminapi.VDB#hasMaterializedViews()
* @since 4.3
*/
public boolean hasMaterializedViews() {
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import javax.transaction.xa.Xid;
+import org.teiid.adminapi.Transaction;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.common.xa.MMXid;
public class TransactionImpl extends MMAdminObject implements Transaction {
Modified: trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/client/ExceptionUtil.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,9 +24,10 @@
import java.lang.reflect.Method;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.xa.XATransactionException;
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,11 +22,11 @@
package com.metamatrix.common.comm.api;
-import java.net.URL;
import java.util.Properties;
-import com.metamatrix.admin.api.core.Admin;
-import com.metamatrix.admin.api.exception.AdminException;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
@@ -49,6 +49,6 @@
/**
* Shutdown the connection factory, including the DQP and all its existing connections
*/
- public void shutdown();
+ public void shutdown(boolean restart);
}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -28,10 +28,11 @@
import java.lang.reflect.Proxy;
import java.util.Properties;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.server.ServerAdmin;
import com.metamatrix.api.exception.security.LogonException;
import com.metamatrix.client.ExceptionUtil;
import com.metamatrix.common.api.MMURL;
@@ -54,7 +55,7 @@
private final class ReconnectingProxy implements InvocationHandler {
- private ServerAdmin target;
+ private Admin target;
private ServerConnection registry;
private Properties p;
private boolean closed;
@@ -63,7 +64,7 @@
this.p = p;
}
- private synchronized ServerAdmin getTarget() throws AdminComponentException, CommunicationException {
+ private synchronized Admin getTarget() throws AdminComponentException, CommunicationException {
if (closed) {
throw new AdminComponentException(CommPlatformPlugin.Util.getString("ERR.014.001.0001")); //$NON-NLS-1$
}
@@ -75,7 +76,7 @@
} catch (ConnectionException e) {
throw new AdminComponentException(e.getMessage());
}
- target = registry.getService(ServerAdmin.class);
+ target = registry.getService(Admin.class);
return target;
}
@@ -93,8 +94,8 @@
try {
return method.invoke(getTarget(), args);
} catch (InvocationTargetException e) {
- if (method.getName().endsWith("bounceSystem") && ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) { //$NON-NLS-1$
- bounceSystem(((Boolean)args[0]).booleanValue());
+ if (method.getName().endsWith("restart") && ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) { //$NON-NLS-1$
+ bounceSystem(true);
return null;
}
throw e.getTargetException();
@@ -174,7 +175,7 @@
* @throws LogonException
* @since 4.3
*/
- public ServerAdmin createAdmin(String userName,
+ public Admin createAdmin(String userName,
char[] password,
String serverURL) throws AdminException {
@@ -194,7 +195,7 @@
* @throws LogonException
* @since 4.3
*/
- public ServerAdmin createAdmin(String userName,
+ public Admin createAdmin(String userName,
char[] password,
String serverURL,
String applicationName) throws AdminException {
@@ -213,12 +214,12 @@
return createAdmin(p);
}
- public ServerAdmin createAdmin(Properties p) {
+ public Admin createAdmin(Properties p) {
p = PropertiesUtils.clone(p);
p.remove(MMURL.JDBC.VDB_NAME);
p.remove(MMURL.JDBC.VDB_VERSION);
p.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
- ServerAdmin serverAdmin = (ServerAdmin)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] { ServerAdmin.class }, new ReconnectingProxy(p));
+ Admin serverAdmin = (Admin)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] { Admin.class }, new ReconnectingProxy(p));
return serverAdmin;
}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/AdminApiServerDiscovery.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/AdminApiServerDiscovery.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/AdminApiServerDiscovery.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -30,9 +30,10 @@
import java.util.Map;
import java.util.Properties;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.objects.ProcessObject;
-import com.metamatrix.admin.api.server.ServerAdmin;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.ProcessObject;
+
import com.metamatrix.common.api.HostInfo;
import com.metamatrix.common.api.MMURL;
import com.metamatrix.platform.security.api.LogonResult;
@@ -79,7 +80,7 @@
synchronized (info) {
if (instance != null
&& (info.lastDiscoveryTime < System.currentTimeMillis() - DISCOVERY_TIMEOUT || info.knownHosts.isEmpty())) {
- ServerAdmin serverAdmin = instance.getService(ServerAdmin.class);
+ Admin serverAdmin = instance.getService(Admin.class);
try {
Collection<ProcessObject> processes = serverAdmin.getProcesses("*");
info.knownHosts.clear();
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -43,8 +43,9 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.metamatrix.admin.api.core.Admin;
-import com.metamatrix.admin.api.exception.AdminException;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+
import com.metamatrix.common.api.HostInfo;
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.comm.api.ServerConnectionFactory;
@@ -299,7 +300,7 @@
}
@Override
- public void shutdown() {
+ public void shutdown(boolean restart) {
// only applies in the Embedded scenario.
}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Admin.java (from rev 1088, trunk/client/src/main/java/com/metamatrix/admin/api/core/Admin.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,40 @@
+/*
+ * 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.adminapi;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * Marker interface for all MetaMatrix administration - core.
+ *
+ * @since 4.3
+ */
+public interface Admin extends ConfigurationAdmin, MonitoringAdmin, RuntimeStateAdmin, SecurityAdmin {
+ /**
+ * Closes connection.
+ * @since 4.3
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
+ void close();
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminComponentException.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminComponentException.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,75 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * An <code>AdminComponentException</code> is thrown when an error occurs as a
+ * result of an internal component error.
+ *
+ * <p>This exception class is capable of containing multiple exceptions. See
+ * {@link AdminException} for details.
+ */
+public final class AdminComponentException extends AdminException {
+
+ /**
+ * No-arg ctor.
+ *
+ * @since 4.3
+ */
+ public AdminComponentException() {
+ super();
+ }
+
+ /**
+ * Construct with a message.
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminComponentException(String msg) {
+ super(msg);
+ }
+
+ public AdminComponentException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct with an optional error code and a message.
+ * @param code an optional error code
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminComponentException(int code, String msg) {
+ super(code, msg);
+ }
+
+ public AdminComponentException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ public AdminComponentException(int code, String msg, Throwable cause) {
+ super(code, msg, cause);
+ }
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminException.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminException.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminException.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminException.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,123 @@
+/*
+ * 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.adminapi;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.metamatrix.core.MetaMatrixCoreException;
+
+/**
+ * <code>AdminException</code> is the base exception for the admin package. Many *Admin methods throw this
+ * exception. Instances will be one of the concrete subtypes:
+ * {@link AdminComponentException} or {@link AdminProcessingException}</p>
+ *
+ * <p><code>AdminException</code>s may contain multiple child exceptions. An example
+ * of this could be when performing an admin action results in multiple failures. Admin
+ * clients should be aware of this and use the {@link #hasMultiple()} method to
+ * determine if they need to check the child exceptions.</p>
+ */
+public abstract class AdminException extends MetaMatrixCoreException {
+
+ // List of Admin exceptions in
+ // case of multiple failure
+ private List children;
+
+ /**
+ * No-arg ctor.
+ *
+ * @since 4.3
+ */
+ AdminException() {
+ super();
+ }
+
+ /**
+ * Construct with a message.
+ * @param msg the error message.
+ * @since 4.3
+ */
+ AdminException(String msg) {
+ super(msg);
+ }
+
+ AdminException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+ /**
+ * Construct with an optional error code and a message.
+ * @param code an optional error code
+ * @param msg the error message.
+ * @since 4.3
+ */
+ AdminException(int code, String msg) {
+ super(Integer.toString(code), msg);
+ }
+
+ AdminException(String msg, Throwable cause) {
+ super(cause, msg);
+ }
+
+ AdminException(int code, String msg, Throwable cause) {
+ super(cause, Integer.toString(code),msg);
+ }
+
+ /**
+ * Determine whether this exception is representing
+ * mutliple component failures.
+ * @return <code>true</code> iff this exception contains multiple
+ * component failure exceptions.
+ * @since 4.3
+ */
+ public boolean hasMultiple() {
+ return (children != null && children.size() > 0);
+ }
+
+ /**
+ * Returns a non-null list of failures (<code>AdminException</code>s), one for each
+ * component that failed.
+ *
+ * <p>The list will have members when {@link #hasMultiple()} returns <code>true</code>.</p>
+ * @return The non-null list of failures.
+ * @since 4.3
+ */
+ public List getChildren() {
+ return (children != null ? children : Collections.EMPTY_LIST);
+ }
+
+ /**
+ * Add a child <code>AdminException</code> for a particular failure
+ * if and action resulted in multiple failures.
+ *
+ * @param child a specific failure
+ * @since 4.3
+ */
+ public void addChild(AdminException child) {
+ if ( children == null ) {
+ children = new ArrayList();
+ }
+ children.add(child);
+ }
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/AdminObject.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,116 @@
+/*
+ * 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.adminapi;
+
+import java.util.Properties;
+
+/**
+ * Base interface of client side admin objects. Specifies behaviors and properties common to all administrative objects.
+ * <p>
+ * Unique identifiers are available for all <code>AdminObject</code>s and their forms are specific to each object. See
+ * the javadoc on the individual object for its particular identifier pattern required.
+ * </p>
+ * <p>
+ * This interface need not be used directly by clients except when coding to constants.
+ * </p>
+ *
+ * @since 4.3
+ */
+public interface AdminObject {
+
+ /**
+ * The character that delimits the atomic components of the identifier.
+ * @see #DELIMITER
+ */
+ public static final char DELIMITER_CHAR = '|';
+
+ /**
+ * The character (as a <code>String</code>) that delimits the atomic components of the identifier.
+ *
+ * <p>It is <emph>strongly</emph> advisable to write admin client code using this <code>DELIMITER</code>
+ * rather than hard-coding a delimiter character in admin code. Doing this eliminates the possibility
+ * of admin client code breaking if/when the delimiter character must be changed.</p>
+ */
+ public static final String DELIMITER = new String(new char[] {DELIMITER_CHAR});
+
+ /**
+ * The delimiter character as a <code>String</code> escaped.
+ * @see #DELIMITER
+ */
+ public static final String ESCAPED_DELIMITER = "\\" + DELIMITER; //$NON-NLS-1$
+
+ /**
+ * The wildcard character (as a <code>String</code>) that can be used in may identifier patterns
+ * to indicate <i>"anything"</i> or, more specifically, replace <i>"zero or more"</i>
+ * identifier components.
+ *
+ * <p>It is <emph>strongly</emph> advisable to write admin client code using this <code>WILDCARD</code>
+ * rather than hard-coding a wildcard character in admin code. Doing this eliminates the possibility
+ * of admin client code breaking if/when the wildcard character must be changed.</p>
+ */
+ public static final String WILDCARD = "*"; //$NON-NLS-1$
+
+ /**
+ * The wildcard character as a <code>String</code> escaped.
+ * @see #WILDCARD
+ */
+ public static final String ESCAPED_WILDCARD = "\\" + WILDCARD; //$NON-NLS-1$
+
+
+ /**
+ * Get the Full Name for this AdminObject. This identifier will uniquely identify this object in the Teiid
+ * system.
+ *
+ * @return String the unique Identifier
+ * @since 4.3
+ */
+ String getIdentifier();
+
+ /**
+ * Get the name for this AdminObject, usually the last component of the identifier.
+ *
+ * @return String Name
+ * @since 4.3
+ */
+ String getName();
+
+ /**
+ * Get the Configuration Properties that defines this process
+ *
+ * @return Properties
+ * @since 4.3
+ */
+ Properties getProperties();
+
+ /**
+ * Searches for the property with the specified key in this Admin Object. If the key is not found the method returns
+ * <code>null</code>.
+ *
+ * @param name
+ * the property key.
+ * @return the value in this Admin Object with the specified key value.
+ * @since 4.3
+ */
+
+ String getPropertyValue(String name);
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/AdminOptions.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,194 @@
+/*
+ * 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.adminapi;
+
+import java.io.Serializable;
+
+import com.metamatrix.admin.AdminPlugin;
+
+
+/**
+ * Creates, collects and stores option values for evaluation when
+ * executing methods where decisions should be made based on user preferences.
+ * <p>
+ * Method of use is to create with an option and use the method {@link #addOption(int)}
+ * when more than one option is wished or required.</p>
+ * <p>
+ * <b>Example:</b>
+ * <pre>
+ * AdminOptions options = new AdminOptions(AdminOptions.OnConflict.OVERWRITE);
+ * options.addOption(BINDINGS_IGNORE_DECRYPT_ERROR);
+ * </pre></p>
+ * @since 4.3
+ */
+public class AdminOptions implements Serializable {
+
+ // *************************************************************************
+ // When adding an option to this interface, don't forget to
+ // add the corresponding string to the toString() method
+ // and to the ALLOWABLE_OPTIONS bitmask below.
+ // *************************************************************************
+
+ /**
+ * In the case when adding resource to the system, if the resource already
+ * exists in the system, these modes define how to handle the situation.
+ */
+ public interface OnConflict {
+
+ /**
+ * Add all bindings in this file and overwrite any
+ * bindings that already exist in the system.
+ * <p><b>NOTE</b>: This will result in a {@link VDB} with
+ * a status of {@link VDB#INACTIVE} or
+ * {@link VDB#ACTIVE}.</p>
+ */
+ public static final int OVERWRITE= 1;
+
+ /**
+ * Don't add any existing bindings contained in this file
+ * (don't update/replace ones that already exist). This
+ * will <i>not</i> keep any new bindings specified from being
+ * added.
+ * <p><b>NOTE</b>: This will result in a {@link VDB} with
+ * a status of {@link VDB#INACTIVE} or
+ * {@link VDB#ACTIVE}.</p>
+ */
+ public static final int IGNORE = 2;
+
+ /**
+ * If there is conflict in the bindings then return with
+ * an exception
+ * <p><b>NOTE</b>: This will result in a {@link VDB} with
+ * a status of {@link VDB#INCOMPLETE} if all models in
+ * the VDB are not bound.</p>
+ */
+ public static final int EXCEPTION = 4;
+ }
+
+ /**
+ * Connector bindings have encrypted passwords as connection
+ * properties. If the password property cannot be decrypted,
+ * the connector binding will not start until the connector
+ * binding password property is changed.
+ * <p>Adding a VDB with this option allows the VDB and its
+ * connector bindings to be added and persisted to the system
+ * configuration, even if the connector binding properties
+ * cannot be decrypted. Users should set the password property
+ * on all connectors added after using this option.</p>
+ * <p><b>NOTE</b>: This will result in a {@link VDB} with
+ * a status of {@link VDB#INACTIVE}.</p>
+ */
+ public static final int BINDINGS_IGNORE_DECRYPT_ERROR = 8;
+
+// =======================================================================================
+// End Options Interface
+// =======================================================================================
+
+ private static final int ALLOWABLEOPTIONS = OnConflict.OVERWRITE |
+ OnConflict.IGNORE |
+ OnConflict.EXCEPTION |
+ BINDINGS_IGNORE_DECRYPT_ERROR;
+
+ // A bitmask for multiple options
+ private int optionsMask;
+
+ /**
+ * Construct with an option. For available options, see
+ * {@link AdminOptions}.
+ * <p>
+ * <b>Note</b>: A RutimeException is thrown for any option given
+ * that is not found in the interface.</p>
+ *
+ * @param option One of the available options in {@link AdminOptions}.
+ * @throws RuntimeException for any option given that is not
+ * found in the interface.
+ * @since 4.3
+ */
+ public AdminOptions(int option) throws RuntimeException {
+ super();
+
+ addOption(option);
+ }
+
+ /**
+ * Add an option to this object if multiple options are required.
+ * <p>
+ * <b>Note</b>: A RutimeException is thrown for any option given
+ * that is not found in the interface.</p>
+ *
+ * @param anOption the option to add.
+ * @throws RuntimeException for any option given that is not
+ * found in the interface.
+ * @since 4.3
+ */
+ public void addOption(int anOption) {
+ if (anOption != 0 && (ALLOWABLEOPTIONS & anOption) == anOption) {
+ this.optionsMask |= anOption;
+ } else {
+ throw new RuntimeException(AdminPlugin.Util.getString("AdminOptions.Unknown_option", new Object[] {"" + anOption})); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * Check if the given option was specified.
+ *
+ * @param anOption the option to check.
+ * @return <code>true</true> iff this opject contains the
+ * geven option.
+ * @since 4.3
+ */
+ public boolean containsOption(int anOption) {
+ return (this.optionsMask & anOption) == anOption;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ * @since 4.3
+ */
+ public String toString() {
+ StringBuffer optionString = new StringBuffer("["); //$NON-NLS-1$
+
+ if ( (optionsMask & OnConflict.OVERWRITE) == OnConflict.OVERWRITE ) {
+ optionString.append("OnConflict_OVERWRITE, "); //$NON-NLS-1$
+ }
+ if ( (optionsMask & OnConflict.IGNORE) == OnConflict.IGNORE ) {
+ optionString.append("OnConflict_IGNORE, "); //$NON-NLS-1$
+ }
+ if ( (optionsMask & OnConflict.EXCEPTION) == OnConflict.EXCEPTION ) {
+ optionString.append("OnConflict_EXCEPTION, "); //$NON-NLS-1$
+ }
+ if ( (optionsMask & BINDINGS_IGNORE_DECRYPT_ERROR) == BINDINGS_IGNORE_DECRYPT_ERROR ) {
+ optionString.append("BINDINGS_IGNORE_DECRYPT_ERROR, "); //$NON-NLS-1$
+ }
+
+ if ( optionString.length() == 1 ) {
+ optionString.append("UNKNOWN"); //$NON-NLS-1$
+ } else if (optionString.length() > 2 && optionString.charAt(optionString.length() - 2) == ',' ) {
+ optionString.setLength(optionString.length() - 2);
+ }
+
+ optionString.append(']');
+ return optionString.toString();
+ }
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/exception/AdminProcessingException.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,76 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * An <code>AdminProcessingException</code> indicates that an error occured during processing as a result
+ * of user input. This exception is the result of handling an invalid user
+ * request, not the result of an internal error.</p>
+ *
+ * <p>This exception class is capable of containing multiple exceptions. See
+ * {@link AdminException} for details.
+ */
+public final class AdminProcessingException extends AdminException {
+
+ /**
+ * No-arg ctor.
+ *
+ * @since 4.3
+ */
+ public AdminProcessingException() {
+ super();
+ }
+
+ /**
+ * Construct with a message.
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminProcessingException(String msg) {
+ super(msg);
+ }
+
+ public AdminProcessingException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct with an optional error code and a message.
+ * @param code an optional error code
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminProcessingException(int code, String msg) {
+ super(code, msg);
+ }
+
+ public AdminProcessingException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ public AdminProcessingException(int code, String msg, Throwable cause) {
+ super(code, msg, cause);
+ }
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/server/AdminRoles.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,79 @@
+/*
+ * 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.adminapi;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Static class that lists the roles allowable in the MetaMatrix system.
+ *
+ * <p>This class can be used to get a list of all allowable administrative role
+ * names or the name of one role to assign to a principal.</p>
+ * @since 4.3
+ */
+public class AdminRoles {
+ private static final Set roleSet;
+
+ static {
+ roleSet = new HashSet();
+ roleSet.add(RoleName.ADMIN_SYSTEM);
+ roleSet.add(RoleName.ADMIN_PRODUCT);
+ roleSet.add(RoleName.ADMIN_READONLY);
+ }
+
+ /**
+ * Get the set of static MetaMatrix administrative roles known to the system.
+ * @return the <code>Set</code> of <code>String</code> role names.
+ * @since 4.3
+ */
+ public static Set getAllRoleNames() {
+ return roleSet;
+ }
+
+ /**
+ * Determine whether an admin role exists by the given <code>roleName</code>.
+ * @param roleName the name for which to validate.
+ * @return <code>true</code> iff an admin role exists with the given role name.
+ * @since 4.3
+ */
+ public static boolean containsRole(String roleName) {
+ return roleSet.contains(roleName);
+ }
+
+ /**
+ * Static class that defines defines the allowed administrative roles
+ * for the MetaMatrix system.
+ * @since 4.3
+ */
+ public static class RoleName {
+ /** System admin role name */
+ public static final String ADMIN_SYSTEM = "Admin.SystemAdmin"; //$NON-NLS-1$
+ /** Product admin role name */
+ public static final String ADMIN_PRODUCT = "Admin.ProductAdmin"; //$NON-NLS-1$
+ /** Read-only admin role name */
+ public static final String ADMIN_READONLY = "Admin.ReadOnlyAdmin"; //$NON-NLS-1$
+
+ public static final String ANONYMOUS = "Anonymous"; //$NON-NLS-1$
+ }
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminStatus.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/AdminStatus.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminStatus.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminStatus.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,68 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * Base interface of admin status objects.
+ * Status objects are returned by some admin methods to indicate warnings or additional information,
+ * that doesn't belong in an Exception.
+ *
+ * @since 4.3
+ */
+public interface AdminStatus {
+
+
+ /**
+ * Status code indicating an unknown status
+ */
+ public final static int CODE_UNKNOWN = -1;
+ /**
+ * Status code indicating that the operation succeeded.
+ */
+ public final static int CODE_SUCCESS = 0;
+
+ /**
+ * Warning status code indicating that an object could not be decrypted.
+ */
+ public final static int CODE_DECRYPTION_FAILED = -101;
+
+
+
+
+ /**
+ * Get the status code.
+ * This will be one of the status codes specified by the constants <code>AdminStatus.CODE_*</code>.
+ * @return String the unique Identifier
+ * @since 4.3
+ */
+ int getCode();
+
+ /**
+ * Get the status message.
+ * @return String Name
+ * @since 4.3
+ */
+ String getMessage();
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Cache.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Cache.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Cache.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Cache.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,54 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * Represents a cache in the MetaMatrix system.
+ *
+ * <p>An idetiifer for cache is specifically represented by a name. All the
+ * different kinds of available cache are listed as enumerations on this interface.
+ * </p>
+ * @since 4.3
+ */
+public interface Cache extends
+ AdminObject {
+
+ /**
+ *
+ */
+ public static final String CODE_TABLE_CACHE = "CodeTableCache"; //$NON-NLS-1$
+ /**
+ *
+ */
+ public static final String PREPARED_PLAN_CACHE = "PreparedPlanCache"; //$NON-NLS-1$
+ /**
+ *
+ */
+ public static final String QUERY_SERVICE_RESULT_SET_CACHE = "QueryServiceResultSetCache"; //$NON-NLS-1$
+ /**
+ *
+ */
+ public static final String CONNECTOR_RESULT_SET_CACHE = "ConnectorResultSetCache"; //$NON-NLS-1$
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreConfigAdmin.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,395 @@
+/*
+ * 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.adminapi;
+
+import java.util.Properties;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * This interface describes the methods to configure MetaMatrix.
+ *
+ * <p>As a <i>core</i> interface,
+ * this administration is common to both the MetaMatrix server and MM Query.</p>
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
+public interface ConfigurationAdmin {
+
+ /**
+ * Set system-wide property. This will be written to config_ns.xml
+ *
+ * @param propertyName
+ * Name of the System Property
+ * @param propertyValue
+ * Value of the System Property
+ * @throws AdminException
+ * if there's a system error or if there's a user input error.
+ * @since 4.3
+ */
+ void setSystemProperty(String propertyName,
+ String propertyValue) throws AdminException;
+
+
+ /**
+ * Set several system-wide properties. These will be written to config_ns.xml
+ * Any existing properties not specified will not be changed.
+ *
+ * @param properties
+ * Properties to set.
+ * @throws AdminException
+ * if there's a system error or if there's a user input error.
+ * @since 4.3
+ */
+ void updateSystemProperties(Properties properties) throws AdminException;
+
+
+ /**
+ * Assign a {@link ConnectorBinding} to 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 map Connector Binding
+ * @throws AdminException
+ * if there's a system error or if there's a user input error.
+ * @since 4.3
+ */
+ void assignBindingToModel(String connectorBindingName,
+ String vdbName,
+ String vdbVersion,
+ String modelName) throws AdminException;
+
+ void assignBindingsToModel(String[] connectorBindingName,
+ String vdbName,
+ String vdbVersion,
+ String modelName) throws AdminException;
+
+ /**
+ * Set a Property for an AdminObject
+ *
+ * @param identifier
+ * 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>.
+ * You may specify either the fully-qualified or unqualified classname.
+ * For example "ConnectorBinding" or "com.metamatrix.admin.api.objects.ConnectorBinding".
+ * @param propertyName
+ * String Property key
+ * @param propertyValue
+ * String value to update
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void setProperty(String identifier,
+ String className,
+ String propertyName,
+ String propertyValue) throws AdminException;
+
+
+ /**
+ * Set several properties for an AdminObject. Any existing properties not specified will not be changed.
+ *
+ * @param identifier
+ * 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>.
+ * You may specify either the fully-qualified or unqualified classname.
+ * For example "ConnectorBinding" or "com.metamatrix.admin.api.objects.ConnectorBinding".
+ * @param properties
+ * Properties to set.
+ * @throws AdminException
+ * if there's a system error or if there's a user input error.
+ * @since 4.3
+ */
+ void updateProperties(String identifier,
+ String className,
+ Properties properties) throws AdminException;
+
+
+ /**
+ * Add Connector Type, will import Connector Type from a file
+ *
+ * @param name
+ * of the Connector Type to add
+ * @param cdkFile
+ * contents of File from Client
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void addConnectorType(String name, char[] cdkFile) throws AdminException;
+
+ /**
+ * Add Connector Type and all the required extension modules required by the
+ * this connector type into the system from the given file byte stream which is
+ * encoded inthe Connector Archive format.
+ *
+ * @param archiveContents contents of File
+ * @param options resolution option in case of conflict in the connector type
+ * @throws AdminException if there's a system error.
+ * @since 4.3.2
+ */
+ void addConnectorArchive(byte[] archiveContents, AdminOptions options ) throws AdminException;
+
+ /**
+ * Delete Connector Type from Next Configuration
+ *
+ * @param name String name of the Connector Type to delete
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void deleteConnectorType(String name) throws AdminException;
+
+ /**
+ * Deploy a {@link ConnectorBinding} to Configuration
+ *
+ * @param name
+ * is the Connector Binding name that will be added to Configuration
+ * @param connectorTypeIdentifier
+ * Name of the Connector Type
+ * @param properties
+ * Name & Value pair need to deploy the Connector Binding
+ * @param options The perferred options when executing this method. There are choices about
+ * what to do when a connector binding with the given identifier already exists in the system.
+ * See the interface {@link AdminOptions.OnConflict} for details.
+ * <p>
+ * Another option is to ignore a binding connection password decrypt error, when adding a connector
+ * binding whose password was encrypted with a different keystore, so that the new password property
+ * can be set after the connector binding has been added.</p>
+ * @throws AdminException
+ * if there's a system error.
+ * @return the {@link ConnectorBinding} representing the current property values and runtime state.
+ * Note that if this is a system with multiple Processes, this method may actually create multiple deployed
+ * Connector Bindings (one for each process). This method will return one of them, arbitrarily.
+ * @since 4.3
+ */
+ ConnectorBinding addConnectorBinding(String name,
+ String connectorTypeIdentifier,
+ Properties properties, AdminOptions options) throws AdminException;
+
+ /**
+ * Import a {@link ConnectorBinding} into the Configuration.
+ *
+ * @param name
+ * is the Connector Binding name that will be added to Configuration
+ * @param xmlFile
+ * contents of XML file that will be sent to the server.
+ * @param options The perferred options when executing this method. There are choices about
+ * what to do when a connector binding with the given identifier already exists in the system.
+ * See the interface {@link AdminOptions.OnConflict} for details.
+ * <p>
+ * Another option is to ignore a binding connection password decrypt error, when adding a connector
+ * binding whose password was encrypted with a different keystore, so that the new password property
+ * can be set after the connector binding has been added.</p>
+ * @throws AdminException
+ * if there's a system error.
+ * @return the {@link ConnectorBinding} representing the current property values and runtime state.
+ * Note that if this is a system with multiple Processes, this method may actually create multiple deployed
+ * Connector Bindings (one for each process). This method will return one of them, arbitrarily.
+ * @since 4.3
+ */
+ ConnectorBinding addConnectorBinding(String name,
+ char[] xmlFile, AdminOptions options) throws AdminException;
+
+ /**
+ * Delete the {@link ConnectorBinding} from the Configuration
+ *
+ * @param connectorBindingIdentifier
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void deleteConnectorBinding(String connectorBindingIdentifier) throws AdminException;
+
+ /**
+ * Import a {@link VDB} file.
+ * <br>A VDB file with internal definitions. Thise is the default VDB export configuration
+ * begining with MetaMatrix version 4.3.</br>
+ *
+ * @param name
+ * VDB Name
+ * @param vdbFile
+ * byte array of the VDB Archive
+ * @param options The perferred options when executing this method. There are choices about
+ * what to do when a connector binding with the given identifier already exists in the system.
+ * @throws AdminException
+ * if there's a system error.
+ * @return the {@link VDB} representing the current property values and runtime state.
+ * @since 4.3
+ */
+ VDB addVDB(String name,
+ byte[] vdbFile, AdminOptions options) throws AdminException;
+
+ /**
+ * Get the {@link LogConfiguration}
+ *
+ * @return LogConfiguration object
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
+ LogConfiguration getLogConfiguration() throws AdminException;
+
+ /**
+ * Set the {@link LogConfiguration} in the MetaMatrix Server
+ *
+ * @param config
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void setLogConfiguration(LogConfiguration config) throws AdminException;
+
+ /**
+ * Adds an {@link ExtensionModule} to the end of the list of modules.
+ * <br><i>All caches (of Class objects) are cleared.</i></br>
+ *
+ * @param type
+ * one of the known types of extension file
+ * @param sourceName
+ * name (e.g. filename) of extension module
+ * @param source
+ * actual contents of module
+ * @param description
+ * (optional) description of the extension module - may be null
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void addExtensionModule(String type,
+ String sourceName,
+ byte[] source,
+ String description) throws AdminException;
+
+ /**
+ * Deletes an {@link ExtensionModule} from the list of modules.
+ * <br><i>All caches (of Class objects) are cleared.</i></br>
+ *
+ * @param sourceName
+ * name (e.g. filename) of extension module
+ * @throws AdminException
+ * if there's a system error.
+ */
+ void deleteExtensionModule(String sourceName) throws AdminException;
+
+ /**
+ * Export an {@link ExtensionModule} to byte array
+ *
+ * @param sourceName unique identifier for the {@link ExtensionModule}.
+ * @return byte array of the extension module
+ * @throws AdminException
+ * @since 4.3
+ */
+ byte[] exportExtensionModule(String sourceName) throws AdminException;
+
+ /**
+ * Export Configuration to character Array in XML format
+ *
+ * @return character array of Configuration
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ char[] exportConfiguration() throws AdminException;
+
+ /**
+ * Export a {@link ConnectorBinding} to character Array in XML format
+ *
+ * @param connectorBindingIdentifier the unique identifier for a {@link ConnectorBinding}.
+ * @return character Array in XML format
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ char[] exportConnectorBinding(String connectorBindingIdentifier) throws AdminException;
+
+ /**
+ * Export Connector Type to character array
+ *
+ * @param connectorTypeIdentifier the unique identifier for for a {@link ConnectorType}
+ * @return character Array in XML format
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ char[] exportConnectorType(String connectorTypeIdentifier) throws AdminException;
+
+ /**
+ * Export Connector Archive, which is bundled connector type with its xml
+ * properties file and all the extension modules required by the this connector type
+ *
+ * @param connectorTypeIdentifier the unique identifier for for a {@link ConnectorType}
+ * @return byte array of the connector archive.
+ * @throws AdminException if there's a system error.
+ * @since 4.3.2
+ */
+ byte[] exportConnectorArchive(String connectorTypeIdentifier) throws AdminException;
+
+ /**
+ * Export VDB to byte array
+ *
+ * @param name identifier of the {@link VDB}
+ * @param version {@link VDB} version
+ * @return byte array of the MetaMatrix VDB Archive
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ byte[] exportVDB(String name, String version) throws AdminException;
+
+
+ /**
+ * Add User Defined Function model to the system. If one is already deployed before this
+ * will replace the previous, otherwise add this as the new UDF model. Once the UDF is added
+ * the new UDF model is loaded.
+ * @param modelFileContents - UDF contents
+ * @param classpath - classpath for the UDF
+ * @throws AdminException
+ */
+ void addUDF(byte[] modelFileContents, String classpath) throws AdminException;
+
+ /**
+ * Delete the User Defined Function model. Note that this will not delete any supporting
+ * extension jar files added, those need to be deleted separately.
+ * @throws AdminException
+ */
+ void deleteUDF() throws AdminException;
+
+ /**
+ * Indicates that an extension module has changed
+ * @throws AdminException
+ * @since 6.1.0
+ */
+ void extensionModuleModified(String name) throws AdminException;
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/ConnectionPool.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,69 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * This object holds the statisics for a ConnectionPool that is being utilized by a Connector.
+ * As per how many available connections
+ * processed etc.
+ * <p>An identifier for QueueWorkerPool, is nothing but the modules it self, like "DQP",
+ * "QueryService" or Connector Binding names etc.</p>
+ *
+ * @since 4.3
+ */
+public interface ConnectionPool extends AdminObject {
+ /**
+ * @return Returns total number of current connections in the Connection Pool
+ * @since 6.1
+ */
+ public int getTotalConnections();
+
+ /**
+ * @return Returns the number of connections waiting for use in the connection pool.
+ * @since 6.1
+ */
+ public int getConnectionsWaiting();
+
+ /**
+ * @return Returns the number of Connections currently in use by clients.
+ *
+ * @since 6.1
+ */
+ public int getConnectionsInuse();
+
+ /**
+ * @return Returns the number of Connections created since the Connection Pool was created.
+ * @since 6.1
+ */
+ long getConnectionsCreated();
+
+
+ /**
+ * @return The number of Connections destroyed since the Connection Pool was created.
+ */
+ long getConnectionsDestroyed();
+
+
+
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/ConnectorBinding.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,110 @@
+/*
+ * 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.adminapi;
+
+import java.util.Date;
+
+/**
+ * Represents a connector binding (the instance of a connector type) in the MetaMatrix system.
+ *
+ * <p>The unique identifier pattern is [host]<{@link #DELIMITER}>[process]<{@link #DELIMITER}>[Connector Binding Name]
+ * when running against a MetaMatrix server. The [Connector Binding Name] can itself have spaces in the name.
+ * In the case of the MM Query, the [host] and [process] do not apply as MM Query is always local.</p>
+ *
+ * @since 4.3
+ */
+public interface ConnectorBinding extends
+ AdminObject {
+ /**Registered by not initialized*/
+ public static final int STATE_NOT_INITIALIZED = 0;
+ /**Open and running*/
+ public static final int STATE_OPEN = 1;
+ /**Registered but closed*/
+ public static final int STATE_CLOSED = 2;
+ /**Failed after running successfully*/
+ public static final int STATE_FAILED = 3;
+ /**Failed during initialization*/
+ public static final int STATE_INIT_FAILED = 4;
+ /**Not registered*/
+ public static final int STATE_NOT_REGISTERED = 5;
+ /**Running, but the underlying data source is unavailable*/
+ public static final int STATE_DATA_SOURCE_UNAVAILABLE = 6;
+ /**Running, not deployed*/
+ public static final int STATE_NOT_DEPLOYED = 7;
+
+ /** Password connector property name */
+ public static final String PASSWORD = "Password"; //$NON-NLS-1$
+
+
+ /**
+ * Returns the String globally unique routing UUID for this
+ * Connector Binding
+ * @return Returns the routingUUID.
+ * @since 4.3
+ */
+ String getRoutingUUID();
+
+ /**
+ * Retrieve the current connector state. This will be one of the constants:
+ * {@link DQP#STATE_OPEN DQP.STATE_OPEN}.
+ * {@link DQP#STATE_NOT_INITIALIZED DQP.STATE_NOT_INITIALIZED}.
+ * {@link DQP#STATE_CLOSED DQP.STATE_CLOSED}.
+ * {@link DQP#STATE_FAILED DQP.STATE_FAILED}.
+ * {@link DQP#STATE_INIT_FAILED DQP.STATE_INIT_FAILED}.
+ * {@link DQP#STATE_NOT_REGISTERED DQP.STATE_NOT_REGISTERED}.
+ * {@link DQP#STATE_DATA_SOURCE_UNAVAILABLE DQP.STATE_DATA_SOURCE_UNAVAILABLE}.
+ * {@link DQP#STATE_NOT_DEPLOYED DQP.STATE_NOT_DEPLOYED}.
+ * @return current connector state.
+ */
+ int getState();
+
+ /**
+ * Retrieve the current connector state as a printable <code>String</code>.
+ * @return current connector state in String form.
+ */
+ String getStateAsString();
+
+ /**
+ * Returns time of last state change.
+ *
+ * @return time of last state change.
+ * @since 4.3
+ */
+ Date getStateChangedTime();
+
+ /**
+ * Returns the description
+ *
+ * @return description
+ */
+ String getDescription();
+
+ /**
+ * Get the identifier for this connector binding's {@link ConnectorType}.
+ * @return the Connector Type identifier which can be used to
+ * find the ConnectorType.
+ * @since 4.3
+ */
+ String getConnectorTypeName();
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/ConnectorType.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,40 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * Represents a connector type in the MetaMatrix system.
+ *
+ * <p>{@link ConnectorBinding}s are instances of a connector type.</p>
+ *
+ * <p>The identifier pattern for a connector type is simply the name
+ * of the connector type. Usally name consistes of multiple words with spaces in between
+ * for example: "Loopback Connector"
+ * </p>
+ *
+ * @since 4.3
+ */
+public interface ConnectorType extends AdminObject {
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/DQP.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/DQP.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/DQP.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/DQP.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,88 @@
+/*
+ * 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.adminapi;
+
+import java.util.Date;
+
+/**
+ * The distributed query processor, which is the internal query engine component used by MetaMatrix products.
+ *
+ * @since 4.3
+ */
+public interface DQP extends
+ AdminObject {
+
+
+ /**Registered by not initialized*/
+ public static final int STATE_NOT_INITIALIZED = 0;
+ /**Open and running*/
+ public static final int STATE_OPEN = 1;
+ /**Registered but closed*/
+ public static final int STATE_CLOSED = 2;
+ /**Failed after running successfully*/
+ public static final int STATE_FAILED = 3;
+ /**Failed during initialization*/
+ public static final int STATE_INIT_FAILED = 4;
+ /**Not registered*/
+ public static final int STATE_NOT_REGISTERED = 5;
+ /**Running, but the underlying data source is unavailable*/
+ public static final int STATE_DATA_SOURCE_UNAVAILABLE = 6;
+ /**Running, not deployed*/
+ public static final int STATE_NOT_DEPLOYED = 7;
+
+ /**
+ * Retrieve the current connector state. This will be one of the constants:
+ * {@link DQP#STATE_OPEN DQP.STATE_OPEN}.
+ * {@link DQP#STATE_NOT_INITIALIZED DQP.STATE_NOT_INITIALIZED}.
+ * {@link DQP#STATE_CLOSED DQP.STATE_CLOSED}.
+ * {@link DQP#STATE_FAILED DQP.STATE_FAILED}.
+ * {@link DQP#STATE_INIT_FAILED DQP.STATE_INIT_FAILED}.
+ * {@link DQP#STATE_NOT_REGISTERED DQP.STATE_NOT_REGISTERED}.
+ * {@link DQP#STATE_DATA_SOURCE_UNAVAILABLE DQP.STATE_DATA_SOURCE_UNAVAILABLE}.
+ * {@link DQP#STATE_NOT_DEPLOYED DQP.STATE_NOT_DEPLOYED}.
+ * @return current connector state.
+ */
+ int getState();
+
+ /**
+ * Retrieve the current connector state.
+ *
+ * @return current connector state.
+ */
+ String getStateAsString();
+
+ /**
+ * Retrieve time of last state change.
+ *
+ * @return time of last state change.
+ * @since 4.3
+ */
+ Date getStateChangedTime();
+
+ /**
+ * Returns the description.
+ *
+ * @return description
+ */
+ public String getDescription();
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedLogger.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,83 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * Custom logging interface that provides a hook for custom implementations to log messages
+ * produced by MM Query.
+ * @since 4.3
+ */
+public interface EmbeddedLogger {
+
+ /**
+ * Message level value that specifies that no messages are to be recorded.
+ */
+ public static final int NONE = 0;
+
+ /**
+ * Message level value that specifies that critical messages are to be recorded.
+ */
+ public static final int CRITICAL = 1;
+
+ /**
+ * Message level value that specifies that error messages and critical
+ * messages are to be recorded.
+ */
+ public static final int ERROR = 2;
+
+ /**
+ * Message level value that specifies that warning, error and critical
+ * messages are to be recorded.
+ */
+ public static final int WARNING = 3;
+
+ /**
+ * Message level value that specifies that information, warning, error and critical
+ * messages are to be recorded.
+ */
+ public static final int INFO = 4;
+
+ /**
+ * Message level value that specifies that detailed, information, warning, error and critical
+ * messages are to be recorded.
+ */
+ public static final int DETAIL = 5;
+
+ /**
+ * Message level value that specifies that all messages are to be recorded.
+ */
+ public static final int TRACE = 6;
+
+ /**
+ * Logs the given message if the current logging level is >= the logLevel parameter.
+ * @param logLevel logging level for this message
+ * @param timestamp timestamp at which this log message was generated
+ * @param componentName name of the component that generated this message
+ * @param threadName name of the thread that generated this message
+ * @param message message body. May be null.
+ * @param throwable exception thrown. May be null.
+ * @since 4.3
+ */
+ void log(int logLevel, long timestamp, String componentName, String threadName, String message, Throwable throwable);
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Entitlement.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Entitlement.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Entitlement.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Entitlement.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,42 @@
+/*
+ * 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.adminapi;
+
+import java.util.Collection;
+
+
+/**
+ * @since 4.3
+ */
+public interface Entitlement extends AdminObject {
+
+ /**
+ * Get the Collection of {@link Principal}s that possess
+ * this Entitlement.
+ * @param principalIdentifier
+ * @return The collection of entitled {@link Principal}s.
+ * @since 4.3
+ */
+ Collection getPrincipals(String principalIdentifier);
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/ExtensionModule.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,103 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * An extension module is a library (usually in jar format) that extends
+ * the MetaMatrix system in some way. Classes of a custom connector can
+ * be added as an extension module.
+ *
+ * <p> The unique identifier pattern for the extension module is generally
+ * the name of the jar file since it applies system wide. Example: <code>MJjdbc.jar</code>
+ * @since 4.3
+ */
+public interface ExtensionModule extends AdminObject {
+
+ /**
+ * The name of the JAR file type of extension
+ * module - this is the only type of
+ * extension module that can be searched
+ * for Class objects
+ */
+ public static final String JAR_FILE_TYPE = "JAR File"; //$NON-NLS-1$
+
+ /**
+ * The name of the Metadata Keyword type of
+ * extension module.
+ */
+ public static final String METADATA_KEYWORD_TYPE = "Metadata Keyword"; //$NON-NLS-1$
+
+ /**
+ * The name of the Metamodel Extension type of
+ * extension module.
+ */
+ public static final String METAMODEL_EXTENSION_TYPE = "Metamodel Extension"; //$NON-NLS-1$
+
+ /**
+ * The name of the Function Definition type of
+ * extension module.
+ */
+ public static final String FUNCTION_DEFINITION_TYPE = "Function Definition"; //$NON-NLS-1$
+
+ /**
+ * The name of the Configuration Model type of
+ * extension module.
+ */
+ public static final String CONFIGURATION_MODEL_TYPE = "Configuration Model"; //$NON-NLS-1$
+
+ /**
+ * The name of the VDB File type of extension module.
+ */
+ public static final String VDB_FILE_TYPE = "VDB File"; //$NON-NLS-1$
+
+ /**
+ * The name of the Keystore File of extension module.
+ */
+ public static final String KEYSTORE_FILE_TYPE = "Keystore File"; //$NON-NLS-1$
+
+ /**
+ * The name of the Miscellaneous File type of extension module.
+ */
+ public static final String MISC_FILE_TYPE = "Miscellaneous Type"; //$NON-NLS-1$
+
+
+ /**
+ * @return description
+ */
+ public String getDescription();
+
+ /**
+ * @return byte array of file contents
+ */
+ public byte[] getFileContents();
+
+ /**
+ * @return String of the Module Type for this Extension Module
+ */
+ public String getModuleType();
+
+
+
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Group.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Group.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Group.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Group.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,39 @@
+/*
+ * 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.adminapi;
+
+/**
+ * A Group is a MetaMatrix principal that can contain other Principals
+ * as members. A Group can contain {@link User}s and other Groups.
+ *
+ * <p>See {@link Principal} for identity pattern.</p>
+ * @since 4.3
+ */
+public interface Group extends Principal {
+
+ /**
+ * Optional property for a group
+ */
+ /** The group description */
+ static final String DESCRIPTION = "description"; //$NON-NLS-1$
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Host.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Host.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Host.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Host.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,75 @@
+/*
+ * 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.adminapi;
+
+
+
+/**
+ * Represents a host in the MetaMatrix system.
+ *
+ * <p>The identifier pattern for a host is <code>"hostName"</code>.
+ * A hostName is considered to be unique across the system.</p>
+ * @since 4.3
+ */
+public interface Host extends AdminObject {
+
+ /**
+ * Install Directory Property
+ */
+ public static final String INSTALL_DIR = "metamatrix.installationDir"; //$NON-NLS-1$
+
+ /**
+ * Log Directory Property
+ */
+ public static final String LOG_DIRECTORY = "metamatrix.log.dir"; //$NON-NLS-1$
+
+ /**
+ * Host Directory Property
+ */
+ public static final String HOST_DIRECTORY = "metamatrix.host.dir"; //$NON-NLS-1$
+
+ /**
+ * Host Enabled Property
+ */
+ public static final String HOST_ENABLED = "host.enabled"; //$NON-NLS-1$
+
+ /**
+ * Host Bind Address Property
+ */
+ public static final String HOST_BIND_ADDRESS = "metamatrix.host.bind.address"; //$NON-NLS-1$
+
+ /**
+ * Host Physical Address Property
+ */
+ public static final String HOST_PHYSICAL_ADDRESS = "metamatrix.host.physical.address"; //$NON-NLS-1$
+
+
+ /**
+ * Return true if this Host is executing.
+ *
+ * @return if this Host is actively participating
+ * in the MetaMatrix system.
+ * @since 4.3
+ */
+ public boolean isRunning();
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/LogConfiguration.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/LogConfiguration.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,106 @@
+/*
+ * 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.adminapi;
+
+import java.util.Set;
+
+import com.metamatrix.core.log.MessageLevel;
+
+
+/**
+ * The LogConfiguration describes the current configuration of the
+ * system logger.
+ *
+ * <p>The log configuration is used to filter on log contexts (components)
+ * and log levels (severity).</p>
+ *
+ * @since 4.3
+ */
+public interface LogConfiguration extends AdminObject {
+
+ /**
+ * Message level value that specifies that no messages are to be recorded.
+ */
+ public static final int NONE = MessageLevel.NONE;
+
+ /**
+ * Message level value that specifies that critical messages are to be recorded.
+ */
+ public static final int CRITICAL = MessageLevel.CRITICAL;
+
+ /**
+ * Message level value that specifies that error messages and critical
+ * messages are to be recorded.
+ */
+ public static final int ERROR = MessageLevel.ERROR;
+
+ /**
+ * Message level value that specifies that warning, error and critical
+ * messages are to be recorded.
+ */
+ public static final int WARNING = MessageLevel.WARNING;
+
+ /**
+ * Message level value that specifies that information, warning, error and critical
+ * messages are to be recorded.
+ */
+ public static final int INFO = MessageLevel.INFO;
+
+ /**
+ * Message level value that specifies that detailed, information, warning, error and critical
+ * messages are to be recorded.
+ */
+ public static final int DETAIL = MessageLevel.DETAIL;
+
+ /**
+ * Message level value that specifies that all messages are to be recorded.
+ */
+ public static final int TRACE = MessageLevel.TRACE;
+
+
+ /**
+ * Get the current configured Log Level for supplied context
+ * @param context
+ * @return int value
+ * @see com.metamatrix.core.log.MessageLevel
+ * @since 4.3
+ */
+ int getLogLevel(String context);
+
+ /**
+ * Obtain the set of message contexts that are currently used.
+ * @return the unmodifiable set of context Strings; never null
+ */
+ Set<String> getContexts();
+
+ /**
+ * Set the Log Level
+ *
+ * Note: Must call setLogConfiguration(LogConfiguration) for log level to take
+ * affect on the server.
+ *
+ * @param context log context name
+ * @param logLevel The logLevel to set.
+ */
+ public void setLogLevel(String context, int logLevel);
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Model.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Model.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Model.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Model.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,85 @@
+/*
+ * 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.adminapi;
+
+import java.util.List;
+
+/**
+ * Represents a metadata model in the MetaMatrix system.
+ *
+ * @since 4.3
+ */
+public interface Model extends AdminObject {
+
+ /**
+ * Return the connector binding names for this Virtual Databse.
+ * @return connector bindings bound to this model.
+ */
+ List getConnectorBindingNames();
+
+ /**
+ * Determine if this model is a physical type.
+ *
+ * @return <code>true</code> iff it contains physical group(s).
+ */
+ boolean isPhysical();
+
+ /**
+ * Determine whether this model is exposed for querying.
+ *
+ * @return <code>true</code> iff the model is visible
+ * for querying.
+ */
+ boolean isVisible();
+
+ /**
+ * Retrieve the model type.
+ * TODO: one of ...
+ * @return model type
+ */
+ String getModelType();
+
+ /**
+ * Retrive the model URI.
+ *
+ * @return model URI
+ */
+ String getModelURI();
+
+ /**
+ * Determine whether this model can support more than one connector binding.
+ *
+ * @return <code>true</code> iff this model supports multi-source bindings
+ */
+ boolean supportsMultiSourceBindings();
+
+ /**
+ * Determine whether this model is a Materialization Model
+ *
+ * @return isMaterialization whether the model is a Materialization Model.
+ * @since 4.3
+ */
+
+ boolean isMaterialization();
+
+}
\ No newline at end of file
Copied: trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreMonitoringAdmin.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,264 @@
+/*
+ * 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.adminapi;
+
+import java.util.Collection;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+
+/**
+ * Used to access the monitorable components of the MetaMatrix system.
+ *
+ * <p>As a <i>core</i> interface,
+ * this administration is common to both the MetaMatrix server and MM Query.</p>
+ *
+ * <p>See the particular admin object in question for an example of
+ * allowed identifier patterns.</p>
+ *
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
+public interface MonitoringAdmin {
+
+ /**
+ * Retrieve the single System object.
+ *
+ * @return The single {@link SystemObject} object, for interacting with system-wide configuration
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ SystemObject getSystem() throws AdminException;
+
+ /**
+ * Get the Connector Types that correspond to the specified identifier pattern.
+ *
+ * @param connectorTypeIdentifier the unique identifier for for a {@link ConnectorType}
+ * <ul>
+ * <li> <code>"*"</code> - for all connector types in the system
+ * <li> <code>"name*"</code> - for all the connector types that begin with given name
+ * <li> <code>"name"</code> - for the single connector type identified by name
+ * </ul>
+ * @return Collection of {@link ConnectorType}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getConnectorTypes(String connectorTypeIdentifier) throws AdminException;
+
+ /**
+ * Get the VDBs that correspond to the specified identifier pattern.
+ *
+ * @param vdbIdentifier the unique identifier for for a {@link VDB} in the system
+ * <ul>
+ * <li> <code>"*"</code> - for all VDBs in the system
+ * <li> <code>"name"</code> or <code>"name*"</code> - for all the VDBs that begin with given name
+ * <li><code>"name<{@link AdminObject#DELIMITER_CHAR}>version"</code> - for single VDB
+ * </ul>
+ * @return Collection of {@link VDB}s. There could be multiple VDBs with the
+ * same name in the Collection but they will differ by VDB version.
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
+ Collection getVDBs(String vdbIdentifier) throws AdminException;
+
+ /**
+ * Get the Connector Bindings that correspond to the specified identifier pattern.
+ *
+ * @param connectorBindingIdentifier the unique identifier pattern of {@link 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
+ * <li><code>"name"</code> - for single connector binding by the given name
+ * </ul>
+ * @return Collection of {@link ConnectorBinding}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getConnectorBindings(String connectorBindingIdentifier) throws AdminException;
+
+ /**
+ * Get all the Connector Bindings for the given VDB identifier pattern
+ * @param identifier - the unique identifier for a {@link VDB}
+ * <ul>
+ * <li> <code>"*"</code> - for all Connector Bindings in the system
+ * <li> <code>"name or name*"</code> - for all the bindings in the VDBs that begin with given name
+ * <li><code>"name<{@link AdminObject#DELIMITER_CHAR}>version"</code> - for all the bindings in a given single VDB
+ * </ul>
+ * @return Collection of {@link ConnectorBinding}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getConnectorBindingsInVDB(String identifier) throws AdminException;
+
+ /**
+ * Get the Extension Modules that correspond to the specified identifier pattern
+ * @param extensionModuleIdentifier - the unique identifier for {@link ExtensionModule}
+ * <ul>
+ * <li> <code>"*"</code> - for all extension modules in the system
+ * <li> <code>"name*"</code> - for all the extension modules in that begin with given name
+ * <li><code>"name"</code> - for a single extension module identified by given name
+ * </ul>
+ * @return Collection of {@link ExtensionModule}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection<ExtensionModule> getExtensionModules(String extensionModuleIdentifier) throws AdminException;
+
+ /**
+ * Get the Queue Worker Pools that correspond to the specified identifier pattern.
+ *
+ * @param identifier - an identfier for the queues {@link QueueWorkerPool}
+ * <ul>
+ * <li> <code>"*"</code> - for all Queue workers in the system
+ * <li> <code>"name*"</code> - for all the Queue workers in that begin with given name
+ * <li><code>"name"</code> - for a single queue in the system
+ * </ul>
+ * for example, In MM Query - "dqp" will return the Stats for MM Query Worker Pool. Also any Connector Binding
+ * name will return the stats for that connector binding.
+ * @return Collection of {@link QueueWorkerPool}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getQueueWorkerPools(String identifier) throws AdminException;
+
+
+ /**
+ * Get the Connection Pool Stats that correspond to the specified identifier pattern.
+ * If the {@link ConnectionPool ConnectionPool} represents an XA connection, there
+ * will be 2 {@link ConnectionPool ConnectionPool}s.
+ *
+ * @param identifier - an identfier that corresponds to the ConnectorBinding that is
+ * running in a process {@link ConnectionPool}
+ * <ul>
+ * <li> <code>"*"</code> - for all Connection Pools in the system
+ * <li> <code>"name*"</code> - for all the Connection Pools that begin with given name
+ * <li><code>"name"</code> - for a single Connection Pool in the system
+ * </ul>
+ * @return Collection of {@link ConnectionPool}
+ * @throws AdminException if there's a system error.
+ * @since 6.1
+ */
+ Collection getConnectionPoolStats(String identifier) throws AdminException;
+
+
+ /**
+ * Get the Caches that correspond to the specified identifier pattern
+ * @param identifier - an identifier for the cache in {@link Cache}
+ * <ul>
+ * <li> <code>"*"</code> - for all different caches in the system
+ * <li> <code>"name*"</code> - for all the caches that begin with given name
+ * <li><code>"name"</code> - for a single cache in the system
+ * </ul>
+ * @return Collection of {@link Cache}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getCaches(String identifier) throws AdminException;
+
+ /**
+ * Get the Sessions that correspond to the specified identifier pattern
+ * @param identifier - an unique identifier for {@link Session}
+ * <ul>
+ * <li> <code>"*"</code> - for all current sessions of the system
+ * <li> <code>"number*"</code> - for all the sessions that begin with given number
+ * <li><code>"number"</code> - for a single current session in the system
+ * </ul>
+ * @return Collection of {@link Session}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection<Session> getSessions(String identifier) throws AdminException;
+
+ /**
+ * Get the Requests that correspond to the specified identifier pattern
+ * @param identifier - An Identifier for {@link Request}
+ * <ul>
+ * <li> <code>"*"</code> - for all current in process requests of the system
+ * <li> <code>"number* or number<{@link AdminObject#DELIMITER_CHAR}>*"</code> - for all the sessions
+ * that begin with given number, or all the requests for particular session etc.
+ * <li><code>"number<{@link AdminObject#DELIMITER_CHAR}>number"</code> - for a single request in the system
+ * </ul>
+ * @return Collection of {@link Request}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+
+ Collection<Request> getRequests(String identifier) throws AdminException;
+
+ /**
+ * Get the Source Request that correspond to the specified identifier pattern
+ * @param identifier An Identifier for {@link Request}
+ * <ul>
+ * <li> <code>"*"</code> - for all current in process requests of the system
+ * <li> <code>"number* or number<{@link AdminObject#DELIMITER_CHAR}>* or number.number.*"</code> - for all the sessions
+ * that begin with given number, or all the requests for particular session etc.
+ * <li><code>"number<{@link AdminObject#DELIMITER_CHAR}>number<{@link AdminObject#DELIMITER_CHAR}>number"</code> - for a single source request in the system
+ * </ul>
+ * @return Collection of {@link Request}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection<Request> getSourceRequests(String identifier) throws AdminException;
+
+ /**
+ * Get all of the available Configuration Properties for the specified AdminObject, and details about them.
+ * @param identifier
+ * 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. These are all the
+ * supported class names. {@link SystemObject}, {@link Host}, {@link ProcessObject}, {@link ConnectorBinding},
+ * {@link ConnectorType},{@link DQP}, {@link Resource}
+ *
+ * Note that in Embedded mode only supported classes are {@link ConnectorBinding}, {@link ConnectorType},
+ * {@link SystemObject}
+ * @return Collection of PropertyDefinition objects.
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getPropertyDefinitions(String identifier,
+ String className) throws AdminException;
+
+
+ /**
+ * Get all transaction matching the identifier.
+ * @return
+ * @throws AdminException
+ */
+ Collection<Transaction> getTransactions() throws AdminException;
+
+ /**
+ * 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#WILDCARD WILDCARD}"
+ * 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
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
+ Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException;
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Principal.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Principal.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Principal.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Principal.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,68 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * A Principal may participate in entitlements (authorization). A Principal
+ * may also posess administrative roles for the system.
+ *
+ * <p>The identifier pattern for all principal types is <code>"name"</code>.
+ * A name is concidered to be unique across the system for all
+ * principal types.</p>
+ * @since 4.3
+ */
+public interface Principal extends AdminObject {
+
+ /** User internal type. Note that a User can be of type Admin and vice versa. */
+ static final int TYPE_USER = 0;
+ /** Group internal type */
+ static final int TYPE_GROUP = 1;
+ /** Admin internal type. Note that a User can be of type Admin and vice versa. */
+ static final int TYPE_ADMIN = 2;
+
+ /** Display String for User type */
+ static final String TYPE_LABEL_USER = "User"; //$NON-NLS-1$
+ /** Display String for Group type */
+ static final String TYPE_LABEL_GROUP = "Group"; //$NON-NLS-1$
+ /** Display String for Admin type */
+ static final String TYPE_LABEL_ADMIN = "Admin"; //$NON-NLS-1$
+
+ /** User and Group names can be no longer then this */
+ static final int NAME_LEN_LIMIT = 32;
+
+ /**
+ * Get the Principal type for this principal.
+ * @return the internal type of this user.
+ * @since 4.3
+ */
+ int getType();
+
+ /**
+ * Get the Principal type String for this principal.
+ * @return the String representation type of this user.
+ * @since 4.3
+ */
+ String getTypeLabel();
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/ProcessObject.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,168 @@
+/*
+ * 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.adminapi;
+
+import java.net.InetAddress;
+
+
+
+/**
+ * A Process in the MetaMatrix system.
+ *
+ * <p>The identifier pattern for a Process is <code>"hostName.processName"</code>.
+ * This Process identifier is concidered to be unique across the system.</p>
+ * @since 4.3
+ */
+public interface ProcessObject extends
+ AdminObject {
+
+ /**
+ * Process Min Heap Size Property Name
+ */
+ public static final String VM_MINIMUM_HEAP_SIZE_PROPERTY_NAME = "vm.starter.minHeapSize"; //$NON-NLS-1$
+ /**
+ * Process Max Heap Size Property Name
+ */
+ public static final String VM_MAXIMUM_HEAP_SIZE_PROPERTY_NAME = "vm.starter.maxHeapSize"; //$NON-NLS-1$
+ /**
+ * Process Port Property Name
+ */
+ public static final String SERVER_PORT = "vm.socketPort"; //$NON-NLS-1$
+ /**
+ * Process Max Treads Property Name
+ */
+ public static final String MAX_THREADS = "vm.maxThreads"; //$NON-NLS-1$
+ /**
+ * Process Time To Live Property Name
+ */
+ public static final String TIMETOLIVE = "vm.timetolive"; //$NON-NLS-1$
+ /**
+ * Process Import Buffer Size Property Name
+ */
+ public static final String INPUT_BUFFER_SIZE = "vm.inputBufferSize"; //$NON-NLS-1$
+ /**
+ * Process Output Buffer Size Property Name
+ */
+ public static final String OUTPUT_BUFFER_SIZE = "vm.outputBufferSize"; //$NON-NLS-1$
+ /**
+ * Process Forced Shutdown Time Property Name
+ */
+ public static final String FORCED_SHUTDOWN_TIME = "vm.forced.shutdown.time"; //$NON-NLS-1$
+ /**
+ * Process Enabled Flag Property Name
+ */
+ public static final String ENABLED_FLAG = "vm.enabled"; //$NON-NLS-1$
+
+ /**
+ * Get the {@link Host} Identifier for this MetaMatrix Process
+ *
+ * @return String A unique identifier for the Host of this Process.
+ * @since 4.3
+ */
+ public String getHostIdentifier();
+
+
+ /**
+ * Get the port number for this MetaMatrix Process
+ *
+ * @return listener port for this host
+ * @since 4.3
+ */
+ public int getPort();
+
+ /**
+ * Get the IP address for the MetaMatrix Process
+ * @return the IP address for the MetaMatrix Process
+ * @since 4.3
+ */
+ public InetAddress getInetAddress();
+
+ /**
+ * Is this process enabled in Configuration
+ *
+ * @return whether this process is enabled.
+ * @since 4.3
+ */
+ public boolean isEnabled();
+
+ /**
+ * @return amount of free memory for this Java process.
+ */
+ public long getFreeMemory();
+
+
+ /**
+ * @return thread count for this Java process.
+ */
+ public int getThreadCount();
+
+ /**
+ * @return total memory allocated for this Java process.
+ */
+ public long getTotalMemory();
+
+
+ /**
+ * @return whether this process is running.
+ * @since 4.3
+ */
+ public boolean isRunning();
+
+ /**
+ * @return Returns the maxSockets.
+ * @since 4.3
+ */
+ public int getMaxSockets();
+ /**
+ * @return Returns the maxVirtualSockets.
+ * @since 4.3
+ */
+ public int getMaxVirtualSockets();
+ /**
+ * @return Returns the objectsRead.
+ * @since 4.3
+ */
+ public long getObjectsRead();
+ /**
+ * @return Returns the objectsWritten.
+ * @since 4.3
+ */
+ public long getObjectsWritten();
+ /**
+ * @return Returns the sockets.
+ * @since 4.3
+ */
+ public int getSockets();
+ /**
+ * @return Returns the virtualSockets.
+ * @since 4.3
+ */
+ public int getVirtualSockets();
+
+
+ /**
+ * @return Returns the queueWorkerPool.
+ * @since 4.3
+ */
+ public QueueWorkerPool getQueueWorkerPool();
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/PropertyDefinition.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,152 @@
+/*
+ * 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.adminapi;
+
+import java.util.Collection;
+
+/**
+ * Information about a property of an AdminObject
+ */
+public interface PropertyDefinition extends AdminObject {
+
+ public enum RestartType {
+ NONE,
+ SERVICE,
+ PROCESS,
+ ALL_PROCESSES,
+ CLUSTER
+ }
+ /**
+ * The value of the maximum multiplicity if the multiplicity is considered unbounded.
+ */
+ public static final int UNBOUNDED_VALUE = Integer.MAX_VALUE;
+
+
+
+ /**
+ * Get the current value of this property.
+ * @return the current value of this property.
+ */
+ String getValue();
+
+ /**
+ * Get the localized display name of this property.
+ * @return the displayable name for this property
+ */
+ String getDisplayName();
+
+ /**
+ * Get the description of this property.
+ * @return the description for this property
+ */
+ String getDescription();
+
+
+
+ /**
+ * Get the type for values of this property.
+ * @return the type that best describes the values of this property.
+ */
+ String getPropertyType();
+
+
+ /**
+ * Get the name of the java class that best represents the property type.
+ * @return the name of the java class that best represents the property type.
+ */
+ String getPropertyTypeClassName();
+
+
+ /**
+ * Get the default value for values of this property, or an empty String if
+ * there is no default value.
+ * @return the default value for this property, or an empty String
+ * if there is no default value.
+ */
+ Object getDefaultValue();
+
+ /**
+ * Get the allowed values for this property.
+ * @return the list of allowed values for this property, or an empty
+ * set if the values do not have to conform to a fixed set.
+ */
+ Collection getAllowedValues();
+
+ /**
+ * Get whether this property requires the system to be restarted before it takes effect.
+ * @return true if this property requires the system to be restarted before it takes effect.
+ */
+ public RestartType getRequiresRestart();
+
+ /**
+ * The modifiable flag is used to identify features that may not be changed once
+ * they are set.
+ * @return true if this property is marked with the modifyable
+ * flag, or false otherwise.
+ */
+ boolean isModifiable();
+
+ /**
+ * Return whether the value or values for this property are constrained to be only
+ * those in the AllowedValues list.
+ * @see #getAllowedValues
+ * @return true if this property's value must be with the list of AllowedValues.
+ */
+ boolean isConstrainedToAllowedValues();
+
+ /**
+ * The "expert" flag is used to distinguish between features that are
+ * intended for expert users from those that are intended for normal users.
+ * @return true if this property is to be marked with the expert flag,
+ * or false otherwise.
+ */
+ boolean isExpert();
+ /**
+ * The "required" flag is used to identify features that require at least
+ * one value (possibly a default value) by the consumer of the property. Whether
+ * a property definition is required or not can be determined entirely from the
+ * multiplicity: if the multiplicity includes '0', then the property is
+ * not required.
+ * <p>
+ * Whether a property is required by the consumer is unrelated to whether
+ * there is a default value, which only simplifies the task of the property
+ * provider. A property may be required, meaning it must have at least one
+ * value, but that same property definition may or may not have a default.
+ * The combination of required and whether it has a default will determine
+ * whether the user must supply a value.
+ * @return true if this property requires at least one value.
+ */
+ boolean isRequired();
+ /**
+ * The "masked" flag is used to tell whether the value should be masked
+ * when displayed to users.
+ * @return true if this property value is to be masked,
+ * or false otherwise.
+ */
+ boolean isMasked();
+
+
+
+}
+
+
Copied: trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/QueueWorkerPool.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,88 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * All server modules use queue based processing inside them. This
+ * object holds the statistics of those queues, as per how many of them queued, dequeued,
+ * processed etc.
+ * <p>An identifier for QueueWorkerPool, is nothing but the modules it self, like "DQP",
+ * "QueryService" or Connector Binding names etc.</p>
+ *
+ * @since 4.3
+ */
+public interface QueueWorkerPool extends AdminObject {
+ /**
+ * @return Returns the number of requests queued.
+ * @since 4.3
+ */
+ public int getQueued();
+
+ /**
+ * @return Returns the number of threads.
+ * @since 4.3
+ */
+ public int getThreads();
+
+ /**
+ * @return Returns the highest number of active threads
+ */
+ public int getHighestThreads();
+
+ /**
+ * @return Returns the number of totalDequeues.
+ * @since 4.3
+ * @deprecated see {@link #getTotalCompleted()}
+ */
+ public long getTotalDequeues();
+
+ /**
+ * @return The number of completed tasks
+ */
+ long getTotalCompleted();
+
+ /**
+ * @return Returns the number of totalEnqueues.
+ * @since 4.3
+ * @deprecated see {@link #getTotalSubmitted()}
+ */
+ public long getTotalEnqueues();
+
+ /**
+ * @return The number of submitted tasks
+ */
+ long getTotalSubmitted();
+
+ /**
+ * @return Returns the totalHighwaterMark.
+ * @since 4.3
+ * @deprecated see {@link #getHighestQueued()}
+ */
+ public int getTotalHighwaterMark();
+
+ /**
+ * @return Returns the highest queue size
+ */
+ public int getHighestQueued();
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Request.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Request.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Request.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Request.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,105 @@
+/*
+ * 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.adminapi;
+
+import java.util.Date;
+
+
+/**
+ * When a user submits a SQL command to the system for processing, usually that represents
+ * a single request. A single request might have one or more source
+ * requests (the requests that are being processed on the physical data sources) as part
+ * of original request.
+ *
+ * <p>A request is identified by a numbers separated by '|'. usually in they are arranged
+ * in the pattern [session]|[request] or [session]|[request]|[source request] </p>
+ * @since 4.3
+ */
+public interface Request extends AdminObject {
+ /**
+ * @return Date the request was created
+ * @since 4.3
+ */
+ public Date getCreated();
+
+ /**
+ * Get the RequestID for a Request
+ * @return RequestID
+ */
+ public String getRequestID();
+
+ /**
+ * Get the SessionID for a Request
+ *
+ * @return long SessionID
+ */
+ public String getSessionID();
+
+ /**
+ * Get the SQL Command sent to the Server for a Request
+ *
+ * @return MetaMatrix SQL Command
+ */
+ public String getSqlCommand();
+
+ /**
+ * Get the Date processing began for the Request
+ * @return Date processing began
+ */
+ public Date getProcessingDate();
+
+ /**
+ * Get the TransactionID of the Request
+ *
+ * @return String of TransactionID if in a transaction
+ */
+ public String getTransactionID();
+
+
+ /**
+ * Get the UserName of the Request
+ *
+ * @return String username for the Request
+ */
+ public String getUserName();
+
+
+ /**
+ * @return Returns the connectorBindingName.
+ * @since 4.3
+ */
+ public String getConnectorBindingName();
+
+ /**
+ * @return Returns whether this is a Source Request.
+ * @since 4.3
+ */
+ public boolean isSource();
+
+ /**
+ * @return In the case that this is a source request this represents the node id. Otherwise blank
+ * @since 4.3
+ */
+ public String getNodeID();
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Resource.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Resource.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Resource.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Resource.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,36 @@
+/*
+ * 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.adminapi;
+
+
+/**
+ * @since 4.3
+ */
+public interface Resource extends AdminObject {
+
+ /**
+ * The environment property that indicates the name of the pool.
+ */
+ public static final String RESOURCE_POOL = "metamatrix.common.pooling.resource.name"; //$NON-NLS-1$
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Role.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Role.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Role.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Role.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,39 @@
+/*
+ * 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.adminapi;
+
+
+
+/**
+ * @since 4.3
+ */
+public interface Role extends AdminObject {
+
+ /** System admin role name */
+ public static final String ADMIN_SYSTEM = AdminRoles.RoleName.ADMIN_SYSTEM;
+ /** Product admin role name */
+ public static final String ADMIN_PRODUCT = AdminRoles.RoleName.ADMIN_PRODUCT;
+ /** Read-only admin role name */
+ public static final String ADMIN_READONLY = AdminRoles.RoleName.ADMIN_READONLY;
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreRuntimeStateAdmin.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,165 @@
+/*
+ * 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.adminapi;
+
+import javax.transaction.xa.Xid;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * This interface defines the methods to interact with the MetaMatrix system
+ * during runtime.
+ *
+ * <p>As a <i>core</i> interface,
+ * this administration is common to both the MetaMatrix server and MM Query.</p>
+ *
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
+public interface RuntimeStateAdmin {
+
+ /**
+ * Start Connector Binding
+ *
+ * @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
+ * <li><code>"name"</code> - for single connector binding by the given name
+ * </ul>
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ void startConnectorBinding(String connectorBindingIdentifier) throws AdminException;
+
+ /**
+ * Stop Connector Binding
+ *
+ * @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
+ * <li><code>"name"</code> - for single connector binding by the given name
+ * </ul>
+ * @param stopNow If true, stop the process forcefully. If false, wait until any pending work is done.
+ * @throws AdminException - if there's a system error.
+ * @since 4.3
+ */
+ void stopConnectorBinding(String connectorBindingIdentifier,
+ boolean stopNow) throws AdminException;
+
+ /**
+ * Clear the cache or caches specified by the cacheIdentifier.
+ * @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
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
+ void clearCache(String cacheIdentifier) throws AdminException;
+
+ /**
+ * Terminate the Session
+ *
+ * @param identifier Session Identifier {@link org.teiid.adminapi.Session}.
+ * No wild cards currently supported, must be explicit
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ void terminateSession(String identifier) throws AdminException;
+
+ /**
+ * Cancel Request
+ *
+ * @param identifier The request identifier 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
+ */
+ void cancelRequest(String identifier) throws AdminException;
+
+ /**
+ * Cancel Source Request
+ *
+ * @param identifier The request identifier 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
+ */
+ void cancelSourceRequest(String identifier) throws AdminException;
+
+ /**
+ * Change the status of a Deployed VDB
+ *
+ * @param name Name of the Virtual Database
+ * @param version Version of the Virtual Database
+ * @param status Active, InActive, Delete
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ public void changeVDBStatus(String name, String version, int status)
+ throws AdminException;
+
+ /**
+ * Mark the given global transaction as rollback only.
+ * @param transactionId
+ * @throws AdminException
+ */
+ void terminateTransaction(Xid transactionId) throws AdminException;
+
+ /**
+ * Mark the given transaction as rollback only.
+ * @param identifier
+ * The exact identifier of the transaction. Wild card is not supported.
+ * @param the session the transaction is associated with.
+ * @throws AdminException
+ */
+ void terminateTransaction(String transactionId, String sessionId) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * 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.
+ * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
+ * @throws AdminException
+ * @since 4.3
+ */
+ void shutdown(int millisToWait) throws AdminException;
+
+ /**
+ * Restart System
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ void restart() throws AdminException;
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/ScriptsContainer.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/ScriptsContainer.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ScriptsContainer.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ScriptsContainer.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,68 @@
+/*
+ * 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.adminapi;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+
+
+
+/**
+ * Contains all information nessecary to save the scripts that will be run
+ * by a MetaMatrix utility to load or refresh the data resident in a
+ * Materialized View.
+ * <p>
+ * Users can get the contents of each file and save each with the
+ * filename associated with it or, more easily, users can save all files
+ * to a local folder. (See {@link #saveAllToDirectory})</p>
+ * <p>
+ * @since 4.3
+ */
+public interface ScriptsContainer extends Serializable {
+
+ /**
+ * Get the file names of all scripts in this container.
+ *
+ * @return The <code>Collection</code> of <code>String</code>
+ * file names of all scripts in this container. This
+ * collection may be empty if an error has occured.
+ * @since 4.3
+ */
+ Collection getFileNames();
+
+ /**
+ * Save all of the scripts contained to the specified local
+ * directory.
+ *
+ * @param directoryLocation the directory location to save
+ * the contained scripts. Must be accessable from where
+ * this code is running.
+ * @param options Specify whether to {@link AdminOptions.OnConflict#OVERWRITE}
+ * or {@link AdminOptions.OnConflict#EXCEPTION} (default) when script files
+ * exist in the <code>directoryLocation</code>.
+ * @throws AdminException if there's an error saving the files.
+ * @since 4.3
+ */
+ void saveAllToDirectory(String directoryLocation, AdminOptions options) throws AdminException;
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/core/CoreSecurityAdmin.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,163 @@
+/*
+ * 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.adminapi;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * This interface defines the methods available for security administration
+ * in the Teiid system.
+ *
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
+public interface SecurityAdmin {
+ /**
+ * 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<Role> getRolesForGroup(String groupIdentifier) throws AdminException;
+
+ /**
+ * Get the group memberships for the given user.
+ *
+ * @param userIdentifier
+ * The unique identifier for the 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<Group> getGroupsForUser(String userIdentifier) throws AdminException;
+
+
+ /**
+ * 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 groups.
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ Collection<Group> getGroups(String groupIdentifier) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * 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 data - character data array containing the XML file which defines the roles
+ * @param options - options to overwrite in case the matching roles already exist.
+ * @return a report of the import
+ * @throws AdminException
+ */
+ String importDataRoles(String vdbName, String vdbVersion, char[] data, AdminOptions options)
+ throws AdminException;
+
+ /**
+ * Export the data roles defined for the given vdb from the current system
+ * @param vdbName - Name of the vdb
+ * @param vdbVersion - version of the vdb
+ * @return - char[] stream containing the XML contents of the roles.
+ * @throws AdminException
+ */
+ char[] exportDataRoles(String vdbName, String vdbVersion) throws AdminException;
+
+ /**
+ * Authenticate a user with the specified user name and credentials
+ * for use with the specified application. The application name may also
+ * be used by the Membership Service to determine the appropriate authentication
+ * mechanism.
+ * @param username the user name that is to be authenticated
+ * @param credential
+ * @param trustePayload
+ * @param applicationName the name of the application for which the user
+ * is authenticating
+ * @return true if the authentication is successful
+ * @throws AdminException
+ */
+ boolean authenticateUser(String username, char[] credentials, Serializable trustePayload, String applicationName) throws AdminException;
+
+ /**
+ * Returns the active authorization provider domain names, in authentication order.
+ * @return List<String>
+ * @throws AdminException
+ */
+ List<String> getDomainNames( ) throws AdminException;
+
+ /**
+ * 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<Group> getGroupsForDomain(String domainName) throws AdminException;
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Service.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Service.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Service.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Service.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,98 @@
+/*
+ * 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.adminapi;
+
+import java.util.Date;
+
+/**
+ * Represents a service in the MetaMatrix system.
+ *
+ * <p>The unique identifier pattern is [host]<{@link #DELIMITER}>[process]<{@link #DELIMITER}>[Service Name]
+ * when running against a MetaMatrix server. The [Service Name] can itself have spaces in the name.
+ * In the case of the MM Query, a Service does not apply as MM Query is not running within a MM Server VM.</p>
+ *
+ * @since 4.3
+ */
+public interface Service extends
+ AdminObject {
+ /**Registered by not initialized*/
+ public static final int STATE_NOT_INITIALIZED = 0;
+ /**Open and running*/
+ public static final int STATE_OPEN = 1;
+ /**Registered but closed*/
+ public static final int STATE_CLOSED = 2;
+ /**Failed after running successfully*/
+ public static final int STATE_FAILED = 3;
+ /**Failed during initialization*/
+ public static final int STATE_INIT_FAILED = 4;
+ /**Not registered*/
+ public static final int STATE_NOT_REGISTERED = 5;
+ /**Running, but the underlying data source is unavailable*/
+ public static final int STATE_DATA_SOURCE_UNAVAILABLE = 6;
+ /**Running, not deployed*/
+ public static final int STATE_NOT_DEPLOYED = 7;
+
+ /**
+ * Retrieve the current connector state. This will be one of the constants:
+ * {@link DQP#STATE_OPEN DQP.STATE_OPEN}.
+ * {@link DQP#STATE_NOT_INITIALIZED DQP.STATE_NOT_INITIALIZED}.
+ * {@link DQP#STATE_CLOSED DQP.STATE_CLOSED}.
+ * {@link DQP#STATE_FAILED DQP.STATE_FAILED}.
+ * {@link DQP#STATE_INIT_FAILED DQP.STATE_INIT_FAILED}.
+ * {@link DQP#STATE_NOT_REGISTERED DQP.STATE_NOT_REGISTERED}.
+ * {@link DQP#STATE_DATA_SOURCE_UNAVAILABLE DQP.STATE_DATA_SOURCE_UNAVAILABLE}.
+ * {@link DQP#STATE_NOT_DEPLOYED DQP.STATE_NOT_DEPLOYED}.
+ * @return current connector state.
+ */
+ int getState();
+
+ /**
+ * Retrieve the current connector state as a printable <code>String</code>.
+ * @return current connector state in String form.
+ */
+ String getStateAsString();
+
+ /**
+ * Returns time of last state change.
+ *
+ * @return time of last state change.
+ * @since 4.3
+ */
+ Date getStateChangedTime();
+
+ /**
+ * Returns the description
+ *
+ * @return description
+ */
+ String getDescription();
+
+ /**
+ * Get the component type identifier for this service {@link ComponentType}.
+ * @return the Component Type identifier which can be used to
+ * find the ComponentType.
+ * @since 6.1
+ */
+ String getComponentTypeName();
+
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/Service.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/client/src/main/java/org/teiid/adminapi/Session.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Session.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Session.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Session.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,186 @@
+/*
+ * 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.adminapi;
+
+import java.util.Date;
+
+/**
+ * A Session is a lasting connection between a client and a MetaMatrix System.
+ *
+ * A user may be allowed to have multiple sessions active simultaneously.
+ *
+ * <p>a Session identifier gets automatically assigned
+ * to a connection when user logs into the system</p>
+ *
+ * @since 4.3
+ */
+public interface Session extends
+ AdminObject {
+
+
+ /**
+ * The session is open (active).
+ */
+ public static final int STATE_ACTIVE = 1;
+
+ /**
+ * The ejb server has passivated the session - it may become
+ *open again in the future
+ */
+ public static final int STATE_PASSIVATED = 2;
+
+ /**
+ * The session is closed - this state cannot change once it
+ *is reached.
+ */
+ public static final int STATE_CLOSED = 3;
+
+ /**
+ * The session has expired - this state cannot change once it
+ *is reached.
+ */
+ public static final int STATE_EXPIRED = 4;
+
+ /**
+ * The session is terminated - this state cannot change once it
+ *is reached.
+ */
+ public static final int STATE_TERMINATED = 5;
+
+ /**
+ * The description when the session has expired - this state cannot change once it
+ * is reached.
+ */
+ public static final String EXPIRED_STATE_DESC = "Expired"; //$NON-NLS-1$
+
+ /**
+ * The description when the session is open (active).
+ */
+ public static final String ACTIVE_STATE_DESC = "Active";//$NON-NLS-1$
+
+ /**
+ * The description when the session is closed - this state cannot change once it
+ * is reached.
+ */
+ public static final String CLOSED_STATE_DESC = "Closed";//$NON-NLS-1$
+
+ /**
+ * The description when the session is terminated - this state cannot change once it
+ *is reached.
+ */
+ public static final String TERMINATED_STATE_DESC = "Terminated";//$NON-NLS-1$
+
+ /**
+ * The description when the ejb server has passivated the session - it may become
+ * open again in the future
+ */
+ public static final String PASSIVATED_STATE_DESC = "Passivated";//$NON-NLS-1$
+
+ /**
+ * The description when the state of the session is not known.
+ */
+ public static final String UNKNOWN_STATE_DESC = "Unknown";//$NON-NLS-1$
+
+
+
+
+ /**
+ * Get the Last time Client has check to see if the server is still available
+ *
+ * @return Date of the last ping to the server.
+ */
+ public Date getLastPingTime();
+
+
+ /**
+ * Get the Session State as a String.
+ *
+ * @return SessionState
+ */
+ public String getStateAsString();
+
+ /**
+ * Get the Application Name
+ *
+ * @return String of the Application Name
+ */
+ public String getApplicationName();
+
+ /**
+ * Get the unique MetaMatrix session
+ * within a given MetaMatrix System
+ *
+ * @return String of the Session ID
+ */
+ public String getSessionID();
+
+ /**
+ * Get the State of the Session
+ *
+ * @return int of the Session's state
+ */
+ public int getState();
+
+ /**
+ * Get User Name for this Session
+ *
+ * @return String of UserName
+ */
+ public String getUserName();
+
+ /**
+ * Get the VDB Name for this Session
+ *
+ * @return String name of the VDB
+ */
+ public String getVDBName();
+
+ /**
+ * Get the VDB Version for this Session
+ *
+ * @return String name/number of the VDB Version
+ */
+ public String getVDBVersion();
+
+ /**
+ * Get the IPAddress for this Session
+ * @return
+ */
+ public String getIPAddress();
+
+
+ /**
+ * Get the host name of the machine the client is
+ * accessing from
+ * @return
+ */
+ public String getHostName() ;
+
+ /**
+ * Get the time the {@link Session} was created.
+ * @return
+ */
+ public Date getCreatedDate();
+
+
+}
\ No newline at end of file
Copied: trunk/client/src/main/java/org/teiid/adminapi/SystemObject.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/SystemObject.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/SystemObject.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/SystemObject.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,50 @@
+/*
+ * 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.adminapi;
+
+import java.util.Date;
+
+
+/**
+ * @since 4.3
+ */
+public interface SystemObject extends AdminObject {
+
+ /**
+ * @return Returns whether the system is started.
+ * @since 4.3
+ */
+ public boolean isStarted();
+
+
+
+ /**
+ * @return Returns the startTime.
+ * @since 4.3
+ */
+ public Date getStartTime();
+
+
+
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Transaction.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/Transaction.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Transaction.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Transaction.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,63 @@
+/*
+ * 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.adminapi;
+
+import java.util.Date;
+
+import javax.transaction.xa.Xid;
+
+public interface Transaction extends AdminObject {
+
+ /**
+ * Get the session associated with the this transaction.
+ * May be null for an unassociated Global transaction.
+ * @return
+ */
+ String getAssociatedSession();
+
+ /**
+ * Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST
+ * @return
+ */
+ String getScope();
+
+ /**
+ * Return the Xid of the Global transaction. Will be null for non-Global transactions.
+ * @return
+ */
+ Xid getXid();
+
+ /**
+ * Get the current status. See {@link javax.transaction.Status} for
+ * possible values.
+ * @return
+ */
+ String getStatus();
+
+ /**
+ * Get the date the transaction was created.
+ * @return
+ */
+ Date getCreated();
+
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/Transaction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/client/src/main/java/org/teiid/adminapi/User.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/User.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/User.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/User.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,52 @@
+/*
+ * 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.adminapi;
+
+/**
+ * A user of the MetaMatrix system may a participant or an
+ * administrator of the MetaMatrix system.
+ * <p>
+ * A User is an actor in the MetaMatrix system. A User
+ * can log in (authenticate) and perform actions on the system.</p>
+ *
+ * <p>See {@link Principal} for identity pattern and other
+ * abilities.</p>
+ * @since 4.3
+ */
+public interface User extends Principal {
+
+ /**
+ * Optional properties for Users
+ */
+ /** User's common name */
+ static final String COMMON_NAME = "commonName"; //$NON-NLS-1$
+ /** User's given name */
+ static final String GIVEN_NAME = "givenName"; //$NON-NLS-1$
+ /** User's surname (last name) */
+ static final String SURNAME = "surName"; //$NON-NLS-1$
+ /** User's location */
+ static final String LOCATION = "location"; //$NON-NLS-1$
+ /** User's telephone number */
+ static final String TELEPHONE_NUMBER = "telephoneNumber"; //$NON-NLS-1$
+
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/VDB.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/objects/VDB.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/VDB.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/VDB.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,122 @@
+/*
+ * 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.adminapi;
+
+import java.util.Collection;
+import java.util.Date;
+
+/**
+ * Represents a Virtual Database in the MetaMatrix system.
+ * <br>A VDB has a name and a version.</br>
+ *
+ * <p>The identifier pattern for a VDB is <CODE>"name<{@link #DELIMITER_CHAR}>version"</CODE>,
+ * where the name of the VDB and its version represent its unique identifier in the MetaMatrix system.
+ * There are no spaces allowed in a given VDB name, and VDB name must start with a letter.
+ * A version number is automatically assigned to a VDB when it is deployed into
+ * a system. A VDB is uniquely identified by <CODE>"name<{@link #DELIMITER_CHAR}>version"</CODE>.
+ * For example: <CODE>"Accounts<{@link #DELIMITER_CHAR}>1"</CODE>, <CODE>"UnifiedSales<{@link #DELIMITER_CHAR}>4</CODE>" etc.
+ * </p>
+ *
+ * @since 4.3
+ */
+public interface VDB extends
+ AdminObject {
+
+ /**
+ * Constant to denote the latest version of a VDB located
+ * at a given repository location. Used when deploying a
+ * VDB to the MetaMatrix Server from the server repository.
+ */
+ public static final String SERVER_REPOSITORY_LATEST_VERSION = "LATEST"; //$NON-NLS-1$
+
+ /**
+ * Incomplete (if import does not have all the connector bindings)
+ *
+ * @since 4.3
+ */
+ public static final int INCOMPLETE = 1;
+ /**
+ * Inactive VDB (can edit connector binding)
+ *
+ * @since 4.3
+ */
+ public static final int INACTIVE = 2;
+ /**
+ * Active VDB
+ *
+ * @since 4.3
+ */
+ public static final int ACTIVE = 3;
+ /**
+ * Mark VDB for Deletion
+ *
+ * @since 4.3
+ */
+ public static final int DELETED = 4;
+
+ /**
+ * @return date the VDB was versioned
+ */
+ public Date getVersionedDate();
+
+ /**
+ * @return user that versioned the VDB
+ */
+ public String getVersionedBy();
+
+ /**
+ * @return Collection of MMModels
+ */
+ public Collection getModels();
+
+ /**
+ * @return the status
+ */
+ public int getState();
+
+ /**
+ * @return the status
+ */
+ public String getStateAsString();
+
+ /**
+ * @return the VDB version
+ */
+ public String getVDBVersion();
+
+ /**
+ * Check to see if this VDB has any Materialized Models
+ *
+ * @return true or false
+ * @since 4.3
+ */
+ public boolean hasMaterializedViews();
+
+ /**
+ * Check to see if this VDB contains a WSDL.
+ * @return true if it contains a WSDL.
+ * @since 5.5.3
+ */
+ public boolean hasWSDL();
+
+}
Modified: trunk/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,9 +22,10 @@
package com.metamatrix.admin.api.objects;
+import org.teiid.adminapi.AdminOptions;
+
import junit.framework.TestCase;
-import com.metamatrix.admin.api.objects.AdminOptions;
/**
Modified: trunk/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,13 +22,19 @@
package com.metamatrix.common.comm.platform.client;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.stub;
+import static org.mockito.Mockito.stubVoid;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
import java.util.Properties;
import org.junit.Test;
-import static org.mockito.Mockito.*;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.server.ServerAdmin;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.api.ServerConnectionFactory;
import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
@@ -38,17 +44,17 @@
@Test public void testBounce() throws Exception {
ServerConnectionFactory scf = mock(ServerConnectionFactory.class);
ServerConnection sc = mock(ServerConnection.class);
- ServerAdmin sa = mock(ServerAdmin.class);
- stubVoid(sa).toThrow(new AdminComponentException(new SingleInstanceCommunicationException())).on().bounceSystem(true);
- stub(sc.getService(ServerAdmin.class)).toReturn(sa);
+ Admin sa = mock(Admin.class);
+ stubVoid(sa).toThrow(new AdminComponentException(new SingleInstanceCommunicationException())).on().restart();
+ stub(sc.getService(Admin.class)).toReturn(sa);
stub(scf.createConnection((Properties)anyObject())).toReturn(sc);
ServerAdminFactory saf = new ServerAdminFactory(scf, 1);
- ServerAdmin admin = saf.createAdmin("foo", "bar".toCharArray(), "mm://test:1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- admin.bounceSystem(true);
+ Admin admin = saf.createAdmin("foo", "bar".toCharArray(), "mm://test:1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ admin.restart();
//verify that the actual bounce was called
- verify(sa, times(1)).bounceSystem(true);
+ verify(sa, times(1)).restart();
//here's the test we issue to see that the system is up after the bounce
verify(sa, times(1)).getSystem();
Modified: trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestAdminApiServerDiscovery.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestAdminApiServerDiscovery.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestAdminApiServerDiscovery.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -30,9 +30,9 @@
import junit.framework.TestCase;
import org.mockito.Mockito;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.ProcessObject;
-import com.metamatrix.admin.api.objects.ProcessObject;
-import com.metamatrix.admin.api.server.ServerAdmin;
import com.metamatrix.common.api.HostInfo;
import com.metamatrix.common.api.MMURL;
import com.metamatrix.platform.security.api.LogonResult;
@@ -50,7 +50,7 @@
assertEquals(1, discovery.getKnownHosts(null, null).size());
SocketServerInstance instance = Mockito.mock(SocketServerInstance.class);
- ServerAdmin serverAdmin = Mockito.mock(ServerAdmin.class);
+ Admin serverAdmin = Mockito.mock(Admin.class);
List<ProcessObject> processes = new ArrayList<ProcessObject>();
ProcessObject p1 = Mockito.mock(ProcessObject.class);
@@ -63,7 +63,7 @@
Mockito.stub(p2.getInetAddress()).toReturn(InetAddress.getByName("0.0.0.0")); //$NON-NLS-1$
processes.add(p2);
Mockito.stub(serverAdmin.getProcesses("*")).toReturn(processes); //$NON-NLS-1$
- Mockito.stub(instance.getService(ServerAdmin.class)).toReturn(serverAdmin);
+ Mockito.stub(instance.getService(Admin.class)).toReturn(serverAdmin);
Mockito.stub(instance.getHostInfo()).toReturn(knownHost);
discovery.connectionSuccessful(knownHost);
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServiceRegistry.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -26,8 +26,9 @@
import junit.framework.TestCase;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.server.ServerAdmin;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.client.ExceptionUtil;
import com.metamatrix.common.xa.XATransactionException;
@@ -38,7 +39,7 @@
public void testExceptionConversionNoException() throws Exception {
- Method m = ServerAdmin.class.getMethod("close", new Class[] {});
+ Method m = Admin.class.getMethod("close", new Class[] {});
Throwable t = ExceptionUtil.convertException(m, new MetaMatrixComponentException());
@@ -47,7 +48,7 @@
public void testAdminExceptionConversion() throws Exception {
- Method m = ServerAdmin.class.getMethod("getHosts", new Class[] {String.class});
+ Method m = Admin.class.getMethod("getProcesses", new Class[] {String.class});
Throwable t = ExceptionUtil.convertException(m, new MetaMatrixComponentException());
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-27 05:22:45 UTC (rev 1089)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -446,7 +446,7 @@
* Shutdown the current transport
*/
void shutdown() {
- this.connectionFactory.shutdown();
+ this.connectionFactory.shutdown(false);
}
/**
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -57,10 +57,10 @@
import javax.transaction.xa.Xid;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
import org.teiid.jdbc.TeiidDriver;
-import com.metamatrix.admin.api.core.Admin;
-import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.api.ServerConnectionFactory;
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/api/Connection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/api/Connection.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/api/Connection.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,9 +24,10 @@
import java.sql.SQLException;
-import com.metamatrix.admin.api.core.Admin;
+import org.teiid.adminapi.Admin;
+
/**
* MetaMatrix extensions to the standard JDBC Connection interface.
*/
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractMMQueryTestCase.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractMMQueryTestCase.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractMMQueryTestCase.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -41,8 +41,8 @@
import junit.framework.Assert;
import org.junit.After;
+import org.teiid.adminapi.Admin;
-import com.metamatrix.admin.api.core.Admin;
import com.metamatrix.core.util.UnitTestUtil;
import com.metamatrix.jdbc.EmbeddedDriver;
import com.metamatrix.script.io.MetadataReader;
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentTypePropDefn.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentTypePropDefn.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/api/ComponentTypePropDefn.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -25,7 +25,8 @@
import java.io.Serializable;
import java.util.List;
-import com.metamatrix.admin.api.objects.PropertyDefinition.RestartType;
+import org.teiid.adminapi.PropertyDefinition.RestartType;
+
import com.metamatrix.common.object.PropertyDefinition;
import com.metamatrix.common.object.PropertyDefinitionImpl;
import com.metamatrix.common.object.PropertyType;
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -30,25 +30,25 @@
public static final String COMPONENT_TYPE_NAME = "Host"; //$NON-NLS-1$
- public static final String INSTALL_DIR = com.metamatrix.admin.api.objects.Host.INSTALL_DIR;
+ public static final String INSTALL_DIR = org.teiid.adminapi.Host.INSTALL_DIR;
- public static final String LOG_DIRECTORY = com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY;
+ public static final String LOG_DIRECTORY = org.teiid.adminapi.Host.LOG_DIRECTORY;
- public static final String HOST_DIRECTORY = com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY;
+ public static final String HOST_DIRECTORY = org.teiid.adminapi.Host.HOST_DIRECTORY;
- public static final String HOST_ENABLED = com.metamatrix.admin.api.objects.Host.HOST_ENABLED;
+ public static final String HOST_ENABLED = org.teiid.adminapi.Host.HOST_ENABLED;
/**
* When specified, indicates what address the host will be bound to. If this
* is not specified, then the host (logical) name will be used.
*/
- public static final String HOST_BIND_ADDRESS = com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS;
+ public static final String HOST_BIND_ADDRESS = org.teiid.adminapi.Host.HOST_BIND_ADDRESS;
/**
* The physical address represents a resolvable address for which the host can
* be found. This may or may not be the same as the host name.
*/
- public static final String HOST_PHYSICAL_ADDRESS = com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS;
+ public static final String HOST_PHYSICAL_ADDRESS = org.teiid.adminapi.Host.HOST_PHYSICAL_ADDRESS;
}
\ No newline at end of file
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -29,22 +29,22 @@
public static final String COMPONENT_TYPE_NAME = "VM"; //$NON-NLS-1$
- public static final String VM_MINIMUM_HEAP_SIZE_PROPERTY_NAME = com.metamatrix.admin.api.objects.ProcessObject.VM_MINIMUM_HEAP_SIZE_PROPERTY_NAME;
- public static final String VM_MAXIMUM_HEAP_SIZE_PROPERTY_NAME = com.metamatrix.admin.api.objects.ProcessObject.VM_MAXIMUM_HEAP_SIZE_PROPERTY_NAME;
+ public static final String VM_MINIMUM_HEAP_SIZE_PROPERTY_NAME = org.teiid.adminapi.ProcessObject.VM_MINIMUM_HEAP_SIZE_PROPERTY_NAME;
+ public static final String VM_MAXIMUM_HEAP_SIZE_PROPERTY_NAME = org.teiid.adminapi.ProcessObject.VM_MAXIMUM_HEAP_SIZE_PROPERTY_NAME;
// Socket VM related properties
/**
* @see SocketVMController
*/
public static final String CLUSTER_PORT = "vm.unicast.port"; //$NON-NLS-1$
- public static final String SERVER_PORT = com.metamatrix.admin.api.objects.ProcessObject.SERVER_PORT;
- public static final String MAX_THREADS = com.metamatrix.admin.api.objects.ProcessObject.MAX_THREADS;
- public static final String TIMETOLIVE = com.metamatrix.admin.api.objects.ProcessObject.TIMETOLIVE;
+ public static final String SERVER_PORT = org.teiid.adminapi.ProcessObject.SERVER_PORT;
+ public static final String MAX_THREADS = org.teiid.adminapi.ProcessObject.MAX_THREADS;
+ public static final String TIMETOLIVE = org.teiid.adminapi.ProcessObject.TIMETOLIVE;
- public static final String INPUT_BUFFER_SIZE = com.metamatrix.admin.api.objects.ProcessObject.INPUT_BUFFER_SIZE;
- public static final String OUTPUT_BUFFER_SIZE = com.metamatrix.admin.api.objects.ProcessObject.OUTPUT_BUFFER_SIZE;
- public static final String FORCED_SHUTDOWN_TIME = com.metamatrix.admin.api.objects.ProcessObject.FORCED_SHUTDOWN_TIME;
- public static final String ENABLED_FLAG = com.metamatrix.admin.api.objects.ProcessObject.ENABLED_FLAG;
+ public static final String INPUT_BUFFER_SIZE = org.teiid.adminapi.ProcessObject.INPUT_BUFFER_SIZE;
+ public static final String OUTPUT_BUFFER_SIZE = org.teiid.adminapi.ProcessObject.OUTPUT_BUFFER_SIZE;
+ public static final String FORCED_SHUTDOWN_TIME = org.teiid.adminapi.ProcessObject.FORCED_SHUTDOWN_TIME;
+ public static final String ENABLED_FLAG = org.teiid.adminapi.ProcessObject.ENABLED_FLAG;
/**
* When specified, indicates what address the vm will be bound to. If this is not
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLHelperImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLHelperImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLHelperImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -34,8 +34,8 @@
import java.util.Properties;
import org.jdom.Element;
+import org.teiid.adminapi.PropertyDefinition.RestartType;
-import com.metamatrix.admin.api.objects.PropertyDefinition.RestartType;
import com.metamatrix.common.CommonPlugin;
import com.metamatrix.common.config.api.AuthenticationProvider;
import com.metamatrix.common.config.api.ComponentDefn;
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinition.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinition.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinition.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,8 +24,9 @@
import java.util.List;
-import com.metamatrix.admin.api.objects.PropertyDefinition.RestartType;
+import org.teiid.adminapi.PropertyDefinition.RestartType;
+
/**
* Defines the type of property that will be placed in a detail panel or table
*/
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinitionImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinitionImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertyDefinitionImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -26,7 +26,8 @@
import java.util.Collections;
import java.util.List;
-import com.metamatrix.admin.api.objects.PropertyDefinition.RestartType;
+import org.teiid.adminapi.PropertyDefinition.RestartType;
+
import com.metamatrix.common.CommonPlugin;
import com.metamatrix.common.util.ErrorMessageKeys;
Modified: trunk/common-internal/src/main/java/com/metamatrix/vdb/runtime/BasicModelInfo.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/vdb/runtime/BasicModelInfo.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/common-internal/src/main/java/com/metamatrix/vdb/runtime/BasicModelInfo.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -163,7 +163,7 @@
* if the model has been flagged so that the user can
* actually assign multi connector bindngs.
*
- * @see com.metamatrix.metadata.runtime.api.Model#supportsMultiSourceBindings()
+ * @see org.teiid.adminapi.Model#supportsMultiSourceBindings()
* @since 4.2
*/
public boolean supportsMultiSourceBindings() {
Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -23,6 +23,7 @@
package com.metamatrix.connector.object;
+import org.teiid.adminapi.AdminException;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ConnectorLogger;
@@ -32,7 +33,6 @@
import org.teiid.connector.language.IProcedure;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.connector.object.extension.IObjectSource;
import com.metamatrix.connector.object.extension.ISourceTranslator;
import com.metamatrix.connector.object.util.ObjectConnectorUtil;
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -32,16 +32,17 @@
import java.util.Properties;
import java.util.Set;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Cache;
+import org.teiid.adminapi.ExtensionModule;
+import org.teiid.adminapi.Session;
+import org.teiid.adminapi.SystemObject;
+import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.dqp.internal.process.Util;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.Cache;
-import com.metamatrix.admin.api.objects.ExtensionModule;
-import com.metamatrix.admin.api.objects.Session;
-import com.metamatrix.admin.api.objects.SystemObject;
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.admin.objects.MMConnectorBinding;
import com.metamatrix.admin.objects.MMConnectorType;
@@ -64,12 +65,15 @@
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.DataService;
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.platform.security.api.SessionToken;
+import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
import com.metamatrix.platform.util.ProductInfoConstants;
import com.metamatrix.server.serverapi.RequestInfo;
@@ -152,7 +156,15 @@
TransactionService getTransactionService() {
return (TransactionService)getManager().findService(DQPServiceNames.TRANSACTION_SERVICE);
}
+
+ MembershipServiceInterface getMembershipService() {
+ return (MembershipServiceInterface)getManager().findService(DQPServiceNames.MEMBERSHIP_SERVICE);
+ }
+ AuthorizationService getAuthorizationService() {
+ return (AuthorizationService)getManager().findService(DQPServiceNames.AUTHORIZATION_SERVICE);
+ }
+
ConfigurationService getConfigurationService() {
return (ConfigurationService)getManager().findService(DQPServiceNames.CONFIGURATION_SERVICE);
}
@@ -245,8 +257,8 @@
}
Object convertToNativeObjects(Object src) {
- if (src instanceof com.metamatrix.admin.api.objects.LogConfiguration) {
- com.metamatrix.admin.api.objects.LogConfiguration config = (com.metamatrix.admin.api.objects.LogConfiguration)src;
+ if (src instanceof org.teiid.adminapi.LogConfiguration) {
+ org.teiid.adminapi.LogConfiguration config = (org.teiid.adminapi.LogConfiguration)src;
return covertToNativeLogConfiguration(config);
}
throw new UnsupportedOperationException(DQPEmbeddedPlugin.Util.getString("UnSupported_object_conversion")); //$NON-NLS-1$
@@ -271,7 +283,7 @@
/**
* Convert LogConfiguration to Admin Object
*/
- private com.metamatrix.admin.api.objects.LogConfiguration covertLogConfiguration(final com.metamatrix.common.log.LogConfiguration src) {
+ private org.teiid.adminapi.LogConfiguration covertLogConfiguration(final com.metamatrix.common.log.LogConfiguration src) {
Map<String, Integer> contextMap = new HashMap<String, Integer>();
for(String context:src.getContexts()) {
contextMap.put(context, src.getLogLevel(context));
@@ -282,7 +294,7 @@
/**
* Convert LogConfiguration to Admin Object
*/
- private com.metamatrix.common.log.LogConfiguration covertToNativeLogConfiguration(final com.metamatrix.admin.api.objects.LogConfiguration src) {
+ private com.metamatrix.common.log.LogConfiguration covertToNativeLogConfiguration(final org.teiid.adminapi.LogConfiguration src) {
Map<String, Integer> contextMap = new HashMap<String, Integer>();
for(String context:src.getContexts()) {
contextMap.put(context, src.getLogLevel(context));
@@ -295,7 +307,7 @@
* @return
* @since 4.3
*/
- private com.metamatrix.admin.api.objects.ConnectorBinding convertConnectorType(final com.metamatrix.common.config.api.ConnectorBinding src, final Object parent) {
+ private org.teiid.adminapi.ConnectorBinding convertConnectorType(final com.metamatrix.common.config.api.ConnectorBinding src, final Object parent) {
MMConnectorBinding binding = new MMConnectorBinding(new String[] {src.getDeployedName()});
binding.setConnectorTypeName(src.getComponentTypeID().getFullName());
@@ -315,13 +327,13 @@
try {
Boolean status = getDataService().getConnectorBindingState(src.getDeployedName());
if (status == Boolean.TRUE) {
- binding.setState(com.metamatrix.admin.api.objects.ConnectorBinding.STATE_OPEN);
+ binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_OPEN);
}
else if (status == Boolean.FALSE) {
- binding.setState(com.metamatrix.admin.api.objects.ConnectorBinding.STATE_DATA_SOURCE_UNAVAILABLE);
+ binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_DATA_SOURCE_UNAVAILABLE);
}
else {
- binding.setState(com.metamatrix.admin.api.objects.ConnectorBinding.STATE_DATA_SOURCE_UNAVAILABLE);
+ binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_DATA_SOURCE_UNAVAILABLE);
}
}catch(Exception e) {
binding.setState(MMConnectorBinding.STATE_DATA_SOURCE_UNAVAILABLE);
@@ -335,7 +347,7 @@
* @return
* @since 4.3
*/
- private com.metamatrix.admin.api.objects.ConnectorType convertConnectorType(final com.metamatrix.common.config.api.ConnectorBindingType src, final Object parent) {
+ private org.teiid.adminapi.ConnectorType convertConnectorType(final com.metamatrix.common.config.api.ConnectorBindingType src, final Object parent) {
MMConnectorType type = new MMConnectorType(new String[] {src.getName()});
type.setCreated(src.getCreatedDate());
type.setCreatedBy(src.getCreatedBy());
@@ -351,7 +363,7 @@
* @return
* @since 4.3
*/
- private com.metamatrix.admin.api.objects.VDB convertVDB(final com.metamatrix.common.vdb.api.VDBDefn src, final Object parent) {
+ private org.teiid.adminapi.VDB convertVDB(final com.metamatrix.common.vdb.api.VDBDefn src, final Object parent) {
MMVDB vdb = new MMVDB(new String[] {src.getName(), src.getVersion()});
vdb.setCreated(src.getDateCreated());
@@ -372,7 +384,7 @@
return vdb;
}
- private com.metamatrix.admin.api.objects.Model convertModel(final com.metamatrix.common.vdb.api.ModelInfo src, final Object parent) {
+ private org.teiid.adminapi.Model convertModel(final com.metamatrix.common.vdb.api.ModelInfo src, final Object parent) {
final com.metamatrix.common.vdb.api.VDBDefn vdb = (com.metamatrix.common.vdb.api.VDBDefn)parent;
MMModel model = new MMModel(new String[] {src.getName()});
model.setCreated(vdb.getDateCreated());
@@ -400,7 +412,7 @@
return model;
}
- private com.metamatrix.admin.api.objects.Request convertRequest(final RequestInfo src) {
+ private org.teiid.adminapi.Request convertRequest(final RequestInfo src) {
String connId = src.getRequestID().getConnectionID();
@@ -630,4 +642,9 @@
}
}
+
+ protected SessionToken validateSession() {
+ return DQPWorkContext.getWorkContext().getSessionToken();
+ }
+
}
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -30,15 +30,16 @@
import java.util.Properties;
import java.util.StringTokenizer;
-import com.metamatrix.admin.api.embedded.EmbeddedConfigAdmin;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.objects.AdminStatus;
-import com.metamatrix.admin.api.objects.LogConfiguration;
-import com.metamatrix.admin.api.objects.VDB;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.AdminStatus;
+import org.teiid.adminapi.ConfigurationAdmin;
+import org.teiid.adminapi.LogConfiguration;
+import org.teiid.adminapi.VDB;
+
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.admin.objects.MMAdminStatus;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -73,14 +74,14 @@
* DQP implementation of the Config Admin API
* @since 4.3
*/
-public class DQPConfigAdminImpl extends BaseAdmin implements EmbeddedConfigAdmin {
+public class DQPConfigAdminImpl extends BaseAdmin implements ConfigurationAdmin {
public DQPConfigAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#setSystemProperty(java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#setSystemProperty(java.lang.String, java.lang.String)
* @since 4.3
*/
public void setSystemProperty(String propertyName,String propertyValue)
@@ -97,7 +98,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#updateSystemProperties(java.util.Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#updateSystemProperties(java.util.Properties)
* @since 4.3
*/
public void updateSystemProperties(Properties properties) throws AdminException {
@@ -112,7 +113,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#setProperty(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#setProperty(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
* @since 4.3
*/
public void setProperty(String identifier, String className, String propertyName, String propertyValue)
@@ -126,7 +127,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#updateProperties(java.lang.String, java.lang.String, java.util.Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#updateProperties(java.lang.String, java.lang.String, java.util.Properties)
* @since 4.3
*/
public void updateProperties(String identifier, String className, Properties properties) throws AdminException {
@@ -186,7 +187,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addConnectorType(java.lang.String, char[])
+ * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorType(java.lang.String, char[])
* @since 4.3
*/
public void addConnectorType(String deployName, char[] cdkFile)
@@ -216,7 +217,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deleteConnectorType(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#deleteConnectorType(java.lang.String)
* @since 4.3
*/
public void deleteConnectorType(String deployName)
@@ -232,10 +233,10 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addConnectorBinding(java.lang.String, java.lang.String, java.util.Properties, AdminOptions)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorBinding(java.lang.String, java.lang.String, java.util.Properties, AdminOptions)
* @since 4.3
*/
- public com.metamatrix.admin.api.objects.ConnectorBinding addConnectorBinding(String deployName, String type, Properties properties, AdminOptions options)
+ public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String deployName, String type, Properties properties, AdminOptions options)
throws AdminException {
// if the options object is null treat as if it is IGNORE as default
if (options == null) {
@@ -261,7 +262,7 @@
}
else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
binding = getDataService().getConnectorBinding(deployName);
- return (com.metamatrix.admin.api.objects.ConnectorBinding) convertToAdminObjects(binding);
+ return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
}
}
@@ -287,7 +288,7 @@
} catch (MetaMatrixComponentException e) {
throw new AdminComponentException(e);
}
- return (com.metamatrix.admin.api.objects.ConnectorBinding) convertToAdminObjects(binding);
+ return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
}
boolean bindingExists(String name) throws MetaMatrixComponentException {
@@ -301,10 +302,10 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addConnectorBinding(java.lang.String, char[], AdminOptions)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorBinding(java.lang.String, char[], AdminOptions)
* @since 4.3
*/
- public com.metamatrix.admin.api.objects.ConnectorBinding addConnectorBinding(String deployName, char[] xmlFile, AdminOptions options)
+ public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String deployName, char[] xmlFile, AdminOptions options)
throws AdminException {
// if the options object is null treat as if it is IGNORE as default
@@ -330,7 +331,7 @@
}
else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
binding = getDataService().getConnectorBinding(deployName);
- return (com.metamatrix.admin.api.objects.ConnectorBinding) convertToAdminObjects(binding);
+ return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
}
}
@@ -363,7 +364,7 @@
throw new AdminComponentException(e);
}
- return (com.metamatrix.admin.api.objects.ConnectorBinding) convertToAdminObjects(binding);
+ return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
}
/**
@@ -398,7 +399,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deleteConnectorBinding(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#deleteConnectorBinding(java.lang.String)
* @since 4.3
*/
public void deleteConnectorBinding(String identifier)
@@ -414,7 +415,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addVDB(java.lang.String, byte[], char[], AdminOptions)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addVDB(java.lang.String, byte[], char[], AdminOptions)
* @since 4.3
*/
private VDB addVDB(String deployName, byte[] vdbFile, char[] defFile, AdminOptions options)
@@ -585,7 +586,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addVDB(java.lang.String, byte[], AdminOptions)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addVDB(java.lang.String, byte[], AdminOptions)
* @since 4.3
*/
public VDB addVDB(String deployName, byte[] vdbFile, AdminOptions options)
@@ -595,7 +596,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addExtensionModule(java.lang.String, java.lang.String, byte[], java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addExtensionModule(java.lang.String, java.lang.String, byte[], java.lang.String)
* @since 4.3
*/
public void addExtensionModule(String type, String sourceName, byte[] source, String description)
@@ -632,7 +633,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deleteExtensionModule(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#deleteExtensionModule(java.lang.String)
* @since 4.3
*/
public void deleteExtensionModule(String sourceName)
@@ -648,7 +649,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
* @since 4.3
*/
public void assignBindingToModel(String deployedConnectorBindingName, String vdbName, String vdbVersion, String modelName)
@@ -682,9 +683,45 @@
throw new AdminComponentException(e);
}
}
+
+ public void assignBindingsToModel(String[] deployedConnectorBindingName, String vdbName, String vdbVersion, String modelName) throws AdminException {
+ if (deployedConnectorBindingName == null || deployedConnectorBindingName.length == 0) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$
+ }
+
+ if (vdbName == null || vdbVersion == null || !vdbName.matches(SINGLE_WORD_REGEX)) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$
+ }
+ if (modelName == null || !modelName.matches(MULTIPLE_WORDS_REGEX)) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_model_name")); //$NON-NLS-1$
+ }
+
+ // find the connector binding if found in the configuration service
+ // add to the vdb binding.
+ try {
+ List list = new ArrayList();
+ for (int i = 0; i < deployedConnectorBindingName.length; i++) {
+ ConnectorBinding binding = getDataService().getConnectorBinding(deployedConnectorBindingName[i]);
+ if (binding != null) {
+ list.add(binding);
+ }
+ }
+
+ if (!list.isEmpty()) {
+ getConfigurationService().assignConnectorBinding(vdbName, vdbVersion, modelName, (ConnectorBinding[])list.toArray(new ConnectorBinding[list.size()]));
+ }
+ else {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Vdb_or_Model_notfound")); //$NON-NLS-1$
+ }
+ } catch (MetaMatrixComponentException e) {
+ throw new AdminComponentException(e);
+ }
+
+ }
+
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#getLogConfiguration()
+ * @see org.teiid.adminapi.ConfigurationAdmin#getLogConfiguration()
* @since 4.3
*/
public LogConfiguration getLogConfiguration()
@@ -693,7 +730,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#setLogConfiguration(com.metamatrix.admin.api.objects.LogConfiguration)
+ * @see org.teiid.adminapi.ConfigurationAdmin#setLogConfiguration(org.teiid.adminapi.LogConfiguration)
* @since 4.3
*/
public void setLogConfiguration(LogConfiguration config)
@@ -702,7 +739,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportExtensionModule(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportExtensionModule(java.lang.String)
* @since 4.3
*/
public byte[] exportExtensionModule(String sourceName) throws AdminException {
@@ -719,7 +756,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConfiguration()
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConfiguration()
* @since 4.3
*/
public char[] exportConfiguration() throws AdminException {
@@ -732,7 +769,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorBinding(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorBinding(java.lang.String)
* @since 4.3
*/
public char[] exportConnectorBinding(String identifier)
@@ -767,7 +804,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorType(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorType(java.lang.String)
* @since 4.3
*/
public char[] exportConnectorType(String identifier)
@@ -797,7 +834,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportVDB(java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportVDB(java.lang.String, java.lang.String)
* @since 4.3
*/
public byte[] exportVDB(String name, String version)
@@ -819,7 +856,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addConnectorArchive(byte[], com.metamatrix.admin.api.objects.AdminOptions)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorArchive(byte[], org.teiid.adminapi.AdminOptions)
* @since 4.3.2
*/
public void addConnectorArchive(byte[] contents, AdminOptions options) throws AdminException {
@@ -938,7 +975,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorArchive(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorArchive(java.lang.String)
* @since 4.3
*/
public byte[] exportConnectorArchive(String identifier) throws AdminException {
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,7 +22,8 @@
package com.metamatrix.dqp.embedded.admin;
-import com.metamatrix.admin.api.embedded.EmbeddedLogger;
+import org.teiid.adminapi.EmbeddedLogger;
+
import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.LogMessage;
import com.metamatrix.core.log.MessageLevel;
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,6 +22,8 @@
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;
@@ -32,22 +34,29 @@
import java.util.Properties;
import java.util.Set;
-import com.metamatrix.admin.api.embedded.EmbeddedMonitoringAdmin;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.SystemObject;
-import com.metamatrix.admin.api.objects.Transaction;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.MonitoringAdmin;
+import org.teiid.adminapi.ProcessObject;
+import org.teiid.adminapi.SystemObject;
+import org.teiid.adminapi.Transaction;
+
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;
@@ -55,14 +64,14 @@
* DQP implementation of the Monitoring API
* @since 4.3
*/
-public class DQPMonitoringAdminImpl extends BaseAdmin implements EmbeddedMonitoringAdmin {
+public class DQPMonitoringAdminImpl extends BaseAdmin implements MonitoringAdmin {
public DQPMonitoringAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getConnectorTypes(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getConnectorTypes(java.lang.String)
* @since 4.3
*/
public Collection getConnectorTypes(String identifier)
@@ -76,7 +85,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getVDBs(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getVDBs(java.lang.String)
* @since 4.3
*/
public Collection getVDBs(String identifier)
@@ -107,7 +116,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getConnectorBindings(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getConnectorBindings(java.lang.String)
* @since 4.3
*/
public Collection getConnectorBindings(String identifier)
@@ -121,7 +130,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getConnectorBindingsInVDB(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getConnectorBindingsInVDB(java.lang.String)
* @since 4.3
*/
public Collection getConnectorBindingsInVDB(String identifier) throws AdminException{
@@ -154,7 +163,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getExtensionModules(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getExtensionModules(java.lang.String)
* @since 4.3
*/
public Collection getExtensionModules(String identifier)
@@ -174,7 +183,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getQueueWorkerPools(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getQueueWorkerPools(java.lang.String)
* @since 4.3
*/
public Collection getQueueWorkerPools(String identifier)
@@ -214,7 +223,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getCaches(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getCaches(java.lang.String)
* @since 4.3
*/
public Collection getCaches(String identifier)
@@ -234,7 +243,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getSessions(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getSessions(java.lang.String)
* @since 4.3
*/
public Collection getSessions(String identifier)
@@ -256,7 +265,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getRequests(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getRequests(java.lang.String)
* @since 4.3
*/
public Collection getRequests(String identifier)
@@ -278,7 +287,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getSourceRequests(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getSourceRequests(java.lang.String)
* @since 4.3
*/
public Collection getSourceRequests(String identifier)
@@ -300,7 +309,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getSystem()
+ * @see org.teiid.adminapi.MonitoringAdmin#getSystem()
* @since 4.3
*/
public SystemObject getSystem(){
@@ -308,7 +317,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
* @since 4.3
*/
public Collection getPropertyDefinitions(String identifier, String className) throws AdminException {
@@ -378,7 +387,11 @@
}
}
-
-
-
+
+ @Override
+ public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
+ ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
+ list.add(this.manager.getProcess());
+ return list;
+ }
}
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -29,15 +29,16 @@
import javax.transaction.xa.Xid;
-import com.metamatrix.admin.api.embedded.EmbeddedLogger;
-import com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.Cache;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.Request;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Cache;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.EmbeddedLogger;
+import org.teiid.adminapi.Request;
+import org.teiid.adminapi.RuntimeStateAdmin;
+
import com.metamatrix.admin.objects.MMRequest;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
@@ -53,7 +54,7 @@
/**
* @since 4.3
*/
-public class DQPRuntimeStateAdminImpl extends BaseAdmin implements EmbeddedRuntimeStateAdmin {
+public class DQPRuntimeStateAdminImpl extends BaseAdmin implements RuntimeStateAdmin {
public DQPRuntimeStateAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
@@ -63,12 +64,12 @@
* @see com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin#stop(int)
* @since 4.3
*/
- public void stop(int millisToWait) throws AdminException {
+ public void shutdown(int millisToWait) throws AdminException {
// TODO: rreddy need to implement the time to wait.
// First terminate all the sessions to the DQP currently have
terminateSession(AdminObject.WILDCARD);
- getManager().shutdown();
+ getManager().shutdown(false);
}
/**
@@ -81,11 +82,11 @@
// Now shutdown the DQP, it will automatically start next timea new connection is
// requested.
- getManager().shutdown();
+ getManager().shutdown(true);
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#startConnectorBinding(java.lang.String)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#startConnectorBinding(java.lang.String)
* @since 4.3
*/
public void startConnectorBinding(String identifier)
@@ -121,7 +122,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#stopConnectorBinding(java.lang.String, boolean)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#stopConnectorBinding(java.lang.String, boolean)
* @since 4.3
*/
public void stopConnectorBinding(String identifier, boolean stopNow)
@@ -157,7 +158,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#clearCache(java.lang.String)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#clearCache(java.lang.String)
* @since 4.3
*/
public void clearCache(String identifier)
@@ -201,7 +202,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#terminateSession(java.lang.String)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#terminateSession(java.lang.String)
* @since 4.3
*/
public void terminateSession(String identifier)
@@ -233,7 +234,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#cancelRequest(java.lang.String)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#cancelRequest(java.lang.String)
* @since 4.3
*/
public void cancelRequest(String identifier)
@@ -258,7 +259,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#cancelSourceRequest(java.lang.String)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#cancelSourceRequest(java.lang.String)
* @since 4.3
*/
public void cancelSourceRequest(String identifier)
@@ -284,7 +285,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#changeVDBStatus(java.lang.String, java.lang.String, int)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#changeVDBStatus(java.lang.String, java.lang.String, int)
* @since 4.3
*/
public void changeVDBStatus(String name, String version, int status)
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,16 +22,266 @@
package com.metamatrix.dqp.embedded.admin;
-import com.metamatrix.admin.api.embedded.EmbeddedSecurityAdmin;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Group;
+import org.teiid.adminapi.Principal;
+import org.teiid.adminapi.SecurityAdmin;
+import org.xml.sax.SAXException;
+
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
+import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
+import com.metamatrix.admin.objects.MMGroup;
+import com.metamatrix.admin.objects.MMRole;
+import com.metamatrix.api.exception.security.AuthorizationException;
+import com.metamatrix.api.exception.security.AuthorizationMgmtException;
+import com.metamatrix.api.exception.security.MembershipServiceException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.platform.admin.api.EntitlementMigrationReport;
+import com.metamatrix.platform.security.api.AuthorizationPolicy;
+import com.metamatrix.platform.security.api.AuthorizationPolicyFactory;
+import com.metamatrix.platform.security.api.AuthorizationRealm;
+import com.metamatrix.platform.security.api.Credentials;
+import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
+import com.metamatrix.platform.security.api.SessionToken;
/**
* @since 4.3
*/
-public class DQPSecurityAdminImpl extends BaseAdmin implements EmbeddedSecurityAdmin {
+public class DQPSecurityAdminImpl extends BaseAdmin implements SecurityAdmin {
public DQPSecurityAdminImpl(EmbeddedConnectionFactoryImpl manager) {
super(manager);
}
+
+ /**
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#addRoleToGroup(java.lang.String, java.lang.String)
+ * @since 4.3
+ */
+ public void assignRoleToGroup(String roleIdentifier, String groupIdentifier) throws AdminException {
+ throw new AdminComponentException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.not_implemented")); //$NON-NLS-1$
+ }
+
+ /**
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#removeRoleFromGroup(java.lang.String, java.lang.String)
+ * @since 4.3
+ */
+ public void removeRoleFromGroup(String roleIdentifier, String groupIdentifier) throws AdminException {
+ throw new AdminComponentException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.not_implemented")); //$NON-NLS-1$
+ }
+
+ public boolean authenticateUser(String username, char[] credentials, Serializable trustePayload, String applicationName) throws AdminException {
+ try {
+ return getMembershipService().authenticateUser(username, new Credentials(credentials), trustePayload, applicationName).isAuthenticated();
+ } catch (MembershipServiceException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+
+ /**
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getGroupsForUser(java.lang.String, boolean)
+ * @since 4.3
+ */
+ public Collection getGroupsForUser(String userIdentifier) throws AdminException {
+ if (userIdentifier == null) {
+ throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+ }
+
+ if ( userIdentifier.equals(AdminObject.WILDCARD) ) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.Cant_use_wildcard")); //$NON-NLS-1$
+ }
+ Collection groups = new ArrayList();
+ // Get all memberships - explicit and implicit
+ Set allMemberships = null;
+ try {
+ allMemberships = getMembershipService().getGroupsForUser(userIdentifier);
+ } catch (MetaMatrixSecurityException e) {
+ throw new AdminComponentException(e);
+ }
+ Iterator allMembershipsItr = allMemberships.iterator();
+ while ( allMembershipsItr.hasNext() ) {
+ groups.add(new MMGroup(new String[] {(String)allMembershipsItr.next()}));
+ }
+ return groups;
+ }
+
+ /**
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getGroups(java.lang.String)
+ * @since 4.3
+ */
+ public Collection<Group> getGroups(String groupIdentifier) throws AdminException {
+ if (groupIdentifier == null) {
+ throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+ }
+
+ Collection<Group> groups = new ArrayList<Group>();
+ Collection allGroups = null;
+ // Add all groups from internal membership domain
+ try {
+ allGroups = getMembershipService().getGroupNames();
+ } catch (MetaMatrixSecurityException e) {
+ throw new AdminComponentException(e);
+ }
+
+ Iterator groupItr = allGroups.iterator();
+ while ( groupItr.hasNext() ) {
+ String groupName = (String) groupItr.next();
+
+ if (!groupIdentifier.equals(AdminObject.WILDCARD) && !groupName.equals(groupIdentifier)) {
+ continue;
+ }
+
+ groups.add(new MMGroup(new String[] {groupName}));
+ }
+ return groups;
+ }
+
+
+ /**
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getRolesForGroup(java.lang.String)
+ * @since 4.3
+ */
+ public Collection getRolesForGroup(String groupIdentifier) throws AdminException {
+ if (groupIdentifier == null) {
+ throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+ }
+
+ if ( groupIdentifier.equals(AdminObject.WILDCARD) ) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.Cant_use_wildcard")); //$NON-NLS-1$
+ }
+ Collection roleNames = null;
+ try {
+ roleNames = getAuthorizationService().getRoleNamesForPrincipal(new MetaMatrixPrincipalName(groupIdentifier, Principal.TYPE_GROUP));
+ } catch (InvalidSessionException e) {
+ throw new AdminComponentException(e);
+ } catch (AuthorizationMgmtException e) {
+ throw new AdminComponentException(e);
+ } catch (AuthorizationException e) {
+ throw new AdminComponentException(e);
+ }
+ Collection roles = new ArrayList();
+ Iterator roleNameItr = roleNames.iterator();
+ while ( roleNameItr.hasNext() ) {
+ String roleName = (String)roleNameItr.next();
+ roles.add(new MMRole(new String[] {roleName}));
+ }
+ return roles;
+ }
+
+ /**
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#importDataRoles(java.lang.String, java.lang.String, char[], org.teiid.adminapi.AdminOptions)
+ */
+ public String importDataRoles(String vdbName, String vdbVersion, char[] xmlContents, AdminOptions options)
+ throws AdminException{
+
+ if (vdbName == null) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbName_can_not_be_null")); //$NON-NLS-1$
+ }
+
+ if (vdbVersion == null) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbVersion_can_not_be_null")); //$NON-NLS-1$
+ }
+
+ if (options == null) {
+
+ options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
+ }
+
+ try {
+ EntitlementMigrationReport rpt = new EntitlementMigrationReport("from file", vdbName + " " + vdbVersion); //$NON-NLS-1$ //$NON-NLS-2$
+
+ Collection<AuthorizationPolicy> roles = AuthorizationPolicyFactory.buildPolicies(vdbName, vdbVersion, xmlContents);
+
+ AuthorizationRealm realm = new AuthorizationRealm(vdbName, vdbVersion);
+
+ getAuthorizationService().updatePoliciesInRealm(realm, roles);
+
+ return rpt.toString();
+ } catch (AuthorizationMgmtException e) {
+ throw new AdminProcessingException(e);
+ } catch (SAXException e) {
+ throw new AdminComponentException(e);
+ } catch (IOException e) {
+ throw new AdminComponentException(e);
+ } catch (ParserConfigurationException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+ /**
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#exportDataRoles(java.lang.String, java.lang.String)
+ */
+ public char[] exportDataRoles(String vdbName, String vdbVersion) throws AdminException {
+
+ if (vdbName == null) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbName_can_not_be_null")); //$NON-NLS-1$
+ }
+
+ if (vdbVersion == null) {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbVersion_can_not_be_null")); //$NON-NLS-1$
+ }
+
+ Collection roles = null;
+ try {
+ roles = getAuthorizationService().getPoliciesInRealm(new AuthorizationRealm(vdbName, vdbVersion));
+ if (roles != null && !roles.isEmpty()) {
+ return AuthorizationPolicyFactory.exportPolicies(roles);
+ }
+ return null;
+ } catch (AuthorizationMgmtException e) {
+ throw new AdminProcessingException(e);
+ } catch (AuthorizationException e) {
+ throw new AdminProcessingException(e);
+ } catch (IOException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+ @Override
+ public List<String> getDomainNames() throws AdminException {
+ try {
+ return this.getMembershipService().getDomainNames();
+ } catch (MembershipServiceException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+ @Override
+ public Collection<Group> getGroupsForDomain(String domainName)
+ throws AdminException {
+ if (domainName == null) {
+ throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+ }
+ try {
+ Collection<String> groupNames = this.getMembershipService().getGroupsForDomain(domainName);
+ List<Group> result = new ArrayList<Group>(groupNames.size());
+ for (String groupName : groupNames) {
+ result.add(new MMGroup(new String[] {groupName}));
+ }
+ return result;
+ } catch (MembershipServiceException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+ void throwProcessingException(String key, Object[] objects) throws AdminException {
+ throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString(key, objects));
+ }
+
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,21 +22,23 @@
package com.metamatrix.jdbc;
+import static org.teiid.dqp.internal.process.Util.convertStats;
+
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
-import java.util.List;
import java.util.Properties;
-import java.util.concurrent.atomic.AtomicInteger;
+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;
import org.teiid.transport.LocalServerConnection;
@@ -45,11 +47,8 @@
import com.google.inject.Guice;
import com.google.inject.Injector;
-import com.metamatrix.admin.api.core.Admin;
-import com.metamatrix.admin.api.embedded.EmbeddedAdmin;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.admin.objects.MMProcess;
+import com.metamatrix.admin.objects.MMQueueWorkerPool;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
@@ -61,9 +60,9 @@
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.protocol.URLHelper;
+import com.metamatrix.common.queue.WorkerPoolStats;
import com.metamatrix.common.util.JMXUtil;
import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.MixinProxy;
import com.metamatrix.dqp.ResourceFinder;
@@ -77,11 +76,11 @@
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.platform.security.api.ILogon;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+import com.metamatrix.platform.vm.controller.ProcessStatistics;
+import com.metamatrix.platform.vm.controller.SocketListenerStats;
/**
@@ -100,6 +99,7 @@
private ConnectionListenerList listenerList = new ConnectionListenerList();
private SocketTransport socketTransport;
private JMXUtil jmxServer;
+ private boolean restart = false;
private final class ConnectionListenerList extends ArrayList<ServerConnectionListener> implements ServerConnectionListener{
@@ -205,8 +205,8 @@
services.registerClientService(ILogon.class, new LogonImpl(sessionService, configService.getClusterName()), com.metamatrix.common.util.LogConstants.CTX_SERVER);
try {
- EmbeddedAdmin roleCheckedServerAdmin = wrapAdminService(EmbeddedAdmin.class, (EmbeddedAdmin)getAdminAPI(null));
- services.registerClientService(EmbeddedAdmin.class, roleCheckedServerAdmin, com.metamatrix.common.util.LogConstants.CTX_ADMIN);
+ 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.
}
@@ -299,7 +299,7 @@
@Override
public void run() {
- shutdown(false);
+ shutdown(false, false);
}
}
@@ -336,11 +336,11 @@
*
* @see com.metamatrix.jdbc.EmbeddedConnectionFactory#shutdown()
*/
- public void shutdown() {
- shutdown(true);
+ public void shutdown(boolean restart) {
+ shutdown(true, restart);
}
- private synchronized void shutdown(boolean undoShutdownHook) {
+ private synchronized void shutdown(boolean undoShutdownHook, boolean restart) {
if (!isAlive()) {
return;
@@ -356,7 +356,7 @@
if (!this.shutdownInProgress) {
// this will by pass, and only let shutdown called once.
- shutdownInProgress = true;
+ this.shutdownInProgress = true;
try {
this.dqp.stop();
@@ -383,9 +383,11 @@
// shutdown the cache.
ResourceFinder.getCacheFactory().destroy();
- shutdownInProgress = false;
+ this.shutdownInProgress = false;
- init = false;
+ this.init = false;
+
+ this.restart = restart;
}
}
@@ -416,10 +418,54 @@
}
}
};
- return (EmbeddedAdmin) Proxy.newProxyInstance(this.getClass().getClassLoader(),new Class[] {EmbeddedAdmin.class}, handler);
+ return (Admin) Proxy.newProxyInstance(this.getClass().getClassLoader(),new Class[] {Admin.class}, handler);
}
public JMXUtil getJMXServer() {
return this.jmxServer;
}
+
+ public MMProcess getProcess() {
+
+ Properties props = getProperties();
+
+ String hostName = ((InetAddress)props.get(DQPEmbeddedProperties.HOST_ADDRESS)).getHostName();
+ String processName = props.getProperty(DQPEmbeddedProperties.PROCESSNAME);
+
+ String[] identifierParts = new String[] {hostName, processName};
+ MMProcess process = new MMProcess(identifierParts);
+
+ Runtime rt = Runtime.getRuntime();
+
+ process.setEnabled(true);
+ process.setCreated(new Date(getStartTime()));
+ process.setInetAddress((InetAddress)props.get(DQPEmbeddedProperties.HOST_ADDRESS));
+ process.setFreeMemory(rt.freeMemory());
+ process.setTotalMemory(rt.totalMemory());
+ process.setProperties(PropertiesUtils.clone(props));
+
+ if (this.socketTransport != null) {
+ SocketListenerStats socketStats = this.socketTransport.getStats();
+ if (socketStats != null) {
+ process.setSockets(socketStats.sockets);
+ process.setMaxSockets(socketStats.maxSockets);
+ process.setObjectsRead(socketStats.objectsRead);
+ process.setObjectsWritten(socketStats.objectsWritten);
+ }
+
+ WorkerPoolStats workerStats = this.socketTransport.getProcessPoolStats();
+ if (workerStats != null) {
+ MMQueueWorkerPool workerPool = convertStats(workerStats, hostName, processName, workerStats.name);
+
+ process.setQueueWorkerPool(workerPool);
+ }
+
+ process.setPort(this.socketTransport.getPort());
+ }
+ return process;
+ }
+
+ public boolean shouldRestart(){
+ return this.restart;
+ }
}
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -29,19 +29,21 @@
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 javax.xml.parsers.ParserConfigurationException;
+import org.teiid.adminapi.AdminRoles;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.xml.sax.SAXException;
import com.google.inject.Inject;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
-import com.metamatrix.admin.api.server.AdminRoles;
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;
@@ -125,14 +127,13 @@
*/
public Collection getInaccessibleResources(String connectionID, int action, Collection resources, int context)
throws MetaMatrixComponentException {
- SessionToken token = DQPWorkContext.getWorkContext().getSessionToken();
AuthorizationRealm realm = getRealm(DQPWorkContext.getWorkContext());
AuthorizationActions actions = getActions(action);
Collection permissions = createPermissions(realm, resources, actions);
String auditContext = getAuditContext(context);
Collection inaccessableResources = Collections.EMPTY_LIST;
try {
- inaccessableResources = getInaccessibleResources(token, auditContext, permissions);
+ inaccessableResources = getInaccessibleResources(getSession(), auditContext, permissions);
} catch (AuthorizationMgmtException e) {
throw new MetaMatrixComponentException(e);
}
@@ -152,7 +153,7 @@
/**
* Of those resources specified, return the subset for which the specified account
* does <emph>NOT</emph> have authorization to access.
- * @param sessionToken the session token of the principal that is calling this method
+ * @param caller the session token of the principal that is calling this method
* @param contextName the name of the context for the caller (@see AuditContext)
* @param requests the permissions that detail the resources and the desired form of access
* @return the subset of <code>requests</code> that the account does <i>not</i> have access to
@@ -160,9 +161,9 @@
* @throws AuthorizationMgmtException if this service is unable to locate resources required
* for this operation
*/
- public Collection getInaccessibleResources(SessionToken sessionToken, String contextName, Collection requests)
+ private Collection getInaccessibleResources(SessionToken caller, String contextName, Collection requests)
throws AuthorizationMgmtException {
- LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, new Object[]{"getInaccessibleResources(", sessionToken, ", ", contextName, ", ", requests, ")"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, new Object[]{"getInaccessibleResources(", caller, ", ", contextName, ", ", requests, ")"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
List resources = new ArrayList();
if (requests != null && ! requests.isEmpty()) {
@@ -173,16 +174,16 @@
}
// Audit - request
- AuditMessage msg = new AuditMessage( contextName, "getInaccessibleResources-request", sessionToken.getUsername(), resources.toArray()); //$NON-NLS-1$
+ AuditMessage msg = new AuditMessage( contextName, "getInaccessibleResources-request", caller.getUsername(), resources.toArray()); //$NON-NLS-1$
LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
- if (isEntitled(sessionToken.getUsername())) {
+ if (isEntitled(caller.getUsername())) {
return Collections.EMPTY_LIST;
}
Collection results = new HashSet(requests);
try {
- Collection policies = this.getPoliciesForPrincipal(new MetaMatrixPrincipalName(sessionToken.getUsername(), MetaMatrixPrincipal.TYPE_USER), sessionToken, getRequestedRealm(requests));
+ Collection policies = this.getPoliciesForPrincipal(new MetaMatrixPrincipalName(caller.getUsername(), MetaMatrixPrincipal.TYPE_USER), getRequestedRealm(requests));
Iterator policyIter = policies.iterator();
@@ -202,10 +203,10 @@
}
if (results.isEmpty()) {
- msg = new AuditMessage( contextName, "getInaccessibleResources-granted all", sessionToken.getUsername(), resources.toArray()); //$NON-NLS-1$
+ msg = new AuditMessage( contextName, "getInaccessibleResources-granted all", caller.getUsername(), resources.toArray()); //$NON-NLS-1$
LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
} else {
- msg = new AuditMessage( contextName, "getInaccessibleResources-denied", sessionToken.getUsername(), resources.toArray()); //$NON-NLS-1$
+ msg = new AuditMessage( contextName, "getInaccessibleResources-denied", caller.getUsername(), resources.toArray()); //$NON-NLS-1$
LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
}
return results;
@@ -243,7 +244,6 @@
}
public boolean hasRole(String connectionID, String roleType, String roleName) throws MetaMatrixComponentException {
- SessionToken token = DQPWorkContext.getWorkContext().getSessionToken();
AuthorizationRealm realm = null;
@@ -256,7 +256,7 @@
}
try {
- return hasPolicy(token, realm, roleName);
+ return hasPolicy(getSession(), realm, roleName);
} catch (AuthorizationMgmtException err) {
throw new MetaMatrixComponentException(err);
}
@@ -272,18 +272,15 @@
return false;
}
- public boolean hasPolicy(SessionToken caller, AuthorizationRealm realm,
- String policyName) throws AuthorizationMgmtException {
+ private boolean hasPolicy(SessionToken session, AuthorizationRealm realm, String policyName) throws AuthorizationMgmtException {
- if (isEntitled(caller.getUsername())) {
+ if (isEntitled(session.getUsername())) {
return true;
}
Collection policies;
try {
- policies = getPoliciesForPrincipal(new MetaMatrixPrincipalName(
- caller.getUsername(), MetaMatrixPrincipal.TYPE_USER),
- caller, realm);
+ policies = getPoliciesForPrincipal(new MetaMatrixPrincipalName(session.getUsername(), MetaMatrixPrincipal.TYPE_USER), realm);
} catch (InvalidPrincipalException e) {
throw new AuthorizationMgmtException(e);
}
@@ -311,6 +308,24 @@
return false;
}
+ public Collection<String> getRoleNamesForPrincipal(MetaMatrixPrincipalName principal) throws AuthorizationMgmtException {
+ Collection policies;
+ try {
+ policies = getPoliciesForPrincipal(principal, RolePermissionFactory.getRealm());
+ } catch (InvalidPrincipalException e) {
+ throw new AuthorizationMgmtException(e);
+ }
+
+ Collection<String> results = new HashSet<String>();
+
+ for (Iterator i = policies.iterator(); i.hasNext();) {
+ AuthorizationPolicy policy = (AuthorizationPolicy) i.next();
+ results.add(policy.getAuthorizationPolicyID().getDisplayName());
+ }
+
+ return results;
+ }
+
/**
* Return a collection of all policies for which this principal has authorization, caching as needed.
* Policies are returned for the principal and all groups in which the principal has membership.
@@ -323,7 +338,7 @@
* @throws InvalidPrincipalException if the principal is invalid.
* @throws MetaMatrixComponentException
*/
- private Collection<AuthorizationPolicy> getPoliciesForPrincipal(MetaMatrixPrincipalName user, SessionToken session, AuthorizationRealm realm)
+ private Collection<AuthorizationPolicy> getPoliciesForPrincipal(MetaMatrixPrincipalName user, AuthorizationRealm realm)
throws AuthorizationMgmtException, InvalidPrincipalException {
Set<AuthorizationPolicy> result = new HashSet<AuthorizationPolicy>();
@@ -335,8 +350,27 @@
}
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
+ }
+
+ return result;
+ }
+
+ @Override
+ public Collection<AuthorizationPolicy> getPoliciesInRealm(AuthorizationRealm realm) throws AuthorizationMgmtException {
+
+ Collection<AuthorizationPolicy> policies = null;
+
+ if (realm.getSubRealmName() != null) {
VDBKey key = new VDBKey(realm.getSuperRealmName(), realm.getSubRealmName());
- Collection<AuthorizationPolicy> policies = null;
synchronized (this.policyCache) {
policies = this.policyCache.get(key);
if (policies == null) {
@@ -360,17 +394,32 @@
this.policyCache.put(key, policies);
}
}
- for (AuthorizationPolicy policy : policies) {
- if (matchesPrincipal(principals, policy)) {
- result.add(policy);
- continue;
+ }
+
+ return policies;
+ }
+
+ public void updatePoliciesInRealm(AuthorizationRealm realm, Collection<AuthorizationPolicy> policies) throws AuthorizationMgmtException {
+
+ if (realm.getSubRealmName() != null) {
+ VDBKey key = new VDBKey(realm.getSuperRealmName(), realm.getSubRealmName());
+ synchronized (this.policyCache) {
+ policies = this.policyCache.get(key);
+ if (policies != null) {
+ this.policyCache.remove(key);
}
- }
- } else {
- //TODO: looking for admin roles
+ try {
+ VDBArchive vdb = vdbService.getVDB(realm.getSuperRealmName(), realm.getSubRealmName());
+ char[] dataRoles = AuthorizationPolicyFactory.exportPolicies(policies);
+ vdb.updateRoles(dataRoles);
+ } catch (IOException e) {
+ throw new AuthorizationMgmtException(e);
+ } catch (MetaMatrixComponentException e) {
+ throw new AuthorizationMgmtException(e);
+ }
+ this.policyCache.put(key, policies);
+ }
}
-
- return result;
}
/**
@@ -443,10 +492,7 @@
* @return Realm to use (based on vdb name and version)
*/
private AuthorizationRealm getRealm(DQPWorkContext context) {
- return
- new AuthorizationRealm(
- context.getVdbName(),
- context.getVdbVersion());
+ return new AuthorizationRealm(context.getVdbName(),context.getVdbVersion());
}
private AuthorizationActions getActions(int actionCode) {
@@ -507,8 +553,14 @@
}
@Override
- public boolean isCallerInRole(SessionToken caller, String roleName) throws AuthorizationMgmtException {
- LogManager.logTrace(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, new Object[]{"isCallerInRole(", caller, roleName, ")"}); //$NON-NLS-1$ //$NON-NLS-2$
- return hasPolicy(caller, RolePermissionFactory.getRealm(), roleName);
+ public boolean isCallerInRole(SessionToken session, String roleName) throws AuthorizationMgmtException {
+ LogManager.logTrace(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, new Object[]{"isCallerInRole(", session, roleName, ")"}); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return hasPolicy(session, RolePermissionFactory.getRealm(), roleName);
}
+
+
+ SessionToken getSession() {
+ return DQPWorkContext.getWorkContext().getSessionToken();
+ }
}
Modified: trunk/embedded/src/main/java/org/teiid/Server.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/Server.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/org/teiid/Server.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -26,7 +26,6 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.RandomAccessFile;
-import java.net.InetAddress;
import java.nio.channels.FileChannel;
import java.util.Properties;
@@ -36,10 +35,9 @@
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
-public class Server implements ServerMBean{
+public class Server extends EmbeddedConnectionFactoryImpl implements ServerMBean {
private Properties props;
- private EmbeddedConnectionFactoryImpl engine;
public Server(Properties props) {
this.props = props;
@@ -48,10 +46,9 @@
private void start() {
try {
// start the engine.
- this.engine = new EmbeddedConnectionFactoryImpl();
- this.engine.initialize(this.props);
+ initialize(this.props);
- this.engine.getJMXServer().register(TYPE, NAME, this);
+ getJMXServer().register(TYPE, NAME, this);
} catch (ApplicationInitializationException e) {
throw new MetaMatrixRuntimeException(e);
@@ -60,13 +57,13 @@
}
}
- private void stopS() {
- if (engine.isAlive()) {
- engine.shutdown();
+ private void stopS(boolean restart) {
+ if (isAlive()) {
+ shutdown(restart);
}
try {
- this.engine.getJMXServer().unregister(TYPE, NAME);
+ getJMXServer().unregister(TYPE, NAME);
} catch (FailedToRegisterException e) {
// ignore
}
@@ -111,16 +108,11 @@
}
@Override
- public boolean isAlive() {
- return engine.isAlive();
- }
-
- @Override
public void shutdown() {
new Thread(){
public void run(){
System.out.println("Server being shutdown..."); //$NON-NLS-1$
- stopS();
+ stopS(false);
}
}.start();
}
@@ -133,7 +125,18 @@
Runtime.getRuntime().halt(-4);
}
}.start();
- }
+ }
+
+ @Override
+ public void restart() {
+ new Thread(){
+ public void run(){
+ System.out.println("Server being shutdown..."); //$NON-NLS-1$
+ stopS(true);
+ }
+ }.start();
+
+ }
/**
* Start the Server Mode
* @param args
@@ -162,7 +165,7 @@
String port = props.getProperty(DQPEmbeddedProperties.SERVER_PORT);
long time = System.currentTimeMillis() - startTime;
- System.out.println("Teiid Server started on port = "+port + "in "+time/1000+" Secs"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ System.out.println("Teiid Server started on port = "+ port + " in "+time/1000+" Secs"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// wait.
while(s.isAlive()) {
@@ -175,7 +178,12 @@
// if for some reason engine is still alive kill it.
if (s.isAlive()) {
- s.stopS();
+ s.stopS(false);
}
+
+ // exit code to restart the process.
+ if (s.shouldRestart()) {
+ System.exit(10);
+ }
}
}
Modified: trunk/embedded/src/main/java/org/teiid/ServerMBean.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/ServerMBean.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/org/teiid/ServerMBean.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -34,4 +34,6 @@
void shutdown();
void halt();
+
+ void restart();
}
Modified: trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -27,10 +27,10 @@
import java.lang.reflect.Method;
import java.util.Arrays;
+import org.teiid.adminapi.AdminRoles;
import org.teiid.dqp.internal.process.DQPWorkContext;
import com.metamatrix.admin.RolesAllowed;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.client.ExceptionUtil;
Modified: trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -32,9 +32,9 @@
import javax.crypto.SealedObject;
+import org.teiid.adminapi.AdminProcessingException;
import org.teiid.dqp.internal.process.DQPWorkContext;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.ExceptionHolder;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
Modified: trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -23,18 +23,22 @@
import java.io.IOException;
import java.net.InetAddress;
+import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.Properties;
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.DQPEmbeddedProperties;
import com.metamatrix.platform.PlatformPlugin;
import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+import com.metamatrix.platform.vm.controller.SocketListenerStats;
/**
* This class starts a Socket for DQP connections and listens on the port and hands out the connections to the
@@ -85,4 +89,16 @@
public void stop() {
this.listener.stop();
}
+
+ public WorkerPoolStats getProcessPoolStats() {
+ return listener.getProcessPoolStats();
+ }
+
+ public int getPort() {
+ return this.listener.getPort();
+ }
+
+ public SocketListenerStats getStats() {
+ return this.listener.getStats();
+ }
}
Modified: trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties
===================================================================
--- trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/main/resources/com/metamatrix/dqp/embedded/i18n.properties 2009-06-30 21:19:01 UTC (rev 1090)
@@ -193,4 +193,18 @@
Admin.bindings_exceeded_limit=You have reached the MetaMatrix license limit of connector bindings, Failed to add connector bindings.
DQPEmbeddedManager.start_dqp=DQP is started at time = {0}
-DQPEmbeddedManager.shutdown_dqp=DQP is shutdown at time = {0}
\ No newline at end of file
+DQPEmbeddedManager.shutdown_dqp=DQP is shutdown at time = {0}
+
+ServerSecurityAdminImpl.User_name_too_long=The user name may not be null and cannot be longer than {0} charachters
+ServerSecurityAdminImpl.neither_User_nor_Group=Parameter memberType is neither a User nor a Group.
+ServerSecurityAdminImpl.Unable_to_aquire_MembershipObjectEditor=Unable to aquire MembershipObjectEditor.
+ServerSecurityAdminImpl.Cant_use_wildcard=The wildcard cannot be used here.
+ServerSecurityAdminImpl.Non_existant_role=No administrative role exists with the identifier [{0}].
+ServerSecurityAdminImpl.Unknown_principal=Unknown principal: {0}
+ServerSecurityAdminImpl.Empty_props=No properties to set.
+ServerSecurityAdminImpl.Invalid_prop=Property [{0}] is not a valid User property and will not be set.
+ServerSecurityAdminImpl.Invalid_props=One or more properties were not set because they are no valid for a User:
+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
Modified: trunk/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -32,18 +32,16 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.AdminRoles;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.transport.AdminAuthorizationInterceptor;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.server.AdminRoles;
-import com.metamatrix.admin.api.server.ServerAdmin;
-import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.core.util.SimpleMock;
import com.metamatrix.dqp.service.AuthorizationService;
-import com.metamatrix.platform.admin.api.ExtensionSourceAdminAPI;
import com.metamatrix.platform.security.api.MetaMatrixSessionID;
import com.metamatrix.platform.security.api.SessionToken;
@@ -63,7 +61,7 @@
@Test(expected=AdminProcessingException.class) public void testAddUserUDF_fail() throws AdminException {
Set<String> userRoles = new HashSet<String>();
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
serverAdmin.addUDF(null, null);
}
@@ -96,27 +94,27 @@
@Test public void testAddUDF_succeed() throws Exception {
Set<String> userRoles = new HashSet<String>();
userRoles.add(AdminRoles.RoleName.ADMIN_SYSTEM);
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
serverAdmin.addUDF(null, null);
}
@Test public void testGetVDBs() throws Exception {
Set<String> userRoles = new HashSet<String>();
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
serverAdmin.getVDBs("*"); //$NON-NLS-1$
}
@Test(expected=AdminProcessingException.class) public void testReadOnlyFails() throws Exception {
Set<String> userRoles = new HashSet<String>();
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
serverAdmin.getSessions("*"); //$NON-NLS-1$
}
@Test public void testBounce_succeed() throws Exception {
Set<String> userRoles = new HashSet<String>();
userRoles.add(AdminRoles.RoleName.ADMIN_PRODUCT);
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
- serverAdmin.bounceSystem(false);
+ Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
+ serverAdmin.restart();
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,10 +24,17 @@
import java.util.Collection;
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
+import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
+import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.core.CoreConstants;
+import com.metamatrix.platform.security.api.AuthorizationPolicy;
+import com.metamatrix.platform.security.api.AuthorizationRealm;
+import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
import com.metamatrix.platform.security.api.SessionToken;
import com.metamatrix.query.eval.SecurityFunctionEvaluator;
@@ -70,6 +77,39 @@
*/
boolean checkingEntitlements();
- boolean isCallerInRole( SessionToken caller, String roleName ) throws AuthorizationMgmtException;
+ boolean isCallerInRole(SessionToken session, String roleName ) throws AuthorizationMgmtException;
+
+ /**
+ * Returns a Collection of String names of MetaMatrix roles to which the
+ * given principal is assigned.
+ * @param caller the session token of the principal that is attempting to access the roles.
+ * @param principal <code>MetaMatrixPrincipalName</code> for which roles are sought
+ * @return The <code>Collection</code> of role names the principal is assigned.
+ * @throws InvalidSessionException if the administrative session is invalid
+ * @throws MetaMatrixSecurityException if there is a problem internally with the MembershipService
+ * @throws AuthorizationException if administrator does not have the authority to see the requested information
+ * @throws ComponentNotFoundException if a component required by this method could not be found within the server
+ */
+ Collection<String> getRoleNamesForPrincipal(MetaMatrixPrincipalName principal)
+ throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
+
+ /**
+ * Returns a <code>Collection</code> of <code>AuthorizationPolicy</code>s
+ * that have <code>AuthorizationPermission</code>s in the given <code>AuthorizationRealm</code>.<br>
+ * <strong>NOTE:</strong> It is the responsibility of the caller to determine
+ * which of the <code>AuthorizationPolicy</code>'s <code>AuthorizationPermission</code>s
+ * are actually in the given <code>AuthorizationRealm</code>. The <code>AuthorizationPolicy</code>
+ * may span <code>AuthorizationRealm</code>s.
+ * @param caller The session token of the principal that is attempting to retrieve the policies.
+ * @param realm The realm in which to search for <code>AuthorizationPermission</code>s.
+ * @return The collection of <code>AuthorizationPolicy</code>s that have permissions
+ * in the given realm - possibly empty but never null.
+ * @throws AuthorizationException if administrator does not have the authority to perform the action.
+ * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
+ */
+ Collection<AuthorizationPolicy> getPoliciesInRealm(AuthorizationRealm realm)
+ throws AuthorizationException, AuthorizationMgmtException;
+
+ void updatePoliciesInRealm(AuthorizationRealm realm, Collection<AuthorizationPolicy> policies) throws AuthorizationMgmtException;
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -31,11 +31,11 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.Transaction;
import org.teiid.connector.xa.api.TransactionContext;
import org.teiid.dqp.internal.transaction.TransactionProvider.XAConnectionSource;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -46,12 +46,12 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
import org.teiid.connector.xa.api.TransactionContext;
import org.teiid.dqp.internal.transaction.TransactionProvider.XAConnectionSource;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.admin.objects.TransactionImpl;
import com.metamatrix.common.application.ApplicationEnvironment;
@@ -630,13 +630,13 @@
}
@Override
- public Collection<com.metamatrix.admin.api.objects.Transaction> getTransactions() {
+ public Collection<org.teiid.adminapi.Transaction> getTransactions() {
Set<TransactionContextImpl> txnSet = Collections.newSetFromMap(new IdentityHashMap<TransactionContextImpl, Boolean>());
synchronized (this.transactions) {
txnSet.addAll(this.transactions.threadToTransactionContext.values());
txnSet.addAll(this.transactions.xidToTransactionContext.values());
}
- Collection<com.metamatrix.admin.api.objects.Transaction> result = new ArrayList<com.metamatrix.admin.api.objects.Transaction>(txnSet.size());
+ Collection<org.teiid.adminapi.Transaction> result = new ArrayList<org.teiid.adminapi.Transaction>(txnSet.size());
for (TransactionContextImpl transactionContextImpl : txnSet) {
if (transactionContextImpl.getTxnID() == null) {
continue;
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,11 +24,16 @@
import java.util.*;
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
+import com.metamatrix.platform.security.api.AuthorizationPolicy;
+import com.metamatrix.platform.security.api.AuthorizationRealm;
+import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
import com.metamatrix.platform.security.api.SessionToken;
/**
@@ -158,9 +163,28 @@
}
@Override
- public boolean isCallerInRole(SessionToken caller, String roleName)
+ public boolean isCallerInRole(SessionToken session, String roleName)
throws AuthorizationMgmtException {
- // rameshTODO Auto-generated method stub
return false;
}
+
+ @Override
+ public Collection<AuthorizationPolicy> getPoliciesInRealm(
+ AuthorizationRealm realm)
+ throws AuthorizationException, AuthorizationMgmtException {
+ return null;
+ }
+
+ @Override
+ public Collection<String> getRoleNamesForPrincipal(MetaMatrixPrincipalName principal) throws InvalidSessionException,
+ AuthorizationException, AuthorizationMgmtException {
+ return null;
+ }
+
+ @Override
+ public void updatePoliciesInRealm(AuthorizationRealm realm,
+ Collection<AuthorizationPolicy> policies)
+ throws AuthorizationMgmtException {
+
+ }
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,9 +24,10 @@
import javax.transaction.xa.XAResource;
+import org.teiid.adminapi.Transaction;
+
import junit.framework.TestCase;
-import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.core.util.SimpleMock;
Copied: trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerAdmin.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerAdmin.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,55 @@
+/*
+ * 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.admin.api.server;
+
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminRoles;
+
+import com.metamatrix.admin.RolesAllowed;
+
+/**
+ * <p>This is the primary facade interface to MetaMatrix server administrative functionality. The
+ * general design is to provide getters to retrieve lightweight data transfer
+ * objects ({@link AdminObject}) which are not "live" and do not communicate back
+ * to the server.</p>
+ *
+ * <p>Generally, all objects have an identifier and each identifier form is
+ * specific to the object type. The identifiers taken by the methods in this interface
+ * may take generic identifiers (such as {@link AdminObject#WILDCARD}) to specify a set of objects
+ * to work on. The identifier forms and uniqueness constraints are specified in the
+ * javadoc for each particular object.
+ * </p>
+ *
+ * @see AdminObject
+ *
+ * @since 4.3
+ */
+public interface ServerAdmin extends ServerMonitoringAdmin, ServerConfigAdmin, ServerRuntimeStateAdmin, ServerSecurityAdmin, org.teiid.adminapi.Admin {
+
+ /**
+ * Closes ServerAdmin connection to the server.
+ * @since 4.3
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
+ void close();
+}
Copied: trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,277 @@
+/*
+ * 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.admin.api.server;
+
+import java.util.Properties;
+
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminRoles;
+import org.teiid.adminapi.ConfigurationAdmin;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.ScriptsContainer;
+import org.teiid.adminapi.VDB;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * Interface that exposes MetaMatrix server configuration for administration.
+ * <p>
+ * Clients should <i>not</i> code directly to this interface but should instead use {@link ServerAdmin}.
+ * </p>
+ *
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
+public interface ServerConfigAdmin extends
+ ConfigurationAdmin {
+
+ /**
+ * Generate the scripts necessary for loading or refreshing a VDB with Materialized Views.
+ * <p>
+ * This method requires that the VDB version exists in the system and that materialization
+ * model(s) have connector bindings bound to them.
+ *
+ * @param vdbName the name of the VDB containing that materialized views.
+ * @param vdbVersion the version of the VDB.
+ * @param metamatrixUserName the user that will be used to run the load transformation in
+ * MetaMatrix (Load).
+ * @param metamatrixUserPwd the MetaMatrix user's password.
+ * @param materializationUserName the user that will be used to log in directly to the
+ * Materialization database and run the DDL (Create, Truncate, Swap).
+ * @param materializationUserPwd the materialization user's password.
+ * @return The container of scripts that can be saved to a directory.
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ ScriptsContainer generateMaterializationScripts(String vdbName, String vdbVersion,
+ String metamatrixUserName, String metamatrixUserPwd,
+ String materializationUserName, String materializationUserPwd) throws AdminException;
+
+ /**
+ * Add a Host with Properties to MetaMatrix System
+ *
+ * @param hostIdentifier
+ * Name of {@link org.teiid.adminapi.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) throws AdminException;
+
+ /**
+ * Enable Host in Configuration
+ *
+ * @param hostIdentifier
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void enableHost(String hostIdentifier) throws AdminException;
+
+ /**
+ * Disable Host in Configuration
+ *
+ * @param identifier
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void disableHost(String identifier) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * Enable Process in Configuration
+ *
+ * @param identifier
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void enableProcess(String identifier) throws AdminException;
+
+ /**
+ * Disable Process in Configuration
+ *
+ * @param identifier
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void disableProcess(String identifier) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+
+
+ /**
+ * Import the Configuration from a character array 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 fileData Contents of configuration file, in XML format, as exported by {@link #exportConfiguration()}
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ void importConfiguration(char[] fileData) throws AdminException;
+
+ /**
+ * 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.
+ * @since 4.3
+ */
+ void deassignBindingFromModel(String connectorBindingName,
+ String vdbName,
+ String vdbVersion,
+ String modelName) throws AdminException;
+
+ /**
+ * 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.
+ * @since 4.3
+ */
+ void assignBindingsToModel(String[] connectorBindingNames,
+ String vdbName,
+ String vdbVersion,
+ String modelName) throws AdminException;
+
+ /**
+ * 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.
+ * @since 4.3
+ */
+ void deassignBindingsFromModel(String[] connectorBindingNames,
+ String vdbName,
+ String vdbVersion,
+ String modelName) throws AdminException;
+
+
+
+ /**
+ * @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) throws AdminException;
+
+ /**
+ * Return the bootstrap properties used to configure initialize the system.
+ * @return
+ * @throws AdminException
+ * @since 6.0.0
+ */
+ Properties getBootstrapProperties() throws AdminException;
+
+ /**
+ * Retrieves the cluster key that authenticates and secures intra-cluster communication.
+ * @return the cluster key or null if encryption is disabled
+ * @throws AdminException
+ * @since 6.0.0
+ */
+ byte[] getClusterKey() throws AdminException;
+
+}
Copied: trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,118 @@
+/*
+ * 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.admin.api.server;
+
+import java.util.Collection;
+
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminRoles;
+import org.teiid.adminapi.MonitoringAdmin;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * Interface that exposes the MetaMatrix server for system monitoring.
+ *
+ * <p>Clients should <i>not</i> code directly to this interface but
+ * should instead use {@link ServerAdmin}.</p>
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
+public interface ServerMonitoringAdmin extends MonitoringAdmin {
+
+ /**
+ * Get the hosts that correspond to the specified identifier pattern.
+ *
+ * @param hostIdentifier the unique identifier for for a {@link org.teiid.adminapi.Host Host}
+ * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
+ * if all hosts are desired.
+ * @return Collection of {@link org.teiid.adminapi.Host Host}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getHosts(String hostIdentifier) throws AdminException;
+
+ /**
+ * 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#WILDCARD WILDCARD}"
+ * 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
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
+ Collection getProcesses(String processIdentifier) throws AdminException;
+
+
+ /**
+ * Get the Services that correspond to the specified identifer pattern.
+ * These services represent what is defined for a given {@link Host} | {@link Process};
+ *
+ * @param resourceIdentifier the unique identifier for for a {@link org.teiid.adminapi.Service Service}
+ * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
+ * if all Services are desired.
+ * @return Collection of {@link org.teiid.adminapi.Service Service}
+ * @throws AdminException if there's a system error.
+ * @since 6.1
+ */
+
+ Collection getServices(String identifier) throws AdminException ;
+
+
+ /**
+ * Get the Resources that correspond to the specified identifer pattern.
+ *
+ * @param resourceIdentifier the unique resourceIdentifier for for a {@link org.teiid.adminapi.Resource Resource}
+ * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
+ * if all Resources are desired.
+ * @return Collection of {@link org.teiid.adminapi.Resource Resource}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getResources(String resourceIdentifier) throws AdminException;
+
+ /**
+ * Get the {@link org.teiid.adminapi.DQP DQP}s that correspond to the specified identifer pattern.
+ *
+ * @param identifier the unique identifier for for a {@link org.teiid.adminapi.DQP DQP}
+ * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
+ * if all Resources are desired.
+ * @return Collection of {@link org.teiid.adminapi.DQP DQP}
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ Collection getDQPs(String identifier) throws AdminException;
+
+ /**
+ * Export the server logs to a byte[]. The bytes contain the contents of a .zip file containing the logs.
+ * @return the logs, as a byte[].
+ * @throws AdminException
+ * @since 4.3
+ */
+ byte[] exportLogs() throws AdminException;
+
+
+}
Copied: trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerRuntimeStateAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerRuntimeStateAdmin.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerRuntimeStateAdmin.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerRuntimeStateAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,123 @@
+/*
+ * 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.admin.api.server;
+
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminRoles;
+import org.teiid.adminapi.RuntimeStateAdmin;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * Interface that exposes the MetaMatrix system for runtime control.
+ *
+ * <p>Clients should <i>not</i> code directly to this interface but
+ * should instead use {@link ServerAdmin}.</p>
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
+public interface ServerRuntimeStateAdmin extends RuntimeStateAdmin {
+
+ /**
+ * Stop the entire system.
+ * @throws AdminException if there's a system error.
+ * @since 4.3
+ */
+ void stopSystem() throws AdminException;
+
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * Start the Host for this cluster
+ * @param hostIdentifier the unique identifier for for a {@link org.teiid.adminapi.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) throws AdminException;
+
+ /**
+ * Stop the Host for this cluster
+ * @param hostIdentifier the unique identifier for for a {@link org.teiid.adminapi.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) throws AdminException;
+
+ /**
+ * Start a Process in the system.
+ * @param processIdentifier the unique identifier for for a
+ * {@link org.teiid.adminapi.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) throws AdminException;
+
+ /**
+ * Stop Process running in the system.
+ * @param processIdentifier the unique identifier for for a
+ * {@link org.teiid.adminapi.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) throws AdminException;
+}
Copied: trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerSecurityAdmin.java (from rev 1086, trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerSecurityAdmin.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerSecurityAdmin.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/admin/api/server/ServerSecurityAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -0,0 +1,189 @@
+/*
+ * 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.admin.api.server;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminRoles;
+import org.teiid.adminapi.Group;
+import org.teiid.adminapi.Principal;
+import org.teiid.adminapi.Role;
+import org.teiid.adminapi.SecurityAdmin;
+
+import com.metamatrix.admin.RolesAllowed;
+
+
+/**
+ * Interface that exposes MetaMatrix security system for administration.
+ * <p>
+ * Clients should <i>not</i> code directly to this interface but should instead use {@link ServerAdmin}.
+ * </p>
+ *
+ * @since 4.3
+ */
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
+public interface ServerSecurityAdmin extends SecurityAdmin {
+
+ /**
+ * 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<Role> getRolesForGroup(String groupIdentifier) throws AdminException;
+
+ /**
+ * Get the Collection of administrative role names possessed by the given user, if any.
+ *
+ * @param userIdentifier
+ * The unique identifier for the 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 {@link Role}s
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ Collection<Role> getRolesForUser(String userIdentifier) throws AdminException;
+
+ /**
+ * Get the group memberships for the given user.
+ *
+ * @param userIdentifier
+ * The unique identifier for the 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<Group> getGroupsForUser(String userIdentifier) throws AdminException;
+
+
+ /**
+ * 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 groups.
+ * @throws AdminException
+ * if there's a system error.
+ * @since 4.3
+ */
+ Collection<Group> getGroups(String groupIdentifier) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * 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) throws AdminException;
+
+ /**
+ * 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 data - character data array containing the XML file which defines the roles
+ * @param options - options to overwrite in case the matching roles already exist.
+ * @return a report of the import
+ * @throws AdminException
+ */
+ String importDataRoles(String vdbName, String vdbVersion, char[] data, AdminOptions options)
+ throws AdminException;
+
+ /**
+ * Export the data roles defined for the given vdb from the current system
+ * @param vdbName - Name of the vdb
+ * @param vdbVersion - version of the vdb
+ * @return - char[] stream containing the XML contents of the roles.
+ * @throws AdminException
+ */
+ char[] exportDataRoles(String vdbName, String vdbVersion) throws AdminException;
+
+ /**
+ * Authenticate a user with the specified user name and credentials
+ * for use with the specified application. The application name may also
+ * be used by the Membership Service to determine the appropriate authentication
+ * mechanism.
+ * @param username the user name that is to be authenticated
+ * @param credential
+ * @param trustePayload
+ * @param applicationName the name of the application for which the user
+ * is authenticating
+ * @return true if the authentication is successful
+ * @throws AdminException
+ */
+ boolean authenticateUser(String username, char[] credentials, Serializable trustePayload, String applicationName) throws AdminException;
+
+ /**
+ * Returns the active authorization provider domain names, in authentication order.
+ * @return List<String>
+ * @throws AdminException
+ */
+ List<String> getDomainNames( ) throws AdminException;
+
+ /**
+ * 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<Group> getGroupsForDomain(String domainName) throws AdminException;
+}
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -36,16 +36,16 @@
import javax.xml.parsers.ParserConfigurationException;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.VDB;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.xml.sax.SAXException;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.objects.VDB;
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.admin.objects.MMConnectorBinding;
import com.metamatrix.admin.objects.MMModel;
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -30,15 +30,17 @@
import javax.transaction.xa.Xid;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.Group;
-import com.metamatrix.admin.api.objects.LogConfiguration;
-import com.metamatrix.admin.api.objects.ScriptsContainer;
-import com.metamatrix.admin.api.objects.SystemObject;
-import com.metamatrix.admin.api.objects.Transaction;
-import com.metamatrix.admin.api.objects.VDB;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.EmbeddedLogger;
+import org.teiid.adminapi.Group;
+import org.teiid.adminapi.LogConfiguration;
+import org.teiid.adminapi.ScriptsContainer;
+import org.teiid.adminapi.SystemObject;
+import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.VDB;
+
import com.metamatrix.admin.api.server.ServerAdmin;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -94,7 +96,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addAuthorizationProvider(java.lang.String, java.lang.String, java.util.Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addAuthorizationProvider(java.lang.String, java.lang.String, java.util.Properties)
* @since 4.3
*/
public void addAuthorizationProvider(String domainprovidername,
@@ -120,7 +122,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getConnectorBindingsInVDB(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getConnectorBindingsInVDB(java.lang.String)
* @since 4.3
*/
public Collection getConnectorBindingsInVDB(String identifier) throws AdminException {
@@ -224,7 +226,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
* @since 4.3
*/
public Collection getPropertyDefinitions(String identifier, String className) throws AdminException {
@@ -273,7 +275,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addConnectorArchive(byte[], com.metamatrix.admin.api.objects.AdminOptions)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorArchive(byte[], org.teiid.adminapi.AdminOptions)
* @since 4.3
*/
public void addConnectorArchive(byte[] archiveContents, AdminOptions options) throws AdminException {
@@ -372,7 +374,7 @@
}
/**
- * @see com.metamatrix.admin.api.server.ServerConfigAdmin#setLogConfiguration(com.metamatrix.admin.api.objects.LogConfiguration)
+ * @see com.metamatrix.admin.api.server.ServerConfigAdmin#setLogConfiguration(org.teiid.adminapi.LogConfiguration)
* @since 4.3
*/
public void setLogConfiguration(LogConfiguration config) throws AdminException {
@@ -389,7 +391,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#updateSystemProperties(java.util.Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#updateSystemProperties(java.util.Properties)
* @since 4.3
*/
public void updateSystemProperties(Properties properties) throws AdminException {
@@ -496,7 +498,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#clearCache(java.lang.String)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#clearCache(java.lang.String)
* @since 4.3
*/
public void clearCache(String cacheIdentifier) throws AdminException {
@@ -518,7 +520,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#updateProperties(java.lang.String, java.lang.String, java.util.Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#updateProperties(java.lang.String, java.lang.String, java.util.Properties)
* @since 4.3
*/
public void updateProperties(String identifier,
@@ -681,7 +683,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
* @since 4.3
*/
public void assignBindingToModel(String connectorBindingName,
@@ -692,7 +694,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deassignBindingsFromModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#deassignBindingsFromModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
* @since 5.0
*/
public void deassignBindingFromModel(String connectorBindingName,
@@ -703,7 +705,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#assignBindingToModel(String[], java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#assignBindingToModel(String[], java.lang.String, java.lang.String, java.lang.String)
* @since 5.0
*/
public void assignBindingsToModel(String[] connectorBindingNames,
@@ -714,7 +716,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deassignBindingsFromModel(String[], java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#deassignBindingsFromModel(String[], java.lang.String, java.lang.String, java.lang.String)
* @since 5.0
*/
public void deassignBindingsFromModel(String[] connectorBindingNames,
@@ -725,7 +727,7 @@
}
/**
- * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#importDataRoles(java.lang.String, java.lang.String, char[], com.metamatrix.admin.api.objects.AdminOptions)
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#importDataRoles(java.lang.String, java.lang.String, char[], org.teiid.adminapi.AdminOptions)
*/
public String importDataRoles(String vdbName, String vdbVersion, char[] data, AdminOptions options) throws AdminException {
return getSecurityAdmin().importDataRoles(vdbName, vdbVersion, data, options);
@@ -740,7 +742,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConfiguration()
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConfiguration()
* @since 4.3
*/
public char[] exportConfiguration() throws AdminException {
@@ -748,7 +750,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#importConfiguration()
+ * @see org.teiid.adminapi.ConfigurationAdmin#importConfiguration()
* @since 4.3
*/
public void importConfiguration(char[] fileData) throws AdminException {
@@ -756,7 +758,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorBinding(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorBinding(java.lang.String)
* @since 4.3
*/
public char[] exportConnectorBinding(String connectorBindingIdentifier) throws AdminException {
@@ -764,7 +766,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorType(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorType(java.lang.String)
* @since 4.3
*/
public char[] exportConnectorType(String connectorTypeIdentifier) throws AdminException {
@@ -772,7 +774,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorArchive(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorArchive(java.lang.String)
* @since 4.3
*/
public byte[] exportConnectorArchive(String connectorTypeIdentifier) throws AdminException {
@@ -780,7 +782,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportExtensionModule(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportExtensionModule(java.lang.String)
* @since 4.3
*/
public byte[] exportExtensionModule(String sourceName) throws AdminException {
@@ -788,7 +790,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportVDB(java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportVDB(java.lang.String, java.lang.String)
* @since 4.3
*/
public byte[] exportVDB(String name, String version) throws AdminException {
@@ -932,14 +934,14 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addUDF(byte[], java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addUDF(byte[], java.lang.String)
*/
public void addUDF(byte[] modelFileContents,String classpath) throws AdminException {
getConfigurationAdmin().addUDF(modelFileContents, classpath);
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deleteUDF()
+ * @see org.teiid.adminapi.ConfigurationAdmin#deleteUDF()
*/
public void deleteUDF() throws AdminException {
getConfigurationAdmin().deleteUDF();
@@ -1001,7 +1003,21 @@
throws AdminException {
return getMonitoringAdmin().getConnectionPoolStats(identifier);
}
-
-
-
+
+ @Override
+ public void extensionModuleModified(String name) throws AdminException {
+ }
+
+ @Override
+ public void restart() throws AdminException {
+ }
+
+ @Override
+ public void setLogListener(EmbeddedLogger listener) throws AdminException {
+ }
+
+ @Override
+ public void shutdown(int millisToWait) throws AdminException {
+ }
+
}
\ No newline at end of file
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -40,21 +40,21 @@
import java.util.Set;
import java.util.StringTokenizer;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.AdminStatus;
+import org.teiid.adminapi.LogConfiguration;
+import org.teiid.adminapi.ProcessObject;
+import org.teiid.adminapi.ScriptsContainer;
+import org.teiid.adminapi.SystemObject;
+import org.teiid.adminapi.VDB;
import org.teiid.transport.SSLConfiguration;
import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.objects.AdminStatus;
-import com.metamatrix.admin.api.objects.LogConfiguration;
-import com.metamatrix.admin.api.objects.ProcessObject;
-import com.metamatrix.admin.api.objects.ScriptsContainer;
-import com.metamatrix.admin.api.objects.SystemObject;
-import com.metamatrix.admin.api.objects.VDB;
import com.metamatrix.admin.api.server.ServerConfigAdmin;
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.admin.objects.MMAdminStatus;
@@ -158,12 +158,12 @@
* java.util.Properties, AdminOptions)
* @since 4.3
*/
- public com.metamatrix.admin.api.objects.ConnectorBinding addConnectorBinding(String connectorBindingName,
+ public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String connectorBindingName,
String connectorTypeIdentifier,
Properties properties,
AdminOptions options) throws AdminException {
- com.metamatrix.admin.api.objects.ConnectorBinding newBinding = null;
+ org.teiid.adminapi.ConnectorBinding newBinding = null;
if (connectorBindingName == null) {
throw new AdminProcessingException(AdminServerPlugin.Util.getString("ServerConfigAdminImpl.Name_can_not_be_null")); //$NON-NLS-1$
@@ -210,12 +210,12 @@
Collection newBindings =
parent.getConnectorBindings(AdminObject.WILDCARD + AdminObject.DELIMITER + connectorBindingName);
- newBinding = (com.metamatrix.admin.api.objects.ConnectorBinding)newBindings.iterator().next();
+ newBinding = (org.teiid.adminapi.ConnectorBinding)newBindings.iterator().next();
} else {
// We didn't add the new connector binding. Return the existing.
if (existingBindings != null && existingBindings.size() > 0) {
// Only expecting one existing binding
- newBinding = (com.metamatrix.admin.api.objects.ConnectorBinding)existingBindings.iterator().next();
+ newBinding = (org.teiid.adminapi.ConnectorBinding)existingBindings.iterator().next();
}
}
return newBinding;
@@ -228,9 +228,9 @@
* @see com.metamatrix.admin.api.server.ServerConfigAdmin#addConnectorBinding(java.lang.String, char[], AdminOptions)
* @since 4.3
*/
- public com.metamatrix.admin.api.objects.ConnectorBinding addConnectorBinding(String connectorBindingName,
+ public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String connectorBindingName,
char[] xmlFile, AdminOptions options) throws AdminException {
- com.metamatrix.admin.api.objects.ConnectorBinding newBinding = null;
+ org.teiid.adminapi.ConnectorBinding newBinding = null;
if (xmlFile == null) {
throw new AdminProcessingException(AdminServerPlugin.Util.getString("ServerConfigAdminImpl.CDK_File_Name_can_not_be_null")); //$NON-NLS-1$
@@ -335,7 +335,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addConnectorArchive(byte[], com.metamatrix.admin.api.objects.AdminOptions)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorArchive(byte[], org.teiid.adminapi.AdminOptions)
* @since 4.3
*/
public void addConnectorArchive(byte[] contents, AdminOptions options) throws AdminException {
@@ -415,7 +415,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addAuthroizationProvider(String, String, Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addAuthroizationProvider(String, String, Properties)
* @param domainname is the name to be assigned to the newly created {@link AuthenticationProvider}
* @param provdertypename is the type of provider to create.
* @param properties are the settings specified by the providertype to be used
@@ -808,7 +808,7 @@
String mmHost = null;
String mmPort = null;
Collection hosts = parent.getHosts(AdminObject.WILDCARD);
- com.metamatrix.admin.api.objects.Host aHost = (com.metamatrix.admin.api.objects.Host) hosts.iterator().next();
+ org.teiid.adminapi.Host aHost = (org.teiid.adminapi.Host) hosts.iterator().next();
mmHost = aHost.getName();
Collection hostProcesses = parent.getProcesses(aHost.getIdentifier() + AdminObject.DELIMITER + AdminObject.WILDCARD);
ProcessObject hostProcess = (ProcessObject) hostProcesses.iterator().next();
@@ -1000,7 +1000,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConfiguration()
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConfiguration()
* @since 4.3
*/
public char[] exportConfiguration() throws AdminException {
@@ -1040,7 +1040,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#importConfiguration(char[])
+ * @see org.teiid.adminapi.ConfigurationAdmin#importConfiguration(char[])
* @since 4.3
*/
public void importConfiguration(char[] fileData) throws AdminException {
@@ -1086,7 +1086,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorBinding(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorBinding(java.lang.String)
* @since 4.3
*/
public char[] exportConnectorBinding(String connectorBindingIdentifier) throws AdminException {
@@ -1167,7 +1167,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorType(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorType(java.lang.String)
* @since 4.3
*/
public char[] exportConnectorType(String connectorTypeIdentifier) throws AdminException {
@@ -1237,7 +1237,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportConnectorArchive(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorArchive(java.lang.String)
* @since 4.3
*/
public byte[] exportConnectorArchive(String connectorTypeIdentifier) throws AdminException {
@@ -1292,7 +1292,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportExtensionModule(java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportExtensionModule(java.lang.String)
* @since 4.3
*/
public byte[] exportExtensionModule(String identifier) throws AdminException {
@@ -1321,7 +1321,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#exportVDB(java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#exportVDB(java.lang.String, java.lang.String)
* @since 4.3
*/
public byte[] exportVDB(String name, String version) throws AdminException {
@@ -1387,7 +1387,7 @@
}
/**
- * @see com.metamatrix.admin.api.server.ServerConfigAdmin#setLogConfiguration(com.metamatrix.admin.api.objects.LogConfiguration)
+ * @see com.metamatrix.admin.api.server.ServerConfigAdmin#setLogConfiguration(org.teiid.adminapi.LogConfiguration)
* @since 4.3
*/
public void setLogConfiguration(LogConfiguration adminLogConfig) throws AdminException {
@@ -1462,7 +1462,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#updateSystemProperties(java.util.Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#updateSystemProperties(java.util.Properties)
* @since 4.3
*/
public void updateSystemProperties(Properties properties) throws AdminException {
@@ -1477,7 +1477,7 @@
/**
- * Supported classes are {@link com.metamatrix.admin.api.objects.Host}, {@link com.metamatrix.admin.api.objects.ConnectorBinding},
+ * Supported classes are {@link org.teiid.adminapi.Host}, {@link org.teiid.adminapi.ConnectorBinding},
* {@link SystemObject}, {@link ProcessObject}
* @see com.metamatrix.admin.api.server.ServerConfigAdmin#setProperty(java.lang.String, java.lang.String, java.lang.String)
* @since 4.3
@@ -1496,9 +1496,9 @@
/**
- * Supported classes are {@link com.metamatrix.admin.api.objects.ConnectorBinding}, {@link com.metamatrix.admin.api.objects.Service},
+ * Supported classes are {@link org.teiid.adminapi.ConnectorBinding}, {@link org.teiid.adminapi.Service},
* {@link SystemObject}, {@link ProcessObject}
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#updateProperties(java.lang.String, java.lang.String, java.util.Properties)
+ * @see org.teiid.adminapi.ConfigurationAdmin#updateProperties(java.lang.String, java.lang.String, java.util.Properties)
* @since 4.3
*/
public void updateProperties(String identifier,
@@ -1698,7 +1698,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
* @since 4.3
*/
public void assignBindingToModel(String connectorBindingName,
@@ -1711,7 +1711,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deassignBindingFromModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#deassignBindingFromModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
* @since 5.0
*/
public void deassignBindingFromModel(String connectorBindingName,
@@ -1724,7 +1724,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#assignBindingsToModel(String[], java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#assignBindingsToModel(String[], java.lang.String, java.lang.String, java.lang.String)
* @since 5.0
*/
public void assignBindingsToModel(String[] connectorBindingNames,
@@ -1804,7 +1804,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deassignBindingFromModel(String[], java.lang.String, java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#deassignBindingFromModel(String[], java.lang.String, java.lang.String, java.lang.String)
* @since 5.0
*/
public void deassignBindingsFromModel(String[] connectorBindingNames,
@@ -1902,8 +1902,8 @@
// Second, stop connector binding if running
Collection binding = parent.getConnectorBindings(connectorBindingIdentifier);
if ( binding != null && binding.size() > 0 ) {
- com.metamatrix.admin.api.objects.ConnectorBinding theBinding = (com.metamatrix.admin.api.objects.ConnectorBinding)binding.iterator().next();
- if ( theBinding != null && theBinding.getState() == com.metamatrix.admin.api.objects.ConnectorBinding.STATE_OPEN ) {
+ org.teiid.adminapi.ConnectorBinding theBinding = (org.teiid.adminapi.ConnectorBinding)binding.iterator().next();
+ if ( theBinding != null && theBinding.getState() == org.teiid.adminapi.ConnectorBinding.STATE_OPEN ) {
try {
shutDownConnectorBinding((MMConnectorBinding)theBinding, true);
} catch (final Exception err) {
@@ -2294,7 +2294,7 @@
aBindingName = ((ConnectorBinding)aBindingObj).getName();
} else {
// instance of com.metamatrix.admin.api.objects.ConnectorBinding - or exception
- aBindingName = ((com.metamatrix.admin.api.objects.ConnectorBinding)aBindingObj).getName();
+ aBindingName = ((org.teiid.adminapi.ConnectorBinding)aBindingObj).getName();
}
bindingNames.add(aBindingName);
}
@@ -2329,7 +2329,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#addUDF(byte[], java.lang.String)
+ * @see org.teiid.adminapi.ConfigurationAdmin#addUDF(byte[], java.lang.String)
*/
public void addUDF(byte[] modelFileContents, String classpath) throws AdminException {
classpath = classpath.trim();
@@ -2357,7 +2357,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreConfigAdmin#deleteUDF()
+ * @see org.teiid.adminapi.ConfigurationAdmin#deleteUDF()
*/
public void deleteUDF() throws AdminException {
deleteExtensionModule(FUNCTION_DEFINITIONS_MODEL);
@@ -2383,5 +2383,10 @@
}
return null;
}
+
+ @Override
+ public void extensionModuleModified(String name) throws AdminException {
+
+ }
}
\ No newline at end of file
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -41,17 +41,18 @@
import java.util.Properties;
import java.util.Set;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.Model;
-import com.metamatrix.admin.api.objects.Resource;
-import com.metamatrix.admin.api.objects.Service;
-import com.metamatrix.admin.api.objects.Session;
-import com.metamatrix.admin.api.objects.SystemObject;
-import com.metamatrix.admin.api.objects.Transaction;
-import com.metamatrix.admin.api.objects.VDB;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Resource;
+import org.teiid.adminapi.Service;
+import org.teiid.adminapi.Session;
+import org.teiid.adminapi.SystemObject;
+import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.VDB;
+
import com.metamatrix.admin.api.server.ServerMonitoringAdmin;
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.admin.objects.MMConnectionPool;
@@ -243,7 +244,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getConnectorBindingsInVDB(java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getConnectorBindingsInVDB(java.lang.String)
* @since 4.3
*/
public Collection getConnectorBindingsInVDB(String identifier) throws AdminException {
@@ -1201,7 +1202,7 @@
}
/**
- * @see com.metamatrix.admin.api.core.CoreMonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
+ * @see org.teiid.adminapi.MonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
* @since 4.3
*/
public Collection getPropertyDefinitions(String identifier, String className) throws AdminException {
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerRuntimeStateAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -31,16 +31,17 @@
import javax.transaction.xa.Xid;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Cache;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.EmbeddedLogger;
+import org.teiid.adminapi.ProcessObject;
+import org.teiid.adminapi.Request;
import org.teiid.dqp.internal.process.DQPWorkContext;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.objects.Cache;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.ProcessObject;
-import com.metamatrix.admin.api.objects.Request;
import com.metamatrix.admin.api.server.ServerRuntimeStateAdmin;
import com.metamatrix.admin.objects.MMConnectorBinding;
import com.metamatrix.admin.objects.MMProcess;
@@ -395,7 +396,7 @@
* @param waitUntilDone Ignored: the waiting for this method is done in ServerAdminClientInterceptor on the client-side.
* @since 4.3
*/
- public void bounceSystem(boolean waitUntilDone) throws AdminException {
+ public void restart() throws AdminException {
try {
getRuntimeStateAdminAPIHelper().bounceServer();
} catch (MetaMatrixComponentException e) {
@@ -432,7 +433,7 @@
/**
- * @see com.metamatrix.admin.api.core.CoreRuntimeStateAdmin#clearCache(java.lang.String)
+ * @see org.teiid.adminapi.RuntimeStateAdmin#clearCache(java.lang.String)
* @since 4.3
*/
public void clearCache(String cacheIdentifier) throws AdminException {
@@ -743,6 +744,16 @@
public void terminateTransaction(Xid transactionId) throws AdminException {
this.getQueryServiceProxy().terminateTransaction(transactionId);
}
-
+ @Override
+ public void setLogListener(EmbeddedLogger listener) throws AdminException {
+ }
+
+ @Override
+ public void bounceSystem(boolean waitUntilDone) throws AdminException {
+ }
+
+ @Override
+ public void shutdown(int millisToWait) throws AdminException {
+ }
}
\ No newline at end of file
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerSecurityAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerSecurityAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerSecurityAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -29,16 +29,17 @@
import java.util.List;
import java.util.Set;
-import com.metamatrix.admin.api.exception.AdminComponentException;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.AdminRoles;
+import org.teiid.adminapi.Group;
+import org.teiid.adminapi.Principal;
+
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.objects.Group;
-import com.metamatrix.admin.api.objects.Principal;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.admin.api.server.ServerSecurityAdmin;
import com.metamatrix.admin.objects.MMGroup;
import com.metamatrix.admin.objects.MMRole;
@@ -284,7 +285,7 @@
}
/**
- * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#importDataRoles(java.lang.String, java.lang.String, char[], com.metamatrix.admin.api.objects.AdminOptions)
+ * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#importDataRoles(java.lang.String, java.lang.String, char[], org.teiid.adminapi.AdminOptions)
*/
public String importDataRoles(String vdbName, String vdbVersion, char[] xmlContents, AdminOptions options)
throws AdminException{
Modified: trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -323,11 +323,11 @@
BasicHost host = new BasicHost(new ConfigurationID(name), new HostID(name), Host.HOST_COMPONENT_TYPE_ID);
Properties props = new Properties();
- props.setProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR, System.getProperty("user.dir"))); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS, "")); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS, "")); //$NON-NLS-1$
+ props.setProperty(org.teiid.adminapi.Host.INSTALL_DIR, getBootStrapProperties().getProperty(org.teiid.adminapi.Host.INSTALL_DIR, System.getProperty("user.dir"))); //$NON-NLS-1$
+ props.setProperty(org.teiid.adminapi.Host.HOST_DIRECTORY, getBootStrapProperties().getProperty(org.teiid.adminapi.Host.HOST_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
+ props.setProperty(org.teiid.adminapi.Host.LOG_DIRECTORY, getBootStrapProperties().getProperty(org.teiid.adminapi.Host.LOG_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
+ props.setProperty(org.teiid.adminapi.Host.HOST_BIND_ADDRESS, getBootStrapProperties().getProperty(org.teiid.adminapi.Host.HOST_BIND_ADDRESS, "")); //$NON-NLS-1$
+ props.setProperty(org.teiid.adminapi.Host.HOST_PHYSICAL_ADDRESS, getBootStrapProperties().getProperty(org.teiid.adminapi.Host.HOST_PHYSICAL_ADDRESS, "")); //$NON-NLS-1$
host.setProperties(props);
return host;
Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/AuthorizationAdminAPIImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/AuthorizationAdminAPIImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/AuthorizationAdminAPIImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -29,9 +29,10 @@
import java.util.Map;
import java.util.Set;
+import org.teiid.adminapi.AdminRoles;
+
import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ConfigurationAdminAPIImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ConfigurationAdminAPIImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ConfigurationAdminAPIImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -26,9 +26,10 @@
import java.util.List;
import java.util.Set;
+import org.teiid.adminapi.AdminRoles;
+
import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.common.actions.ActionDefinition;
Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ExtensionSourceAdminAPIImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ExtensionSourceAdminAPIImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/ExtensionSourceAdminAPIImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -25,9 +25,10 @@
import java.util.Collection;
import java.util.List;
+import org.teiid.adminapi.AdminRoles;
+
import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.common.extensionmodule.ExtensionModuleDescriptor;
Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -32,7 +32,8 @@
import java.util.List;
import java.util.Map;
-import com.metamatrix.admin.api.exception.AdminException;
+import org.teiid.adminapi.AdminException;
+
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MultipleException;
Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -28,9 +28,10 @@
import java.util.Iterator;
import java.util.List;
+import org.teiid.adminapi.AdminRoles;
+
import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.api.exception.MultipleException;
Modified: trunk/server/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -27,9 +27,10 @@
import java.util.Map;
import java.util.Set;
+import org.teiid.adminapi.AdminOptions;
+
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
-import com.metamatrix.admin.api.objects.AdminOptions;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.AuthorizationException;
Modified: trunk/server/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -33,10 +33,11 @@
import java.util.Properties;
import java.util.Set;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminRoles;
+
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/ProcessManagement.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -24,7 +24,8 @@
import java.net.InetAddress;
-import com.metamatrix.admin.api.exception.AdminException;
+import org.teiid.adminapi.AdminException;
+
import com.metamatrix.common.config.api.ServiceComponentDefnID;
import com.metamatrix.common.log.LogConfiguration;
import com.metamatrix.platform.service.api.ServiceID;
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-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -37,10 +37,10 @@
import java.util.Map;
import java.util.Properties;
+import org.teiid.adminapi.AdminException;
import org.teiid.transport.AdminAuthorizationInterceptor;
import org.teiid.transport.LogonImpl;
-import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.admin.api.server.ServerAdmin;
import com.metamatrix.admin.server.ServerAdminImpl;
import com.metamatrix.api.exception.MetaMatrixComponentException;
Modified: trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -34,11 +34,11 @@
import java.util.Properties;
import java.util.Set;
+import org.teiid.adminapi.AdminRoles;
import org.teiid.transport.SSLConfiguration;
import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.server.AdminRoles;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.common.config.api.ConnectorBinding;
Modified: trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataHelper.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -33,7 +33,8 @@
import java.util.Map;
import java.util.Set;
-import com.metamatrix.admin.api.objects.AdminOptions;
+import org.teiid.adminapi.AdminOptions;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.common.jdbc.JDBCPlatform;
Modified: trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -34,6 +34,7 @@
import com.google.inject.Inject;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
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.InvalidUserException;
import com.metamatrix.api.exception.security.MembershipServiceException;
@@ -44,9 +45,11 @@
import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.platform.security.api.AuthorizationActions;
import com.metamatrix.platform.security.api.AuthorizationPermission;
+import com.metamatrix.platform.security.api.AuthorizationPolicy;
import com.metamatrix.platform.security.api.AuthorizationRealm;
import com.metamatrix.platform.security.api.BasicAuthorizationPermission;
import com.metamatrix.platform.security.api.BasicAuthorizationPermissionFactory;
+import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
import com.metamatrix.platform.security.api.SessionToken;
import com.metamatrix.platform.security.api.StandardAuthorizationActions;
import com.metamatrix.platform.security.api.service.AuthorizationServiceInterface;
@@ -213,10 +216,29 @@
}
@Override
- public boolean isCallerInRole(SessionToken caller, String roleName)
+ public boolean isCallerInRole(SessionToken session, String roleName)
throws AuthorizationMgmtException {
- // rameshTODO Auto-generated method stub
return false;
}
+ @Override
+ public Collection<AuthorizationPolicy> getPoliciesInRealm(
+ AuthorizationRealm realm)
+ throws AuthorizationException, AuthorizationMgmtException {
+ return null;
+ }
+
+ @Override
+ public Collection<String> getRoleNamesForPrincipal(
+ MetaMatrixPrincipalName principal) throws InvalidSessionException,
+ AuthorizationException, AuthorizationMgmtException {
+ return null;
+ }
+
+ @Override
+ public void updatePoliciesInRealm(AuthorizationRealm realm,
+ Collection<AuthorizationPolicy> policies)
+ throws AuthorizationMgmtException {
+ }
+
}
Modified: trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -34,10 +34,10 @@
import javax.transaction.xa.Xid;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.Transaction;
import org.teiid.dqp.internal.process.DQPCore;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.objects.Transaction;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.server.InvalidRequestIDException;
Modified: trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/main/java/com/metamatrix/server/query/service/QueryServiceInterface.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -26,8 +26,9 @@
import javax.transaction.xa.Xid;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.objects.Transaction;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.Transaction;
+
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.server.InvalidRequestIDException;
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -32,7 +32,8 @@
import java.util.Properties;
import java.util.Set;
-import com.metamatrix.admin.api.objects.Cache;
+import org.teiid.adminapi.Cache;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -34,7 +34,8 @@
import java.util.Properties;
import java.util.Set;
-import com.metamatrix.admin.api.objects.Resource;
+import org.teiid.adminapi.Resource;
+
import com.metamatrix.common.actions.ActionDefinition;
import com.metamatrix.common.actions.CreateObject;
import com.metamatrix.common.actions.ModificationException;
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -34,8 +34,9 @@
import javax.transaction.xa.Xid;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.objects.Transaction;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.Transaction;
+
import com.metamatrix.admin.objects.MMAdminObject;
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -28,7 +28,8 @@
import java.util.List;
import java.util.Set;
-import com.metamatrix.admin.api.objects.AdminObject;
+import org.teiid.adminapi.AdminObject;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MultipleException;
import com.metamatrix.api.exception.security.AuthorizationException;
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/IdentifierConstants.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/IdentifierConstants.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/IdentifierConstants.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -22,8 +22,8 @@
package com.metamatrix.admin.server;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.Request;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.Request;
/**
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -28,16 +28,17 @@
import java.util.List;
import java.util.Properties;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Host;
+import org.teiid.adminapi.ProcessObject;
+import org.teiid.adminapi.Service;
+
import junit.framework.TestCase;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.Host;
-import com.metamatrix.admin.api.objects.ProcessObject;
-import com.metamatrix.admin.api.objects.Service;
import com.metamatrix.admin.objects.MMConnectorBinding;
import com.metamatrix.admin.objects.MMProcess;
import com.metamatrix.common.application.DQPConfigSource;
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -28,13 +28,14 @@
import java.util.List;
import java.util.Properties;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Request;
+import org.teiid.adminapi.Session;
+
import junit.framework.TestCase;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.Request;
-import com.metamatrix.admin.api.objects.Session;
import com.metamatrix.admin.objects.MMConnectorBinding;
import com.metamatrix.admin.objects.MMConnectorType;
import com.metamatrix.admin.objects.MMDQP;
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/TestServerRuntimeStateAdminImpl.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/TestServerRuntimeStateAdminImpl.java 2009-06-27 05:22:45 UTC (rev 1089)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/TestServerRuntimeStateAdminImpl.java 2009-06-30 21:19:01 UTC (rev 1090)
@@ -23,14 +23,15 @@
package com.metamatrix.admin.server;
import java.util.List;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Cache;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Request;
+
import junit.framework.TestCase;
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.objects.AdminObject;
-import com.metamatrix.admin.api.objects.Cache;
-import com.metamatrix.admin.api.objects.ConnectorBinding;
-import com.metamatrix.admin.api.objects.Request;
import com.metamatrix.common.id.dbid.DBIDGenerator;
import com.metamatrix.platform.config.ConfigUpdateMgr;
import com.metamatrix.platform.registry.ClusteredRegistryState;
15 years, 6 months
teiid SVN: r1089 - in trunk/engine/src: test/java/com/metamatrix/query/parser and 1 other directories.
by teiid-commits@lists.jboss.org
Author: loleary
Date: 2009-06-27 01:22:45 -0400 (Sat, 27 Jun 2009)
New Revision: 1089
Added:
trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestJoinPredicate.java
Modified:
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/JoinPredicate.java
trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java
Log:
TEIID-695: Equality comparison of JoinPredicate returns true even when JoinPredicate criteria is different
Fixed JoinPredicate.equals(Object) method to compare its own criteria to the Object's criteria instead of comparing its own criteria to itself.
Added TestJoinPredicate UnitTest to cover equality checks on JoinPredicate object.
Fixed TestParser to build JoinPredicate in the same manner that the Parser is building it during parsing of a query which contains JoinPredicate.
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/JoinPredicate.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/JoinPredicate.java 2009-06-26 22:06:04 UTC (rev 1088)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/JoinPredicate.java 2009-06-27 05:22:45 UTC (rev 1089)
@@ -194,7 +194,7 @@
if(thisCrit != null && thisCrit.size() == 0) {
thisCrit = null;
}
- List otherCrit = this.getJoinCriteria();
+ List otherCrit = other.getJoinCriteria();
if(otherCrit != null && otherCrit.size() == 0) {
otherCrit = null;
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java 2009-06-26 22:06:04 UTC (rev 1088)
+++ trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java 2009-06-27 05:22:45 UTC (rev 1089)
@@ -6231,13 +6231,10 @@
Select s = new Select();
s.addSymbol(new AllSymbol());
From f = new From();
- JoinPredicate jp = new JoinPredicate(new UnaryFromClause(new GroupSymbol("m.g1")), new UnaryFromClause(new GroupSymbol("m.g2")), JoinType.JOIN_INNER); //$NON-NLS-1$ //$NON-NLS-2$
CompareCriteria c1 = new CompareCriteria(new ElementSymbol("e1"), CompareCriteria.EQ, new Constant(new Integer(0))); //$NON-NLS-1$
CompoundCriteria cc1 = new CompoundCriteria(CompoundCriteria.AND, c1, predCrit);
- List crits = new ArrayList();
- crits.add(cc1);
- jp.setJoinCriteria(crits);
+ JoinPredicate jp = new JoinPredicate(new UnaryFromClause(new GroupSymbol("m.g1")), new UnaryFromClause(new GroupSymbol("m.g2")), JoinType.JOIN_INNER, cc1); //$NON-NLS-1$ //$NON-NLS-2$
f.addClause(jp);
Query q = new Query();
@@ -6245,14 +6242,14 @@
q.setFrom(f);
helpTest("SELECT * FROM m.g1 JOIN m.g2 ON e1=0 AND " + sqlPred, //$NON-NLS-1$
- "SELECT * FROM m.g1 INNER JOIN m.g2 ON e1 = 0 AND " + sqlPred, q); //$NON-NLS-1$
+ "SELECT * FROM m.g1 INNER JOIN m.g2 ON e1 = 0 AND " + sqlPred, q); //$NON-NLS-1$
}
public void testCompoundNonJoinCriteriaInFromWithComparisonCriteria() {
CompareCriteria c2 = new CompareCriteria(new ElementSymbol("e2"), CompareCriteria.EQ, new Constant(new Integer(1))); //$NON-NLS-1$
- helpTestCompoundNonJoinCriteria("e2 IS NULL", c2); //$NON-NLS-1$
+ helpTestCompoundNonJoinCriteria("e2 = 1", c2); //$NON-NLS-1$
}
public void testCompoundNonJoinCriteriaInFromWithIsNull() {
Added: trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestJoinPredicate.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestJoinPredicate.java (rev 0)
+++ trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestJoinPredicate.java 2009-06-27 05:22:45 UTC (rev 1089)
@@ -0,0 +1,347 @@
+/*
+ * 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.query.sql.lang;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.*;
+import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.query.sql.symbol.*;
+
+/**
+ * Test the <code>JoinPredicate</code> implementation to verify it is producing
+ * expected <code>JoinPredicate</code> objects.
+ */
+public class TestJoinPredicate extends TestCase {
+
+ // ################################## FRAMEWORK ################################
+
+ public TestJoinPredicate(String name) {
+ super(name);
+ }
+
+ // ################################## TEST HELPERS ################################
+
+ /**
+ * Constructs an example <code>JoinPredicate</code> object that can be used
+ * as join predicate in a query.
+ *
+ * @param joinType the type of join to be constructed
+ * @param joinOnElement the element name to be used in the left and right
+ * side criteria of the ON expression of the join
+ * @return a join predicate object
+ */
+ public static JoinPredicate example(JoinType joinType, String joinOnElement) {
+ JoinPredicate jp = new JoinPredicate();
+
+ GroupSymbol g1 = new GroupSymbol("m.g1"); //$NON-NLS-1$
+ GroupSymbol g2 = new GroupSymbol("m.g2"); //$NON-NLS-1$
+ FromClause lc = new UnaryFromClause(g1);
+ FromClause rc = new UnaryFromClause(g2);
+
+ Expression le = new ElementSymbol("m.g1." + joinOnElement); //$NON-NLS-1$
+ Expression re = new ElementSymbol("m.g2." + joinOnElement); //$NON-NLS-1$
+ Criteria c1 = new CompareCriteria(le, CompareCriteria.EQ, re);
+
+ jp.setLeftClause(lc);
+ jp.setRightClause(rc);
+ jp.setJoinType(joinType != null ? joinType : JoinType.JOIN_LEFT_OUTER);
+ jp.setJoinCriteria( Arrays.asList(new Object[]{c1}));
+
+ return jp;
+ }
+
+ /**
+ * Constructs an example <code>JoinPredicate</code> object that contains
+ * compound criteria in the join's ON expression. The resulting object
+ * could be used as join predicate in a query.
+ * <p>
+ * This method calls <code>example(joinType, joinOnElement)</code> to
+ * construct the initial join predicate object. The join criteria of
+ * the initial join predicate object is then modified to add the use
+ * of compound criteria which include the original criteria from the
+ * initial join predicate object and the newly constructed criteria
+ * specified from the <code>andJoinOnElement</code> string.
+ *
+ * @param joinType the type of join to be constructed
+ * @param joinOnElement the element name to be used in the left and right
+ * side criteria of the ON expression of the join
+ * @param andJoinOnElement the element name to be used in the left and right
+ * side criteria of the right hand expression of AND
+ * criteria of the ON expression of the join
+ * @return a join predicate object
+ */
+ public static JoinPredicate example(JoinType joinType, String joinOnElement, String andJoinOnElement) {
+ JoinPredicate jp = example(joinType, joinOnElement);
+ List<Criteria> joinCrits = jp.getJoinCriteria();
+ List<Object> newJoinCrits = new ArrayList<Object>(1);
+
+ Expression le = new ElementSymbol("m.g1." + andJoinOnElement); //$NON-NLS-1$
+ Expression re = new ElementSymbol("m.g2." + andJoinOnElement); //$NON-NLS-1$
+ Criteria c1 = new CompareCriteria(le, CompareCriteria.EQ, re);
+
+ Iterator<Criteria> ci = joinCrits.iterator();
+
+ if (!ci.hasNext()) {
+ newJoinCrits.add(c1);
+ }
+
+ while (ci.hasNext()) {
+ Criteria crit = ci.next();
+ if ( ci.hasNext() ) newJoinCrits.add(crit);
+ else {
+ Criteria compundCrit = new CompoundCriteria(CompoundCriteria.AND, crit, c1);
+ newJoinCrits.add(compundCrit);
+ }
+ }
+
+ jp.setJoinCriteria(newJoinCrits);
+
+ return jp;
+ }
+
+ // ################################## ACTUAL TESTS ################################
+
+ /**
+ * Test <code>equals()</code> method of <code>JoinPredicate</code> to
+ * verify it properly evaluates the equality of two <code>JoinPredicate</code>
+ * objects.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * that were constructed with the same join type and with the same criteria
+ * evaluate as equal.
+ * <p>
+ * For example:
+ * ... m.g1 LEFT OUTER JOIN m.g2 ON m.g1.e1 = m.g2.e1
+ */
+ public void testEquals1() {
+ JoinPredicate jp1 = example(JoinType.JOIN_LEFT_OUTER, "e1"); //$NON-NLS-1$
+ JoinPredicate jp2 = example(JoinType.JOIN_LEFT_OUTER, "e1"); //$NON-NLS-1$
+ assertTrue("Equivalent join predicate don't compare as equal: " + jp1 + ", " + jp2, jp1.equals(jp2)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Test <code>equals()</code> method of <code>JoinPredicate</code> to
+ * verify it properly evaluates the equality of two
+ * <code>JoinPredicate</code> objects.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * that were constructed with the same join type and with the same
+ * compound criteria evaluate as equal.
+ * <p>
+ * For example:
+ * ... m.g1 LEFT OUTER JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
+ */
+ public void testEquals2() {
+ JoinPredicate jp1 = example(JoinType.JOIN_LEFT_OUTER, "e1", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ JoinPredicate jp2 = example(JoinType.JOIN_LEFT_OUTER, "e1", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Equivalent join predicate don't compare as equal: " + jp1 + ", " + jp2, jp1.equals(jp2)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Test <code>equals()</code> method of <code>JoinPredicate</code> to
+ * verify it properly evaluates the equality of two <code>JoinPredicate</code>
+ * objects.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * that were constructed with different join types but with the same
+ * compound criteria evaluate as not equal.
+ * <p>
+ * For example:
+ * ... m.g1 LEFT OUTER JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
+ * ... m.g1 RIGHT OUTER JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
+ */
+ public void testEquals3() {
+ JoinPredicate jp1 = example(JoinType.JOIN_LEFT_OUTER, "e1", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ JoinPredicate jp2 = example(JoinType.JOIN_RIGHT_OUTER, "e1", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Different join predicate compare as equal: " + jp1 + ", " + jp2, !jp1.equals(jp2)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Test <code>equals()</code> method of <code>JoinPredicate</code> to
+ * verify it properly evaluates the equality of two <code>JoinPredicate</code>
+ * objects.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * that were constructed with the same join type but with different
+ * criteria evaluate as not equal.
+ * <p>
+ * For example:
+ * ... m.g1 INNER JOIN m.g2 ON m.g1.e1 = m.g2.e1
+ * ... m.g1 INNER JOIN m.g2 ON m.g1.e2 = m.g2.e2
+ */
+ public void testEquals4() {
+ JoinPredicate jp1 = example(JoinType.JOIN_INNER, "e1"); //$NON-NLS-1$
+ JoinPredicate jp2 = example(JoinType.JOIN_INNER, "e2"); //$NON-NLS-1$
+ assertTrue("Different join predicate compare as equal: " + jp1 + ", " + jp2, !jp1.equals(jp2)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Test <code>equals()</code> method of <code>JoinPredicate</code> to
+ * verify it properly evaluates the equality of two <code>JoinPredicate</code>
+ * objects.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * that were constructed with the same join type but with different
+ * compound criteria evaluate as not equal.
+ * <p>
+ * For example:
+ * ... m.g1 CROSS JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
+ * ... m.g1 CROSS JOIN m.g2 ON ((m.g1.e2 = m.g2.e2) AND (m.g1.e2 = m.g2.e2))
+ */
+ public void testEquals5() {
+ JoinPredicate jp1 = example(JoinType.JOIN_CROSS, "e1", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ JoinPredicate jp2 = example(JoinType.JOIN_CROSS, "e2", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Different join predicate compare as equal: " + jp1 + ", " + jp2, !jp1.equals(jp2)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
+ * <p>
+ * This test ensures that the same <code>JoinPredicate</code> object
+ * evaluates as equal when it is compared to itself.
+ * <p>
+ * For example:
+ * ... m.g1 FULL OUTER JOIN m.g2 ON m.g1.e1 = m.g2.e1
+ */
+ public void testSelfEquivalence(){
+ JoinPredicate jp1 = example(JoinType.JOIN_FULL_OUTER, "e1"); //$NON-NLS-1$
+ int equals = 0;
+ UnitTestUtil.helpTestEquivalence(equals, jp1, jp1);
+ }
+
+ /**
+ * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * constructed with the same join type and the same criteria evaluates as
+ * equal.
+ * <p>
+ * For example:
+ * ... m.g1 FULL OUTER JOIN m.g2 ON m.g1.e1 = m.g2.e1
+ * ... m.g1 FULL OUTER JOIN m.g2 ON m.g1.e1 = m.g2.e1
+ */
+ public void testEquivalence(){
+ JoinPredicate jp1 = example(JoinType.JOIN_FULL_OUTER, "e1"); //$NON-NLS-1$
+ JoinPredicate jp2 = example(JoinType.JOIN_FULL_OUTER, "e1"); //$NON-NLS-1$
+ int equals = 0;
+ UnitTestUtil.helpTestEquivalence(equals, jp1, jp2);
+ }
+
+ /**
+ * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
+ * <p>
+ * This test ensures that a <code>JoinPredicate</code> object's clone
+ * evaluate as equal when compared to the original object.
+ * <p>
+ * For example:
+ * ... m.g1 UNION JOIN m.g2 ON m.g1.e1 = m.g2.e1
+ */
+ public void testCloneEquivalence(){
+ JoinPredicate jp1 = example(JoinType.JOIN_UNION, "e1"); //$NON-NLS-1$
+ JoinPredicate jp2 = (JoinPredicate)jp1.clone();
+ int equals = 0;
+ UnitTestUtil.helpTestEquivalence(equals, jp1, jp2);
+ }
+
+ /**
+ * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * constructed with the same join type but with different criteria evaluate
+ * as not equal.
+ * <p>
+ * For example:
+ * ... m.g1 FULL OUTER JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
+ * ... m.g1 FULL OUTER JOIN m.g2 ON m.g1.e400 = m.g2.e400
+ */
+ public void testNonEquivalence1(){
+ JoinPredicate jp1 = example(JoinType.JOIN_FULL_OUTER, "e1", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ JoinPredicate jp2 = example(JoinType.JOIN_FULL_OUTER, "e400"); //$NON-NLS-1$
+ int equals = -1;
+ UnitTestUtil.helpTestEquivalence(equals, jp1, jp2);
+ }
+
+ /**
+ * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * constructed with the same join type but with different criteria evaluate
+ * as not equal.
+ * <p>
+ * For example:
+ * ... m.g1 FULL OUTER JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
+ * ... m.g1 FULL OUTER JOIN m.g2 ON ((m.g1.e2 = m.g2.e2) AND (m.g1.e1 = m.g2.e1))
+ */
+ public void testNonEquivalence2(){
+ JoinPredicate jp1 = example(JoinType.JOIN_LEFT_OUTER, "e1", "e2"); //$NON-NLS-1$ //$NON-NLS-2$
+ JoinPredicate jp2 = example(JoinType.JOIN_LEFT_OUTER, "e2", "e1"); //$NON-NLS-1$ //$NON-NLS-2$
+ int equals = -1;
+ UnitTestUtil.helpTestEquivalence(equals, jp1, jp2);
+ }
+
+ /**
+ * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
+ * <p>
+ * This test ensures that two different <code>JoinPredicate</code> objects
+ * constructed with different join types but with the same criteria evaluate
+ * as not equal.
+ * <p>
+ * For example:
+ * ... m.g1 LEFT OUTER JOIN m.g2 ON m.g1.e1 = m.g2.e1
+ * ... m.g1 RIGHT OUTER JOIN m.g2 ON m.g1.e2 = m.g2.e2
+ */
+ public void testNonEquivalence3(){
+ JoinPredicate jp1 = example(JoinType.JOIN_LEFT_OUTER, "e1"); //$NON-NLS-1$
+ JoinPredicate jp2 = example(JoinType.JOIN_RIGHT_OUTER, "e1"); //$NON-NLS-1$
+ int equals = -1;
+ UnitTestUtil.helpTestEquivalence(equals, jp1, jp2);
+ }
+
+
+ // ################################## TEST SUITE ################################
+
+
+ /**
+ * This suite of all tests could be defined in another class but it seems easier to
+ * maintain it here.
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("TestJoinPredicate"); //$NON-NLS-1$
+ suite.addTestSuite(TestJoinPredicate.class);
+ return suite;
+ }
+
+ // ################################## MAIN ################################
+
+ /**
+ * This is a handy main that will run the suite defined in this class. It has no code specific
+ * to this class and can be copied into any class that has a method "public static Test suite()".
+ */
+ public static void main(String arg[]) {
+ junit.textui.TestRunner.run(suite());
+ }
+
+}
Property changes on: trunk/engine/src/test/java/com/metamatrix/query/sql/lang/TestJoinPredicate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 6 months
teiid SVN: r1088 - in trunk: build/kit-embedded and 79 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-06-26 18:06:04 -0400 (Fri, 26 Jun 2009)
New Revision: 1088
Added:
trunk/build/kit-embedded/bin/
trunk/build/kit-embedded/bin/run.bat
trunk/build/kit-embedded/bin/run.sh
trunk/build/kit-embedded/bin/shutdown.bat
trunk/build/kit-embedded/bin/shutdown.sh
trunk/build/kit-embedded/deploy/membership-file.properties
trunk/build/kit-embedded/deploy/membership-ldap.properties
trunk/client-jdbc/src/main/java/org/
trunk/client-jdbc/src/main/java/org/teiid/
trunk/client-jdbc/src/main/java/org/teiid/jdbc/
trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java
trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java
trunk/embedded/src/main/java/org/teiid/Server.java
trunk/embedded/src/main/java/org/teiid/ServerMBean.java
trunk/embedded/src/main/java/org/teiid/Shutdown.java
trunk/embedded/src/main/java/org/teiid/transport/
trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java
trunk/embedded/src/main/java/org/teiid/transport/ChannelListener.java
trunk/embedded/src/main/java/org/teiid/transport/ClientInstance.java
trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java
trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java
trunk/embedded/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
trunk/embedded/src/main/java/org/teiid/transport/SSLConfiguration.java
trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java
trunk/embedded/src/main/java/org/teiid/transport/SocketClientInstance.java
trunk/embedded/src/main/java/org/teiid/transport/SocketListener.java
trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java
trunk/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java
trunk/embedded/src/test/java/org/
trunk/embedded/src/test/java/org/teiid/
trunk/embedded/src/test/java/org/teiid/transport/
trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java
trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java
trunk/embedded/src/test/java/org/teiid/transport/TestSocketRemoting.java
trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
trunk/server/src/main/java/com/metamatrix/common/config/ResourceNames.java
trunk/server/src/main/java/com/metamatrix/common/config/model/
trunk/server/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java
trunk/server/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java
trunk/server/src/main/java/com/metamatrix/common/config/reader/
trunk/server/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java
trunk/server/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java
trunk/server/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java
trunk/server/src/test/java/com/metamatrix/common/config/
trunk/server/src/test/java/com/metamatrix/common/config/model/
trunk/server/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java
trunk/server/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java
Removed:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedSQLException.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/ResourceNames.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java
trunk/common-internal/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java
trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java
trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/
trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/spi/
trunk/engine/src/main/java/com/metamatrix/common/application/DQPGuiceModule.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServicePropertyNames.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/ChannelListener.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SSLAwareChannelHandler.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/AdminAuthorizationInterceptor.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ClientInstance.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/LogonImpl.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
trunk/server/src/main/java/com/metamatrix/common/net/ServerSocketConfiguration.java
trunk/server/src/test/java/com/metamatrix/common/comm/platform/server/TestAdminAuthInterceptor.java
trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java
trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java
trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java
Modified:
trunk/build/assembly/embedded/build-configuration.xml
trunk/build/assembly/embedded/embedded-dist.xml
trunk/build/kit-embedded/deploy.properties
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDriver.java
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/com/metamatrix/jdbc/MMSQLException.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
trunk/client/src/main/java/com/metamatrix/admin/api/core/Admin.java
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedMonitoringAdmin.java
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedRuntimeStateAdmin.java
trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedSecurityAdmin.java
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/util/ConfigurationPropertyNames.java
trunk/common-internal/src/main/java/com/metamatrix/common/util/LogConstants.java
trunk/common-internal/src/main/java/com/metamatrix/common/util/crypto/keymanage/FilePasswordConverter.java
trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties
trunk/embedded/pom.xml
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/jdbc/EmbeddedGuiceModule.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/Log4JUtil.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
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/file/FileMembershipDomain.java
trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
trunk/embedded/src/main/resources/com/metamatrix/platform/i18n.properties
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
trunk/embedded/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java
trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
trunk/engine/src/main/java/com/metamatrix/common/application/DQPConfigSource.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/storage/file/FileStorageManager.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java
trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties
trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/server/pom.xml
trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java
trunk/server/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java
trunk/server/src/main/java/com/metamatrix/server/dqp/config/PlatformConfigSource.java
trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java
trunk/test-integration/pom.xml
trunk/test-integration/src/test/java/com/metamatrix/cdk/TestLoopbackConnector.java
trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestCase3473.java
trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXQueryServices.java
trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestPartsDatabaseMetadata.java
trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestResultSetMetadata.java
trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestSystemVirtualModel.java
trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestVirtualDocWithVirtualProc.java
trunk/test-integration/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataInConnector.java
Log:
TEIID-664, TEIID-665, TEIID-666, TEIID-680, TEIID259, TEIID-601, TEIID-259
1) Added socket code to the embedded, enabled the socket transport
2) Wired Membership, Authentication, Session services with configuration and rest of the engine
3) Collapsed EmbeddedConfigSource, EmbeddedGuiceModule and DQPGuiceModule into single EmbeddedguiceModule
4) Removed EmbeddedConnectionFactory, promoted the use of ServerConnection on the embedded. This made few classes collapse.
5) Created separate Teiid Driver, Teiid DataSource
6) Created initial Server kit
Modified: trunk/build/assembly/embedded/build-configuration.xml
===================================================================
--- trunk/build/assembly/embedded/build-configuration.xml 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/build/assembly/embedded/build-configuration.xml 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,19 +1,19 @@
<project default="main" name="teiid-configuration-build" basedir=".">
-
+
<property name="kit.dir" value="${basedir}/target/kit-embedded"/>
<property name="extensions.dir" value="${basedir}/target/dependency"/>
-
-
+
+
<target name="main" >
<copy todir="${kit.dir}">
<fileset dir="${basedir}/kit-embedded"/>
- </copy>
-
+ </copy>
+
<!-- unzip the connector zip files in to directory and move the jar files into extensions directory -->
<unzip dest="${extensions.dir}/unzipped">
<fileset dir="${extensions.dir}">
- <include name="*.zip"/>
+ <include name="*.zip"/>
</fileset>
</unzip>
<move todir="${kit.dir}/extensions">
@@ -21,16 +21,33 @@
<include name="**/*.jar"/>
</fileset>
</move>
-
- <!-- add all the cdk files, and then add the combined fragment to the config.xml -->
- <concat destfile="${extensions.dir}/unzipped/all-cdks.xml">
- <fileset dir="${extensions.dir}/unzipped" includes="connector-*.xml"/>
- </concat>
-
- <loadfile property="connector-types-fragment" srcFile="${extensions.dir}/unzipped/all-cdks.xml"/>
- <replace file="${kit.dir}/deploy/configuration.xml" token="${connector-types-fragment-fill-in}" value="${connector-types-fragment}"/>
- <mkdir dir="${kit.dir}/log"/>
- </target>
-
+ <!-- add all the cdk files, and then add the combined fragment to the config.xml -->
+ <concat destfile="${extensions.dir}/unzipped/all-cdks.xml">
+ <fileset dir="${extensions.dir}/unzipped" includes="connector-*.xml"/>
+ </concat>
+
+ <loadfile property="connector-types-fragment" srcFile="${extensions.dir}/unzipped/all-cdks.xml"/>
+ <replace file="${kit.dir}/deploy/configuration.xml" token="${connector-types-fragment-fill-in}" value="${connector-types-fragment}"/>
+
+ <mkdir dir="${kit.dir}/log"/>
+ <mkdir dir="${kit.dir}/work"/>
+
+ <antcall target="chmod"/>
+ </target>
+
+ <target name="set.os">
+ <condition property="UnixOS">
+ <os family="unix"/>
+ </condition>
+ <condition property="WinOS">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+ <target name="chmod" depends="set.os" if="UnixOS">
+ <fixcrlf srcdir="${kit.dir}/bin" eol="lf" eof="remove" includes="**/*.sh"/>
+ <chmod dir="${kit.dir}/bin" perm="ugo+rx" includes="**/*.sh"/>
+ </target>
+
</project>
\ No newline at end of file
Modified: trunk/build/assembly/embedded/embedded-dist.xml
===================================================================
--- trunk/build/assembly/embedded/embedded-dist.xml 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/build/assembly/embedded/embedded-dist.xml 2009-06-26 22:06:04 UTC (rev 1088)
@@ -17,7 +17,7 @@
<includes>
<include>teiid-${version}-client.jar</include>
</includes>
- <outputDirectory>/</outputDirectory>
+ <outputDirectory>client</outputDirectory>
</fileSet>
<fileSet>
@@ -37,7 +37,7 @@
<includes>
<include>teiid-hibernate-dialect-${version}.jar</include>
</includes>
- <outputDirectory>hibernate</outputDirectory>
+ <outputDirectory>client</outputDirectory>
</fileSet>
<fileSet>
Added: trunk/build/kit-embedded/bin/run.bat
===================================================================
--- trunk/build/kit-embedded/bin/run.bat (rev 0)
+++ trunk/build/kit-embedded/bin/run.bat 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,76 @@
+@echo off
+rem -------------------------------------------------------------------------
+rem Teiid Bootstrap Script for Windows (borrowed & modified from JBoss AS)
+rem -------------------------------------------------------------------------
+
+
+@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%\deploy;%TEIID_HOME%\client\*;%TEIID_HOME%\lib\*;
+
+rem JVM memory allocation pool parameters. Modify as appropriate.
+set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=256m
+
+rem Add JMX support
+set JMX_PORT=9999
+set 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
+
+rem With Sun JVMs reduce the RMI GCs to once per hour
+set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+
+rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
+rem set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
+
+echo ===============================================================================
+echo.
+echo Teiid 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.
+
+:RESTART
+"%JAVA%" %JAVA_OPTS% ^
+ -classpath "%JBOSS_CLASSPATH%" ^
+ -server ^
+ org.teiid.Server %TEIID_HOME%\deploy.properties %*
+
+if ERRORLEVEL 10 goto RESTART
+
+:END
+if "x%NOPAUSE%" == "x" pause
+
+:END_NO_PAUSE
Added: trunk/build/kit-embedded/bin/run.sh
===================================================================
--- trunk/build/kit-embedded/bin/run.sh (rev 0)
+++ trunk/build/kit-embedded/bin/run.sh 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,132 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## Teiid Bootstrap Script ##
+## (script borrowed from JBossAS) ##
+### ====================================================================== ###
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+linux=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Linux)
+ linux=true
+ ;;
+esac
+
+# Add JMX support
+JMX_PORT=9999
+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
+
+# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
+if [ "$linux" = "true" ]; then
+ JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
+fi
+
+
+# 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/deploy:$TEIID_HOME/client/*:$TEIID_HOME/lib/*"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ TEIID_HOME=`cygpath --path --windows "$TEIID_HOME"`
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ TEIID_CLASSPATH=`cygpath --path --windows "$TEIID_CLASSPATH"`
+fi
+
+# Display our environment
+echo "========================================================================="
+echo ""
+echo " Teiid 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 ""
+
+while true; do
+ if [ "x$LAUNCH_TEIID_IN_BACKGROUND" = "x" ]; then
+ # Execute the JVM in the foreground
+ "$JAVA" $JAVA_OPTS \
+ -classpath "$TEIID_CLASSPATH" \
+ -server \
+ org.teiid.Server $TEIID_HOME/deploy.properties "$@"
+ _STATUS=$?
+ else
+ # Execute the JVM in the background
+ "$JAVA" $JAVA_OPTS \
+ -classpath "$TEIID_CLASSPATH" \
+ -server \
+ org.teiid.Server $TEIID_HOME/deploy.properties "$@" &
+ _PID=$!
+ echo $_PID > $TEIID_HOME/work/teiid.pid
+ # Trap common signals and relay them to the process
+ trap "kill -HUP $_PID" HUP
+ trap "kill -TERM $_PID" INT
+ trap "kill -QUIT $_PID" QUIT
+ trap "kill -PIPE $_PID" PIPE
+ trap "kill -TERM $_PID" TERM
+ # Wait until the background process exits
+ WAIT_STATUS=128
+ while [ "$WAIT_STATUS" -ge 128 ]; do
+ wait $_PID 2>/dev/null
+ WAIT_STATUS=$?
+ if [ "${WAIT_STATUS}" -gt 128 ]; then
+ SIGNAL=`expr ${WAIT_STATUS} - 128`
+ SIGNAL_NAME=`kill -l ${SIGNAL}`
+ echo "*** Teiid process (${_PID}) received ${SIGNAL_NAME} signal ***" >&2
+ fi
+ done
+ if [ "${WAIT_STATUS}" -lt 127 ]; then
+ _STATUS=$WAIT_STATUS
+ else
+ _STATUS=0
+ fi
+ fi
+
+ if [ "$_STATUS" -eq 10 ]; then
+ echo "Restarting ..."
+ else
+ exit $_STATUS
+ fi
+done
+
Added: trunk/build/kit-embedded/bin/shutdown.bat
===================================================================
--- trunk/build/kit-embedded/bin/shutdown.bat (rev 0)
+++ trunk/build/kit-embedded/bin/shutdown.bat 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,75 @@
+@echo off
+rem -------------------------------------------------------------------------
+rem Teiid Bootstrap Script for Windows (borrowed & modified from JBoss AS)
+rem -------------------------------------------------------------------------
+
+
+@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%\deploy;%TEIID_HOME%\client\*;%TEIID_HOME%\lib\*;
+
+rem JVM memory allocation pool parameters. Modify as appropriate.
+set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=256m
+
+rem Add JMX support
+set JMX_PORT=9999
+
+rem With Sun JVMs reduce the RMI GCs to once per hour
+set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+
+rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
+rem set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
+
+echo ===============================================================================
+echo.
+echo Teiid 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.
+
+:RESTART
+"%JAVA%" %JAVA_OPTS% ^
+ -classpath "%JBOSS_CLASSPATH%" ^
+ -server ^
+ org.teiid.Shutdown %TEIID_HOME%\deploy.properties %JMX_PORT% %*
+
+if ERRORLEVEL 10 goto RESTART
+
+:END
+if "x%NOPAUSE%" == "x" pause
+
+:END_NO_PAUSE
Added: trunk/build/kit-embedded/bin/shutdown.sh
===================================================================
--- trunk/build/kit-embedded/bin/shutdown.sh (rev 0)
+++ trunk/build/kit-embedded/bin/shutdown.sh 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,98 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## Teiid Bootstrap Script ##
+## (script borrowed from JBossAS) ##
+### ====================================================================== ###
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+linux=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Linux)
+ linux=true
+ ;;
+esac
+
+# Add JMX support
+JMX_PORT=9999
+
+# 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
+
+# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
+if [ "$linux" = "true" ]; then
+ JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
+fi
+
+
+# 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/deploy:$TEIID_HOME/client/*:$TEIID_HOME/lib/*"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ TEIID_HOME=`cygpath --path --windows "$TEIID_HOME"`
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ TEIID_CLASSPATH=`cygpath --path --windows "$TEIID_CLASSPATH"`
+fi
+
+# Display our environment
+echo "========================================================================="
+echo ""
+echo " Teiid 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 ""
+
+while true; do
+ "$JAVA" $JAVA_OPTS \
+ -classpath "$TEIID_CLASSPATH" \
+ -server \
+ org.teiid.Shutdown $TEIID_HOME/deploy.properties $JMX_PORT "$@"
+ _STATUS=$?
+
+ if [ "$_STATUS" -eq 10 ]; then
+ echo "Restarting ..."
+ else
+ exit $_STATUS
+ fi
+done
+
Added: trunk/build/kit-embedded/deploy/membership-file.properties
===================================================================
--- trunk/build/kit-embedded/deploy/membership-file.properties (rev 0)
+++ trunk/build/kit-embedded/deploy/membership-file.properties 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,11 @@
+#File based membership domain configuration properties
+
+#Location of the properties file containing user name and password entries.
+usersFile=users.properties
+
+#Location of the properties file containing group assignments
+groupsFile=groups.properties
+
+#Check passwords against the users file.
+checkPassword=true
+
Property changes on: trunk/build/kit-embedded/deploy/membership-file.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/kit-embedded/deploy/membership-ldap.properties
===================================================================
--- trunk/build/kit-embedded/deploy/membership-ldap.properties (rev 0)
+++ trunk/build/kit-embedded/deploy/membership-ldap.properties 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,49 @@
+# Configuration file for LDAP membership domain
+
+activate=true
+
+#Full LDAP URL (mandatory)
+ldapURL=
+
+#Bind account password for group lookup.
+ldapAdmin.password=
+
+#The attribute(s) that uniquely identifies a user.
+users.displayName.attribute = uid
+
+#The search filter(s) to apply to each users root context.
+users.searchFilter=(objectclass=*)
+
+#Specifies the context(s) to use when searching for users.(mandatory)
+users.rootContext=
+
+#Bind account DN for group lookup.
+ldapAdmin.dn=
+
+#Attribute(s) that appears on each user that identifies group membership.
+users.memberOf.attribute=
+
+#The attribute(s) that uniquely identifies a group.
+groups.displayName.attribute=
+
+#How far down the directory tree to search each users root context.
+users.searchScope=SUBTREE_SCOPE
+
+#Specifies the context(s) to use when searching for groups.(mandatory)
+groups.rootContext=
+
+# Membership Domain Class Name
+AuthDomainClass=com.metamatrix.platform.security.membership.spi.ldap.LDAPMembershipDomain
+
+#The search filter(s) to apply to each groups root context
+groups.searchFilter=(objectclass=*)
+
+#How far down the directory tree to search each groups root context.
+groups.searchScope=SUBTREE_SCOPE
+
+#Time to wait for LDAP operations to complete.
+txnTimeoutInMillis=
+
+#The attribute(s) that contains the members of the group.
+groups.groupMember.attribute=
+
Property changes on: trunk/build/kit-embedded/deploy/membership-ldap.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/build/kit-embedded/deploy.properties
===================================================================
--- trunk/build/kit-embedded/deploy.properties 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/build/kit-embedded/deploy.properties 2009-06-26 22:06:04 UTC (rev 1088)
@@ -2,6 +2,9 @@
# This is properties file used for bootstrap Teiid embedded for loading
#
+# name of the process that uniquely identifies this process( if ignored one will be assigned)
+processName=localhost
+
#Path to the Teiid Configuration file
dqp.configFile=./deploy/configuration.xml
@@ -76,4 +79,67 @@
#ResultSetCacheMaxAge=3600000
#Defines whether caching is restricted to a specific session ('session') or a specific VDB version ('vdb'). (default vdb)
-#ResultSetCacheScope=vdb
\ No newline at end of file
+#ResultSetCacheScope=vdb
+
+#
+# Session Service Settings
+#
+
+#Maximum number of sessions allowed by the system
+session.maxSessions=5000
+
+#Max allowed time before the session is timed out between two ping calls
+session.timeoutInMilli=1800000
+
+#
+# Membership Service Settings (handles the authentication of the user)
+#
+
+membership.enabled=true
+membership.superUser=admin
+membership.superUserPassword=teiid
+#Membership Domain Order (comma separated list of domains to authenticate user. ex: file, ldap)
+membership.DomainOrder=file
+#Allow connections only from specified hosts
+#membership.allowedHosts=
+
+# File Membership Domain Settings (activate, Membership Domain Class Name, Property file for configuration)
+file.activate=false
+file.AuthDomainClass=com.metamatrix.platform.security.membership.spi.file.FileMembershipDomain
+file.propertiesFile=./deploy/membership-file.properties
+
+# LDAP Membership Domain Settings (activate, Membership Domain Class Name, Property file for configuration)
+#ldap.activate=false
+#ldap.AuthDomainClass=com.metamatrix.platform.security.membership.spi.ldap.LDAPMembershipDomain
+#ldap.propertiesFile=./deploy/membership-ldap.properties
+
+#
+# Authorization Service Settings
+#
+
+# Enable entitlements (data, admin)
+entitlements.enabled=false
+
+
+#
+# Server Settings (Socket transport)
+#
+
+server.portNumber=31000
+server.bindAddress=localhost
+#server.maxSocketThreads=15
+#server.inputBufferSize=0
+#server.outputBufferSize=0
+
+
+# SSL Settings
+#ssl.enabled=true
+#ssl.protocol=SSLv3
+#ssl.authenticationMode=1-way
+#ssl.keymanagementalgorithm=
+#ssl.keystore.filename=teiid.keystore
+#ssl.keystore.Password=changeme
+#ssl.keystoretype=JKS
+#ssl.truststore.filename=teiid.truststore
+#ssl.truststore.Password=changeme
+#client.encryption.enabled=true
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/core/Admin.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/core/Admin.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/core/Admin.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,12 +22,20 @@
package com.metamatrix.admin.api.core;
+import com.metamatrix.admin.RolesAllowed;
+import com.metamatrix.admin.api.server.AdminRoles;
+
/**
* Marker interface for all MetaMatrix administration - core.
*
* @since 4.3
*/
public interface Admin extends CoreConfigAdmin, CoreMonitoringAdmin, CoreRuntimeStateAdmin, CoreSecurityAdmin {
-
+ /**
+ * Closes connection.
+ * @since 4.3
+ */
+ @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
+ void close();
}
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedConfigAdmin.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,13 +22,16 @@
package com.metamatrix.admin.api.embedded;
+import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.core.CoreConfigAdmin;
import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.server.AdminRoles;
/**
* @since 4.3
*/
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
public interface EmbeddedConfigAdmin extends CoreConfigAdmin {
/**
* Indicates that an extension module has changed
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedMonitoringAdmin.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedMonitoringAdmin.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedMonitoringAdmin.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,12 +22,15 @@
package com.metamatrix.admin.api.embedded;
+import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.core.CoreMonitoringAdmin;
+import com.metamatrix.admin.api.server.AdminRoles;
/**
* @since 4.3
*/
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
public interface EmbeddedMonitoringAdmin extends
CoreMonitoringAdmin {
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedRuntimeStateAdmin.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedRuntimeStateAdmin.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedRuntimeStateAdmin.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,14 +22,17 @@
package com.metamatrix.admin.api.embedded;
+import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.core.CoreRuntimeStateAdmin;
import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.server.AdminRoles;
/**
* @since 4.3
*/
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
public interface EmbeddedRuntimeStateAdmin extends CoreRuntimeStateAdmin {
/**
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedSecurityAdmin.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedSecurityAdmin.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/embedded/EmbeddedSecurityAdmin.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,12 +22,15 @@
package com.metamatrix.admin.api.embedded;
+import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.core.CoreSecurityAdmin;
+import com.metamatrix.admin.api.server.AdminRoles;
/**
* @since 4.3
*/
+(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
public interface EmbeddedSecurityAdmin extends
CoreSecurityAdmin {
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,6 +22,7 @@
package com.metamatrix.common.comm.api;
+import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.platform.security.api.LogonResult;
public interface ServerConnection {
@@ -36,4 +37,6 @@
LogonResult getLogonResult();
+ boolean isSameInstance(ServerConnection conn) throws CommunicationException;
+
}
\ No newline at end of file
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,8 +22,11 @@
package com.metamatrix.common.comm.api;
+import java.net.URL;
import java.util.Properties;
+import com.metamatrix.admin.api.core.Admin;
+import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
@@ -40,4 +43,12 @@
*/
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
+ */
+ public void shutdown();
+
}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -213,14 +213,12 @@
return createAdmin(p);
}
- public ServerAdmin createAdmin(Properties p)
- throws AdminComponentException, AdminException {
+ public ServerAdmin createAdmin(Properties p) {
p = PropertiesUtils.clone(p);
p.remove(MMURL.JDBC.VDB_NAME);
p.remove(MMURL.JDBC.VDB_VERSION);
p.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
- ServerAdmin serverAdmin = (ServerAdmin)Proxy.newProxyInstance(Thread.currentThread()
- .getContextClassLoader(), new Class[] { ServerAdmin.class }, new ReconnectingProxy(p));
+ ServerAdmin serverAdmin = (ServerAdmin)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] { ServerAdmin.class }, new ReconnectingProxy(p));
return serverAdmin;
}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -293,12 +293,15 @@
}
}
- public boolean isSameInstance(SocketServerConnection otherService) throws CommunicationException {
+ public boolean isSameInstance(ServerConnection otherService) throws CommunicationException {
+ if (!(otherService instanceof SocketServerConnection)) {
+ return false;
+ }
SocketAddress address = selectServerInstance().getRemoteAddress();
if (address == null) {
return false;
}
- return address.equals(otherService.selectServerInstance().getRemoteAddress());
+ return address.equals(((SocketServerConnection)otherService).selectServerInstance().getRemoteAddress());
}
public void selectNewServerInstance(Object service) {
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -29,24 +29,28 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.InetAddress;
+import java.net.URL;
import java.net.UnknownHostException;
+import java.sql.SQLException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Timer;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
+import com.metamatrix.admin.api.core.Admin;
+import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.common.api.HostInfo;
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.comm.api.ServerConnectionFactory;
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.comm.platform.client.ServerAdminFactory;
import com.metamatrix.common.util.NetUtils;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.MetaMatrixCoreException;
@@ -288,4 +292,15 @@
this.maxCachedInstances = maxCachedInstances;
}
+ @Override
+ public Admin getAdminAPI(Properties connectionProperties) throws AdminException {
+ ServerAdminFactory factory = ServerAdminFactory.getInstance();
+ return factory.createAdmin(connectionProperties);
+ }
+
+ @Override
+ public void shutdown() {
+ // only applies in the Embedded scenario.
+ }
+
}
Modified: trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -36,11 +36,24 @@
public static final String DQP_KEYSTORE = "dqp.keystore"; //$NON-NLS-1$
public static final String DQP_WORKDIR = "dqp.workdir"; //$NON-NLS-1$
public static final String DQP_LIBDIR = "dqp.lib"; //$NON-NLS-1$
+ public static final String PROCESSNAME = "processName"; //$NON-NLS-1$
+ public static final String CLUSTERNAME = "clusterName"; //$NON-NLS-1$
+
+ // socket specific
+ public static final String BIND_ADDRESS = "server.bindAddress"; //$NON-NLS-1$
+ public static final String SERVER_PORT = "server.portNumber"; //$NON-NLS-1$
+ public static final String MAX_THREADS = "server.maxSocketThreads"; //$NON-NLS-1$
+ public static final String INPUT_BUFFER_SIZE = "server.inputBufferSize"; //$NON-NLS-1$
+ public static final String OUTPUT_BUFFER_SIZE = "server.outputBufferSize"; //$NON-NLS-1$
//derived properties
public static final String DQP_IDENTITY = "dqp.identity"; //$NON-NLS-1$
public static final String DQP_TMPDIR = "mm.io.tmpdir"; //$NON-NLS-1$
public static final String DQP_WORKSPACE = "dqp.workspacedir"; //$NON-NLS-1$
+ public static final String BOOTURL = "bootURL"; //$NON-NLS-1$
+ public static final String ENABLE_SOCKETS = "sockets.enabled"; //$NON-NLS-1$
+ public static final String HOST_ADDRESS = "hostAddress"; //$NON-NLS-1$
+
public interface BufferService {
/**
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDriver.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDriver.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -82,8 +82,8 @@
return driverProps.toArray(propInfo);
}
- abstract List<DriverPropertyInfo> getAdditionalPropertyInfo(String url, Properties info);
+ protected abstract List<DriverPropertyInfo> getAdditionalPropertyInfo(String url, Properties info);
- abstract void parseURL(String url, Properties info) throws SQLException;
+ protected abstract void parseURL(String url, Properties info) throws SQLException;
}
\ No newline at end of file
Deleted: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactory.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,50 +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.jdbc;
-
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Properties;
-
-/**
- * A marker interface for creating connections Embedded DQP. The interface is
- * defined so that it can be used with DQP class loading.
- */
-public interface EmbeddedConnectionFactory {
-
- public void initialize(URL bootstrapURL, Properties props) throws SQLException;
-
- /**
- * Create a Connection to the DQP. This will load a DQP instance if one is not present
- * @param properties
- * @return Connection to DQP
- * @throws SQLException
- */
- public Connection createConnection(Properties properties) throws SQLException;
-
- /**
- * Shutdown the connection factory, including the DQP and all its existing connections
- */
- public void shutdown();
-}
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-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedDriver.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,7 +22,6 @@
package com.metamatrix.jdbc;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -44,6 +43,10 @@
import java.util.regex.Pattern;
import com.metamatrix.common.classloader.PostDelegatingClassLoader;
+import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.api.ServerConnectionFactory;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.protocol.MMURLConnection;
import com.metamatrix.common.protocol.MetaMatrixURLStreamHandlerFactory;
import com.metamatrix.common.protocol.URLHelper;
@@ -140,7 +143,7 @@
// now create the connection
EmbeddedTransport transport = getDQPTransport(dqpURL, info);
- Connection conn = transport.createConnection(info);
+ Connection conn = transport.createConnection(dqpURL, info);
return conn;
}
@@ -179,7 +182,7 @@
* @param The properties object which is to be updated with properties in the URL.
* @throws SQLException if the URL is not in the expected format.
*/
- void parseURL(String url, Properties info) throws SQLException {
+ protected void parseURL(String url, Properties info) throws SQLException {
if (url == null || url.trim().length() == 0) {
String logMsg = BaseDataSource.getResourceMessage("EmbeddedDriver.URL_must_be_specified"); //$NON-NLS-1$
throw new SQLException(logMsg);
@@ -279,7 +282,7 @@
}
@Override
- List<DriverPropertyInfo> getAdditionalPropertyInfo(String url,
+ protected List<DriverPropertyInfo> getAdditionalPropertyInfo(String url,
Properties info) {
return Collections.emptyList();
}
@@ -324,9 +327,8 @@
* @since 4.3
*/
static class EmbeddedTransport {
- private EmbeddedConnectionFactory connectionFactory;
+ private ServerConnectionFactory connectionFactory;
private ClassLoader classLoader;
- private String workspaceDirectory;
private URL url;
public EmbeddedTransport(URL dqpURL, Properties info) throws SQLException {
@@ -338,13 +340,7 @@
props.putAll(info);
props = PropertiesUtils.resolveNestedProperties(props);
-
- String dqpId = getDQPIdentity();
- props.setProperty(DQPEmbeddedProperties.DQP_IDENTITY, dqpId);
- // Create a temporary workspace directory
- this.workspaceDirectory = createWorkspace(props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR), dqpId);
- props.setProperty(DQPEmbeddedProperties.DQP_WORKSPACE, this.workspaceDirectory);
-
+
// a non-delegating class loader will be created from where all third party dependent jars can be loaded
ArrayList<URL> runtimeClasspathList = new ArrayList<URL>();
String libLocation = props.getProperty(DQPEmbeddedProperties.DQP_LIBDIR, "./lib/"); //$NON-NLS-1$
@@ -380,10 +376,9 @@
Thread.currentThread().setContextClassLoader(this.classLoader);
String className = "com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl"; //$NON-NLS-1$
Class<?> clazz = this.classLoader.loadClass(className);
- this.connectionFactory = (EmbeddedConnectionFactory)clazz.newInstance();
- this.connectionFactory.initialize(dqpURL, props);
+ this.connectionFactory = (ServerConnectionFactory)clazz.newInstance();
} catch (Exception e) {
- throw new EmbeddedSQLException(e);
+ throw MMSQLException.create(e);
} finally {
Thread.currentThread().setContextClassLoader(current);
}
@@ -439,7 +434,7 @@
return props;
}catch(IOException e) {
String logMsg = BaseDataSource.getResourceMessage("EmbeddedTransport.invalid_dqpproperties_path", new Object[] {dqpURL}); //$NON-NLS-1$
- throw new EmbeddedSQLException(e, logMsg);
+ throw MMSQLException.create(e, logMsg);
}finally {
if (in != null) {
try{in.close();}catch(IOException e) {}
@@ -451,15 +446,7 @@
* Shutdown the current transport
*/
void shutdown() {
- this.connectionFactory.shutdown();
-
- // remove any artifacts which are not cleaned-up
- if (this.workspaceDirectory != null) {
- File file = new File(this.workspaceDirectory);
- if (file.exists()) {
- delete(file);
- }
- }
+ this.connectionFactory.shutdown();
}
/**
@@ -468,80 +455,25 @@
* @param info
* @return Connection
*/
- Connection createConnection(Properties info) throws SQLException {
+ Connection createConnection(URL url, Properties info) throws SQLException {
ClassLoader current = null;
try {
current = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(classLoader);
- return connectionFactory.createConnection(info);
+ Thread.currentThread().setContextClassLoader(classLoader);
+ try {
+ info.setProperty(DQPEmbeddedProperties.BOOTURL, url.toExternalForm());
+ ServerConnection conn = connectionFactory.createConnection(info);
+ return new MMConnection(conn, info, url.toExternalForm(), connectionFactory);
+ } catch (CommunicationException e) {
+ throw MMSQLException.create(e);
+ } catch (ConnectionException e) {
+ throw MMSQLException.create(e);
+ }
} finally {
Thread.currentThread().setContextClassLoader(current);
}
}
- /**
- * Define an identifier for the DQP
- * @return a JVM level unique identifier
- */
- String getDQPIdentity() {
- synchronized (System.class) {
- String id = System.getProperty(DQPEmbeddedProperties.DQP_IDENTITY, "1"); //$NON-NLS-1$
- int identity = Integer.parseInt(id);
- System.setProperty(DQPEmbeddedProperties.DQP_IDENTITY, String.valueOf(identity + 1));
- id = String.valueOf(identity);
- return id;
- }
- }
-
- /**
- * Create the temporary workspace directory for the dqp
- * @param identity - identity of the dqp
- * @throws MMSQLException
- */
- String createWorkspace(String baseDir, String identity) throws MMSQLException {
- if (baseDir == null) {
- baseDir = System.getProperty("java.io.tmpdir")+"/teiid/"; //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- try {
- baseDir = URLHelper.buildURL(this.url, baseDir).getPath();
- } catch (MalformedURLException e) {
- throw MMSQLException.create(e);
- }
- }
- System.setProperty(DQPEmbeddedProperties.DQP_TMPDIR, baseDir + "/temp"); //$NON-NLS-1$S
-
- File f = new File(baseDir, identity);
-
- // If directory already exists then try to delete it; because we may have
- // failed to delete at end of last run (JVM holds lock on jar files)
- if (f.exists()) {
- delete(f);
- }
-
- // since we may have cleaned it up now , create the directory again
- if (!f.exists()) {
- f.mkdirs();
- }
- return f.getAbsolutePath();
- }
-
- /**
- * delete the any directory including sub-trees
- * @param file
- */
- private void delete(File file) {
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- delete(files[i]);
- } // for
- }
-
- // for saftey purpose only delete the jar files
- if (file.getName().endsWith(".jar")) { //$NON-NLS-1$
- file.delete();
- }
- }
}
}
Deleted: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedSQLException.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedSQLException.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/EmbeddedSQLException.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,103 +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.jdbc;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.sql.SQLException;
-
-
-/**
- * @since 4.3
- */
-public class EmbeddedSQLException extends SQLException {
- private Throwable parentException = null;
- private String message = null;
-
- public EmbeddedSQLException(Throwable e) {
- this.parentException = e;
- }
-
- public EmbeddedSQLException(Throwable e, String msg) {
- this.parentException = e;
- this.message = msg;
- }
-
- public EmbeddedSQLException(String msg) {
- this.message = msg;
- }
-
- /**
- * @see java.lang.Throwable#getMessage()
- * @since 4.3
- */
- public String getMessage() {
- if (message != null && parentException != null) {
- return message + " source:"+parentException.getMessage(); //$NON-NLS-1$
- }
- else if (message != null && parentException == null ){
- return message;
- }
- return parentException.getMessage();
- }
-
- /**
- * @see java.lang.Throwable#printStackTrace()
- * @since 4.3
- */
- public void printStackTrace() {
- if (parentException != null) {
- parentException.printStackTrace();
- }
- else {
- super.printStackTrace();
- }
- }
-
- /**
- * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
- * @since 4.3
- */
- public void printStackTrace(PrintStream s) {
- if (parentException != null) {
- parentException.printStackTrace(s);
- }
- else {
- super.printStackTrace(s);
- }
- }
-
- /**
- * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
- * @since 4.3
- */
- public void printStackTrace(PrintWriter s) {
- if (parentException != null) {
- parentException.printStackTrace(s);
- }
- else {
- super.printStackTrace(s);
- }
- }
-
-}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -57,9 +57,15 @@
import javax.transaction.xa.Xid;
+import org.teiid.jdbc.TeiidDriver;
+
+import com.metamatrix.admin.api.core.Admin;
+import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.api.ServerConnectionFactory;
import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
@@ -81,9 +87,13 @@
* methods in the class throw SQLException.</p>
*/
-public abstract class MMConnection extends WrapperImpl implements com.metamatrix.jdbc.api.Connection {
+public class MMConnection extends WrapperImpl implements com.metamatrix.jdbc.api.Connection {
private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
-
+
+ // constant value giving product name
+ private final static String SERVER_NAME = "Teiid Server"; //$NON-NLS-1$
+ private final static String EMBEDDED_NAME = "Teiid Embedded"; //$NON-NLS-1$
+
// Unique request ID generator
private long requestIDGenerator;
@@ -112,6 +122,9 @@
private boolean disableLocalTransactions = false;
private ClientSideDQP dqp;
protected ServerConnection serverConn;
+
+ private Admin admin;
+ ServerConnectionFactory connFactory = null;
/**
* <p>MMConnection constructor, tring to establish connection to metamatrix with
@@ -120,10 +133,12 @@
* @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) {
+ public MMConnection(ServerConnection serverConn, Properties info, String url, ServerConnectionFactory connFactory) {
this.serverConn = serverConn;
this.url = url;
- this.dqp = serverConn.getService(ClientSideDQP.class);
+ this.dqp = serverConn.getService(ClientSideDQP.class);
+ this.connFactory = connFactory;
+
// set default properties if not overridden
String overrideProp = info.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
if ( overrideProp == null || overrideProp.trim().length() == 0 ) {
@@ -223,7 +238,22 @@
String getUrl() {
return this.url;
}
-
+
+ /**
+ * @see com.metamatrix.jdbc.api.Connection#getAdminAPI()
+ * @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;
+ }
+
/**
* Connection identifier of this connection
* @return identifier
@@ -287,7 +317,12 @@
logger.fine(JDBCPlugin.Util.getString("MMConnection.Connection_close_success")); //$NON-NLS-1$
// set the status of the connection to closed
closed = true;
- }
+ }
+
+ if (admin != null) {
+ admin.close();
+ }
+
}
/**
@@ -507,7 +542,12 @@
* Get the database name that this connection is representing
* @return String name of the database
*/
- public abstract String getDatabaseName();
+ public String getDatabaseName() {
+ if (this.serverConn instanceof SocketServerConnection) {
+ return SERVER_NAME;
+ }
+ return EMBEDDED_NAME;
+ }
/**
* Retrieves the current holdability of ResultSet objects created using this Connection object.
@@ -908,12 +948,24 @@
} catch (SQLException e) {
logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$
}
+
+ //perform load balancing
+ if (this.serverConn instanceof SocketServerConnection) {
+ ((SocketServerConnection)this.serverConn).selectNewServerInstance(this.getDQP());
+ }
}
- public abstract BaseDriver getBaseDriver();
+ public BaseDriver getBaseDriver() {
+ if (this.serverConn instanceof SocketServerConnection) {
+ return new TeiidDriver();
+ }
+ return new EmbeddedDriver();
+ }
- public abstract boolean isSameProcess(MMConnection conn) throws CommunicationException;
-
+ public boolean isSameProcess(MMConnection conn) throws CommunicationException {
+ return this.serverConn.isSameInstance(conn.serverConn);
+ }
+
//## JDBC4.0-begin ##
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -137,13 +137,13 @@
return myConnection;
}
- MMServerConnection createMMConnection(String url, Properties info)
+ MMConnection createMMConnection(String url, Properties info)
throws ConnectionException, CommunicationException {
ServerConnection serverConn = SocketServerConnectionFactory.getInstance().createConnection(info);
// construct a MMConnection object.
- MMServerConnection connection = MMServerConnection.newInstance(serverConn, info, url);
+ MMConnection connection = new MMConnection(serverConn, info, url, SocketServerConnectionFactory.getInstance());
return connection;
}
@@ -157,7 +157,7 @@
* @param The properties object which is to be updated with properties in the URL.
* @throws SQLException if the URL is not in the expected format.
*/
- void parseURL(String url, Properties info) throws SQLException {
+ protected void parseURL(String url, Properties info) throws SQLException {
if(url == null) {
String msg = JDBCPlugin.Util.getString("MMDriver.urlFormat"); //$NON-NLS-1$
throw new MMSQLException(msg);
@@ -230,7 +230,7 @@
}
@Override
- List<DriverPropertyInfo> getAdditionalPropertyInfo(String url,
+ protected List<DriverPropertyInfo> getAdditionalPropertyInfo(String url,
Properties info) {
List<DriverPropertyInfo> dpis = new LinkedList<DriverPropertyInfo>();
DriverPropertyInfo dpi = new DriverPropertyInfo(MMURL.CONNECTION.SERVER_URL, info.getProperty(MMURL.CONNECTION.SERVER_URL));
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLException.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLException.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLException.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -197,11 +197,9 @@
if (childException instanceof MMSQLException) {
super.setNextException(ex);
break;
- } else {
- super.setNextException(new MMSQLException(childException, getMessage(childException, null),
- false));
- childException = childException.getNextException();
}
+ super.setNextException(new MMSQLException(childException, getMessage(childException, null),false));
+ childException = childException.getNextException();
}
}
}
@@ -210,7 +208,7 @@
* Constructor a MMSQLException object initialized with reason.
* @param reason String object which is the description of the exception.
*/
- MMSQLException(String reason) {
+ public MMSQLException(String reason) {
super(reason, SQLStates.DEFAULT);
}
Deleted: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,124 +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.jdbc;
-
-import java.sql.SQLException;
-import java.util.Properties;
-
-import com.metamatrix.admin.api.core.Admin;
-import com.metamatrix.admin.api.server.ServerAdmin;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.platform.client.ServerAdminFactory;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
-
-/**
- * @since 4.3
- */
-public class MMServerConnection extends MMConnection {
-
- // constant value giving product name
- private final static String SERVER_NAME = "Teiid Server"; //$NON-NLS-1$
-
- private ServerAdmin serverAdmin;
-
- /**
- * Factory Constructor
- * @param serverConn
- * @param info
- * @param url
- */
- public static MMServerConnection newInstance(ServerConnection serverConn, Properties info, String url) {
- return new MMServerConnection(serverConn, info, url);
- }
-
- /**
- * @param driver
- * @param serverConn
- * @param info
- * @param url
- * @param tracker
- * @since 4.3
- */
- public MMServerConnection(ServerConnection serverConn, Properties info, String url) {
- super(serverConn, info, url);
- }
-
- /**
- * @see com.metamatrix.jdbc.api.Connection#getAdminAPI()
- * @since 4.3
- */
- public synchronized Admin getAdminAPI() throws SQLException {
- try {
- if (serverAdmin == null) {
- ServerAdminFactory factory = ServerAdminFactory.getInstance();
- serverAdmin = factory.createAdmin(this.propInfo);
- }
- } catch(Exception e) {
- throw MMSQLException.create(e);
- }
- return serverAdmin;
- }
-
- /**
- * @see com.metamatrix.jdbc.MMConnection#close()
- * @since 4.3
- */
- public synchronized void close() throws SQLException {
- super.close();
- if (serverAdmin != null) {
- serverAdmin.close();
- }
- }
-
- /**
- * @see com.metamatrix.jdbc.MMConnection#getDatabaseName()
- */
- public String getDatabaseName() {
- return SERVER_NAME;
- }
-
- @Override
- public BaseDriver getBaseDriver() {
- return new MMDriver();
- }
-
- @Override
- public void recycleConnection() {
- super.recycleConnection();
- //perform load balancing
- if (this.serverConn instanceof SocketServerConnection) {
- ((SocketServerConnection)this.serverConn).selectNewServerInstance(this.getDQP());
- }
- }
-
- @Override
- public boolean isSameProcess(MMConnection conn) throws CommunicationException {
- if (conn instanceof MMServerConnection
- && this.serverConn instanceof SocketServerConnection
- && conn.serverConn instanceof SocketServerConnection) {
- return ((SocketServerConnection)this.serverConn).isSameInstance((SocketServerConnection)conn.serverConn);
- }
- return false;
- }
-}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -40,7 +40,8 @@
*/
public class MMJDBCURL {
private static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
- private static final String JDBC_PROTOCOL = "jdbc:metamatrix:"; //$NON-NLS-1$
+ private static final String JDBC_PROTOCOL = "jdbc:teiid:"; //$NON-NLS-1$
+ private static final String OLD_JDBC_PROTOCOL = "jdbc:metamatrix:"; //$NON-NLS-1$
private static final String[] KNOWN_PROPERTIES = {
BaseDataSource.APP_NAME,
@@ -134,13 +135,22 @@
}
private void parseJDBCProtocol(String protocol) {
- if (!protocol.startsWith(JDBC_PROTOCOL)) {
- throw new IllegalArgumentException();
- }
- if (protocol.length() == JDBC_PROTOCOL.length()) {
- throw new IllegalArgumentException();
- }
- vdbName = protocol.substring(JDBC_PROTOCOL.length());
+ if (protocol.startsWith(JDBC_PROTOCOL)) {
+ if (protocol.length() == JDBC_PROTOCOL.length()) {
+ throw new IllegalArgumentException();
+ }
+ vdbName = protocol.substring(JDBC_PROTOCOL.length());
+ }
+ else if (protocol.startsWith(OLD_JDBC_PROTOCOL)) {
+ if (protocol.length() == OLD_JDBC_PROTOCOL.length()) {
+ throw new IllegalArgumentException();
+ }
+ vdbName = protocol.substring(OLD_JDBC_PROTOCOL.length());
+ }
+ else {
+ throw new IllegalArgumentException();
+ }
+
}
private void parseConnectionPart(String connectionInfo) {
Added: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java (rev 0)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,490 @@
+/*
+ * 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.Connection;
+import java.util.Properties;
+
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.jdbc.BaseDataSource;
+import com.metamatrix.jdbc.JDBCPlugin;
+import com.metamatrix.jdbc.MMSQLException;
+import com.metamatrix.jdbc.util.MMJDBCURL;
+
+/**
+ * The MetaMatrix JDBC DataSource implementation class of {@link javax.sql.DataSource} and
+ * {@link javax.sql.XADataSource}.
+ * <p>
+ * The {@link javax.sql.DataSource} interface follows the JavaBean design pattern,
+ * meaning the implementation class has <i>properties</i> that are accessed with getter methods
+ * and set using setter methods, and where the getter and setter methods follow the JavaBean
+ * naming convention (e.g., <code>get</code><i>PropertyName</i><code>() : </code><i>PropertyType</i>
+ * and <code>set</code><i>PropertyName</i><code>(</code><i>PropertyType</i><code>) : void</code>).
+ * </p>
+ * The {@link javax.sql.XADataSource} interface is almost identical to the {@link javax.sql.DataSource}
+ * interface, but rather than returning {@link java.sql.Connection} instances, there are methods that
+ * return {@link javax.sql.XAConnection} instances that can be used with distributed transactions.
+ * <p>
+ * The following are the properties for this DataSource:
+ * <table cellspacing="0" cellpadding="0" border="1" width="100%">
+ * <tr><td><b>Property Name</b></td><td><b>Type</b></td><td><b>Description</b></td></tr>
+ * <tr><td>portNumber </td><td><code>int </code></td><td>The port number where a MetaMatrix Server is listening
+ * for requests.</td></tr>
+ * <tr><td>serverName </td><td><code>String</code></td><td>The hostname or IP address of the MetaMatrix Server.</td></tr>
+ * <table>
+ * </p>
+ */
+public class TeiidDataSource extends BaseDataSource {
+
+ /**
+ * The port number where a MetaMatrix Server is listening for requests.
+ * This property name is one of the standard property names defined by the JDBC 2.0 specification,
+ * and is <i>optional</i>.
+ */
+ private int portNumber;
+
+ /**
+ * The name of the host where the MetaMatrix Server is running.
+ * This property name is one of the standard property names defined by the JDBC 2.0 specification,
+ * and is <i>required</i>.
+ */
+ private String serverName;
+
+ /**
+ * Specify a set of data source credentials to pass to the connectors as defined in
+ * {@link MMURL.JDBC.CREDENTIALS}.
+ */
+ private String credentials;
+
+ /**
+ * Specify whether to make a secure (SSL, mms:) connection or a normal non-SSL mm: connection.
+ * the default is to use a non-secure connection.
+ * @since 5.0.2
+ */
+ private boolean secure = false;
+
+ /**
+ * Holds a comma delimited list of alternate MetaMatrix Server(s):Port(s) that can
+ * be used for connection fail-over.
+ * @since 5.5
+ */
+ private String alternateServers;
+
+ /**
+ * The auto failover mode for calls made to the query engine. If true query engine calls that fail will
+ * allow the connection to choose another process.
+ */
+ private String autoFailover;
+
+ private String discoveryStrategy;
+
+ /**
+ * Constructor for MMDataSource.
+ */
+ public TeiidDataSource() {
+ }
+
+ // --------------------------------------------------------------------------------------------
+ // H E L P E R M E T H O D S
+ // --------------------------------------------------------------------------------------------
+
+ protected Properties buildProperties(final String userName, final String password) {
+ Properties props = super.buildProperties(userName, password);
+
+ props.setProperty(MMURL.CONNECTION.SERVER_URL,this.buildServerURL());
+
+ if (this.getAutoFailover() != null) {
+ props.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, this.getAutoFailover());
+ }
+
+ if (this.getCredentials() != null) {
+ props.setProperty(MMURL.JDBC.CREDENTIALS, this.getCredentials());
+ }
+
+ if (this.getDiscoveryStrategy() != null) {
+ props.setProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, this.getDiscoveryStrategy());
+ }
+
+ return props;
+ }
+
+ protected String buildServerURL() {
+ if ( this.alternateServers == null ) {
+ // Format: "mm://server:port"
+ return new MMURL(this.serverName, this.portNumber, this.secure).getAppServerURL();
+ }
+
+ // Format: "mm://server1:port,server2:port,..."
+ String serverURL = ""; //$NON-NLS-1$
+
+ serverURL = "" + ( this.secure ? MMURL.SECURE_PROTOCOL : MMURL.DEFAULT_PROTOCOL ); //$NON-NLS-1$
+ serverURL += "" + this.serverName; //$NON-NLS-1$
+ if ( this.portNumber != 0 )
+ serverURL += MMURL.COLON_DELIMITER + this.portNumber;
+ if ( this.alternateServers.length() > 0 ) {
+ String[] as = this.alternateServers.split( MMURL.COMMA_DELIMITER);
+
+ for ( int i = 0; i < as.length; i++ ) {
+ String[] server = as[i].split( MMURL.COLON_DELIMITER );
+
+ if ( server.length > 0 ) {
+ serverURL += MMURL.COMMA_DELIMITER + server[0];
+ if ( server.length > 1 ) {
+ serverURL += MMURL.COLON_DELIMITER + server[1];
+ } else {
+ serverURL += MMURL.COLON_DELIMITER + this.portNumber;
+ }
+ }
+ }
+ }
+
+ return new MMURL(serverURL).getAppServerURL();
+ }
+
+ protected String buildURL() {
+ return new MMJDBCURL(this.getDatabaseName(), buildServerURL(), buildProperties(getUser(), getPassword())).getJDBCURL();
+ }
+
+ protected void validateProperties( final String userName, final String password) throws java.sql.SQLException {
+ super.validateProperties(userName, password);
+
+ String reason = reasonWhyInvalidPortNumber(this.portNumber);
+ if ( reason != null ) {
+ throw createConnectionError(reason);
+ }
+
+ reason = reasonWhyInvalidServerName(this.serverName);
+ if ( reason != null ) {
+ throw createConnectionError(reason);
+ }
+
+ reason = reasonWhyInvalidAlternateServers(this.alternateServers);
+ if ( reason != null) {
+ throw createConnectionError(reason);
+ }
+ }
+
+ private MMSQLException createConnectionError(String reason) {
+ String msg = JDBCPlugin.Util.getString("MMDataSource.Err_connecting", reason); //$NON-NLS-1$
+ return new MMSQLException(msg);
+ }
+
+ // --------------------------------------------------------------------------------------------
+ // D A T A S O U R C E M E T H O D S
+ // --------------------------------------------------------------------------------------------
+
+ /**
+ * Attempt to establish a database connection.
+ * @return a Connection to the database
+ * @throws java.sql.SQLException if a database-access error occurs
+ * @see javax.sql.DataSource#getConnection()
+ */
+ public Connection getConnection() throws java.sql.SQLException {
+ return getConnection(null,null);
+ }
+
+ /**
+ * Attempt to establish a database connection.
+ * @param userName the database user on whose behalf the Connection is being made
+ * @param password the user's password
+ * @return a Connection to the database
+ * @throws java.sql.SQLException if a database-access error occurs
+ * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
+ */
+ public Connection getConnection(String userName, String password) throws java.sql.SQLException {
+ try {
+ validateProperties(userName,password);
+ final Properties props = buildProperties(userName, password);
+ final TeiidDriver driver = new TeiidDriver();
+ return driver.createConnection(buildURL(), props);
+ } catch (MetaMatrixCoreException e) {
+ throw MMSQLException.create(e, e.getMessage());
+ }
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return buildURL().substring(16); // URL without the "jdbc:metamatrix:" at the front
+ }
+
+ // --------------------------------------------------------------------------------------------
+ // P R O P E R T Y M E T H O D S
+ // --------------------------------------------------------------------------------------------
+
+ /**
+ * Returns the port number.
+ * @return the port number
+ */
+ public int getPortNumber() {
+ return portNumber;
+ }
+
+ /**
+ * Returns the name of the MetaMatrix Server.
+ * @return the name of the MetaMatrix Server
+ */
+ public String getServerName() {
+ return serverName;
+ }
+
+ /**
+ * Returns the credentials string defining credentials to use with connectors for per-user logon.
+ * @since 4.3.2
+ */
+ public String getCredentials() {
+ return credentials;
+ }
+
+ /**
+ * Returns a flag indicating whether to create a secure connection or not.
+ * @return True if using secure mms: protocol, false for normal mm: protocol.
+ * @since 5.0.2
+ */
+ public boolean isSecure() {
+ return this.secure;
+ }
+
+ /**
+ * Returns a string containing a comma delimited list of alternate
+ * MetaMatrix Server(s).
+ *
+ * The list will be in the form of server2[:port2][,server3[:port3]]. If no
+ * alternate servers have been defined <code>null</code> is returned.
+ * @return A comma delimited list of server:port or <code>null</code> If
+ * no alternate servers are defined.
+ * @since 5.5
+ */
+ public String getAlternateServers() {
+ if ( this.alternateServers != null && this.alternateServers.length() < 1 )
+ return null;
+ return this.alternateServers;
+ }
+
+ /**
+ * Sets the portNumber.
+ * @param portNumber The portNumber to set
+ */
+ public void setPortNumber(final int portNumber) {
+ this.portNumber = portNumber;
+ }
+
+ /**
+ * Sets the serverName.
+ * @param serverName The serverName to set
+ */
+ public void setServerName(final String serverName) {
+ this.serverName = serverName;
+ }
+
+ /**
+ * Sets the credentials string defining credentials to use with connectors for per-user logon.
+ * @since 4.3.2
+ */
+ public void setCredentials(final String credentials) {
+ this.credentials = credentials;
+ }
+
+ /**
+ * Sets the secure flag to use mms: protocol instead of the default mm: protocol.
+ * @param secure True to use mms:
+ * @since 5.0.2
+ */
+ public void setSecure(final boolean secure) {
+ this.secure = secure;
+ }
+
+ /**
+ * Sets a list of alternate MetaMatrix Sserver(s) that can be used for
+ * connection fail-over.
+ *
+ * The form of the list should be server2[:port2][,server3:[port3][,...]].
+ *
+ * If ":port" is omitted, the port defined by <code>portNumber</code> is used.
+ *
+ * If <code>servers</code> is empty or <code>null</code>, the value of
+ * <code>alternateServers</code> is cleared.
+ * @param servers A comma delimited list of alternate MetaMatrix
+ * Server(s):Port(s) to use for connection fail-over. If blank or
+ * <code>null</code>, the list is cleared.
+ * @since 5.5
+ */
+ public void setAlternateServers(final String servers) {
+ this.alternateServers = servers;
+ if ( this.alternateServers != null && this.alternateServers.length() < 1 )
+ this.alternateServers = null;
+ }
+
+
+ // --------------------------------------------------------------------------------------------
+ // V A L I D A T I O N M E T H O D S
+ // --------------------------------------------------------------------------------------------
+
+ /**
+ * Return the reason why the supplied port number may be invalid, or null
+ * if it is considered valid.
+ * @param portNumber a possible value for the property
+ * @return the reason why the property is invalid, or null if it is considered valid
+ * @see #setPortNumber(int)
+ */
+ public static String reasonWhyInvalidPortNumber( final int portNumber) {
+ if ( portNumber == 0 ) {
+ return null; // default is always fine
+ }
+ if ( portNumber < 1 ) {
+ return JDBCPlugin.Util.getString("MMDataSource.Port_number_must_be_positive"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Return the reason why the supplied server name may be invalid, or null
+ * if it is considered valid.
+ * @param serverName a possible value for the property
+ * @return the reason why the property is invalid, or null if it is considered valid
+ * @see #setServerName(String)
+ * */
+ public static String reasonWhyInvalidServerName( final String serverName ) {
+ if ( serverName == null || serverName.trim().length() == 0 ) {
+ return JDBCPlugin.Util.getString("MMDataSource.Server_name_required"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * The reason why "socketsPerVM" is invalid.
+ * @param value of "socketsPerVM" property
+ * @return reason
+ */
+ public static String reasonWhyInvalidSocketsPerVM(final String socketsPerVM) {
+ if (socketsPerVM != null) {
+ int value = -1;
+ try {
+ value = Integer.parseInt(socketsPerVM);
+ } catch (Exception e) {
+ }
+
+ if (value <= 0) {
+ return JDBCPlugin.Util.getString("MMDataSource.Sockets_per_vm_invalid"); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * The reason why "stickyConnections" is invalid.
+ * @param value of "stickyConnections" property
+ * @return reason
+ */
+ public static String reasonWhyInvalidStickyConnections(final String stickyConnections) {
+ if (stickyConnections != null) {
+ if ((! stickyConnections.equalsIgnoreCase("true")) && //$NON-NLS-1$
+ (! stickyConnections.equalsIgnoreCase("false"))) { //$NON-NLS-1$
+ return JDBCPlugin.Util.getString("MMDataSource.Sticky_connections_invalid"); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+ /**
+ * The reason why "alternateServers" is invalid.
+ * @param value of "alternateServers" property
+ * @return reason
+ */
+ public static String reasonWhyInvalidAlternateServers(final String alternateServers) {
+ if ( alternateServers == null || alternateServers.trim().length() < 1 )
+ return null;
+
+ String[] as = alternateServers.split( MMURL.COMMA_DELIMITER);
+ String sReason = null;
+ String reason = ""; //$NON-NLS-1$
+ int reasonCount = 0;
+ final String newline = System.getProperty("line.separator"); //$NON-NLS-1$
+
+ for ( int i = 0; i < as.length; i++ ) {
+ String[] server = as[i].split( MMURL.COLON_DELIMITER );
+
+ if ( server.length < 1 || server.length > 2 ) {
+ // ie "server:31000:an invalid value"
+ // ie "server,server:31000"
+ return JDBCPlugin.Util.getString("MMDataSource.Alternate_Servers_format"); //$NON-NLS-1$
+ }
+
+ // check the server name portion
+ sReason = reasonWhyInvalidServerName(server[0] );
+ if ( sReason != null ) {
+ reason += (reason.length() > 0 ? newline : "" ) + sReason; //$NON-NLS-1$
+ reasonCount++;
+ sReason = null;
+ }
+
+ if ( server.length > 1 ) {
+ // check the port portion
+ int port = 0;
+ // parse the int from the string
+ try { port = Integer.parseInt(server[1]); }
+ catch ( NumberFormatException e ) {
+ // ie "server:invalid_port"
+ reason += (reason.length() > 0 ? newline : "" ) //$NON-NLS-1$
+ + JDBCPlugin.Util.getString("MMDataSource.serverPort_must_be_a_number"); //$NON-NLS-1$
+ reasonCount++;
+ }
+ sReason = reasonWhyInvalidPortNumber(port);
+ if ( sReason != null ) {
+ reason += (reason.length() > 0 ? newline : "" ) + sReason; //$NON-NLS-1$
+ reasonCount++;
+ sReason = null;
+ }
+ }
+ }
+ if ( reasonCount < 1 ) return null;
+ return JDBCPlugin.Util.getString("MMDataSource.alternateServer_is_invalid", String.valueOf(reasonCount), reason); //$NON-NLS-1$
+ }
+
+ /**
+ * @return Returns the transparentFailover.
+ */
+ public String getAutoFailover() {
+ return this.autoFailover;
+ }
+
+ /**
+ * @param transparentFailover The transparentFailover to set.
+ */
+ public void setAutoFailover(String autoFailover) {
+ this.autoFailover = autoFailover;
+ }
+
+ public String getDiscoveryStrategy() {
+ return discoveryStrategy;
+ }
+
+ public void setDiscoveryStrategy(String discoveryStrategy) {
+ this.discoveryStrategy = discoveryStrategy;
+ }
+
+}
+
Property changes on: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java (rev 0)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,251 @@
+/*
+ * 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.Connection;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
+import com.metamatrix.common.util.ApplicationInfo;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.jdbc.BaseDataSource;
+import com.metamatrix.jdbc.BaseDriver;
+import com.metamatrix.jdbc.JDBCPlugin;
+import com.metamatrix.jdbc.MMConnection;
+import com.metamatrix.jdbc.MMSQLException;
+import com.metamatrix.jdbc.api.ConnectionProperties;
+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
+ * 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>
+ */
+
+public final class TeiidDriver extends BaseDriver {
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
+
+ static final String DRIVER_NAME = "Teiid JDBC Driver"; //$NON-NLS-1$
+
+ /**
+ * Suports JDBC URLS of format
+ * - jdbc:teiid:BQT@mm://localhost:####;version=1
+ * - jdbc:teiid:BQT@mms://localhost:####;version=1
+ * - jdbc:teiid:BQT@mm(s)://host1:####,host2:####,host3:####;version=1
+ */
+
+ // This host/port pattern allows just a . or a - to be in the host part.
+ static final String HOST_PORT_PATTERN = "[\\p{Alnum}\\.\\-]+:\\d+"; //$NON-NLS-1$
+ static final String URL_PATTERN = "jdbc:(metamatrix|teiid):(\\w+)@((mm[s]?://"+HOST_PORT_PATTERN+"(,"+HOST_PORT_PATTERN+")*)[;]?){1}((.*)*)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ static Pattern urlPattern = Pattern.compile(URL_PATTERN);
+
+ private static TeiidDriver INSTANCE = new TeiidDriver();
+
+ // Static initializer
+ static {
+ try {
+ DriverManager.registerDriver(INSTANCE);
+ } catch(SQLException e) {
+ // Logging
+ String logMsg = JDBCPlugin.Util.getString("MMDriver.Err_registering", e.getMessage()); //$NON-NLS-1$
+ logger.log(Level.SEVERE, logMsg);
+ }
+ }
+
+ public static TeiidDriver getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Should be a singleton and only constructed in {@link #getInstance}.
+ */
+ public TeiidDriver() {
+ // this is not singleton, if you want singleton make this private.
+ }
+
+ /**
+ * This method tries to make a metamatrix connection to the given URL. This class
+ * will return a null if this is not the right driver to connect to the given URL.
+ * @param The URL used to establish a connection.
+ * @return Connection object created
+ * @throws SQLException if it is unable to establish a connection to the MetaMatrix server.
+ */
+ public Connection connect(String url, Properties info) throws SQLException {
+
+ MMConnection myConnection = null;
+ // create a properties obj if it is null
+ if(info == null) {
+ info = new Properties();
+ } else {
+ info = PropertiesUtils.clone(info);
+ }
+
+ // The url provided is in the correct format.
+ if (!acceptsURL(url)) {
+ return null;
+ }
+
+ try {
+ // parse the URL to add it's properties to properties object
+ parseURL(url, info);
+
+ myConnection = createConnection(url, info);
+ } catch (MetaMatrixCoreException e) {
+ logger.log(Level.SEVERE, "Could not create connection", e); //$NON-NLS-1$
+ throw MMSQLException.create(e, e.getMessage());
+ }
+
+ // logging
+ String logMsg = JDBCPlugin.Util.getString("JDBCDriver.Connection_sucess"); //$NON-NLS-1$
+ logger.fine(logMsg);
+
+ return myConnection;
+ }
+
+ MMConnection createConnection(String url, Properties info)
+ throws ConnectionException, CommunicationException {
+
+ ServerConnection serverConn = SocketServerConnectionFactory.getInstance().createConnection(info);
+
+ // construct a MMConnection object.
+ MMConnection connection = new MMConnection(serverConn, info, url, SocketServerConnectionFactory.getInstance());
+ return connection;
+ }
+
+ /**
+ * This method parses the URL and adds properties to the the properties object.
+ * These include required and any optional properties specified in the URL.
+ * Expected URL format -- jdbc:metamatrix:local:VDB@server:port;version=1;user=logon;
+ * password=pw;logFile=<logFile.log>;
+ * logLevel=<logLevel>;txnAutoWrap=<?>;credentials=mycredentials
+ * @param The URL needed to be parsed.
+ * @param The properties object which is to be updated with properties in the URL.
+ * @throws SQLException if the URL is not in the expected format.
+ */
+ protected void parseURL(String url, Properties info) throws SQLException {
+ if(url == null) {
+ String msg = JDBCPlugin.Util.getString("MMDriver.urlFormat"); //$NON-NLS-1$
+ throw new MMSQLException(msg);
+ }
+ try {
+ MMJDBCURL jdbcURL = new MMJDBCURL(url);
+ info.setProperty(BaseDataSource.VDB_NAME, jdbcURL.getVDBName());
+ info.setProperty(MMURL.CONNECTION.SERVER_URL, jdbcURL.getConnectionURL());
+ Properties optionalParams = jdbcURL.getProperties();
+ MMJDBCURL.normalizeProperties(info);
+ Enumeration keys = optionalParams.keys();
+ while (keys.hasMoreElements()) {
+ String propName = (String)keys.nextElement();
+ // Don't let the URL properties override the passed-in Properties object.
+ if (!info.containsKey(propName)) {
+ info.setProperty(propName, optionalParams.getProperty(propName));
+ }
+ }
+ // add the property only if it is new because they could have
+ // already been specified either through url or otherwise.
+ if(!info.containsKey(BaseDataSource.VDB_VERSION) && jdbcURL.getVDBVersion() != null) {
+ info.setProperty(BaseDataSource.VDB_VERSION, jdbcURL.getVDBVersion());
+ }
+ if(!info.containsKey(BaseDataSource.APP_NAME)) {
+ info.setProperty(BaseDataSource.APP_NAME, BaseDataSource.DEFAULT_APP_NAME);
+ }
+
+ } catch(IllegalArgumentException iae) {
+ throw new MMSQLException(JDBCPlugin.Util.getString("MMDriver.urlFormat")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns true if the driver thinks that it can open a connection to the given URL.
+ * Typically drivers will return true if they understand the subprotocol specified
+ * in the URL and false if they don't.
+ * Expected URL format is
+ * jdbc:metamatrix:subprotocol:VDB@server:port;version=1;logFile=<logFile.log>;logLevel=<logLevel>;txnAutoWrap=<?>
+ * @param The URL used to establish a connection.
+ * @return A boolean value indicating whether the driver understands the subprotocol.
+ * @throws SQLException, should never occur
+ */
+ public boolean acceptsURL(String url) throws SQLException {
+ Matcher m = urlPattern.matcher(url);
+ return m.matches();
+ }
+
+ /**
+ * Get's the driver's major version number. Initially this should be 1.
+ * @return major version number of the driver.
+ */
+ public int getMajorVersion() {
+ return ApplicationInfo.getInstance().getMajorReleaseVersion();
+ }
+
+ /**
+ * Get's the driver's minor version number. Initially this should be 0.
+ * @return major version number of the driver.
+ */
+ public int getMinorVersion() {
+ return ApplicationInfo.getInstance().getMinorReleaseVersion();
+ }
+
+ /**
+ * @see com.metamatrix.jdbc.BaseDriver#getDriverName()
+ * @since 4.3
+ */
+ public String getDriverName() {
+ return DRIVER_NAME;
+ }
+
+ @Override
+ protected List<DriverPropertyInfo> getAdditionalPropertyInfo(String url,
+ Properties info) {
+ List<DriverPropertyInfo> dpis = new LinkedList<DriverPropertyInfo>();
+ DriverPropertyInfo dpi = new DriverPropertyInfo(MMURL.CONNECTION.SERVER_URL, info.getProperty(MMURL.CONNECTION.SERVER_URL));
+ dpi.required = true;
+ dpis.add(dpi);
+ dpis.add(new DriverPropertyInfo(BaseDataSource.USER_NAME, info.getProperty(BaseDataSource.USER_NAME)));
+ dpis.add(new DriverPropertyInfo(BaseDataSource.PASSWORD, info.getProperty(BaseDataSource.PASSWORD)));
+ dpis.add(new DriverPropertyInfo(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD, info.getProperty(BaseDataSource.PASSWORD)));
+ return dpis;
+ }
+
+}
+
+
Property changes on: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDriver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMConnection.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -31,6 +31,7 @@
import junit.framework.TestCase;
import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.api.ServerConnectionFactory;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.platform.security.api.LogonResult;
import com.metamatrix.platform.security.api.MetaMatrixSessionID;
@@ -48,7 +49,7 @@
super(name);
}
- public static MMServerConnection getMMConnection() {
+ public static MMConnection getMMConnection() {
ServerConnection mock = mock(ServerConnection.class);
stub(mock.getService(ClientSideDQP.class)).toReturn(mock(ClientSideDQP.class));
Properties props = new Properties();
@@ -59,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 MMServerConnection(mock, props, serverUrl);
+ return new MMConnection(mock, props, serverUrl, mock(ServerConnectionFactory.class));
}
public void testGetMetaData() throws Exception {
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDataSource.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -515,7 +515,7 @@
final String partialMode = "true"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, 500, false, secure,
- "jdbc:metamatrix:vdbName@mm://hostname:7001;fetchSize=500;ApplicationName=JDBC;serverURL=mm://hostname:7001;VirtualDatabaseVersion=1.2.3;partialResultsMode=true;VirtualDatabaseName=vdbName"); //$NON-NLS-1$
+ "jdbc:teiid:vdbName@mm://hostname:7001;fetchSize=500;ApplicationName=JDBC;serverURL=mm://hostname:7001;VirtualDatabaseVersion=1.2.3;partialResultsMode=true;VirtualDatabaseName=vdbName"); //$NON-NLS-1$
}
public void testBuildingURL2() {
@@ -527,7 +527,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, -1, false, secure,
- "jdbc:metamatrix:vdbName@mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName"); //$NON-NLS-1$
+ "jdbc:teiid:vdbName@mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName"); //$NON-NLS-1$
}
public void testBuildURL3() {
@@ -539,7 +539,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, -1, true, secure,
- "jdbc:metamatrix:vdbName@mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
+ "jdbc:teiid:vdbName@mm://hostname:7001;ApplicationName=JDBC;serverURL=mm://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
}
// Test secure protocol
@@ -552,7 +552,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = true;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,null,transactionAutoWrap, partialMode, -1, true, secure,
- "jdbc:metamatrix:vdbName@mms://hostname:7001;ApplicationName=JDBC;serverURL=mms://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
+ "jdbc:teiid:vdbName@mms://hostname:7001;ApplicationName=JDBC;serverURL=mms://hostname:7001;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
}
/*
@@ -570,7 +570,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap, partialMode, -1, true, secure,
- "jdbc:metamatrix:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
+ "jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
}
/*
@@ -588,7 +588,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = true;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap, partialMode, -1, true, secure,
- "jdbc:metamatrix:vdbName@mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
+ "jdbc:teiid:vdbName@mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mms://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
}
/*
@@ -607,7 +607,7 @@
final String partialMode = "false"; //$NON-NLS-1$
final boolean secure = false;
helpTestBuildingURL(vdbName,vdbVersion,serverName,portNumber,alternateServers,transactionAutoWrap, partialMode, -1, true, secure,
- "jdbc:metamatrix:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
+ "jdbc:teiid:vdbName@mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;ApplicationName=JDBC;serverURL=mm://hostName:7001,hostName:7002,hostName2:7001,hostName2:7002;txnAutoWrap=PESSIMISTIC;partialResultsMode=false;VirtualDatabaseName=vdbName;sqlOptions=SHOWPLAN"); //$NON-NLS-1$
}
public void testBuildURL_AdditionalProperties() {
@@ -616,7 +616,7 @@
ds.setServerName("hostName"); //$NON-NLS-1$
ds.setDatabaseName("vdbName"); //$NON-NLS-1$
ds.setPortNumber(1);
- assertEquals("jdbc:metamatrix:vdbName@mm://hostname:1;fetchSize=2000;ApplicationName=JDBC;serverURL=mm://hostname:1;a=b;VirtualDatabaseName=vdbName;foo=bar", ds.buildURL()); //$NON-NLS-1$
+ assertEquals("jdbc:teiid:vdbName@mm://hostname:1;fetchSize=2000;ApplicationName=JDBC;serverURL=mm://hostname:1;a=b;VirtualDatabaseName=vdbName;foo=bar", ds.buildURL()); //$NON-NLS-1$
}
public void testInvalidDataSource() {
Modified: trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
===================================================================
--- trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -54,14 +54,14 @@
String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;configFile=testdata/bqt/dqp_stmt_e2e.xmi;disableLocalTxn=true;autoFailover=false"; //$NON-NLS-1$
Properties expectedProperties = new Properties();
- expectedProperties.setProperty("version", "1");
- expectedProperties.setProperty("user", "xyz");
- expectedProperties.setProperty("password", "***");
- expectedProperties.setProperty("logLevel", "1");
- expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi");
- expectedProperties.setProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS, "true");
- expectedProperties.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, "false");
- MMJDBCURL url = new MMJDBCURL(URL); //$NON-NLS-1$
+ expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("logLevel", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS, "true"); //$NON-NLS-1$
+ expectedProperties.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, "false"); //$NON-NLS-1$
+ MMJDBCURL url = new MMJDBCURL(URL);
assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
assertEquals(expectedProperties, url.getProperties());
@@ -224,14 +224,14 @@
public void testConstructor() {
MMJDBCURL url = new MMJDBCURL("myVDB", "mm://myhost:12345",null); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("jdbc:metamatrix:myVDB@mm://myhost:12345", url.getJDBCURL()); //$NON-NLS-1$
+ assertEquals("jdbc:teiid:myVDB@mm://myhost:12345", url.getJDBCURL()); //$NON-NLS-1$
Properties props = new Properties();
props.setProperty(BaseDataSource.USER_NAME, "myuser"); //$NON-NLS-1$
props.setProperty(BaseDataSource.PASSWORD, "mypassword"); //$NON-NLS-1$
props.put("ClieNTtOKeN", new Integer(1)); //$NON-NLS-1$
url = new MMJDBCURL("myVDB", "mm://myhost:12345", props); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("jdbc:metamatrix:myVDB@mm://myhost:12345;user=myuser;password=mypassword", url.getJDBCURL()); //$NON-NLS-1$
+ assertEquals("jdbc:teiid:myVDB@mm://myhost:12345;user=myuser;password=mypassword", url.getJDBCURL()); //$NON-NLS-1$
}
public void testConstructor_Exception() {
@@ -291,24 +291,6 @@
assertEquals(password, p.getProperty("password")); //$NON-NLS-1$
}
- public void testDriverManagerException() {
- //register the drivers -- MMDriver first to ensure it is not throwing an exception
- new MMDriver();
- new EmbeddedDriver();
-
- try {
- DriverManager.getConnection("jdbc:metamatrix:QT_Ora9DS@somefile"); //$NON-NLS-1$
- } catch (SQLException e) {
- assertEquals("This Path: mmfile:somefile used to locate mm.properties is invalid. Please check your file system and correct your JDBC URL. source:somefile", e.getMessage()); //$NON-NLS-1$
- }
-
- try {
- DriverManager.getConnection("jdbc:foo:QT_Ora9DS@mm://host:30000"); //$NON-NLS-1$
- } catch (SQLException e) {
- assertTrue(e.getMessage().startsWith("No suitable driver")); //$NON-NLS-1$
- }
-
- }
public void testGetServerURL_NoProperties() {
String result = new MMJDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
Added: trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,81 @@
+/*
+ * 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.util;
+
+import java.lang.management.ManagementFactory;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+
+import com.metamatrix.core.MetaMatrixCoreException;
+
+public class JMXUtil {
+ public enum MBeanType {SERVICE, SERVER, UTIL, ADMINAPI};
+
+ String processName;
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+
+ public JMXUtil(String processName) {
+ this.processName = processName;
+ }
+
+ public ObjectName buildName(MBeanType type, String name) throws FailedToRegisterException {
+ try {
+ return new ObjectName("Teiid["+processName+"]:type="+type+",name="+name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } catch (MalformedObjectNameException e) {
+ throw new FailedToRegisterException(e);
+ }
+ }
+
+ public void register(MBeanType type, String name, Object anObj) throws FailedToRegisterException {
+ try {
+ mbs.registerMBean(anObj, buildName(type, name));
+ } catch (InstanceAlreadyExistsException e) {
+ throw new FailedToRegisterException(e);
+ } catch (MBeanRegistrationException e) {
+ throw new FailedToRegisterException(e);
+ } catch (NotCompliantMBeanException e) {
+ throw new FailedToRegisterException(e);
+ }
+ }
+
+ public void unregister(MBeanType type, String name) throws FailedToRegisterException {
+ try {
+ mbs.unregisterMBean(buildName(type, name));
+ } catch (InstanceNotFoundException e) {
+ throw new FailedToRegisterException(e);
+ } catch (MBeanRegistrationException e) {
+ throw new FailedToRegisterException(e);
+ }
+ }
+
+ public static class FailedToRegisterException extends MetaMatrixCoreException{
+ public FailedToRegisterException(Throwable e) {
+ super(e);
+ }
+ }
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -129,9 +129,12 @@
Enumeration propNameEnum = props.propertyNames();
while ( propNameEnum.hasMoreElements() ) {
String name = (String) propNameEnum.nextElement();
- if ( name.startsWith(searchStr) || addAll ) {
- results.put(name, props.get(name));
+ if ( name.startsWith(searchStr)) {
+ results.put(name.substring(searchStr.length()), props.get(name));
}
+ else if (addAll) {
+ results.put(name, props.get(name));
+ }
}
return results;
@@ -444,12 +447,11 @@
}
}
- public static Properties loadFromURL(String url) throws MalformedURLException, IOException {
+ public static Properties loadFromURL(URL url) throws MalformedURLException, IOException {
Properties result = new Properties();
InputStream is = null;
try {
- URL file = URLHelper.buildURL(url);
- is = file.openStream();
+ is = url.openStream();
result.load(is);
} finally {
if (is != null) {
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,396 +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.config;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.Properties;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ComponentTypeID;
-import com.metamatrix.common.config.api.Configuration;
-import com.metamatrix.common.config.api.ConfigurationID;
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
-import com.metamatrix.common.config.api.Host;
-import com.metamatrix.common.config.api.HostID;
-import com.metamatrix.common.config.api.ResourceModel;
-import com.metamatrix.common.config.api.SharedResource;
-import com.metamatrix.common.config.api.VMComponentDefn;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.config.model.BasicHost;
-import com.metamatrix.common.config.reader.CurrentConfigurationReader;
-import com.metamatrix.common.config.reader.PropertiesConfigurationReader;
-import com.metamatrix.common.properties.UnmodifiableProperties;
-import com.metamatrix.common.util.ApplicationInfo;
-import com.metamatrix.common.util.ErrorMessageKeys;
-import com.metamatrix.common.util.NetUtils;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.ReflectionHelper;
-
-/**
- * <p>
- * This class represents a single and universal framework for accessing
- * the current configuration for an application or server VM. The current
- * configuration contains the specification of runtime properties and
- * component deployment information. Depending upon the bootstrap information,
- * this framework may access the configuration information from a central
- * repository or simply from a local file.
- * </p>
- * <p>
- * This framework can be configured to periodically refresh the cached
- * configuation information, and a separate thread is used to do this in
- * the background. As such, the static <code>shutdown()</code> method
- * should be called by applications when exiting. This method will block until
- * this framework has successfully shutdown and cleaned up all resources,
- * and will return gracefully if the method were already called.
- * Note, however, that any call to this framework to obtain configuration
- * information will restart the framework, requiring another eventual
- * shutdown.
- * </p>
- */
-public final class CurrentConfiguration {
- /*
- * This property enables the overriding of the default {@link BOOTSTRAP_FILE_NAME}
- */
- public static final String BOOTSTRAP_FILE_PROPERTY_OVERRIDE = "teiid.bootstrap.file"; //$NON-NLS-1$
-
- public static final String BOOTSTRAP_FILE_NAME = "teiid.properties"; //$NON-NLS-1$
- public static final String CONFIGURATION_READER_CLASS_PROPERTY_NAME = "metamatrix.config.reader"; //$NON-NLS-1$
- public static final String CLUSTER_NAME = "cluster.name"; //$NON-NLS-1$
- public static final String CONFIGURATION_NAME= "configuration.name"; //$NON-NLS-1$
- public static final String CLUSTER_MEMBERS = "cluster.unicast.members"; //$NON-NLS-1$
-
- private CurrentConfigurationReader reader;
- private Properties bootstrapProperties;
- private Properties modifyableBootstrapProperties;
- private Properties systemBootstrapProperties;
- private String bindAddress;
- private InetAddress hostAddress;
- private String configurationName;
- private String processName;
-
- private static CurrentConfiguration INSTANCE = new CurrentConfiguration();
-
- public static CurrentConfiguration getInstance() {
- return INSTANCE;
- }
-
- /**
- * Private constructor that prevents instantiation.
- */
- private CurrentConfiguration() {
- setHostProperties(null);
- }
-
- private void setHostProperties(String bind) {
- Host host = getDefaultHost();
- this.configurationName = host.getFullName();
- String hostName = host.getHostAddress();
- if (bind == null) {
- bind = host.getBindAddress();
- }
-
- boolean bindAddressDefined = (bind != null && bind.length() > 0);
- boolean hostNameDefined = (hostName != null && hostName.length() > 0);
-
- try {
- if (hostNameDefined) {
- this.hostAddress = NetUtils.resolveHostByName(hostName);
- }
-
- if (bindAddressDefined) {
- this.bindAddress = bind;
-
- if (!hostNameDefined) {
- this.hostAddress = InetAddress.getByName(bindAddress);
- }
- }
- else {
- if (!hostNameDefined) {
- this.hostAddress = NetUtils.getInstance().getInetAddress();
- }
- this.bindAddress = this.hostAddress.getHostAddress();
- }
- } catch (UnknownHostException e) {
- throw new RuntimeException(e);
- }
-
- // these properties will be used to identify the server in TCP based cluster setup.
- String unicastMembers = bootstrapProperties.getProperty(CLUSTER_MEMBERS);
- if (unicastMembers == null) {
- unicastMembers = this.configurationName+"|"+this.hostAddress.getCanonicalHostName(); //$NON-NLS-1$
- }
- else {
- unicastMembers = unicastMembers+","+this.configurationName+"|"+this.hostAddress.getCanonicalHostName(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- modifyableBootstrapProperties.setProperty(CLUSTER_MEMBERS, unicastMembers);
- }
-
- public boolean isAvailable() {
- return this.reader != null;
- }
-
- /**
- * Return the stringified representation of this application information object.
- * @return the string form of this object; never null
- */
- public String getHostInfo() {
- StringBuffer sb = new StringBuffer("Host Information"); //$NON-NLS-1$
- sb.append('\n');
- sb.append(" VM Name: " + processName ); //$NON-NLS-1$
- sb.append('\n');
- sb.append(" Hostname: " + hostAddress.getCanonicalHostName() ); //$NON-NLS-1$
- sb.append('\n');
- sb.append(" Version: ").append(ApplicationInfo.getInstance().getReleaseNumber()); //$NON-NLS-1$
- sb.append('\n');
- sb.append(" Build Date: ").append(ApplicationInfo.getInstance().getBuildDate()); //$NON-NLS-1$
- return sb.toString();
- }
-
- public void setProcessName(String name) {
- VMComponentDefn deployedVM;
- try {
- deployedVM = getConfiguration().getVMForHost(getDefaultHost().getName(), name);
- } catch (ConfigurationException e) {
- throw new MetaMatrixRuntimeException(e);
- }
-
- if (deployedVM == null) {
- throw new MetaMatrixRuntimeException(CommonPlugin.Util.getString("CurrentConfiguration.unknown_process", name)); //$NON-NLS-1$
- }
- this.processName = name;
- setHostProperties(deployedVM.getBindAddress());
- }
-
- public String getBindAddress() {
- return bindAddress;
- }
-
- public InetAddress getHostAddress() {
- return hostAddress;
- }
-
- public String getConfigurationName() {
- return configurationName;
- }
-
- public String getProcessName() {
- return processName;
- }
-
- public String getClusterName() throws ConfigurationException {
- Properties props = getResourceProperties(ResourceNames.JGROUPS);
- return props.getProperty(CLUSTER_NAME, "Teiid-Cluster"); //$NON-NLS-1$
- }
-
- /**
- * Get all of the configuration properties. The properties
- * that are returned have default properties that are the bootstrap properties.
- * @return the immutable properties; never null
- * @throws ConfigurationException if the current configuration and/or
- * bootstrap properties could not be obtained
- */
- public Properties getProperties() {
- try {
- ConfigurationModelContainer cmc = getReader().getConfigurationModel();
- ComponentTypeID id = cmc.getConfiguration().getComponentTypeID();
- Properties result = new Properties(getBootStrapProperties());
- PropertiesUtils.putAll(result, cmc.getDefaultPropertyValues(id));
- PropertiesUtils.putAll(result, cmc.getConfiguration().getProperties());
- return new UnmodifiableProperties(result);
- } catch (ConfigurationException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- }
-
- /**
- * Get the connection properties for the specified resource. The resourse name
- * is dependent on the type of resource. For services, excluding connectors,
- * the resource name will be the component type name {@link com.metamatrix.common.config.api.ComponentType}.
- * For other types, they will generally have a predefined static variable
- * called RESOURCE_NAME that will be used to ask for its properties.
- * @param resourceName is the name of the resource to obtain properties for.
- * @return the immutable properties; never null
- * @throws ConfigurationException if the current configuration and/or
- * bootstrap properties could not be obtained
- */
- public Properties getResourceProperties(String resourceName) throws ConfigurationException {
- Properties result;
-
- SharedResource sr = getReader().getConfigurationModel().getResource(resourceName);
-
- Properties props;
- if (sr != null) {
- props = ResourceModel.getDefaultProperties(resourceName);
- props.putAll(sr.getProperties());
- } else {
- props = new Properties();
-
- }
-
- // allow the system properties to override
- PropertiesUtils.setOverrideProperies(props, getSystemBootStrapProperties());
-
- result = new UnmodifiableProperties(props);
-
- return result;
- }
-
- /**
- * Get the current configuration that is to be used for deployment.
- * @return the Configuration used for deployment
- * @throws ConfigurationException if the current configuration could not be obtained
- */
- public Configuration getConfiguration() throws ConfigurationException {
- Configuration config = getReader().getConfigurationModel().getConfiguration();
- if ( config == null ) {
- throw new ConfigurationException(ErrorMessageKeys.CONFIG_ERR_0021, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0021));
- }
- return config;
- }
-
-
- /**
- * Get the current configuration that is to be used for deployment.
- * @return the Configuration used for deployment
- * @throws ConfigurationException if the current configuration could not be obtained
- */
- public ConfigurationModelContainer getConfigurationModel() throws ConfigurationException {
- ConfigurationModelContainer config = null;
- try {
- config = getReader().getConfigurationModel();
- } catch (UnsupportedOperationException e) {
- }
-
- if (config == null) {
- throw new ConfigurationException(ErrorMessageKeys.CONFIG_ERR_0022,
- CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0022));
- }
-
- return config;
- }
-
- /**
- * Returns a <code>Collection</code> of type <code>ComponentType</code> that represent
- * all the ComponentTypes defined.
- * @param includeDeprecated true if class names that have been deprecated should be
- * included in the returned list, or false if only non-deprecated constants should be returned.
- * @return List of type <code>ComponentType</code>
- * @throws ConfigurationException if an error occurred within or during communication with the Configuration Service.
- * @see com.metamatrix.common.api.ComponentType
- */
- public Collection<ComponentType> getComponentTypes(boolean includeDeprecated) throws ConfigurationException {
- return getReader().getConfigurationModel().getComponentTypes().values();
- }
-
-
- /**
- * Returns the Host based on the current running machine.
- * @return the full Host object
- * @throws ConfigurationException if an error occurred within or during
- * communication with the Configuration Service, or if there is no object
- * for the given ID.
- */
- public Host getDefaultHost() {
- String name = getBootStrapProperties().getProperty(CONFIGURATION_NAME, "embedded"); //$NON-NLS-1$
- BasicHost host = new BasicHost(new ConfigurationID(name), new HostID(name), Host.HOST_COMPONENT_TYPE_ID);
-
- Properties props = new Properties();
- props.setProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR, System.getProperty("user.dir"))); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS, "")); //$NON-NLS-1$
- props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS, "")); //$NON-NLS-1$
-
- host.setProperties(props);
- return host;
- }
-
-
- /**
- * Reset causes not just a refresh, but the bootstrapping process
- * to occur again.
- */
- public static void reset() {
- INSTANCE = new CurrentConfiguration();
- }
-
- public synchronized Properties getBootStrapProperties() {
- if (bootstrapProperties == null) {
- Properties systemBootStrapProps = getSystemBootStrapProperties();
- Properties bootstrapProps = new Properties(systemBootStrapProps);
- InputStream bootstrapPropStream = null;
-
- String bootstrapfile = systemBootStrapProps.getProperty(BOOTSTRAP_FILE_PROPERTY_OVERRIDE, BOOTSTRAP_FILE_NAME);
- try {
- bootstrapPropStream = this.getClass().getClassLoader().getResourceAsStream(bootstrapfile);
- if (bootstrapPropStream != null) {
- bootstrapProps.load(bootstrapPropStream);
- }
- } catch (IOException e) {
- throw new MetaMatrixRuntimeException(ErrorMessageKeys.CONFIG_ERR_0069, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0069, BOOTSTRAP_FILE_NAME));
- } finally {
- try {
- if (bootstrapPropStream != null) {
- bootstrapPropStream.close();
- }
- } catch (IOException e ) {
- }
- }
- modifyableBootstrapProperties = bootstrapProps;
- bootstrapProperties = new UnmodifiableProperties(bootstrapProps);
- }
- return bootstrapProperties;
- }
-
- public synchronized final Properties getSystemBootStrapProperties() {
- if (systemBootstrapProperties == null) {
- systemBootstrapProperties = new UnmodifiableProperties(System.getProperties());
- }
- return systemBootstrapProperties;
- }
-
- synchronized CurrentConfigurationReader getReader() throws ConfigurationException {
- if (reader == null) {
- // Get the default bootstrap properties from the System properties ...
- Properties bootstrap = getBootStrapProperties();
-
- String readerClassName = bootstrap.getProperty( CONFIGURATION_READER_CLASS_PROPERTY_NAME, PropertiesConfigurationReader.class.getName() );
-
- try {
- reader = (CurrentConfigurationReader)ReflectionHelper.create(readerClassName, null, Thread.currentThread().getContextClassLoader());
- } catch (Exception e) {
- throw new ConfigurationException(e);
- }
- }
-
- return reader;
- }
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/config/ResourceNames.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/ResourceNames.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/ResourceNames.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,43 +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.config;
-
-/**
-* ResourceNames defines the different resources that require
-* connection properties. These properties are loaded up by
-* the {@link CurrentConfiguration} and made available by calling
-* the method {@link #getResourceProperties}. The following
-* are the basis for the names:
-* - CompTypes, excluding connectors (e.g., Config Service, Session Service, etc).
-* - internal operations (e.g., Runtime Metadata, logging, cursors, etc.)
-*/
-public interface ResourceNames {
-
-
- public static final String RUNTIME_METADATA_SERVICE = "RuntimeMetadataService"; //$NON-NLS-1$
- public static final String MEMBERSHIP_SERVICE = "MembershipService"; //$NON-NLS-1$
- public static final String XA_TRANSACTION_MANAGER = "XATransactionManager"; //$NON-NLS-1$
- public static final String INDEXING_SERVICE = "IndexingService"; //$NON-NLS-1$
- public static final String JGROUPS = "JGroups"; //$NON-NLS-1$
- public static final String SSL = "SSL"; //$NON-NLS-1$
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,123 +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.config.model;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.ComponentDefn;
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ComponentTypeDefn;
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.object.PropertyDefinition;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.common.util.crypto.CryptoException;
-import com.metamatrix.common.util.crypto.CryptoUtil;
-import com.metamatrix.core.util.Assertion;
-
-
-/**
- * Utilities for encrypting and decrypting properties of configuration ComponentDefns
- * @since 4.3
- */
-public class ComponentCryptoUtil {
-
-
- /**
- * Check whether the encrypted properties for the specified ComponentDefn can be decrypted.
- * @param defn The ComponentDefn to check.
- * @param componentTypeDefns Collection<ComponentTypeDefn> The ComponentTypeDefns containing the
- * PropertyDefinitions for the specified ComponentDefn.
- * @return true if the properties could be decrypted for that defn.
- * @since 4.3
- */
- public static boolean checkPropertiesDecryptable(ComponentDefn defn, Collection componentTypeDefns) {
- boolean result = true;
-
- try {
- decryptProperties(defn, componentTypeDefns);
- } catch (CryptoException e) {
- result = false;
- }
-
- return result;
- }
-
- /**
- * Bails on the first masked property name that's contained in props but the value
- * can't be decrypted. All masked properties that exist in props must be decryptable.
- * @param props
- * @param componentTypeIdentifier
- * @return
- * @since 4.3
- */
- public static boolean checkPropertiesDecryptable(Properties props,
- Collection maskedPropertyNames) {
- if (maskedPropertyNames != null) {
- Iterator propItr = maskedPropertyNames.iterator();
- while (propItr.hasNext()) {
- String maskedPropName = (String)propItr.next();
- String maskedValue = null;
- if (props != null) {
- maskedValue = props.getProperty(maskedPropName);
- }
- if (maskedValue != null && !CryptoUtil.canDecrypt(maskedValue)) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- public static Properties getDecryptedProperties(ComponentDefn defn) throws ConfigurationException, CryptoException {
- ConfigurationModelContainer configModel = CurrentConfiguration.getInstance().getConfigurationModel();
-
- ComponentType componentType = configModel.getComponentType(defn.getComponentTypeID().getName());
- Assertion.isNotNull(componentType, "unknown component type"); //$NON-NLS-1$
-
- Collection compTypeDefns = componentType.getComponentTypeDefinitions();
- return decryptProperties(defn, compTypeDefns);
- }
-
- private static Properties decryptProperties(ComponentDefn defn,
- Collection compTypeDefns) throws CryptoException {
- Properties result = PropertiesUtils.clone(defn.getProperties(), false);
- for ( Iterator compTypeDefnItr = compTypeDefns.iterator(); compTypeDefnItr.hasNext(); ) {
- ComponentTypeDefn typeDefn = (ComponentTypeDefn) compTypeDefnItr.next();
- PropertyDefinition propDefn = typeDefn.getPropertyDefinition();
- String propName = propDefn.getName();
- String propValue = result.getProperty(propName);
- if ( propValue != null && propDefn.isMasked() ) {
- propValue = CryptoUtil.getDecryptor().decrypt(propValue);
- result.setProperty(propName, propValue);
- }
- }
-
- return result;
- }
-
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,140 +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.config.model;
-
-import java.util.Iterator;
-import java.util.List;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.core.util.StringUtil;
-
-
-
-
-/**
- * @since 4.3
- */
-public class PropertyValidations {
-
-
-
- public static final String UDP_MCAST_ADDR_PROPERTY = "udp.mcast_addr"; //$NON-NLS-1$
- public static final String SYSTEM_NAME = CurrentConfiguration.CLUSTER_NAME;
-
- private static final String MULTICAST_PORT_FORMAT = "224.255.255.255"; //$NON-NLS-1$
-
-
- /**
- * @see com.metamatrix.common.util.commandline.IPropertyValidation#isPropertyValid(java.lang.String, java.lang.String)
- * @since 4.3
- */
- public void isPropertyValid(String key,
- String value) throws ConfigurationException {
-
- if (key == null) {
- return;
- }
- if (key.equalsIgnoreCase(UDP_MCAST_ADDR_PROPERTY)) {
- validate_multicast_port(key, value);
- }
-
- if (key.equalsIgnoreCase(SYSTEM_NAME)) {
- validate_nonnull_and_contiguous("System Name", key, value);//$NON-NLS-1$
- }
- }
-
- protected void validate_multicast_port(String key, String value) throws ConfigurationException {
- if (value == null || value.trim().length() == 0) {
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_format", new Object[] {"MulticastPort", "Null", MULTICAST_PORT_FORMAT} )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- List parts = StringUtil.getTokens(value, "."); //$NON-NLS-1$
- // the port must have 4 parts
- if (parts.size() != 4) {
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_format", new Object[] {"MulticastPort", value, MULTICAST_PORT_FORMAT} )); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- validate_nonnull_and_contiguous("MulticastPort", key, value); //$NON-NLS-1$
-
- // verify each part is numeric
- for (Iterator it=parts.iterator(); it.hasNext();) {
- String part = (String) it.next();
- if (isInvalidNumeric(part )) {
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_numeric_value", new Object[] {part, ", must be between 0 and 255"} )); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- validate_port_range(key, part, 0, 255);
- }
-
-
- }
-
- protected void validate_port_range(String key, String value, int start, int end) throws ConfigurationException {
- if (value == null || value.trim().length() == 0) {
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_format", new Object[] {key, "Null", "Range " + start + " and " + end } )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- Long nbr = null;
- try {
- nbr = new Long(value);
- } catch (NumberFormatException nfe) {
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_numeric_value", new Object[] {key, ", must be between " + start + " and " + end} )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- if (nbr.longValue() >= start && nbr.longValue() <= end) {
-
- }else {
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_numeric_value", new Object[] {key, ", must be between " + start + " and " + end} )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
-
- }
-
- protected void validate_nonnull_and_contiguous(String display, String key, String value) throws ConfigurationException {
- if (value == null || value.trim().length() == 0) {
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_contiguous_value", new Object[] {display} )); //$NON-NLS-1$
- }
-
- if (value.indexOf(" ") > 0) { //$NON-NLS-1$
- throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_contiguous_value", new Object[] {display} )); //$NON-NLS-1$
- }
-
- }
-
- protected void throwException(String msg) throws ConfigurationException {
- throw new ConfigurationException(msg);
-
- }
-
- protected boolean isInvalidNumeric(String value) {
- try {
- new Long(value);
- return false;
- } catch (NumberFormatException nfe) {
- return true;
- }
- }
-
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,57 +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.config.reader;
-
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-
-/**
- * <p>
- * This interface defines a self-contained reader for the current configuration,
- * and should be used <i>only</i> by the {@link com.metamatrix.common.config.CurrentConfiguration CurrentConfiguration}
- * framework. As such, this is an extremely low-level implementation that may
- * <i>not</i> use anything but <code>com.metamatrix.common.util</code> components
- * and only components that do not use {@link com.metamatrix.common.logging.LogManager LogManager}.
- * </p>
- * <p>
- * Each class that implements this interface must supply a no-arg constructor.
- * </p>
- */
-public interface CurrentConfigurationReader {
-
- // ------------------------------------------------------------------------------------
- // C O N F I G U R A T I O N I N F O R M A T I O N
- // ------------------------------------------------------------------------------------
-
- /**
- * Obtain the next startup configuration model. The implementation
- * may <i>not</i> use logging but instead should rely upon returning
- * an exception in the case of any errors.
- * @return the serializable Configuration instance
- * @throws ConfigurationException if an error occurred within or during
- * communication with the repository.
- */
- ConfigurationModelContainer getConfigurationModel() throws ConfigurationException;
-
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,124 +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.config.reader;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.Configuration;
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
-import com.metamatrix.common.config.api.ConfigurationObjectEditor;
-import com.metamatrix.common.config.api.exceptions.ConfigurationConnectionException;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.config.model.BasicConfigurationObjectEditor;
-import com.metamatrix.common.config.model.ConfigurationModelContainerImpl;
-import com.metamatrix.common.util.ErrorMessageKeys;
-
-/**
- * <p>
- * This class implements a self-contained reader for the current configuration,
- * and should be used <i>only</i> by the {@link com.metamatrix.common.config.CurrentConfiguration CurrentConfiguration}
- * framework. As such, this is an extremely low-level implementation that may
- * <i>not</i> use anything but <code>com.metamatrix.common.util</code> components
- * and only components that do not use {@link com.metamatrix.common.logging.LogManager LogManager}.
- * </p>
- * <p>
- * Each class that implements this interface must supply a no-arg constructor.
- * </p>
- */
-public class PropertiesConfigurationReader implements CurrentConfigurationReader {
-
- private ConfigurationModelContainer c;
-
- /**
- * The environment property name for the property file that contains the configuration.
- */
- public static final String FILENAME = "metamatrix.config.readerFile"; //$NON-NLS-1$
-
- /**
- * Default, no-arg constructor
- * @throws ConfigurationException
- * @throws ConfigurationConnectionException
- */
- public PropertiesConfigurationReader() throws ConfigurationConnectionException, ConfigurationException{
- Properties env = CurrentConfiguration.getInstance().getBootStrapProperties();
- String filename = env.getProperty(FILENAME);
- Properties p = null;
- if (filename != null) {
- File f = new File(filename);
- InputStream is = null;
- try {
- if (f.exists()) {
- is = new FileInputStream(f);
- } else {
- is = this.getClass().getResourceAsStream(filename);
- }
- if (is == null) {
- throw new ConfigurationConnectionException(ErrorMessageKeys.CONFIG_ERR_0064, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0064, filename));
- }
- p = new Properties(env);
- p.load(is);
- } catch (IOException e) {
- throw new ConfigurationConnectionException(e);
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
- }
- } else {
- p = env;
- }
-
- // Use the properties from the file to create a new Configuration object ...
- ConfigurationObjectEditor coe = new BasicConfigurationObjectEditor(false);
- Configuration currentConfiguration = coe.createConfiguration(PropertiesConfigurationReader.class.getSimpleName() + ':' + filename);
- currentConfiguration = (Configuration)coe.modifyProperties(currentConfiguration, p, ConfigurationObjectEditor.SET);
- c = new ConfigurationModelContainerImpl(currentConfiguration);
- }
-
- // ------------------------------------------------------------------------------------
- // C O N F I G U R A T I O N I N F O R M A T I O N
- // ------------------------------------------------------------------------------------
-
- /**
- * Obtain the next startup configuration model. The implementation
- * may <i>not</i> use logging but instead should rely upon returning
- * an exception in the case of any errors.
- * @return the serializable Configuration instance
- * @throws ConfigurationException if an error occurred within or during
- * communication with the repository.
- */
- public ConfigurationModelContainer getConfigurationModel() throws ConfigurationException {
- return c;
- }
-
-}
-
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/config/util/ConfigurationPropertyNames.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/config/util/ConfigurationPropertyNames.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/config/util/ConfigurationPropertyNames.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -35,11 +35,5 @@
// needs to be change, which will impact the importing of .DEF files.
static final double CONFIG_CURR_VERSION_DBL = 6.0;
static final String CONFIG_CURR_VERSION = "6.0";
-
-
- public static final String MEMBERSHIP_ADMIN_PASSWORD = "security.membership.admin.password"; //$NON-NLS-1$
- public static final String MEMBERSHIP_ADMIN_USERNAME = "security.membership.admin.username"; //$NON-NLS-1$
- public static final String MEMBERSHIP_SECURITY_ENABLED = "security.membership.security.enabled"; //$NON-NLS-1$
- public static final String MEMBERSHIP_DOMAIN_ORDER = "security.membership.DomainOrder"; //$NON-NLS-1$
-
+
}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,117 +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.util;
-
-
-/**
- * Class that defines common property constants
- */
-public final class CommonPropertyNames {
-
- public static final String DOMAIN_ID = "metamatrix.siteID"; //$NON-NLS-1$
-
- public static final String RMI_CONTEXT_FACTORY = "metamatrix.deployment.rmiContextFactory"; //$NON-NLS-1$
-
- public static final String BEAN_CONTEXT_FACTORY = "metamatrix.deployment.beanContextFactory"; //$NON-NLS-1$
-
- public static final String DEFAULT_JNDI_URL = "metamatrix.deployment.defaultJndiURL"; //$NON-NLS-1$
-
- /**
- * <p>This property indicates the VM is running inside an
- * ApplicationServer. If the property exists and is set to true</p>
- * <p>This is an optional property</p>
- */
- public static final String APP_SERVER_VM = "metamatrix.appserver_vm"; //$NON-NLS-1$
- /**
- * <p>This property indicates the EJB server platform which the MetaMatrix
- * server is running on. Currently the only two possible values are
- * IBM's {@link #WEBSPHERE_PLATFORM WebSphere} server, and
- * the {@link #WEBLOGIC_PLATFORM Weblogic} server. The MetaMatrix
- * server</p>
- * <p>This is a required property</p>
- */
- public static final String SERVER_PLATFORM = "metamatrix.deployment.platform"; //$NON-NLS-1$
-
-
- /**
- * <p>This constant defines one of the possible values for the
- * {@link #SERVER_PLATFORM} property. It indicates that
- * no application server is running.</p>
- * <p>This is not a property, but rather a possible value for
- * the {@link #SERVER_PLATFORM} property.</p>
- */
- public static final String STANDALONE_PLATFORM = "standalone"; //$NON-NLS-1$
-
- /**
- * This is the installation directory defined by the bootstrapping process.
- * The bootstrapping information will provide this property by which the
- * {@link #CurrentConfiguration.getProperty()} will return.
- * @since 4.0
- */
- public static final String INSTALLATION_DIRECTORY = "metamatrix.installationDir"; //$NON-NLS-1$
-
- /**
- * This is the location the configuration models are located. This
- * property is used by the installation and configuration persistent components.
- */
- public static final String CONFIG_MODELS_DIRECTORY = "metamatrix.config.modelsDir"; //$NON-NLS-1$
-
- /**
- * The date of installation of the MetaMatrix suite
- */
- public static final String INSTALL_DATE = "metamatrix.installationDate"; //$NON-NLS-1$
-
-
- /**
- * This is the property name of the MetaMatrixAdmin password.
- */
- public static final String ADMIN_PASSWORD = "metamatrix.admin.password"; //$NON-NLS-1$
-
- /**
- * This is the property name of the MetaMatrixAdmin username.
- */
- public static final String ADMIN_USERNAME = "metamatrix.admin.username"; //$NON-NLS-1$
-
-
- /**
- * If this property is set to true then client side encryption is enabled.
- */
- public static final String CLIENT_ENCRYPTION_ENABLED = "metamatrix.encryption.client.encryption"; //$NON-NLS-1$
-
- /**
- * This property indicates the encryption provider, if set to none encryption is disabled.
- */
- public static final String JCE_PROVIDER = "metamatrix.encryption.jce.provider"; //$NON-NLS-1$
-
-
- /**
- * Extension Module file types to cache in memory.
- * Should be comma-delimited list of values as stored in
- * JDBCNames.ExtensionFilesTable.ColumnName.FILE_TYPE.
- * For example: "JAR File, Function Definition".
- * Default is none.
- */
- public static final String EXTENSION_TYPES_TO_CACHE = "metamatrix.server.extensionTypesToCache"; //$NON-NLS-1$
-
-
-}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/util/LogConstants.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/util/LogConstants.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/util/LogConstants.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -31,4 +31,6 @@
public static final String CTX_MEMBERSHIP = "MEMBERSHIP"; //$NON-NLS-1$
public static final String CTX_AUTHORIZATION = "AUTHORIZATION"; //$NON-NLS-1$
public static final String CTX_AUTHORIZATION_ADMIN_API = "AUTHORIZATION_ADMIN_API"; //$NON-NLS-1$
+ public static final String CTX_SERVER= "Server"; //$NON-NLS-1$
+ public static final String CTX_ADMIN = "ADMIN"; //$NON-NLS-1$
}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/util/crypto/keymanage/FilePasswordConverter.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/util/crypto/keymanage/FilePasswordConverter.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/util/crypto/keymanage/FilePasswordConverter.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -37,7 +37,6 @@
import org.jdom.Document;
import org.jdom.Element;
-import com.metamatrix.common.util.CommonPropertyNames;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.common.util.crypto.PasswordChangeUtility;
@@ -58,8 +57,7 @@
public static final int FILE_TYPE_PROPERTIES = 2;
public static final int FILE_TYPE_VDB = 3;
- private static String DEFAULT_KEY_FILE = System.getProperty(CommonPropertyNames.INSTALLATION_DIRECTORY) + File.separator
- + "config" + File.separator + CryptoUtil.KEY_NAME; //$NON-NLS-1$
+ private static String DEFAULT_KEY_FILE = CryptoUtil.KEY_NAME;
private static final String PASSWORD = "PASSWORD"; //$NON-NLS-1$
Modified: trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties
===================================================================
--- trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties 2009-06-26 22:06:04 UTC (rev 1088)
@@ -3095,7 +3095,7 @@
VDBArchiveSotRef.Unable_to_reead_file=Failed to read the specific file {0}
URIResource.Resource_not_found=Resource {0} could not be found or loaded in order to know what type of model classes to entitle.
-BasicApplication.Failed_while_installing_service_of_type__1=Failed while installing service of type
+BasicApplication.Failed_while_installing_service_of_type__1=Failed while installing service of type
VDBDefnXMLHelper.Unable_to_read_defn_file=Unable to read DEF file.
Deleted: trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java
===================================================================
--- trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,151 +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.config.model;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.api.ComponentTypeDefn;
-import com.metamatrix.common.config.api.ComponentTypeDefnID;
-import com.metamatrix.common.config.api.ConnectorBindingID;
-import com.metamatrix.common.config.reader.PropertiesConfigurationReader;
-import com.metamatrix.common.object.PropertyDefinitionImpl;
-import com.metamatrix.common.util.crypto.CryptoUtil;
-
-
-public class TestComponentCryptoUtil extends TestCase {
-
-
- private static String ENCRYPTED;
- private final static String NOT_ENCRYPTED = "not decrypted"; //$NON-NLS-1$
-
-
- public TestComponentCryptoUtil(String name) throws Exception {
- super(name);
- }
-
-
- public void setUp() throws Exception {
- System.setProperty(CurrentConfiguration.CONFIGURATION_READER_CLASS_PROPERTY_NAME, PropertiesConfigurationReader.class.getName());
- ENCRYPTED = new String(CryptoUtil.stringEncrypt("password")); //$NON-NLS-1$
- }
-
- public void testCheckPropertiesDecryptable() throws Exception {
- BasicComponentDefn defn = new BasicConnectorBinding(null, new ConnectorBindingID(null, "binding"), null); //$NON-NLS-1$
-
- //positive case
- List componentTypeDefns = new ArrayList();
-
- helpSetProperty(defn, componentTypeDefns, "prop1", ENCRYPTED, true); //$NON-NLS-1$
- helpSetProperty(defn, componentTypeDefns, "prop2", NOT_ENCRYPTED, false); //$NON-NLS-1$
-
- boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(defn, componentTypeDefns);
- assertTrue(decryptable);
-
-
-
- //negative case
- componentTypeDefns = new ArrayList();
-
- helpSetProperty(defn, componentTypeDefns, "prop1", ENCRYPTED, true); //$NON-NLS-1$
- helpSetProperty(defn, componentTypeDefns, "prop2", NOT_ENCRYPTED, true); //$NON-NLS-1$
-
- decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(defn, componentTypeDefns);
- assertFalse(decryptable);
-
- }
-
-
-
- /**
- * Helper method that sets a property on a ComponentDefn, and adds it to a list of ComponentTypeDefns
- *
- * @since 4.3
- */
- private void helpSetProperty(BasicComponentDefn defn, List componentTypeDefns, String key, String value, boolean isMasked) {
- //set on the ComponentDefn
- defn.addProperty(key, value);
-
- //create a ComponentTypeDefn and add to the list
- PropertyDefinitionImpl pd = new PropertyDefinitionImpl();
- pd.setName(key);
- pd.setMasked(isMasked);
- ComponentTypeDefn ctd = new BasicComponentTypeDefn(new ComponentTypeDefnID(key), null, pd, false, false);
- componentTypeDefns.add(ctd);
- }
-
- public void testCheckPropertiesDecryptableEmpty() throws Exception {
- boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(new Properties(), new ArrayList());
- assertTrue("Expected true ", decryptable); //$NON-NLS-1$
- }
-
- public void testCheckPropertiesDecryptableNull() throws Exception {
- boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable((Properties)null, (Collection)null);
- assertTrue("Expected true ", decryptable); //$NON-NLS-1$
- }
-
- public void testCheckPropertiesDecryptableNullProperties() throws Exception {
- Collection maskedNames = new ArrayList();
- maskedNames.add("Roberto"); //$NON-NLS-1$
- maskedNames.add("Pietro"); //$NON-NLS-1$
- maskedNames.add("Digiorno"); //$NON-NLS-1$
- maskedNames.add("Digragorio"); //$NON-NLS-1$
- boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable((Properties)null, maskedNames);
- assertTrue("Expected true ", decryptable); //$NON-NLS-1$
- }
-
- public void testCheckPropertiesDecryptableFail() throws Exception {
- String maskedPropName = "password"; //$NON-NLS-1$
- Collection maskedNames = new ArrayList();
- maskedNames.add(maskedPropName);
-
- Properties props = new Properties();
- props.setProperty(maskedPropName, "mm"); //$NON-NLS-1$
-
- boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(props, maskedNames);
- assertFalse("Expected not decryptable ", decryptable); //$NON-NLS-1$
- }
-
- public void testCheckPropertiesDecryptablePass() throws Exception {
- String maskedPropName = "password"; //$NON-NLS-1$
- Collection maskedNames = new ArrayList();
- maskedNames.add(maskedPropName);
-
- Properties props = new Properties();
- props.setProperty(maskedPropName, ENCRYPTED); //$NON-NLS-1$
-
- boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(props, maskedNames);
- assertTrue("Expected decryptable ", decryptable); //$NON-NLS-1$
- }
-
-
-
-}
-
-
Deleted: trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java
===================================================================
--- trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,69 +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.config.model;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-
-public class TestPropertyValidation extends TestCase {
-
- /**
- * @param name
- */
- public TestPropertyValidation(String name) {
- super(name);
-
- }
-
- // ################################## TESTS ################################
-
- public void testBoundariesMultiCastPort() throws Exception{
- PropertyValidations val = new PropertyValidations();
- val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.0.0.0" ); //$NON-NLS-1$
-
- val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.255.255.255" ); //$NON-NLS-1$
-
- }
-
- public void testInvalidAlphaMultiCastPort() throws Exception{
- try {
- PropertyValidations val = new PropertyValidations();
- val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.a.c.d" ); //$NON-NLS-1$
- fail("224.a.c.d multicast port has alpha characters and is invalid"); //$NON-NLS-1$
- } catch (ConfigurationException ce) {
-
- }
- }
-
- public void testMissingNodesMultiCastPort() throws Exception{
- try {
- PropertyValidations val = new PropertyValidations();
- val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.10." ); //$NON-NLS-1$
- fail("224.10. multicast port is missing nodes and is invalid"); //$NON-NLS-1$
- } catch (ConfigurationException ce) {
-
- }
- }
-
-}
Modified: trunk/embedded/pom.xml
===================================================================
--- trunk/embedded/pom.xml 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/pom.xml 2009-06-26 22:06:04 UTC (rev 1088)
@@ -68,6 +68,11 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ </dependency>
+
</dependencies>
</project>
\ No newline at end of file
Deleted: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/EmbeddedConfigSource.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,105 +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.embedded;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.teiid.dqp.internal.cache.DQPContextCache;
-
-import com.google.inject.Binder;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.name.Named;
-import com.google.inject.name.Names;
-import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.common.application.DQPConfigSource;
-import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.dqp.embedded.services.EmbeddedBufferService;
-import com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService;
-import com.metamatrix.dqp.embedded.services.EmbeddedDataService;
-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.DQPServiceNames;
-
-/**
- * This class is main hook point for the Embedded DQP configuration. This classe's
- * responsibility is to encapsulate the knowledge of creating of the various application
- * services used the DQP.
- *
- */
-@Singleton
-public class EmbeddedConfigSource implements DQPConfigSource {
-
- private Properties props;
- private boolean useTxn;
- private URL dqpURL;
-
- @Inject
- DQPContextCache contextCache;
-
- /**
- * Based the configuration file load the DQP services
- * @param configFile
- * @throws ApplicationInitializationException
- */
- @Inject public EmbeddedConfigSource(@Named("BootstrapURL") URL dqpURL, @Named("DQPProperties") Properties connectionProperties) {
- this.dqpURL = dqpURL;
- this.props = connectionProperties;
- useTxn = PropertiesUtils.getBooleanProperty(props, EmbeddedTransactionService.TRANSACTIONS_ENABLED, true);
- }
-
- /**
- * @see com.metamatrix.common.application.DQPConfigSource#getProperties()
- */
- public Properties getProperties() {
- return this.props;
- }
-
- @Override
- public void updateBindings(Binder binder) {
- if (contextCache != null) {
- binder.bind(DQPContextCache.class).toInstance(contextCache);
- }
- binder.bind(URL.class).annotatedWith(Names.named("BootstrapURL")).toInstance(this.dqpURL); //$NON-NLS-1$
- }
-
- @Override
- public Map<String, Class<? extends ApplicationService>> getDefaultServiceClasses() {
- Map<String, Class<? extends ApplicationService>> result = new HashMap<String, Class<? extends ApplicationService>>();
- result.put(DQPServiceNames.CONFIGURATION_SERVICE, EmbeddedConfigurationService.class);
- result.put(DQPServiceNames.BUFFER_SERVICE, EmbeddedBufferService.class);
- result.put(DQPServiceNames.VDB_SERVICE, EmbeddedVDBService.class);
- result.put(DQPServiceNames.METADATA_SERVICE, EmbeddedMetadataService.class);
- result.put(DQPServiceNames.DATA_SERVICE, EmbeddedDataService.class);
- if (useTxn) {
- result.put(DQPServiceNames.TRANSACTION_SERVICE, EmbeddedTransactionService.class);
- }
- return result;
- }
-
-}
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1494,5 +1494,10 @@
Properties getUserPreferences() {
return userPreferences;
}
+
+ @Override
+ public String getClusterName() {
+ return getUserPreferences().getProperty(DQPEmbeddedProperties.CLUSTERNAME, "embedded"); //$NON-NLS-1$
+ }
}
Deleted: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnection.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,138 +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.jdbc;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import com.metamatrix.admin.api.core.Admin;
-import com.metamatrix.admin.api.embedded.EmbeddedAdmin;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.core.util.MixinProxy;
-import com.metamatrix.dqp.embedded.admin.DQPConfigAdminImpl;
-import com.metamatrix.dqp.embedded.admin.DQPMonitoringAdminImpl;
-import com.metamatrix.dqp.embedded.admin.DQPRuntimeStateAdminImpl;
-import com.metamatrix.dqp.embedded.admin.DQPSecurityAdminImpl;
-
-/**
- * This class simple wrapper on top of MMConnection for the EmbeddedDriver and
- * EmbeddedDataSource.
- *
- * The specific reason for this class is to have a management API on the
- * a JDBC Connection.
- *
- * @since 4.3
- */
-public class EmbeddedConnection extends MMConnection {
-
- // constant value giving product name
- private final static String SERVER_NAME = "Teiid Embedded"; //$NON-NLS-1$
-
- EmbeddedConnectionFactoryImpl manager = null;
- ConnectionListener listener = null;
-
- /**
- * ctor
- */
- public EmbeddedConnection(EmbeddedConnectionFactoryImpl manager, ServerConnection serverConn, Properties info, ConnectionListener listener) {
- super(serverConn, info, null);
- this.manager = manager;
- this.listener = listener;
-
- // tell the listener that connection has been created
- if (listener != null) {
- this.listener.connectionAdded(getConnectionId(), this);
- }
- }
-
- /**
- * Get the Admin API interface, so that the caller can manager various aspects of configuring the DQP, like adding, deleteing
- * a VDB. Look at Java Docs for <code>Admin</code> all supported functionality.
- *
- * @return retuns reference to API, never null.
- * @since 4.3
- */
- public Admin getAdminAPI() throws SQLException {
-
- InvocationHandler handler = new MixinProxy(new Object[] {
- new DQPConfigAdminImpl(manager),
- new DQPMonitoringAdminImpl(manager),
- new DQPRuntimeStateAdminImpl(manager),
- new DQPSecurityAdminImpl(manager)
- }) {
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- // We we perform any DQP functions check if the DQP is still alive
- if (!manager.isAlive()) {
- throw new AdminProcessingException(JDBCPlugin.Util.getString("EmbeddedConnection.DQP_shutDown")); //$NON-NLS-1$
- }
-
- // Since all the loading is done by the executing threads class loader, by defination we need to
- // switch to our local non-delegating class loader each time the class enters into the dqp connection
- // boundary, however for simplicity sake we have only put this barrier, in the comm layer to isolate the
- // DQP code however the com.mm.jdbc.sql code will still use the calling class loader. By changing the
- // class loader here, I am at atleast avoiding the classloading issues for the Admin code. - rreddy.
- ClassLoader callingClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- // Set the class loader to current class classloader so that the this classe's class loader gets used
- Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
- return super.invoke(proxy, method, args);
- }
- finally {
- Thread.currentThread().setContextClassLoader(callingClassLoader);
- }
- }
- };
- return (EmbeddedAdmin) Proxy.newProxyInstance(this.getClass().getClassLoader(),new Class[] {EmbeddedAdmin.class}, handler);
- }
-
- /**
- * @see com.metamatrix.jdbc.MMConnection#getDatabaseName()
- */
- @Override
- public String getDatabaseName() {
- return SERVER_NAME;
- }
-
- @Override
- public BaseDriver getBaseDriver() {
- return new EmbeddedDriver();
- }
-
- @Override
- public boolean isSameProcess(MMConnection conn) {
- return (conn instanceof EmbeddedConnection);
- }
-
- @Override
- public void close() throws SQLException {
- if (this.listener != null) {
- this.listener.connectionRemoved(getConnectionId(), this);
- }
- super.close();
- }
-}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,34 +22,66 @@
package com.metamatrix.jdbc;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.MalformedURLException;
import java.net.URL;
-import java.sql.Connection;
import java.sql.SQLException;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
import org.teiid.dqp.internal.process.DQPCore;
+import org.teiid.transport.AdminAuthorizationInterceptor;
+import org.teiid.transport.LocalServerConnection;
+import org.teiid.transport.LogonImpl;
+import org.teiid.transport.SocketTransport;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import com.metamatrix.admin.api.core.Admin;
+import com.metamatrix.admin.api.embedded.EmbeddedAdmin;
+import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.exception.AdminProcessingException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
+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;
+import com.metamatrix.common.protocol.URLHelper;
+import com.metamatrix.common.util.JMXUtil;
+import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.MixinProxy;
import com.metamatrix.dqp.ResourceFinder;
+import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+import com.metamatrix.dqp.embedded.admin.DQPConfigAdminImpl;
+import com.metamatrix.dqp.embedded.admin.DQPMonitoringAdminImpl;
+import com.metamatrix.dqp.embedded.admin.DQPRuntimeStateAdminImpl;
+import com.metamatrix.dqp.embedded.admin.DQPSecurityAdminImpl;
+import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.dqp.util.LogConstants;
-import com.metamatrix.jdbc.transport.LocalTransportHandler;
+import com.metamatrix.platform.security.api.ILogon;
+import com.metamatrix.platform.security.api.MetaMatrixSessionID;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
/**
@@ -57,31 +89,47 @@
* This is also responsible for initializing the DQP if the DQP instance is not
* already alive.
*/
-public class EmbeddedConnectionFactoryImpl implements EmbeddedConnectionFactory {
- private static final int ACTIVE = 3;
- private LocalTransportHandler handler = null;
+public class EmbeddedConnectionFactoryImpl implements ServerConnectionFactory {
private volatile boolean shutdownInProgress = false;
private DQPCore dqp;
private long starttime = -1L;
private Thread shutdownThread;
+ private ClientServiceRegistry clientServices;
+ private String workspaceDirectory;
+ private boolean init = false;
+ private ConnectionListenerList listenerList = new ConnectionListenerList();
+ private SocketTransport socketTransport;
+ private JMXUtil jmxServer;
+
+ private final class ConnectionListenerList extends ArrayList<ServerConnectionListener> implements ServerConnectionListener{
- /**
- * @see com.metamatrix.jdbc.EmbeddedConnectionFactory#createConnection()
- */
- public Connection createConnection(Properties props) throws SQLException {
+ @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 {
- // check for the valid connection properties
- checkConnectionProperties (props);
+
+ initialize(connectionProperties);
+ return new LocalServerConnection(connectionProperties, this.clientServices, listenerList);
- ServerConnection serverConn = this.handler.createConnection(props);
-
- // Should occur every time in class loader using existing attributes
- return new EmbeddedConnection(this, serverConn, props, null);
- } catch (ConnectionException e) {
- throw new EmbeddedSQLException(e);
+ } catch (ApplicationInitializationException e) {
+ throw new ConnectionException(e.getCause());
}
- }
+ }
+
/**
* When the DQP is restarted using the admin API, it only shuts it down, it gets
@@ -92,34 +140,159 @@
* @throws ApplicationInitializationException
* @since 4.3
*/
- public void initialize(URL bootstrapURL, Properties props) throws SQLException {
- Injector injector = Guice.createInjector(new EmbeddedGuiceModule(bootstrapURL, props));
- ResourceFinder.setInjector(injector);
- DQPConfigSource configSource = injector.getInstance(DQPConfigSource.class);
-
- // start the DQP
- this.dqp = new DQPCore();
+ public synchronized void initialize(Properties info) throws ApplicationInitializationException {
+ if (this.init) {
+ return;
+ }
+
+ String dqpId = getDQPIdentity(info);
+ info.setProperty(DQPEmbeddedProperties.DQP_IDENTITY, dqpId);
+
+ URL bootstrapURL = null;
+ Properties props = info;
try {
- this.dqp.start(configSource);
- } catch (ApplicationInitializationException e) {
- throw new EmbeddedSQLException(e);
+ bootstrapURL = URLHelper.buildURL(info.getProperty(DQPEmbeddedProperties.BOOTURL));
+ props = PropertiesUtils.loadFromURL(bootstrapURL);
+ props.putAll(info);
+ props = PropertiesUtils.resolveNestedProperties(props);
+ } catch (IOException e) {
+ throw new ApplicationInitializationException(e);
}
+
+ // Create a temporary workspace directory
+ this.workspaceDirectory = createWorkspace(bootstrapURL, props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR), dqpId);
+ props.setProperty(DQPEmbeddedProperties.DQP_WORKSPACE, this.workspaceDirectory);
+
+ this.jmxServer = new JMXUtil(dqpId);
+
+ EmbeddedGuiceModule config = new EmbeddedGuiceModule(bootstrapURL, props);
+ Injector injector = Guice.createInjector(config);
+ ResourceFinder.setInjector(injector);
+ config.setInjector(injector);
+ // start the DQP
+ this.dqp = injector.getInstance(DQPCore.class);
+ this.dqp.start(config);
+
// make the configuration service listen for the connection life-cycle events
// used during VDB delete
ConfigurationService configService = (ConfigurationService)findService(DQPServiceNames.CONFIGURATION_SERVICE);
+ this.clientServices = createClientServices(configService);
+
+ // start socket transport
+ boolean enableSocketTransport = PropertiesUtils.getBooleanProperty(props, DQPEmbeddedProperties.ENABLE_SOCKETS, false);
+ if (enableSocketTransport) {
+ 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
- this.handler = new LocalTransportHandler(this.dqp);
- this.handler.registerListener(configService.getConnectionListener());
+ listenerList.add(configService.getConnectionListener());
+
this.shutdownThread = new ShutdownWork();
Runtime.getRuntime().addShutdownHook(this.shutdownThread);
this.starttime = System.currentTimeMillis();
+ this.init = true;
DQPEmbeddedPlugin.logInfo("DQPEmbeddedManager.start_dqp", new Object[] {new Date(System.currentTimeMillis()).toString()}); //$NON-NLS-1$
}
- class ShutdownWork extends Thread {
+ private ClientServiceRegistry createClientServices(ConfigurationService configService) {
+ 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);
+
+ try {
+ EmbeddedAdmin roleCheckedServerAdmin = wrapAdminService(EmbeddedAdmin.class, (EmbeddedAdmin)getAdminAPI(null));
+ services.registerClientService(EmbeddedAdmin.class, roleCheckedServerAdmin, com.metamatrix.common.util.LogConstants.CTX_ADMIN);
+ } catch (AdminException e) {
+ // ignore; exception is not thrown in this case.
+ }
+
+ services.registerClientService(ClientSideDQP.class, this.dqp, LogConstants.CTX_QUERY_SERVICE);
+
+ return services;
+ }
+
+ /**
+ * Define an identifier for the DQP
+ * @return a JVM level unique identifier
+ */
+ private String getDQPIdentity(Properties props) {
+
+ String processName = props.getProperty(DQPEmbeddedProperties.PROCESSNAME);
+ if (processName != null) {
+ return processName;
+ }
+
+ synchronized (System.class) {
+ String id = System.getProperty(DQPEmbeddedProperties.DQP_IDENTITY, "1"); //$NON-NLS-1$
+ int identity = Integer.parseInt(id);
+ System.setProperty(DQPEmbeddedProperties.DQP_IDENTITY, String.valueOf(identity + 1));
+ id = String.valueOf(identity);
+ return id;
+ }
+ }
+
+ /**
+ * Create the temporary workspace directory for the dqp
+ * @param identity - identity of the dqp
+ * @throws MMSQLException
+ */
+ private String createWorkspace(URL bootstrapURL, String baseDir, String identity) throws ApplicationInitializationException {
+ if (baseDir == null) {
+ baseDir = System.getProperty("java.io.tmpdir")+"/teiid/"; //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ try {
+ baseDir = URLHelper.buildURL(bootstrapURL, baseDir).getPath();
+ } catch (MalformedURLException e) {
+ throw new ApplicationInitializationException(e);
+ }
+ }
+ System.setProperty(DQPEmbeddedProperties.DQP_TMPDIR, baseDir + "/temp"); //$NON-NLS-1$S
+
+ File f = new File(baseDir, identity);
+
+ // If directory already exists then try to delete it; because we may have
+ // failed to delete at end of last run (JVM holds lock on jar files)
+ if (f.exists()) {
+ delete(f);
+ }
+
+ // since we may have cleaned it up now , create the directory again
+ if (!f.exists()) {
+ f.mkdirs();
+ }
+ return f.getAbsolutePath();
+ }
+
+ /**
+ * delete the any directory including sub-trees
+ * @param file
+ */
+ private void delete(File file) {
+ if (file.isDirectory()) {
+ File[] files = file.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ delete(files[i]);
+ } // for
+ }
+
+ // for saftey purpose only delete the jar files
+ if (file.getName().endsWith(".jar")) { //$NON-NLS-1$
+ file.delete();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T wrapAdminService(Class<T> iface, T impl) {
+ AuthorizationService authService = (AuthorizationService)this.dqp.getEnvironment().findService(DQPServiceNames.AUTHORIZATION_SERVICE);
+ return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, new AdminAuthorizationInterceptor(authService, impl));
+ }
+
+ class ShutdownWork extends Thread {
ShutdownWork(){
super("embedded-shudown-thread"); //$NON-NLS-1$
}
@@ -169,6 +342,10 @@
private synchronized void shutdown(boolean undoShutdownHook) {
+ if (!isAlive()) {
+ return;
+ }
+
if (undoShutdownHook) {
Runtime.getRuntime().removeShutdownHook(this.shutdownThread);
}
@@ -187,70 +364,62 @@
LogManager.logWarning(LogConstants.CTX_DQP, e, e.getMessage());
}
+ // remove any artifacts which are not cleaned-up
+ if (this.workspaceDirectory != null) {
+ File file = new File(this.workspaceDirectory);
+ if (file.exists()) {
+ delete(file);
+ }
+ }
+
this.dqp = null;
- this.handler = null;
-
+ // shutdown the socket transport.
+ if (this.socketTransport != null) {
+ this.socketTransport.stop();
+ this.socketTransport = null;
+ }
+
// shutdown the cache.
ResourceFinder.getCacheFactory().destroy();
shutdownInProgress = false;
+
+ init = false;
}
}
-
- /**
- * Are the connection properties supplied for connection match with those of the
- * DQP
- * @param props
- * @return
- * @since 4.3
- */
- private void checkConnectionProperties(Properties props) throws SQLException {
- String vdbName = props.getProperty(BaseDataSource.VDB_NAME);
- String vdbVersion = props.getProperty(BaseDataSource.VDB_VERSION);
-
- try {
- VDBService service = (VDBService)findService(DQPServiceNames.VDB_SERVICE);
- List<VDBArchive> vdbs = service.getAvailableVDBs();
- // We are looking for the latest version find that now
- if (vdbVersion == null) {
- vdbVersion = findLatestVersion(vdbName, vdbs);
- }
-
- props.setProperty(BaseDataSource.VDB_VERSION, vdbVersion);
+ @Override
+ public Admin getAdminAPI(Properties connectionProperties) throws AdminException {
+
+ InvocationHandler handler = new MixinProxy(new Object[] {
+ new DQPConfigAdminImpl(this),
+ new DQPMonitoringAdminImpl(this),
+ new DQPRuntimeStateAdminImpl(this),
+ new DQPSecurityAdminImpl(this)
+ }) {
- // This below call will load the VDB from configuration into VDB service
- // if not already done so.
- int status = service.getVDB(vdbName, vdbVersion).getStatus();
- if (status != ACTIVE) {
- throw new EmbeddedSQLException(JDBCPlugin.Util.getString("EmbeddedConnectionFactory.vdb_notactive", new Object[] {vdbName, vdbVersion})); //$NON-NLS-1$
- }
- } catch (MetaMatrixComponentException e) {
- throw new EmbeddedSQLException(e, JDBCPlugin.Util.getString("EmbeddedConnectionFactory.vdb_notavailable", new Object[] {vdbName, vdbVersion})); //$NON-NLS-1$
- }
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ // We we perform any DQP functions check if the DQP is still alive
+ if (!isAlive()) {
+ throw new AdminProcessingException(JDBCPlugin.Util.getString("EmbeddedConnection.DQP_shutDown")); //$NON-NLS-1$
+ }
+
+ ClassLoader callingClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ // Set the class loader to current class classloader so that the this classe's class loader gets used
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ return super.invoke(proxy, method, args);
+ }
+ finally {
+ Thread.currentThread().setContextClassLoader(callingClassLoader);
+ }
+ }
+ };
+ return (EmbeddedAdmin) Proxy.newProxyInstance(this.getClass().getClassLoader(),new Class[] {EmbeddedAdmin.class}, handler);
}
-
- /**
- * Find the latest version of the VDB available in the deployment.
- * @param vdbName
- * @param vdbs
- * @return
- * @throws EmbeddedSQLException
- * @since 4.3
- */
- String findLatestVersion(String vdbName, List<VDBArchive> vdbs) throws EmbeddedSQLException{
- int latestVersion = 0;
- for (VDBArchive vdb:vdbs) {
- if(vdb.getName().equalsIgnoreCase(vdbName)) {
- // Make sure the VDB Name and version number are the only parts of this vdb key
- latestVersion = Math.max(latestVersion, Integer.parseInt(vdb.getVersion()));
- }
- }
- if(latestVersion != 0) {
- return String.valueOf(latestVersion);
- }
- throw new EmbeddedSQLException(JDBCPlugin.Util.getString("EmbeddedConnectionFactory.vdb_notavailable", vdbName)); //$NON-NLS-1$
- }
-
+
+ public JMXUtil getJMXServer() {
+ return this.jmxServer;
+ }
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,28 +22,50 @@
package com.metamatrix.jdbc;
+import java.net.InetAddress;
import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Properties;
import org.jboss.cache.Cache;
import org.teiid.dqp.internal.cache.DQPContextCache;
+import org.teiid.dqp.internal.process.DQPCore;
import com.google.inject.AbstractModule;
+import com.google.inject.Injector;
import com.google.inject.Scopes;
import com.google.inject.name.Names;
import com.metamatrix.cache.CacheFactory;
import com.metamatrix.cache.jboss.JBossCacheFactory;
+import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.common.log.LogConfiguration;
import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.NetUtils;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.LogListener;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.embedded.EmbeddedConfigSource;
+import com.metamatrix.dqp.embedded.services.EmbeddedBufferService;
+import com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService;
+import com.metamatrix.dqp.embedded.services.EmbeddedDataService;
+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.authorization.service.AuthorizationServiceImpl;
+import com.metamatrix.platform.security.membership.service.MembershipServiceImpl;
+import com.metamatrix.platform.security.session.service.SessionServiceImpl;
-public class EmbeddedGuiceModule extends AbstractModule {
+public class EmbeddedGuiceModule extends AbstractModule implements DQPConfigSource{
private Properties props;
private URL bootstrapURL;
+ Injector injector;
public EmbeddedGuiceModule(URL bootstrapURL, Properties props) {
this.bootstrapURL = bootstrapURL;
@@ -57,21 +79,87 @@
bind(URL.class).annotatedWith(Names.named("BootstrapURL")).toInstance(bootstrapURL); //$NON-NLS-1$
bindConstant().annotatedWith(Names.named("HostName")).to("embedded"); //$NON-NLS-1$ //$NON-NLS-2$
- bindConstant().annotatedWith(Names.named("ProcessName")).to(props.getProperty(DQPEmbeddedProperties.DQP_IDENTITY)); //$NON-NLS-1$
- String workspaceDir = props.getProperty(DQPEmbeddedProperties.DQP_WORKSPACE);
+ bindConstant().annotatedWith(Names.named("ProcessName")).to(props.getProperty(DQPEmbeddedProperties.DQP_IDENTITY, "test")); //$NON-NLS-1$ //$NON-NLS-2$
+ String workspaceDir = props.getProperty(DQPEmbeddedProperties.DQP_WORKSPACE, System.getProperty("user.dir")); //$NON-NLS-1$
bindConstant().annotatedWith(Names.named("WorkspaceDir")).to(workspaceDir); //$NON-NLS-1$
bind(Properties.class).annotatedWith(Names.named("DQPProperties")).toInstance(this.props); //$NON-NLS-1$
+ InetAddress address = resolveHostAddress(props.getProperty(DQPEmbeddedProperties.BIND_ADDRESS));
+ bind(InetAddress.class).annotatedWith(Names.named(DQPEmbeddedProperties.HOST_ADDRESS)).toInstance(address);
+ this.props.put(DQPEmbeddedProperties.HOST_ADDRESS, address);
+
bind(Cache.class).toProvider(CacheProvider.class).in(Scopes.SINGLETON);
bind(CacheFactory.class).to(JBossCacheFactory.class).in(Scopes.SINGLETON);
bind(DQPContextCache.class).in(Scopes.SINGLETON);
- bind(DQPConfigSource.class).to(EmbeddedConfigSource.class);
+ bind(DQPCore.class).in(Scopes.SINGLETON);
+ configureServices();
+
// this needs to be removed.
binder().requestStaticInjection(LogManager.class);
}
-
+ private InetAddress resolveHostAddress(String bindAddress) {
+ try {
+ if (bindAddress == null) {
+ return NetUtils.getInstance().getInetAddress();
+ }
+ return NetUtils.resolveHostByName(bindAddress);
+ } catch (UnknownHostException e) {
+ throw new MetaMatrixRuntimeException("Failed to resolve the bind address"); //$NON-NLS-1$
+ }
+ }
+
+ private void configureServices() {
+ Map<String, Class<? extends ApplicationService>> defaults = getDefaultServiceClasses();
+ for(int i=0; i<DQPServiceNames.ALL_SERVICES.length; i++) {
+ final String serviceName = DQPServiceNames.ALL_SERVICES[i];
+ String className = this.props.getProperty("service."+serviceName+".classname"); //$NON-NLS-1$ //$NON-NLS-2$
+ Class clazz = defaults.get(serviceName);
+ if (clazz != null && className != null) {
+ try {
+ clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ }
+ if (clazz != null) {
+ bind(DQPServiceNames.ALL_SERVICE_CLASSES[i]).to(clazz).in(Scopes.SINGLETON);
+ }
+ }
+ }
+
+ private Map<String, Class<? extends ApplicationService>> getDefaultServiceClasses() {
+ boolean useTxn = PropertiesUtils.getBooleanProperty(props, EmbeddedTransactionService.TRANSACTIONS_ENABLED, true);
+
+ Map<String, Class<? extends ApplicationService>> result = new HashMap<String, Class<? extends ApplicationService>>();
+ result.put(DQPServiceNames.CONFIGURATION_SERVICE, EmbeddedConfigurationService.class);
+ result.put(DQPServiceNames.BUFFER_SERVICE, EmbeddedBufferService.class);
+ result.put(DQPServiceNames.VDB_SERVICE, EmbeddedVDBService.class);
+ result.put(DQPServiceNames.METADATA_SERVICE, EmbeddedMetadataService.class);
+ result.put(DQPServiceNames.DATA_SERVICE, EmbeddedDataService.class);
+ if (useTxn) {
+ result.put(DQPServiceNames.TRANSACTION_SERVICE, EmbeddedTransactionService.class);
+ }
+ result.put(DQPServiceNames.SESSION_SERVICE, SessionServiceImpl.class);
+ result.put(DQPServiceNames.MEMBERSHIP_SERVICE, MembershipServiceImpl.class);
+ result.put(DQPServiceNames.AUTHORIZATION_SERVICE, AuthorizationServiceImpl.class);
+ return result;
+ }
+
+ public void setInjector(Injector injector) {
+ this.injector = injector;
+ }
+
+ @Override
+ public Properties getProperties() {
+ return this.props;
+ }
+
+ @Override
+ public ApplicationService getServiceInstance(Class<? extends ApplicationService> type) {
+ return this.injector.getInstance(type);
+ }
}
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/Log4JUtil.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/Log4JUtil.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/Log4JUtil.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -107,6 +107,7 @@
contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_EXTENSION_SOURCE);
contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_COMMANDLOGGING);
contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_AUDITLOGGING);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_QUERY_SERVICE);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_CONFIG);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_COMMUNICATION);
@@ -115,6 +116,8 @@
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_MEMBERSHIP);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION_ADMIN_API);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_SERVER);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_ADMIN);
contexts.add(ROOT_CONTEXT+LogRuntimeMetadataConstants.CTX_RUNTIME_METADATA);
contexts.add("com.arjuna"); //$NON-NLS-1$
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogConfigurationProvider.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -39,9 +39,6 @@
@Singleton
class LogConfigurationProvider implements Provider<LogConfiguration> {
- @Inject
- DQPConfigSource configSource;
-
@Override
public LogConfiguration get() {
return new Log4JLogConfiguration();
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -24,34 +24,32 @@
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Properties;
import org.apache.log4j.Logger;
-import org.apache.log4j.Priority;
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.application.DQPConfigSource;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.JavaLogWriter;
import com.metamatrix.core.log.LogListener;
-import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
@Singleton
class LogListernerProvider implements Provider<LogListener> {
- @Inject
- DQPConfigSource configSource;
+ @Inject @Named("DQPProperties")
+ Properties props;
@Inject @Named("BootstrapURL")
URL dqpURL;
@Override
public LogListener get() {
- String logFile = configSource.getProperties().getProperty(DQPEmbeddedProperties.DQP_LOGFILE);
- String instanceId = configSource.getProperties().getProperty(DQPEmbeddedProperties.DQP_IDENTITY, "0"); //$NON-NLS-1$
+ String logFile = this.props.getProperty(DQPEmbeddedProperties.DQP_LOGFILE);
+ String instanceId = this.props.getProperty(DQPEmbeddedProperties.DQP_IDENTITY, "0"); //$NON-NLS-1$
// Configure Logging
try {
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/authorization/service/AuthorizationServiceImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -37,6 +37,7 @@
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.xml.sax.SAXException;
+import com.google.inject.Inject;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
import com.metamatrix.admin.api.server.AdminRoles;
@@ -68,7 +69,6 @@
import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
import com.metamatrix.platform.security.api.SessionToken;
import com.metamatrix.platform.security.api.StandardAuthorizationActions;
-import com.metamatrix.platform.security.api.service.AuthorizationServicePropertyNames;
import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
import com.metamatrix.platform.security.util.RolePermissionFactory;
import com.metamatrix.platform.util.ErrorMessageKeys;
@@ -95,7 +95,7 @@
/*
* Injected state
*/
- protected MembershipServiceInterface membershipServiceProxy;
+ protected MembershipServiceInterface membershipService;
protected VDBService vdbService;
protected LRUCache<VDBKey, Collection<AuthorizationPolicy>> policyCache = new LRUCache<VDBKey, Collection<AuthorizationPolicy>>();
@@ -106,7 +106,7 @@
* @see com.metamatrix.common.application.ApplicationService#initialize(java.util.Properties)
*/
public void initialize(Properties env) throws ApplicationInitializationException {
- this.useEntitlements = PropertiesUtils.getBooleanProperty(env, AuthorizationServicePropertyNames.DATA_ACCESS_AUTHORIZATION_ENABLED, false);
+ this.useEntitlements = PropertiesUtils.getBooleanProperty(env, ENTITELEMENTS_ENABLED, false);
}
/*
@@ -335,17 +335,19 @@
}
if (realm.getSubRealmName() != null) {
- VDBKey key = new VDBKey(realm.getRealmName(), realm.getSubRealmName());
+ VDBKey key = new VDBKey(realm.getSuperRealmName(), realm.getSubRealmName());
Collection<AuthorizationPolicy> policies = null;
synchronized (this.policyCache) {
policies = this.policyCache.get(key);
if (policies == null) {
try {
- VDBArchive vdb = vdbService.getVDB(realm.getRealmName(), realm.getSubRealmName());
+ VDBArchive vdb = vdbService.getVDB(realm.getSuperRealmName(), realm.getSubRealmName());
if (vdb.getDataRoles() == null) {
policies = Collections.emptyList();
}
- policies = AuthorizationPolicyFactory.buildPolicies(vdb.getName(), vdb.getVersion(), vdb.getDataRoles());
+ else {
+ policies = AuthorizationPolicyFactory.buildPolicies(vdb.getName(), vdb.getVersion(), vdb.getDataRoles());
+ }
} catch (SAXException e) {
throw new AuthorizationMgmtException(e);
} catch (IOException e) {
@@ -381,17 +383,16 @@
*/
private Set<MetaMatrixPrincipalName> getGroupsForPrincipal(MetaMatrixPrincipalName principal)
throws AuthorizationMgmtException, InvalidPrincipalException {
- LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION,
- new Object[] {"getGroupsForPrincipal(", principal, ") - Getting all group memberships."}); //$NON-NLS-1$ //$NON-NLS-2$
+
+ LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, new Object[] {"getGroupsForPrincipal(", principal, ") - Getting all group memberships."}); //$NON-NLS-1$ //$NON-NLS-2$
// Get the set of all groups this Principal is a member of
Set<MetaMatrixPrincipalName> allPrincipals = new HashSet<MetaMatrixPrincipalName>();
try {
Collection groups = Collections.EMPTY_SET;
- if (principal.getType() == MetaMatrixPrincipal.TYPE_USER ||
- principal.getType() == MetaMatrixPrincipal.TYPE_ADMIN) {
- groups = membershipServiceProxy.getGroupsForUser(principal.getName());
+ if (principal.getType() == MetaMatrixPrincipal.TYPE_USER || principal.getType() == MetaMatrixPrincipal.TYPE_ADMIN) {
+ groups = membershipService.getGroupsForUser(principal.getName());
} else if (principal.getType() == MetaMatrixPrincipal.TYPE_GROUP) {
- MetaMatrixPrincipal groupPrincipal = membershipServiceProxy.getPrincipal(principal);
+ MetaMatrixPrincipal groupPrincipal = membershipService.getPrincipal(principal);
groups = new HashSet();
groups.add(groupPrincipal.getName());
}
@@ -401,8 +402,7 @@
// HACK: Convert ALL member principals to MetaMatrixPrincipalName objs
// since Auth and Memb svcs don't speak the same language.
MetaMatrixPrincipalName member = new MetaMatrixPrincipalName((String) memberItr.next(), MetaMatrixPrincipal.TYPE_GROUP);
- LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION,
- new Object[]{"getGroupsForPrincipal(", principal, ") - Adding membership <", member, ">"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, new Object[]{"getGroupsForPrincipal(", principal, ") - Adding membership <", member, ">"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
allPrincipals.add(member);
}
// Add original Principal, now that we know he's been authenticated.
@@ -418,14 +418,12 @@
protected boolean isEntitled(String principal) {
try {
- if (membershipServiceProxy.isSuperUser(principal) || !membershipServiceProxy.isSecurityEnabled()) {
- LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION,
- new Object[]{ "Automatically entitling principal", principal}); //$NON-NLS-1$
+ if (membershipService.isSuperUser(principal) || !membershipService.isSecurityEnabled()) {
+ LogManager.logDetail(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION,new Object[]{ "Automatically entitling principal", principal}); //$NON-NLS-1$
return true;
}
} catch (MembershipServiceException e) {
- String msg = PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_AUTHORIZATION_0075);
- LogManager.logError(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, e, msg);
+ LogManager.logError(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, e, PlatformPlugin.Util.getString(ErrorMessageKeys.SEC_AUTHORIZATION_0075));
}
return false;
}
@@ -494,17 +492,23 @@
}
}
- public void setMembershipServiceProxy(
- MembershipServiceInterface membershipServiceProxy) {
- this.membershipServiceProxy = membershipServiceProxy;
+ @Inject
+ public void setMembershipService(MembershipServiceInterface membershipService) {
+ this.membershipService = membershipService;
}
public void setUseEntitlements(boolean useEntitlements) {
this.useEntitlements = useEntitlements;
}
+ @Inject
public void setVdbService(VDBService vdbService) {
this.vdbService = vdbService;
}
-
+
+ @Override
+ public boolean isCallerInRole(SessionToken caller, String roleName) throws AuthorizationMgmtException {
+ LogManager.logTrace(com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION, new Object[]{"isCallerInRole(", caller, roleName, ")"}); //$NON-NLS-1$ //$NON-NLS-2$
+ return hasPolicy(caller, RolePermissionFactory.getRealm(), roleName);
+ }
}
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -24,7 +24,9 @@
import java.io.IOException;
import java.io.Serializable;
+import java.net.InetAddress;
import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -38,6 +40,8 @@
import org.teiid.dqp.internal.process.DQPWorkContext;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
import com.metamatrix.api.exception.security.InvalidPrincipalException;
import com.metamatrix.api.exception.security.InvalidUserException;
@@ -47,14 +51,15 @@
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.api.AuthenticationProviderType;
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.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.core.util.StringUtil;
+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;
@@ -114,15 +119,19 @@
private boolean isSecurityEnabled = true;
private List<MembershipDomainHolder> domains = new ArrayList<MembershipDomainHolder>();
+ private URL dqpURL;
+ private InetAddress hostAddress;
- public MembershipServiceImpl() {
- super();
+ @Inject
+ public MembershipServiceImpl(@Named("BootstrapURL") URL dqpURL, @Named(DQPEmbeddedProperties.HOST_ADDRESS) InetAddress hostAddress) {
+ this.dqpURL = dqpURL;
+ this.hostAddress = hostAddress;
}
// -----------------------------------------------------------------------------------
// S E R V I C E - R E L A T E D M E T H O D S
// -----------------------------------------------------------------------------------
-
+
/**
* Perform initialization and commence processing. This method is called only once.
* <p>Note: In order to perform the chaining of membership domains, this method assumes
@@ -132,8 +141,14 @@
* @throws ApplicationInitializationException
*/
@Override
- public void initialize(Properties env)
- throws ApplicationInitializationException {
+ public void initialize(Properties env) throws ApplicationInitializationException {
+
+ isSecurityEnabled = Boolean.valueOf(env.getProperty(SECURITY_ENABLED)).booleanValue();
+ LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, "Security Enabled: " + isSecurityEnabled); //$NON-NLS-1$
+
+ if (!isSecurityEnabled) {
+ return;
+ }
adminUsername = env.getProperty(ADMIN_USERNAME, DEFAULT_ADMIN_USERNAME);
@@ -147,15 +162,14 @@
this.allowedAddresses = Pattern.compile(property);
}
- isSecurityEnabled = Boolean.valueOf(env.getProperty(SECURITY_ENABLED)).booleanValue();
- LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, "Security Enabled: " + isSecurityEnabled); //$NON-NLS-1$
-
- try {
- //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$
- throw new ApplicationInitializationException(err);
+ if (CryptoUtil.isValueEncrypted(adminCredentials)) {
+ try {
+ //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$
+ throw new ApplicationInitializationException(err);
+ }
}
String domainNameOrder = env.getProperty(MembershipServiceInterface.DOMAIN_ORDER);
@@ -216,13 +230,17 @@
properties.setProperty(DOMAIN_NAME, domainName);
- String propsString = properties.getProperty(DOMAIN_PROPERTIES);
+ String propsString = properties.getProperty(DOMAIN_PROPERTIES);
if (propsString != null) {
- Properties customProps = PropertiesUtils.loadFromURL(propsString);
+ URL url = URLHelper.buildURL(this.dqpURL, propsString);
+ Properties customProps = PropertiesUtils.loadFromURL(url);
properties.putAll(customProps);
+
+ // Using this URL the Membership providers can further define and files that are in relative context to this file
+ properties.put(DOMAIN_PROPERTIES, url);
}
-
+
domain.initialize(properties);
return domain;
@@ -295,7 +313,7 @@
LogManager.logWarning(LogConstants.CTX_MEMBERSHIP, PlatformPlugin.Util.getString("MembershipServiceImpl.unknown_host")); //$NON-NLS-1$
return new FailedAuthenticationToken();
}
- if (!allowedAddresses.matcher(address).matches() || address.equals(CurrentConfiguration.getInstance().getHostAddress().getHostAddress())) {
+ 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$
return new FailedAuthenticationToken();
}
Modified: trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/spi/file/FileMembershipDomain.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/spi/file/FileMembershipDomain.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/membership/spi/file/FileMembershipDomain.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.Serializable;
import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -36,8 +37,10 @@
import com.metamatrix.api.exception.security.InvalidUserException;
import com.metamatrix.api.exception.security.LogonException;
import com.metamatrix.api.exception.security.UnsupportedCredentialException;
+import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.platform.security.api.Credentials;
+import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
import com.metamatrix.platform.security.api.service.SuccessfulAuthenticationToken;
import com.metamatrix.platform.security.membership.spi.MembershipDomain;
import com.metamatrix.platform.security.membership.spi.MembershipSourceException;
@@ -71,14 +74,14 @@
throw new MembershipSourceException("Required property " +USERS_FILE+ " was missing."); //$NON-NLS-1$ //$NON-NLS-2$
}
- users = loadFile(userFile);
+ users = loadFile(env, userFile);
if (groupFile == null) {
throw new MembershipSourceException("Required property " +GROUPS_FILE+ " was missing."); //$NON-NLS-1$ //$NON-NLS-2$
}
groups.clear();
- groups.putAll(loadFile(groupFile));
+ groups.putAll(loadFile(env, groupFile));
userGroups.clear();
for (Iterator i = groups.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry)i.next();
@@ -98,9 +101,10 @@
}
}
- private Properties loadFile(String file) throws MembershipSourceException {
+ private Properties loadFile(Properties env, String file) throws MembershipSourceException {
try {
- return PropertiesUtils.loadFromURL(file);
+ URL baseURL = (URL)env.get(MembershipServiceInterface.DOMAIN_PROPERTIES);
+ return PropertiesUtils.loadFromURL(URLHelper.buildURL(baseURL, file));
} catch (MalformedURLException e) {
throw new MembershipSourceException(e, "Could not load file"); //$NON-NLS-1$
} catch (IOException e) {
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -35,6 +35,8 @@
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;
@@ -49,6 +51,7 @@
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;
@@ -295,7 +298,8 @@
return info;
}
- void setMembershipService(MembershipServiceInterface membershipService) {
+ @Inject
+ public void setMembershipService(MembershipServiceInterface membershipService) {
this.membershipService = membershipService;
}
@@ -315,14 +319,15 @@
this.sessionTimeLimit = sessionTimeLimit;
}
+ @Inject
public void setDqpCore(DQPCore dqpCore) {
this.dqpCore = dqpCore;
}
@Override
- public void initialize(Properties props)
- throws ApplicationInitializationException {
-
+ public void initialize(Properties props) throws ApplicationInitializationException {
+ this.sessionMaxLimit = Long.parseLong(props.getProperty(MAX_SESSIONS, DEFAULT_MAX_SESSIONS));
+ this.sessionTimeLimit = Long.parseLong(props.getProperty(SESSION_TIMEOUT, DEFAULT_SESSION_TIMEOUT));
}
@Override
@@ -342,6 +347,7 @@
this.sessionMonitor.cancel();
}
+ @Inject
public void setVdbService(VDBService vdbService) {
this.vdbService = vdbService;
}
Added: trunk/embedded/src/main/java/org/teiid/Server.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/Server.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/Server.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,181 @@
+/*
+ * 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.FileReader;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.net.InetAddress;
+import java.nio.channels.FileChannel;
+import java.util.Properties;
+
+import com.metamatrix.common.application.exception.ApplicationInitializationException;
+import com.metamatrix.common.util.JMXUtil.FailedToRegisterException;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+
+public class Server implements ServerMBean{
+
+ private Properties props;
+ private EmbeddedConnectionFactoryImpl engine;
+
+ public Server(Properties props) {
+ this.props = props;
+ }
+
+ private void start() {
+ try {
+ // start the engine.
+ this.engine = new EmbeddedConnectionFactoryImpl();
+ this.engine.initialize(this.props);
+
+ this.engine.getJMXServer().register(TYPE, NAME, this);
+
+ } catch (ApplicationInitializationException e) {
+ throw new MetaMatrixRuntimeException(e);
+ } catch (FailedToRegisterException e) {
+ throw new MetaMatrixRuntimeException(e.getCause());
+ }
+ }
+
+ private void stopS() {
+ if (engine.isAlive()) {
+ engine.shutdown();
+ }
+
+ try {
+ this.engine.getJMXServer().unregister(TYPE, NAME);
+ } catch (FailedToRegisterException e) {
+ // ignore
+ }
+ }
+
+ public static boolean duplicateProcess(Properties props) {
+ try {
+ String parent = new File(new File(props.getProperty(DQPEmbeddedProperties.BOOTURL)).getParent(), props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR)).getCanonicalPath();
+ File f = new File(parent, "teiid.pid"); //$NON-NLS-1$
+ FileChannel channel = new RandomAccessFile(f, "rw").getChannel(); //$NON-NLS-1$
+ return (channel.tryLock() == null);
+ } catch (IOException e) {
+ // ignore
+ }
+ return true;
+ }
+
+
+ private static Properties loadConfiguration(String configFile) {
+ File f = new File (configFile);
+ if (!f.exists()) {
+ System.out.println("Missing the bootstrap properties file, failed to start"); //$NON-NLS-1$
+ System.exit(-3);
+ }
+
+ Properties props = null;
+ try {
+ FileReader bootProperties = new FileReader(f);
+ props = new Properties();
+ props.load(bootProperties);
+
+ // enable socket communication by default.
+ props.setProperty(DQPEmbeddedProperties.ENABLE_SOCKETS, Boolean.TRUE.toString());
+ props.setProperty(DQPEmbeddedProperties.BOOTURL, f.getCanonicalPath());
+
+ } catch (IOException e) {
+ System.out.println("Failed to load bootstrap properties file."); //$NON-NLS-1$
+ e.printStackTrace();
+ System.exit(-3);
+ }
+ return props;
+ }
+
+ @Override
+ public boolean isAlive() {
+ return engine.isAlive();
+ }
+
+ @Override
+ public void shutdown() {
+ new Thread(){
+ public void run(){
+ System.out.println("Server being shutdown..."); //$NON-NLS-1$
+ stopS();
+ }
+ }.start();
+ }
+
+ @Override
+ public void halt() {
+ new Thread() {
+ public void run() {
+ System.err.println("Killing the Teiid Server now!"); //$NON-NLS-1$
+ Runtime.getRuntime().halt(-4);
+ }
+ }.start();
+ }
+ /**
+ * Start the Server Mode
+ * @param args
+ */
+ public static void main(String[] args) {
+ if (args.length < 1) {
+ System.out.println("Usage:Server <boot-properties-file>"); //$NON-NLS-1$
+ System.exit(-1);
+ }
+
+ long startTime = System.currentTimeMillis();
+
+ // load configuration
+ Properties props = loadConfiguration(args[0]);
+
+ // check for duplicate process
+ if (duplicateProcess(props)) {
+ System.out.println("There is already another Server process running! Failed to start"); //$NON-NLS-1$
+ System.exit(-2);
+ }
+
+ // load the server
+ Server s = new Server(props);
+ s.start();
+
+ String port = props.getProperty(DQPEmbeddedProperties.SERVER_PORT);
+ long time = System.currentTimeMillis() - startTime;
+
+ System.out.println("Teiid Server started on port = "+port + "in "+time/1000+" Secs"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ // wait.
+ while(s.isAlive()) {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+
+ // if for some reason engine is still alive kill it.
+ if (s.isAlive()) {
+ s.stopS();
+ }
+ }
+}
Property changes on: trunk/embedded/src/main/java/org/teiid/Server.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/embedded/src/main/java/org/teiid/ServerMBean.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/ServerMBean.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/ServerMBean.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,37 @@
+/*
+ * 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 javax.management.ObjectName;
+
+import com.metamatrix.common.util.JMXUtil;
+
+public interface ServerMBean {
+ public static final String NAME = "Server"; //$NON-NLS-1$
+ public static final JMXUtil.MBeanType TYPE = JMXUtil.MBeanType.SERVER;
+
+ boolean isAlive();
+
+ void shutdown();
+
+ void halt();
+}
Property changes on: trunk/embedded/src/main/java/org/teiid/ServerMBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/embedded/src/main/java/org/teiid/Shutdown.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/Shutdown.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/Shutdown.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,101 @@
+package org.teiid;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import com.metamatrix.common.util.JMXUtil;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+
+public class Shutdown {
+
+ public static void main(String[] args) throws Exception {
+ if (args.length < 2) {
+ System.out.println("Usage:Shutdown <boot-properties-file> <jmxPort>"); //$NON-NLS-1$
+ System.exit(-1);
+ }
+
+ Properties props = loadConfiguration(args[0]);
+
+ JMXUtil jmx = new JMXUtil(props.getProperty(DQPEmbeddedProperties.PROCESSNAME));
+
+ JMXServiceURL serviceURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:"+args[1]+"/jmxrmi"); //$NON-NLS-1$ //$NON-NLS-2$
+ JMXConnector connector = JMXConnectorFactory.connect(serviceURL);
+ MBeanServerConnection mbsc = connector.getMBeanServerConnection();
+
+ ServerProxyHandler handler = new ServerProxyHandler(mbsc, jmx.buildName(ServerMBean.TYPE, ServerMBean.NAME));
+ Class<?>[] ifaces = { ServerMBean.class };
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ ServerMBean server = (ServerMBean) Proxy.newProxyInstance(tcl, ifaces,handler);
+ server.shutdown();
+ }
+
+ private static Properties loadConfiguration(String configFile) {
+ File f = new File (configFile);
+ if (!f.exists()) {
+ System.out.println("Missing the bootstrap properties file, failed to start"); //$NON-NLS-1$
+ System.exit(-3);
+ }
+
+ Properties props = null;
+ try {
+ FileReader bootProperties = new FileReader(f);
+ props = new Properties();
+ props.load(bootProperties);
+
+ // enable socket communication by default.
+ props.setProperty(DQPEmbeddedProperties.ENABLE_SOCKETS, Boolean.TRUE.toString());
+ props.setProperty(DQPEmbeddedProperties.BOOTURL, f.getCanonicalPath());
+
+ } catch (IOException e) {
+ System.out.println("Failed to load bootstrap properties file."); //$NON-NLS-1$
+ e.printStackTrace();
+ System.exit(-3);
+ }
+ return props;
+ }
+
+ /**
+ * Taken from JBoss AS Shutdown.java class.
+ */
+ private static class ServerProxyHandler implements InvocationHandler {
+ ObjectName serverName;
+ MBeanServerConnection server;
+
+ ServerProxyHandler(MBeanServerConnection server, ObjectName serverName) {
+ this.server = server;
+ this.serverName = serverName;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ String methodName = method.getName();
+ Class[] sigTypes = method.getParameterTypes();
+ ArrayList sigStrings = new ArrayList();
+ for (int s = 0; s < sigTypes.length; s++) {
+ sigStrings.add(sigTypes[s].getName());
+ }
+ String[] sig = new String[sigTypes.length];
+ sigStrings.toArray(sig);
+ Object value = null;
+ try {
+ value = server.invoke(serverName, methodName, args, sig);
+ } catch (UndeclaredThrowableException e) {
+ throw e.getUndeclaredThrowable();
+ }
+ return value;
+ }
+ }
+
+}
Property changes on: trunk/embedded/src/main/java/org/teiid/Shutdown.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/AdminAuthorizationInterceptor.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -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.transport;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+import com.metamatrix.admin.RolesAllowed;
+import com.metamatrix.admin.api.server.AdminRoles;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.api.exception.security.AuthorizationException;
+import com.metamatrix.client.ExceptionUtil;
+import com.metamatrix.common.comm.platform.CommPlatformPlugin;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.log.MessageLevel;
+import com.metamatrix.core.util.ArgCheck;
+import com.metamatrix.dqp.service.AuditMessage;
+import com.metamatrix.dqp.service.AuthorizationService;
+import com.metamatrix.dqp.util.LogConstants;
+import com.metamatrix.platform.security.api.SessionToken;
+
+/**
+ * Call authorization service to make sure the current admin user has the
+ * proper admin role(s) to perform the method.
+ */
+public class AdminAuthorizationInterceptor implements InvocationHandler {
+
+ private final Object service;
+ private AuthorizationService authAdmin;
+
+
+ /**
+ * Ctor.
+ * @param securityContextFactory
+ * @param authorizationService
+ * @param methodNames
+ * @since 4.3
+ */
+ public AdminAuthorizationInterceptor(AuthorizationService authorizationService, Object service) {
+ ArgCheck.isNotNull(authorizationService);
+ this.authAdmin = authorizationService;
+ this.service = service;
+ }
+
+ /**
+ *
+ * @param invocation
+ * @param securityContext
+ * @throws AuthorizationException
+ * @throws MetaMatrixProcessingException
+ * @since 4.3
+ */
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ SessionToken adminToken = DQPWorkContext.getWorkContext().getSessionToken();
+
+ Method serviceMethod = service.getClass().getMethod(method.getName(), method.getParameterTypes());
+ RolesAllowed allowed = serviceMethod.getAnnotation(RolesAllowed.class);
+ if (allowed == null) {
+ allowed = method.getAnnotation(RolesAllowed.class);
+ if (allowed == null) {
+ allowed = serviceMethod.getDeclaringClass().getAnnotation(RolesAllowed.class);
+ if (allowed == null) {
+ allowed = method.getDeclaringClass().getAnnotation(RolesAllowed.class);
+ }
+ }
+ }
+ if (allowed == null || allowed.value() == null) {
+ throw new MetaMatrixRuntimeException("Could not determine roles allowed for admin method"); //$NON-NLS-1$
+ }
+
+ boolean authorized = false;
+ AuditMessage msg = new AuditMessage(LogConstants.CTX_ADMIN_API, Arrays.toString(allowed.value())+"-request", adminToken.getUsername(), new Object[]{method.getName()}); //$NON-NLS-1$
+ LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
+
+ for (int i = 0; i < allowed.value().length; i++) {
+ String requiredRoleName = allowed.value()[i];
+ if (AdminRoles.RoleName.ANONYMOUS.equalsIgnoreCase(requiredRoleName)) {
+ authorized = true;
+ break;
+ }
+
+ if (authAdmin.isCallerInRole(adminToken, requiredRoleName)) {
+ authorized = true;
+ break;
+ }
+ }
+ if (!authorized) {
+ msg = new AuditMessage(LogConstants.CTX_ADMIN_API, Arrays.toString(allowed.value())+"-denied", adminToken.getUsername(), new Object[]{method.getName()}); //$NON-NLS-1$
+ LogManager.log(MessageLevel.INFO, LogConstants.CTX_AUDITLOGGING, msg);
+
+ Object[] msgParts = buildAuditMessage(adminToken, Arrays.toString(allowed.value()), method);
+ String errMsg = CommPlatformPlugin.Util.getString("AdminAuthorizationInterceptor.Admin_not_authorized", msgParts); //$NON-NLS-1$
+ throw ExceptionUtil.convertException(method, new AuthorizationException(errMsg));
+ }
+ try {
+ return method.invoke(service, args);
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+
+ /**
+ * Builds an audit msg using given values including method signature string from given invocation using method
+ * name and argument values.
+ * @param securityContext
+ * @param adminToken
+ * @param requiredRoleName
+ * @param invocation
+ * @return
+ * @since 5.0
+ */
+ private Object[] buildAuditMessage(SessionToken adminToken, String requiredRoleName, Method invocation) {
+ return new Object[] {adminToken.getUsername(), adminToken.getSessionID().toString(), requiredRoleName, invocation.getName()};
+ }
+
+}
Copied: trunk/embedded/src/main/java/org/teiid/transport/ChannelListener.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/ChannelListener.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/ChannelListener.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/ChannelListener.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,39 @@
+/*
+ * 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.transport;
+
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.platform.socket.ObjectChannel;
+
+public interface ChannelListener {
+
+ public interface ChannelListenerFactory {
+ ChannelListener createChannelListener(ObjectChannel channel);
+ }
+
+ void receivedMessage(Object msg) throws CommunicationException;
+
+ void exceptionOccurred(Throwable t);
+
+ void onConnection() throws CommunicationException;
+}
\ No newline at end of file
Property changes on: trunk/embedded/src/main/java/org/teiid/transport/ChannelListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/embedded/src/main/java/org/teiid/transport/ClientInstance.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ClientInstance.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/ClientInstance.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/ClientInstance.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,58 @@
+/*
+ * 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.transport;
+
+import java.io.Serializable;
+
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+import com.metamatrix.common.comm.api.Message;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.util.crypto.Cryptor;
+
+/**
+ * Represents a ClientConnection from the server's point of view. This interface
+ * can be used by a ServerListener implementation to manage the incoming
+ * client connections, retrieve information about a particular connection,
+ * and send a message to a particular connection in the asynchronous message scenario.
+ */
+public interface ClientInstance {
+
+ /**
+ * Send a message to this particular client using the asynch message key.
+ * @param message The message to send
+ * @param messageKey The key sent with the asynch query
+ * @throws CommunicationException If an error occurs during the send
+ */
+ void send(Message message, Serializable messageKey);
+
+ /**
+ * Shutdown the server's connection to the client.
+ * @throws CommunicationException If an error occurs during the shutdown
+ */
+ void shutdown() throws CommunicationException;
+
+ Cryptor getCryptor();
+
+ DQPWorkContext getWorkContext();
+}
Copied: trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java (from rev 1067, trunk/embedded/src/main/java/com/metamatrix/jdbc/transport/LocalServerConnection.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,141 @@
+/*
+ * 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.transport;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.client.ExceptionUtil;
+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;
+import com.metamatrix.dqp.client.ClientSideDQP;
+import com.metamatrix.jdbc.JDBCPlugin;
+import com.metamatrix.platform.security.api.ILogon;
+import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.SessionToken;
+
+public class LocalServerConnection implements ServerConnection {
+
+ 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{
+
+ this.clientServices = clientServices;
+
+ //Initialize the workContext
+ workContext = new DQPWorkContext();
+ DQPWorkContext.setWorkContext(workContext);
+
+ this.result = authenticate(connectionProperties);
+
+ this.listener = listener;
+
+ if (this.listener != null) {
+ this.listener.connectionAdded(this);
+ }
+
+ this.classLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ public synchronized LogonResult authenticate(Properties connProps) throws ConnectionException, CommunicationException {
+ try {
+ LogonResult logonResult = getService(ILogon.class).logon(connProps);
+ return logonResult;
+ } catch (LogonException e) {
+ // Propagate the original message as it contains the message we want
+ // to give to the user
+ throw new ConnectionException(e, e.getMessage());
+ } catch (MetaMatrixComponentException e) {
+ if (e.getCause() instanceof CommunicationException) {
+ throw (CommunicationException)e.getCause();
+ }
+ throw new CommunicationException(e, CommPlatformPlugin.Util.getString("PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to_MetaMatrix")); //$NON-NLS-1$
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public <T> T getService(final Class<T> iface) {
+
+ return (T) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new InvocationHandler() {
+
+ public Object invoke(Object arg0, Method arg1, Object[] arg2)
+ throws Throwable {
+ if (!isOpen()) {
+ throw ExceptionUtil.convertException(arg1, new MetaMatrixComponentException(JDBCPlugin.Util.getString("LocalTransportHandler.session_inactive"))); //$NON-NLS-1$
+ }
+ ClassLoader current = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(classLoader);
+ DQPWorkContext.setWorkContext(workContext);
+ try {
+ return arg1.invoke(clientServices.getClientService(iface), arg2);
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ } finally {
+ Thread.currentThread().setContextClassLoader(current);
+ }
+ }
+ });
+ }
+
+ public boolean isOpen() {
+ return !shutdown;
+ }
+
+ public void shutdown() {
+ if (shutdown) {
+ return;
+ }
+ if (this.listener != null) {
+ this.listener.connectionRemoved(this);
+ }
+ this.shutdown = true;
+ }
+
+ public LogonResult getLogonResult() {
+ return result;
+ }
+
+ @Override
+ public boolean isSameInstance(ServerConnection conn) throws CommunicationException {
+ return (conn instanceof LocalServerConnection);
+ }
+}
Property changes on: trunk/embedded/src/main/java/org/teiid/transport/LocalServerConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java (from rev 1068, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/LogonImpl.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/LogonImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,179 @@
+/*
+ * 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.transport;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.CredentialMap;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
+import com.metamatrix.api.exception.ComponentNotFoundException;
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.api.exception.security.MetaMatrixAuthenticationException;
+import com.metamatrix.api.exception.security.SessionServiceException;
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.dqp.client.ResultsFuture;
+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;
+import com.metamatrix.platform.security.api.MetaMatrixSessionID;
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
+import com.metamatrix.platform.security.api.SessionToken;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+import com.metamatrix.platform.util.ProductInfoConstants;
+
+public class LogonImpl implements ILogon {
+
+ private SessionServiceInterface service;
+ private String clusterName;
+
+ public LogonImpl(SessionServiceInterface service, String clusterName) {
+ this.service = service;
+ this.clusterName = clusterName;
+ }
+
+ public LogonResult logon(Properties connProps) throws LogonException,
+ ComponentNotFoundException {
+
+ String applicationName = connProps.getProperty(MMURL.CONNECTION.APP_NAME);
+ // user may be null if using trustedToken to log on
+ String user = connProps.getProperty(MMURL.CONNECTION.USER_NAME);
+ // password may be null if using trustedToken to log on
+ String password = connProps.getProperty(MMURL.CONNECTION.PASSWORD);
+ Credentials credential = null;
+ if (password != null) {
+ credential = new Credentials(password.toCharArray());
+ }
+
+ if(connProps.containsKey(ConnectionProperties.PROP_CREDENTIALS)) {
+ handleCredentials(connProps, user, password);
+ }
+
+ Object payload = connProps.get(MMURL.CONNECTION.CLIENT_TOKEN_PROP);
+
+ try {
+ MetaMatrixSessionInfo sessionInfo = service.createSession(user,
+ credential, (Serializable) payload, applicationName,
+ connProps);
+ // logon
+ 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$
+ return new LogonResult(sessionInfo.getSessionToken(), sessionInfo.getProductInfo(), clusterName);
+ } catch (MetaMatrixAuthenticationException e) {
+ throw new LogonException(e, e.getMessage());
+ } catch (SessionServiceException e) {
+ throw new LogonException(e, e.getMessage());
+ }
+ }
+
+ private void handleCredentials(Properties connProps, String user, String password) throws LogonException {
+
+ // 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$
+ }
+
+ // Parse credentials and store CredentialMap as session token
+ try {
+ String credentials = connProps.getProperty(ConnectionProperties.PROP_CREDENTIALS);
+ CredentialMap credentialMap = null;
+ boolean defaultToLogon = false;
+ if(credentials.startsWith(ConnectionProperties.DEFAULT_TO_LOGON)) {
+ defaultToLogon = true;
+ }
+ int parenIndex = credentials.indexOf("("); //$NON-NLS-1$
+ if(parenIndex >= 0) {
+ credentialMap = CredentialMap.parseCredentials(credentials.substring(parenIndex));
+ } else {
+ credentialMap = new CredentialMap();
+ }
+ if(defaultToLogon) {
+ credentialMap.setDefaultCredentialMode(CredentialMap.MODE_USE_DEFAULTS_GLOBALLY);
+ Map<String, String> defaultCredentials = new HashMap<String, String>();
+ defaultCredentials.put(CredentialMap.USER_KEYWORD, user);
+ defaultCredentials.put(CredentialMap.PASSWORD_KEYWORD, password);
+ credentialMap.setDefaultCredentials(defaultCredentials);
+ } else {
+ credentialMap.setDefaultCredentialMode(CredentialMap.MODE_IGNORE_DEFAULTS);
+ }
+ connProps.put(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD, credentialMap);
+ } catch(ConnectorException e) {
+ throw new LogonException(e.getMessage());
+ }
+
+ // Remove credentials from info properties
+ connProps.remove(ConnectionProperties.PROP_CREDENTIALS);
+ }
+
+ private MetaMatrixSessionID updateDQPContext(MetaMatrixSessionInfo sessionInfo) {
+ MetaMatrixSessionID sessionID = sessionInfo.getSessionID();
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ workContext.setSessionToken(sessionInfo.getSessionToken());
+ workContext.setAppName(sessionInfo.getApplicationName());
+ workContext.setTrustedPayload(sessionInfo.getTrustedToken());
+ workContext.setVdbName(sessionInfo.getProductInfo(ProductInfoConstants.VIRTUAL_DB));
+ workContext.setVdbVersion(sessionInfo.getProductInfo(ProductInfoConstants.VDB_VERSION));
+ return sessionID;
+ }
+
+ public ResultsFuture<?> logoff() throws InvalidSessionException, MetaMatrixComponentException {
+ try {
+ this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
+ } catch (SessionServiceException e) {
+ throw new MetaMatrixComponentException(e);
+ }
+ return null;
+ }
+
+ public ResultsFuture<?> ping() throws InvalidSessionException,MetaMatrixComponentException {
+ this.service.pingServer(DQPWorkContext.getWorkContext().getSessionId());
+ return null;
+ }
+
+ @Override
+ public void assertIdentity(SessionToken sessionId) throws InvalidSessionException, MetaMatrixComponentException {
+ MetaMatrixSessionInfo sessionInfo;
+ try {
+ sessionInfo = this.service.validateSession(sessionId.getSessionID());
+ } catch (SessionServiceException e) {
+ throw new MetaMatrixComponentException(e);
+ }
+
+ if (!sessionInfo.getSessionToken().equals(sessionInfo.getSessionToken())) {
+ throw new InvalidSessionException();
+ }
+ this.updateDQPContext(sessionInfo);
+ }
+
+}
Copied: trunk/embedded/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SSLAwareChannelHandler.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,251 @@
+/*
+ * 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.transport;
+
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.net.ssl.SSLEngine;
+
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelFutureListener;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.DefaultChannelPipeline;
+import org.jboss.netty.channel.ExceptionEvent;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelHandler;
+import org.jboss.netty.handler.codec.serialization.ObjectDecoder;
+import org.jboss.netty.handler.codec.serialization.ObjectEncoder;
+import org.jboss.netty.handler.ssl.SslHandler;
+
+import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
+import com.metamatrix.common.comm.platform.CommPlatformPlugin;
+import com.metamatrix.common.comm.platform.socket.ObjectChannel;
+
+/**
+ * Main class for creating Netty Nio Channels
+ */
+
+(a)ChannelPipelineCoverage(ChannelPipelineCoverage.ALL)
+public class SSLAwareChannelHandler extends SimpleChannelHandler implements ChannelPipelineFactory {
+
+ public class ObjectChannelImpl implements ObjectChannel {
+ private final Channel channel;
+
+ public ObjectChannelImpl(Channel channel) {
+ this.channel = channel;
+ }
+
+ public void close() {
+ channel.close();
+ }
+
+ public boolean isOpen() {
+ return channel.isOpen();
+ }
+
+ public SocketAddress getRemoteAddress() {
+ return channel.getRemoteAddress();
+ }
+
+ @Override
+ public Object read() throws IOException,
+ ClassNotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Future<?> write(Object msg) {
+ final ChannelFuture future = channel.write(msg);
+ future.addListener(completionListener);
+ return new Future<Void>() {
+
+ @Override
+ public boolean cancel(boolean arg0) {
+ return future.cancel();
+ }
+
+ @Override
+ public Void get() throws InterruptedException,
+ ExecutionException {
+ future.await();
+ if (!future.isSuccess()) {
+ throw new ExecutionException(future.getCause());
+ }
+ return null;
+ }
+
+ @Override
+ public Void get(long arg0, TimeUnit arg1)
+ throws InterruptedException, ExecutionException,
+ TimeoutException {
+ if (future.await(arg0, arg1)) {
+ if (!future.isSuccess()) {
+ throw new ExecutionException(future.getCause());
+ }
+ return null;
+ }
+ throw new TimeoutException();
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return future.isCancelled();
+ }
+
+ @Override
+ public boolean isDone() {
+ return future.isDone();
+ }
+ };
+ }
+ }
+
+ private final ChannelListener.ChannelListenerFactory listenerFactory;
+ private final SSLEngine engine;
+ private final ClassLoader classLoader;
+ private Map<Channel, ChannelListener> listeners = Collections.synchronizedMap(new HashMap<Channel, ChannelListener>());
+ private AtomicLong objectsRead = new AtomicLong(0);
+ private AtomicLong objectsWritten = new AtomicLong(0);
+ private volatile int maxChannels;
+
+ private ChannelFutureListener completionListener = new ChannelFutureListener() {
+
+ @Override
+ public void operationComplete(ChannelFuture arg0)
+ throws Exception {
+ if (arg0.isSuccess()) {
+ objectsWritten.getAndIncrement();
+ }
+ }
+
+ };
+
+ public SSLAwareChannelHandler(ChannelListener.ChannelListenerFactory listenerFactory,
+ SSLEngine engine, ClassLoader classloader) {
+ this.listenerFactory = listenerFactory;
+ this.engine = engine;
+ this.classLoader = classloader;
+ }
+
+ @Override
+ public void channelConnected(ChannelHandlerContext ctx,
+ final ChannelStateEvent e) throws Exception {
+ ChannelListener listener = this.listenerFactory.createChannelListener(new ObjectChannelImpl(e.getChannel()));
+ synchronized (this.listeners) {
+ this.listeners.put(e.getChannel(), listener);
+ maxChannels = Math.max(maxChannels, this.listeners.size());
+ }
+ if (engine != null) {
+ SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
+ sslHandler.handshake(e.getChannel()).addListener(new ChannelFutureListener() {
+ public void operationComplete(ChannelFuture arg0)
+ throws Exception {
+ onConnection(e.getChannel());
+ }
+ });
+ } else {
+ onConnection(e.getChannel());
+ }
+ }
+
+ private void onConnection(Channel channel) throws Exception {
+ ChannelListener listener = this.listeners.get(channel);
+ if (listener != null) {
+ listener.onConnection();
+ }
+ }
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx,
+ ExceptionEvent e) throws Exception {
+ ChannelListener listener = this.listeners.get(e.getChannel());
+ if (listener != null) {
+ listener.exceptionOccurred(e.getCause());
+ }
+ e.getChannel().close();
+ }
+
+ @Override
+ public void messageReceived(ChannelHandlerContext ctx,
+ MessageEvent e) throws Exception {
+ objectsRead.getAndIncrement();
+ ChannelListener listener = this.listeners.get(e.getChannel());
+ if (listener != null) {
+ listener.receivedMessage(e.getMessage());
+ }
+ }
+
+ @Override
+ public void channelDisconnected(ChannelHandlerContext ctx,
+ ChannelStateEvent e) throws Exception {
+ ChannelListener listener = this.listeners.remove(e.getChannel());
+ if (listener != null) {
+ listener.exceptionOccurred(new SingleInstanceCommunicationException(CommPlatformPlugin.Util.getString("SSLAwareChannelHandler.channel_closed"))); //$NON-NLS-1$
+ }
+ }
+
+ public ChannelPipeline getPipeline() throws Exception {
+ ChannelPipeline pipeline = new DefaultChannelPipeline();
+
+ if (engine != null) {
+ pipeline.addLast("ssl", new SslHandler(engine)); //$NON-NLS-1$
+ }
+ pipeline.addLast("decoder", new ObjectDecoder(1 << 24, classLoader)); //$NON-NLS-1$
+ pipeline.addLast("encoder", new ObjectEncoder()); //$NON-NLS-1$
+ pipeline.addLast("handler", this); //$NON-NLS-1$
+ return pipeline;
+ }
+
+ public long getObjectsRead() {
+ return this.objectsRead.get();
+ }
+
+ public long getObjectsWritten() {
+ return this.objectsWritten.get();
+ }
+
+ public int getConnectedChannels() {
+ return this.listeners.size();
+ }
+
+ public int getMaxConnectedChannels() {
+ return this.maxChannels;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/embedded/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/embedded/src/main/java/org/teiid/transport/SSLConfiguration.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/net/ServerSocketConfiguration.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/SSLConfiguration.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/SSLConfiguration.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,152 @@
+/*
+ * 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.transport;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.Arrays;
+import java.util.Properties;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+
+import com.metamatrix.common.comm.platform.socket.SocketUtil;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.common.util.crypto.CryptoException;
+import com.metamatrix.common.util.crypto.CryptoUtil;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.Assertion;
+
+
+public class SSLConfiguration {
+
+ private static final String SSL_ENABLED = "ssl.enabled"; //$NON-NLS-1$
+
+ private static final String KEYSTORE_FILENAME = "ssl.keystore.filename"; //$NON-NLS-1$
+ private static final String KEYSTORE_PASSWORD = "ssl.keystore.Password"; //$NON-NLS-1$
+ private static final String KEYSTORE_TYPE = "ssl.keystoretype"; //$NON-NLS-1$
+ private static final String SSL_PROTOCOL = "ssl.protocol"; //$NON-NLS-1$
+ private static final String KEY_MANAGER_ALGORITHM = "ssl.keymanagementalgorithm"; //$NON-NLS-1$
+
+ private static final String TRUSTSTORE_FILENAME = "ssl.truststore.filename"; //$NON-NLS-1$
+ private static final String TRUSTSTORE_PASSWORD = "ssl.truststore.Password"; //$NON-NLS-1$
+ private static final String AUTHENTICATION_MODE = "ssl.authenticationMode"; //$NON-NLS-1$
+ private static final String CLIENT_ENCRYPTION_ENABLED = "client.encryption.enabled"; //$NON-NLS-1$
+
+ private static final String ONEWAY = "1-way"; //$NON-NLS-1$ - one way is the default
+ private static final String TWOWAY = "2-way"; //$NON-NLS-1$
+ private static final String ANONYMOUS = "anonymous"; //$NON-NLS-1$
+
+ private static final String DEFAULT_SSL_PROTOCOL = "SSLv3"; //$NON-NLS-1$
+ private static final String DEFAULT_KEYSTORE_TYPE = "JKS"; //$NON-NLS-1$
+
+ /*
+ * External SSL resource settings
+ */
+ private boolean ssl_enabled;
+ private String sslProtocol = DEFAULT_SSL_PROTOCOL;
+ private String keyManagerFactoryAlgorithm;
+ private String keyStoreType = DEFAULT_KEYSTORE_TYPE;
+ private String keyStoreFileName;
+ private String keyStorePassword = ""; //$NON-NLS-1$
+ private String trustStoreFileName;
+ private String trustStorePassword = ""; //$NON-NLS-1$
+ private String authenticationMode = ONEWAY;
+
+ /*
+ * Client encryption property. This may belong somewhere else
+ */
+ boolean client_encryption_enabled = false;
+
+ public void init(Properties props) {
+ ssl_enabled = PropertiesUtils.getBooleanProperty(props, SSL_ENABLED, false);
+
+ if (ssl_enabled) {
+ client_encryption_enabled = PropertiesUtils.getBooleanProperty(props, CLIENT_ENCRYPTION_ENABLED, true);
+
+ keyStoreFileName = props.getProperty(KEYSTORE_FILENAME);
+ try {
+ keyStorePassword = CryptoUtil.stringDecrypt(props.getProperty(KEYSTORE_PASSWORD, "")); //$NON-NLS-1$
+ } catch (CryptoException err) {
+ throw new MetaMatrixRuntimeException(err);
+ }
+
+ keyStoreType = props.getProperty(KEYSTORE_TYPE, DEFAULT_KEYSTORE_TYPE);
+
+ keyManagerFactoryAlgorithm = props.getProperty(KEY_MANAGER_ALGORITHM, KeyManagerFactory.getDefaultAlgorithm());
+
+ authenticationMode = props.getProperty(AUTHENTICATION_MODE);
+
+ trustStoreFileName = props.getProperty(TRUSTSTORE_FILENAME);
+ try {
+ trustStorePassword = CryptoUtil.stringDecrypt(props.getProperty(TRUSTSTORE_PASSWORD, "")); //$NON-NLS-1$
+ } catch (CryptoException err) {
+ throw new MetaMatrixRuntimeException(err);
+ }
+
+ sslProtocol = props.getProperty(SSL_PROTOCOL, DEFAULT_SSL_PROTOCOL);
+ }
+ }
+
+ public SSLEngine getServerSSLEngine() throws IOException, GeneralSecurityException {
+ if (!isServerSSLEnabled()) {
+ return null;
+ }
+
+ // Use the SSLContext to create an SSLServerSocketFactory.
+ SSLContext context = null;
+
+ if (ANONYMOUS.equals(authenticationMode)) {
+ context = SocketUtil.getAnonSSLContext();
+ } else {
+ context = SocketUtil.getSSLContext(keyStoreFileName,
+ keyStorePassword,
+ trustStoreFileName,
+ trustStorePassword,
+ keyManagerFactoryAlgorithm,
+ keyStoreType,
+ sslProtocol);
+ }
+
+ SSLEngine result = context.createSSLEngine();
+ result.setUseClientMode(false);
+ if (ANONYMOUS.equals(authenticationMode)) {
+ Assertion.assertTrue(Arrays.asList(result.getSupportedCipherSuites()).contains(SocketUtil.ANON_CIPHER_SUITE));
+ result.setEnabledCipherSuites(new String[] {
+ SocketUtil.ANON_CIPHER_SUITE
+ });
+ }
+ result.setNeedClientAuth(TWOWAY.equals(authenticationMode));
+ return result;
+ }
+
+ public boolean isServerSSLEnabled() {
+ return ssl_enabled && CryptoUtil.isEncryptionEnabled();
+ }
+
+ public boolean isClientEncryptionEnabled() {
+ return CryptoUtil.isEncryptionEnabled() && client_encryption_enabled;
+ }
+
+}
Property changes on: trunk/embedded/src/main/java/org/teiid/transport/SSLConfiguration.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/ServerWorkItem.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,180 @@
+/*
+ * 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.transport;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.concurrent.ExecutionException;
+
+import javax.crypto.SealedObject;
+
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+import com.metamatrix.admin.api.exception.AdminProcessingException;
+import com.metamatrix.api.exception.ComponentNotFoundException;
+import com.metamatrix.api.exception.ExceptionHolder;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.comm.ClientServiceRegistry;
+import com.metamatrix.common.comm.api.Message;
+import com.metamatrix.common.comm.platform.socket.client.ServiceInvocationStruct;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.common.util.crypto.CryptoException;
+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.platform.security.api.ILogon;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+
+public class ServerWorkItem implements Runnable {
+ private final ClientInstance socketClientInstance;
+ private final Serializable messageKey;
+ private final Message message;
+ private final ClientServiceRegistry server;
+ private final SessionServiceInterface sessionService;
+
+ public ServerWorkItem(ClientInstance socketClientInstance,
+ Serializable messageKey, Message message,
+ ClientServiceRegistry server, SessionServiceInterface sessionService) {
+ this.socketClientInstance = socketClientInstance;
+ this.messageKey = messageKey;
+ this.message = message;
+ this.server = server;
+ this.sessionService = sessionService;
+ }
+
+ /**
+ * main entry point for remote method calls. encryption/decryption is
+ * handled here so that it won't be done by the io thread
+ */
+ public void run() {
+ DQPWorkContext.setWorkContext(this.socketClientInstance.getWorkContext());
+ Message result = null;
+ String service = null;
+ final boolean encrypt = message.getContents() instanceof SealedObject;
+ try {
+ message.setContents(this.socketClientInstance.getCryptor().unsealObject(message.getContents()));
+
+ if (!(message.getContents() instanceof ServiceInvocationStruct)) {
+ throw new AssertionError("unknown message contents"); //$NON-NLS-1$
+ }
+ 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$
+ }
+ if (!(instance instanceof ILogon)) {
+ DQPWorkContext workContext = this.socketClientInstance.getWorkContext();
+ sessionService.validateSession(workContext.getSessionId());
+ }
+ service = serviceStruct.targetClass;
+ ReflectionHelper helper = new ReflectionHelper(instance.getClass());
+ Method m = helper.findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
+ Object methodResult;
+ try {
+ methodResult = m.invoke(instance, serviceStruct.args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ if (ResultsFuture.class.isAssignableFrom(m.getReturnType()) && methodResult != null) {
+ ResultsFuture<Serializable> future = (ResultsFuture<Serializable>) methodResult;
+ future.addCompletionListener(new ResultsFuture.CompletionListener<Serializable>() {
+
+ public void onCompletion(
+ ResultsFuture<Serializable> completedFuture) {
+ Message asynchResult = new Message();
+ try {
+ asynchResult.setContents(completedFuture.get());
+ } catch (InterruptedException e) {
+ asynchResult.setContents(processException(e, serviceStruct.targetClass));
+ } catch (ExecutionException e) {
+ asynchResult.setContents(processException(e.getCause(), serviceStruct.targetClass));
+ }
+ sendResult(asynchResult, encrypt);
+ }
+
+ });
+ } else { // synch call
+ Message resultHolder = new Message();
+ resultHolder.setContents((Serializable)methodResult);
+ result = resultHolder;
+ }
+ } catch (Throwable t) {
+ Message holder = new Message();
+ holder.setContents(processException(t, service));
+ result = holder;
+ }
+ if (result != null) {
+ sendResult(result, encrypt);
+ }
+ }
+
+ void sendResult(Message result, boolean encrypt) {
+ if (encrypt) {
+ try {
+ result.setContents(socketClientInstance.getCryptor().sealObject(result.getContents()));
+ } catch (CryptoException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ }
+ socketClientInstance.send(result, messageKey);
+ }
+
+ private Serializable processException(Throwable e, String service) {
+ String context = null;
+ if (service != null) {
+ context = this.server.getLoggingContextForService(service);
+ }
+ if (context == null) {
+ context = LogConstants.CTX_SERVER;
+ }
+ // Case 5558: Differentiate between system level errors and
+ // processing errors. Only log system level errors as errors,
+ // log the processing errors as warnings only
+ if (e instanceof MetaMatrixProcessingException) {
+ logProcessingException(e, context);
+ } 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$
+ }
+
+ return new ExceptionHolder(e);
+ }
+
+ private void logProcessingException(Throwable e, String context) {
+ Throwable cause = e;
+ while (cause.getCause() != null && cause != cause.getCause()) {
+ cause = cause.getCause();
+ }
+ 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$
+ }
+
+}
\ No newline at end of file
Copied: trunk/embedded/src/main/java/org/teiid/transport/SocketClientInstance.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/SocketClientInstance.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/SocketClientInstance.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,158 @@
+/*
+ * 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.transport;
+
+import java.io.Serializable;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+import com.metamatrix.common.comm.ClientServiceRegistry;
+import com.metamatrix.common.comm.api.Message;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.platform.CommPlatformPlugin;
+import com.metamatrix.common.comm.platform.socket.Handshake;
+import com.metamatrix.common.comm.platform.socket.ObjectChannel;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.queue.WorkerPool;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.common.util.crypto.CryptoException;
+import com.metamatrix.common.util.crypto.Cryptor;
+import com.metamatrix.common.util.crypto.DhKeyGenerator;
+import com.metamatrix.common.util.crypto.NullCryptor;
+import com.metamatrix.core.log.MessageLevel;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+
+/**
+ * Sockets implementation of the communication framework class representing the server's view of a client connection.
+ * Implements the server-side of the sockets messaging protocol.
+ * The client side of the protocol is implemented in SocketServerInstance.
+ * Users of this class are expected to provide a WorkerPool for processing incoming messages. Users must also call read().
+ * Users also provide a ServerListener implementation. The ServerListener is the application level object
+ * processing the application level messages.
+ */
+public class SocketClientInstance implements ChannelListener, ClientInstance {
+
+ private final ObjectChannel objectSocket;
+ private final WorkerPool workerPool;
+ private final ClientServiceRegistry server;
+ private Cryptor cryptor;
+ private boolean usingEncryption;
+ private DhKeyGenerator keyGen;
+ private DQPWorkContext workContext = new DQPWorkContext();
+ private SessionServiceInterface sessionService;
+
+ public SocketClientInstance(ObjectChannel objectSocket, WorkerPool workerPool, ClientServiceRegistry server, boolean isClientEncryptionEnabled, SessionServiceInterface sessionService) {
+ this.objectSocket = objectSocket;
+ this.workerPool = workerPool;
+ this.server = server;
+ this.usingEncryption = isClientEncryptionEnabled;
+ this.sessionService = sessionService;
+ SocketAddress address = this.objectSocket.getRemoteAddress();
+ if (address instanceof InetSocketAddress) {
+ InetSocketAddress addr = (InetSocketAddress)address;
+ this.workContext.setClientAddress(addr.getAddress().getHostAddress());
+ this.workContext.setClientHostname(addr.getHostName());
+ }
+ }
+
+ public void send(Message message, Serializable messageKey) {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_SERVER, " message: " + message + " for request ID:" + messageKey); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ message.setMessageKey(messageKey);
+ objectSocket.write(message);
+ }
+
+ /**
+ * @return Returns the cryptor.
+ */
+ public Cryptor getCryptor() {
+ return this.cryptor;
+ }
+
+ public void exceptionOccurred(Throwable t) {
+ LogManager.logDetail(LogConstants.CTX_SERVER, t, "Unhandled exception, closing client instance"); //$NON-NLS-1$
+ }
+
+ public void onConnection() throws CommunicationException {
+ Handshake handshake = new Handshake();
+ handshake.setVersion(SocketListener.getVersionInfo());
+
+ if (usingEncryption) {
+ keyGen = new DhKeyGenerator();
+ byte[] publicKey;
+ try {
+ publicKey = keyGen.createPublicKey();
+ } catch (CryptoException e) {
+ throw new CommunicationException(e);
+ }
+ handshake.setPublicKey(publicKey);
+ }
+ this.objectSocket.write(handshake);
+ }
+
+ private void receivedHahdshake(Handshake handshake) throws CommunicationException {
+ if (usingEncryption) {
+ byte[] returnedPublicKey = handshake.getPublicKey();
+
+ //ensure the key information
+ if (returnedPublicKey == null) {
+ throw new CommunicationException(CommPlatformPlugin.Util.getString("SocketClientInstance.invalid_sessionkey")); //$NON-NLS-1$
+ }
+
+ try {
+ this.cryptor = keyGen.getSymmetricCryptor(returnedPublicKey);
+ } catch (CryptoException e) {
+ throw new CommunicationException(e);
+ }
+ this.keyGen = null;
+ } else {
+ this.cryptor = new NullCryptor();
+ }
+ }
+
+ public void receivedMessage(Object msg) throws CommunicationException {
+ if (msg instanceof Message) {
+ processMessagePacket((Message)msg);
+ } else if (msg instanceof Handshake) {
+ receivedHahdshake((Handshake)msg);
+ }
+ }
+
+ private void processMessagePacket(Message packet) {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_SERVER, "processing message:" + packet); //$NON-NLS-1$
+ }
+ workerPool.execute(new ServerWorkItem(this, packet.getMessageKey(), packet, this.server, this.sessionService));
+ }
+
+ public void shutdown() throws CommunicationException {
+ this.objectSocket.close();
+ }
+
+ public DQPWorkContext getWorkContext() {
+ return this.workContext;
+ }
+}
Copied: trunk/embedded/src/main/java/org/teiid/transport/SocketListener.java (from rev 1067, trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java)
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/SocketListener.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/SocketListener.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,133 @@
+/*
+ * 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.transport;
+
+import java.net.InetSocketAddress;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.net.ssl.SSLEngine;
+
+import org.jboss.netty.bootstrap.ServerBootstrap;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
+import org.teiid.transport.ChannelListener.ChannelListenerFactory;
+
+import com.metamatrix.common.comm.ClientServiceRegistry;
+import com.metamatrix.common.comm.platform.socket.ObjectChannel;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.queue.WorkerPool;
+import com.metamatrix.common.queue.WorkerPoolFactory;
+import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.util.ApplicationInfo;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.core.log.MessageLevel;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+import com.metamatrix.platform.vm.controller.SocketListenerStats;
+
+/**
+ * Server-side class to listen for new connection requests and create a SocketClientConnection for each connection request.
+ */
+public class SocketListener implements ChannelListenerFactory {
+ private ClientServiceRegistry server;
+ private SSLAwareChannelHandler channelHandler;
+ private Channel serverChanel;
+ private boolean isClientEncryptionEnabled;
+ private SessionServiceInterface sessionService;
+ private WorkerPool workerPool;
+ private ExecutorService nettyPool;
+
+ /**
+ *
+ * @param port
+ * @param bindaddress
+ * @param server
+ * @param inputBufferSize
+ * @param outputBufferSize
+ * @param workerPool
+ * @param engine null if SSL is disabled
+ */
+ public SocketListener(int port, String bindAddress, ClientServiceRegistry server, int inputBufferSize,
+ int outputBufferSize, int maxWorkers, SSLEngine engine, boolean isClientEncryptionEnabled, SessionServiceInterface sessionService) {
+ this.isClientEncryptionEnabled = isClientEncryptionEnabled;
+ this.sessionService = sessionService;
+ if (port < 0 || port > 0xFFFF) {
+ throw new IllegalArgumentException("port out of range:" + port); //$NON-NLS-1$
+ }
+
+ this.server = server;
+ this.workerPool = WorkerPoolFactory.newWorkerPool("SocketWorker", maxWorkers); //$NON-NLS-1$
+ this.nettyPool = Executors.newCachedThreadPool();
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_SERVER, "server = " + this.server + "binding to port:" + port); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ ChannelFactory factory = new NioServerSocketChannelFactory(nettyPool, nettyPool, Math.min(Runtime.getRuntime().availableProcessors(), maxWorkers));
+
+ ServerBootstrap bootstrap = new ServerBootstrap(factory);
+ this.channelHandler = new SSLAwareChannelHandler(this, engine, Thread.currentThread().getContextClassLoader());
+ bootstrap.setPipelineFactory(channelHandler);
+ if (inputBufferSize != 0) {
+ bootstrap.setOption("receiveBufferSize", new Integer(inputBufferSize)); //$NON-NLS-1$
+ }
+ if (outputBufferSize != 0) {
+ bootstrap.setOption("sendBufferSize", new Integer(outputBufferSize)); //$NON-NLS-1$
+ }
+ bootstrap.setOption("keepAlive", Boolean.TRUE); //$NON-NLS-1$
+
+ this.serverChanel = bootstrap.bind(new InetSocketAddress(bindAddress, port));
+ }
+
+ public WorkerPoolStats getProcessPoolStats() {
+ return this.workerPool.getStats();
+ }
+
+ public int getPort() {
+ return ((InetSocketAddress)this.serverChanel.getLocalAddress()).getPort();
+ }
+
+ static String getVersionInfo() {
+ return ApplicationInfo.getInstance().getMajorReleaseNumber();
+ }
+
+ public void stop() {
+ this.serverChanel.close();
+ this.workerPool.shutdownNow();
+ this.nettyPool.shutdownNow();
+ }
+
+ public SocketListenerStats getStats() {
+ SocketListenerStats stats = new SocketListenerStats();
+ stats.objectsRead = this.channelHandler.getObjectsRead();
+ stats.objectsWritten = this.channelHandler.getObjectsWritten();
+ stats.sockets = this.channelHandler.getConnectedChannels();
+ stats.maxSockets = this.channelHandler.getMaxConnectedChannels();
+ return stats;
+ }
+
+ public ChannelListener createChannelListener(ObjectChannel channel) {
+ return new SocketClientInstance(channel, this.workerPool, this.server, this.isClientEncryptionEnabled, this.sessionService);
+ }
+
+}
\ No newline at end of file
Added: trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java (rev 0)
+++ trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,88 @@
+/*
+ * 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.transport;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.GeneralSecurityException;
+import java.util.Properties;
+
+import com.metamatrix.common.comm.ClientServiceRegistry;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+import com.metamatrix.platform.PlatformPlugin;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+
+/**
+ * This class starts a Socket for DQP connections and listens on the port and hands out the connections to the
+ * users
+ */
+public class SocketTransport {
+
+ private static final int DEFAULT_SERVER_PORT = 31000;
+ private static final int DEFAULT_MAX_THREADS = 15;
+ private static final int DEFAULT_INPUT_BUFFER_SIZE = 0;
+ private static final int DEFAULT_OUTPUT_BUFFER_SIZE = 0;
+
+ private Properties props;
+ private SocketListener listener;
+
+ private SessionServiceInterface sessionSerice;
+ protected ClientServiceRegistry clientServices;
+
+ public SocketTransport(Properties props, ClientServiceRegistry serivices, SessionServiceInterface sessionService) {
+ this.props = props;
+ this.clientServices = serivices;
+ this.sessionSerice = sessionService;
+ }
+
+ public void start() {
+ int socketPort = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.SERVER_PORT, DEFAULT_SERVER_PORT);
+ int maxThreads = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.MAX_THREADS, DEFAULT_MAX_THREADS);
+ int inputBufferSize = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.INPUT_BUFFER_SIZE, DEFAULT_INPUT_BUFFER_SIZE);
+ int outputBufferSize = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.OUTPUT_BUFFER_SIZE, DEFAULT_OUTPUT_BUFFER_SIZE);
+ String bindAddress = ((InetAddress)props.get(DQPEmbeddedProperties.HOST_ADDRESS)).getHostAddress();
+
+ try {
+ 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$
+ 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$
+ } catch (IOException e) {
+ throw new MetaMatrixRuntimeException(e, PlatformPlugin.Util.getString("SocketVMController.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$
+ }
+ }
+
+ public void stop() {
+ this.listener.stop();
+ }
+}
Property changes on: trunk/embedded/src/main/java/org/teiid/transport/SocketTransport.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/embedded/src/main/resources/com/metamatrix/platform/i18n.properties
===================================================================
--- trunk/embedded/src/main/resources/com/metamatrix/platform/i18n.properties 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/main/resources/com/metamatrix/platform/i18n.properties 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1280,7 +1280,7 @@
ServerWorkItem.Component_Not_Found=Component not found: {0}
SocketVMController.0=Register Admin API
-SocketVMController.1={0} is bound to address {1} listening on port {2}
+SocketVMController.1=Bound to address {1} listening on port {2}
SocketVMController.2=Problem starting server binding to address {0} and listening on port {1}
SocketVMController.3=Setting Server Listener listenerFilter={0}
SocketVMController.4=Getting ServerListener Registry: {0}
@@ -1289,4 +1289,5 @@
RemoteProxy.localCallFailed=Remote client could not invoke local service method {0} on {1}
JGroupsMessageBus.noResponse=No response for remote method call
commonextensionspath_in_use=Extension modules "{0}" are in scope to create the service - {1}
-commonextensionspath_not_in_use=Failed to use extension modules "{0}" to create the service -{1}
\ No newline at end of file
+commonextensionspath_not_in_use=Failed to use extension modules "{0}" to create the service -{1}
+LogonImpl.Invalid_use_of_credentials_and_token=Conflicting use of both client session token and credentials.
\ No newline at end of file
Modified: trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -28,12 +28,15 @@
import junit.framework.TestCase;
-import com.metamatrix.common.application.Application;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.core.util.UnitTestUtil;
-import com.metamatrix.dqp.service.DQPServiceNames;
+import com.metamatrix.dqp.service.ConfigurationService;
import com.metamatrix.dqp.service.FakeAbstractService;
import com.metamatrix.dqp.service.FakeVDBService;
+import com.metamatrix.dqp.service.VDBService;
+import com.metamatrix.jdbc.EmbeddedGuiceModule;
public class TestEmbeddedConfigSource extends TestCase {
@@ -49,11 +52,14 @@
Properties p = new Properties();
URL url = buildDQPUrl(UnitTestUtil.getTestDataPath() + "/bqt/fakebqt.properties"); //$NON-NLS-1$
p.load(url.openStream());
- EmbeddedConfigSource source = new EmbeddedConfigSource(url, p);
- Application application = new Application();
- application.start(source);
- assertTrue(application.getEnvironment().findService(DQPServiceNames.VDB_SERVICE) instanceof FakeVDBService);
- assertTrue(application.getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE) instanceof FakeAbstractService);
+
+ EmbeddedGuiceModule source = new EmbeddedGuiceModule(url, p);
+ Injector injector = Guice.createInjector(source);
+ source.setInjector(injector);
+
+
+ assertTrue(source.getServiceInstance(VDBService.class) instanceof FakeVDBService);
+ assertTrue(source.getServiceInstance(ConfigurationService.class) instanceof FakeAbstractService);
}
}
Copied: trunk/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java (from rev 1067, trunk/server/src/test/java/com/metamatrix/common/comm/platform/server/TestAdminAuthInterceptor.java)
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java (rev 0)
+++ trunk/embedded/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,123 @@
+/*
+ * 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;
+
+import java.lang.reflect.Proxy;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+import org.teiid.transport.AdminAuthorizationInterceptor;
+
+import com.metamatrix.admin.api.exception.AdminException;
+import com.metamatrix.admin.api.exception.AdminProcessingException;
+import com.metamatrix.admin.api.server.AdminRoles;
+import com.metamatrix.admin.api.server.ServerAdmin;
+import com.metamatrix.api.exception.security.AuthorizationException;
+import com.metamatrix.api.exception.security.AuthorizationMgmtException;
+import com.metamatrix.core.util.SimpleMock;
+import com.metamatrix.dqp.service.AuthorizationService;
+import com.metamatrix.platform.admin.api.ExtensionSourceAdminAPI;
+import com.metamatrix.platform.security.api.MetaMatrixSessionID;
+import com.metamatrix.platform.security.api.SessionToken;
+
+
+/**
+ * @since 4.3
+ */
+public class TestAdminAuthInterceptor {
+
+ @Before public void setUp() throws Exception {
+ DQPWorkContext.getWorkContext().setSessionToken(new SessionToken(new MetaMatrixSessionID(1), "gojo")); //$NON-NLS-1$
+ }
+
+ @After public void tearDown() throws Exception {
+ DQPWorkContext.setWorkContext(new DQPWorkContext());
+ }
+
+ @Test(expected=AdminProcessingException.class) public void testAddUserUDF_fail() throws AdminException {
+ Set<String> userRoles = new HashSet<String>();
+ ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ serverAdmin.addUDF(null, null);
+ }
+
+ private <T> T getTestServerAdmin(final Set<String> userRoles, Class<T> iface) {
+ return getTestServerAdmin(userRoles, iface, SimpleMock.createSimpleMock(iface));
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T getTestServerAdmin(final Set<String> userRoles, Class<T> iface, T impl) {
+ AuthorizationService service = Mockito.mock(AuthorizationService.class);
+ try {
+ Mockito.stub(service.isCallerInRole((SessionToken)Mockito.anyObject(), Mockito.argThat(new BaseMatcher<String>() {
+ @Override
+ public boolean matches(Object arg0) {
+ return userRoles.contains(arg0);
+ }
+
+ @Override
+ public void describeTo(Description arg0) {
+
+ }
+ }))).toReturn(Boolean.TRUE);
+ } catch (AuthorizationMgmtException e) {
+ throw new RuntimeException(e);
+ }
+ AdminAuthorizationInterceptor authInterceptor = new AdminAuthorizationInterceptor(service, impl);
+ return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, authInterceptor);
+ }
+
+ @Test public void testAddUDF_succeed() throws Exception {
+ Set<String> userRoles = new HashSet<String>();
+ userRoles.add(AdminRoles.RoleName.ADMIN_SYSTEM);
+ ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ serverAdmin.addUDF(null, null);
+ }
+
+ @Test public void testGetVDBs() throws Exception {
+ Set<String> userRoles = new HashSet<String>();
+ ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ serverAdmin.getVDBs("*"); //$NON-NLS-1$
+ }
+
+ @Test(expected=AdminProcessingException.class) public void testReadOnlyFails() throws Exception {
+ Set<String> userRoles = new HashSet<String>();
+ ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ serverAdmin.getSessions("*"); //$NON-NLS-1$
+ }
+
+ @Test public void testBounce_succeed() throws Exception {
+ Set<String> userRoles = new HashSet<String>();
+ userRoles.add(AdminRoles.RoleName.ADMIN_PRODUCT);
+ ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
+ serverAdmin.bounceSystem(false);
+ }
+
+
+}
Modified: trunk/embedded/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java
===================================================================
--- trunk/embedded/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/embedded/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,6 +22,8 @@
package com.metamatrix.platform.security.membership.service;
+import java.net.Inet4Address;
+import java.net.InetAddress;
import java.util.Properties;
import java.util.regex.Pattern;
@@ -47,7 +49,7 @@
p.setProperty(MembershipServiceInterface.ADMIN_USERNAME, "metamatrixadmin"); //$NON-NLS-1$
p.setProperty(MembershipServiceInterface.ADMIN_PASSWORD, CryptoUtil.getCryptor().encrypt("mm")); //$NON-NLS-1$
p.setProperty(MembershipServiceInterface.SECURITY_ENABLED, Boolean.TRUE.toString());
- MembershipServiceImpl membershipServiceImpl = new MembershipServiceImpl();
+ MembershipServiceImpl membershipServiceImpl = new MembershipServiceImpl(null, null);
membershipServiceImpl.initialize(p);
@@ -60,7 +62,7 @@
p.setProperty(MembershipServiceInterface.ADMIN_USERNAME, "metamatrixadmin"); //$NON-NLS-1$
p.setProperty(MembershipServiceInterface.ADMIN_PASSWORD, CryptoUtil.getCryptor().encrypt("mm")); //$NON-NLS-1$
p.setProperty(MembershipServiceInterface.SECURITY_ENABLED, Boolean.FALSE.toString());
- MembershipServiceImpl membershipServiceImpl = new MembershipServiceImpl();
+ MembershipServiceImpl membershipServiceImpl = new MembershipServiceImpl(null,null);
membershipServiceImpl.initialize(p);
@@ -81,8 +83,8 @@
assertEquals("@", MembershipServiceImpl.getBaseUsername("@")); //$NON-NLS-1$ //$NON-NLS-2$
}
- private MembershipServiceImpl createMembershipService() throws MembershipSourceException {
- MembershipServiceImpl membershipService = new MembershipServiceImpl();
+ private MembershipServiceImpl createMembershipService() throws Exception {
+ MembershipServiceImpl membershipService = new MembershipServiceImpl(null, InetAddress.getLocalHost());
MembershipServiceImpl.MembershipDomainHolder membershipDomainHolder = new MembershipServiceImpl.MembershipDomainHolder(
TestFileMembershipDomain
.createFileMembershipDomain(),
Copied: trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java (from rev 1067, trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java)
===================================================================
--- trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java (rev 0)
+++ trunk/embedded/src/test/java/org/teiid/transport/TestCommSockets.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,193 @@
+/*
+ * 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.
+ */
+package org.teiid.transport;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.net.InetSocketAddress;
+import java.util.Properties;
+
+import javax.net.ssl.SSLEngine;
+
+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;
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.comm.ClientServiceRegistry;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.comm.platform.socket.SocketUtil;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
+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.platform.security.api.ILogon;
+import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+import com.metamatrix.platform.vm.controller.SocketListenerStats;
+
+public class TestCommSockets {
+
+ SocketListener listener;
+ private SocketServerConnectionFactory sscf;
+ private InetSocketAddress addr;
+
+ @Before public void setUp() {
+ addr = new InetSocketAddress(0);
+ }
+
+ @After public void tearDown() throws Exception {
+ if (listener != null) {
+ listener.stop();
+ }
+ }
+
+ @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$
+ listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
+ csr, 1024, 1024, 1, null, true, sessionService);
+
+ try {
+ Properties p = new Properties();
+ String url = new MMURL(addr.getHostName(), listener.getPort() - 1, false).getAppServerURL();
+ p.setProperty(MMURL.CONNECTION.SERVER_URL, url); //wrong port
+ SocketServerConnectionFactory.getInstance().createConnection(p);
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (CommunicationException e) {
+
+ }
+ }
+
+ @Test public void testConnectWithoutPooling() throws Exception {
+ Properties p = new Properties();
+ p.setProperty("org.teiid.sockets.maxCachedInstances", String.valueOf(0)); //$NON-NLS-1$
+ SocketServerConnection conn = helpEstablishConnection(false, null, true, p);
+ SocketListenerStats stats = listener.getStats();
+ assertEquals(2, stats.objectsRead); // handshake response, logon,
+ assertEquals(1, stats.sockets);
+ conn.shutdown();
+ stats = listener.getStats();
+ assertEquals(1, stats.maxSockets);
+ assertEquals(3, stats.objectsRead); // handshake response, logon, logoff
+ if (stats.sockets > 0) {
+ // there is a timing issue here, since the effect of shutdown on the
+ // server side can be delayed
+ Thread.sleep(500);
+ }
+ stats = listener.getStats();
+ assertEquals(0, stats.sockets);
+ }
+
+ @Test public void testConnectWithPooling() throws Exception {
+ SocketServerConnection conn = helpEstablishConnection(false, null);
+ SocketListenerStats stats = listener.getStats();
+ assertEquals(2, stats.objectsRead); // handshake response, logon,
+ assertEquals(1, stats.sockets);
+ conn.shutdown();
+ stats = listener.getStats();
+ assertEquals(1, stats.maxSockets);
+ assertEquals(3, stats.objectsRead); // handshake response, logon, logoff
+ stats = listener.getStats();
+ assertEquals(1, stats.sockets);
+ conn = helpEstablishConnection(false, null);
+ conn.shutdown();
+ stats = listener.getStats();
+ assertEquals(1, stats.sockets);
+ assertEquals(1, stats.maxSockets);
+ }
+
+
+ @Test public void testConnectWithoutClientEncryption() throws Exception {
+ SocketServerConnection conn = helpEstablishConnection(false, null, false, new Properties());
+ assertTrue(conn.selectServerInstance().getCryptor() instanceof NullCryptor);
+ conn.shutdown();
+ }
+
+ private SocketServerConnection helpEstablishConnection(boolean secure,
+ SSLEngine serverSSL) throws CommunicationException, ConnectionException {
+ return helpEstablishConnection(secure, serverSSL, true, new Properties());
+ }
+
+ private SocketServerConnection helpEstablishConnection(boolean secure,
+ SSLEngine serverSSL, boolean isClientEncryptionEnabled, Properties socketConfig) throws CommunicationException,
+ ConnectionException {
+ if (listener == null) {
+ SessionServiceInterface sessionService = mock(SessionServiceInterface.class);
+ ClientServiceRegistry csr = new ClientServiceRegistry();
+ csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster") { //$NON-NLS-1$
+ @Override
+ public LogonResult logon(Properties connProps)
+ throws LogonException, ComponentNotFoundException {
+ return new LogonResult();
+ }
+ }, "foo"); //$NON-NLS-1$
+ listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
+ csr, 1024, 1024, 1, serverSSL, isClientEncryptionEnabled, sessionService);
+ SocketListenerStats stats = listener.getStats();
+ assertEquals(0, stats.maxSockets);
+ assertEquals(0, stats.objectsRead);
+ assertEquals(0, stats.objectsWritten);
+ assertEquals(0, stats.sockets);
+ }
+
+ Properties p = new Properties();
+ String url = new MMURL(addr.getHostName(), listener.getPort(),secure).getAppServerURL();
+ p.setProperty(MMURL.CONNECTION.SERVER_URL, url);
+ p.setProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, UrlServerDiscovery.class.getName());
+ if (sscf == null) {
+ sscf = new SocketServerConnectionFactory();
+ sscf.init(socketConfig);
+ }
+ return sscf.createConnection(p);
+ }
+
+ @Test public void testSSLConnectWithNonSSLServer() throws Exception {
+ try {
+ helpEstablishConnection(true, null);
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (CommunicationException e) {
+
+ }
+ }
+
+ @Test public void testAnonSSLConnect() throws Exception {
+ SSLEngine engine = SocketUtil.getAnonSSLContext().createSSLEngine();
+ engine.setUseClientMode(false);
+ engine.setEnabledCipherSuites(new String[] { SocketUtil.ANON_CIPHER_SUITE });
+ Properties p = new Properties();
+ p.setProperty(SocketUtil.TRUSTSTORE_FILENAME, SocketUtil.NONE);
+ SocketServerConnection conn = helpEstablishConnection(true, engine, true, p);
+ conn.shutdown();
+ }
+
+}
Copied: trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java (from rev 1067, trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java)
===================================================================
--- trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java (rev 0)
+++ trunk/embedded/src/test/java/org/teiid/transport/TestLogonImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+package org.teiid.transport;
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.mockito.Mockito;
+
+import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.MetaMatrixSessionID;
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+
+public class TestLogonImpl extends TestCase {
+
+ public void testLogonResult() throws Exception {
+ SessionServiceInterface ssi = Mockito
+ .mock(SessionServiceInterface.class);
+
+ String userName = "Fred"; //$NON-NLS-1$
+ String applicationName = "test"; //$NON-NLS-1$
+ Properties p = new Properties();
+ p.setProperty(MMURL.CONNECTION.USER_NAME, userName);
+ p.setProperty(MMURL.CONNECTION.APP_NAME, applicationName);
+
+ MetaMatrixSessionInfo resultInfo = new MetaMatrixSessionInfo(
+ new MetaMatrixSessionID(1), userName, 0, applicationName, new Properties(),
+ null, null);
+
+ Mockito.stub(ssi.createSession(userName, null, null, applicationName,
+ p)).toReturn(resultInfo);
+
+ LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
+
+ LogonResult result = impl.logon(p);
+ assertEquals(userName, result.getUserName());
+ assertEquals(new MetaMatrixSessionID(1), result.getSessionID());
+ }
+
+ public void testCredentials() throws Exception {
+ SessionServiceInterface ssi = Mockito.mock(SessionServiceInterface.class);
+ LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
+ Properties p = new Properties();
+ p.put(MMURL.CONNECTION.CLIENT_TOKEN_PROP, new Object());
+ //invalid credentials
+ p.setProperty(MMURL.JDBC.CREDENTIALS, "(...)"); //$NON-NLS-1$
+
+ try {
+ impl.logon(p);
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (LogonException e) {
+ assertEquals("Conflicting use of both client session token and credentials.", e.getMessage()); //$NON-NLS-1$
+ }
+
+ p.remove(MMURL.CONNECTION.CLIENT_TOKEN_PROP);
+
+ try {
+ impl.logon(p);
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (LogonException e) {
+ assertEquals("Credentials string must contain \"system\" property.", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+}
Copied: trunk/embedded/src/test/java/org/teiid/transport/TestSocketRemoting.java (from rev 1067, trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java)
===================================================================
--- trunk/embedded/src/test/java/org/teiid/transport/TestSocketRemoting.java (rev 0)
+++ trunk/embedded/src/test/java/org/teiid/transport/TestSocketRemoting.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,224 @@
+/*
+ * 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.transport;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+
+import org.teiid.dqp.internal.process.DQPWorkContext;
+import org.teiid.transport.ClientInstance;
+import org.teiid.transport.ServerWorkItem;
+
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.common.api.HostInfo;
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.comm.ClientServiceRegistry;
+import com.metamatrix.common.comm.api.Message;
+import com.metamatrix.common.comm.api.ResultsReceiver;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerInstance;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerInstanceFactory;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerInstanceImpl;
+import com.metamatrix.common.comm.platform.socket.client.UrlServerDiscovery;
+import com.metamatrix.common.util.crypto.Cryptor;
+import com.metamatrix.common.util.crypto.NullCryptor;
+import com.metamatrix.common.xa.XATransactionException;
+import com.metamatrix.core.util.SimpleMock;
+import com.metamatrix.dqp.client.ClientSideDQP;
+import com.metamatrix.dqp.client.ResultsFuture;
+import com.metamatrix.platform.security.api.ILogon;
+import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.SessionToken;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+
+public class TestSocketRemoting extends TestCase {
+
+ public interface FakeService {
+
+ ResultsFuture<Integer> asynchResult();
+
+ String exceptionMethod() throws MetaMatrixProcessingException;
+
+ }
+
+ private static class FakeServiceImpl implements FakeService {
+
+ public ResultsFuture<Integer> asynchResult() {
+ ResultsFuture<Integer> result = new ResultsFuture<Integer>();
+ result.getResultsReceiver().receiveResults(new Integer(5));
+ return result;
+ }
+
+ public String exceptionMethod() throws MetaMatrixProcessingException {
+ throw new MetaMatrixProcessingException();
+ }
+
+ }
+
+ private static class FakeClientServerInstance extends SocketServerInstanceImpl implements ClientInstance {
+
+ ClientServiceRegistry clientServiceRegistry;
+ private ResultsReceiver<Object> listener;
+
+ public FakeClientServerInstance(ClientServiceRegistry clientServiceRegistry) {
+ super();
+ this.clientServiceRegistry = clientServiceRegistry;
+ }
+
+ public HostInfo getHostInfo() {
+ return new HostInfo("fake", 1); //$NON-NLS-1$
+ }
+
+ public boolean isOpen() {
+ return true;
+ }
+
+ @Override
+ public void send(Message message, ResultsReceiver<Object> listener,
+ Serializable messageKey) throws CommunicationException,
+ InterruptedException {
+ ServerWorkItem workItem = new ServerWorkItem(this, messageKey, message, clientServiceRegistry, SimpleMock.createSimpleMock(SessionServiceInterface.class));
+ this.listener = listener;
+ workItem.run();
+ }
+
+ public void shutdown() {
+
+ }
+
+ public Cryptor getCryptor() {
+ return new NullCryptor();
+ }
+
+ public DQPWorkContext getWorkContext() {
+ return new DQPWorkContext();
+ }
+
+ public void send(Message message, Serializable messageKey) {
+ this.listener.receiveResults(message.getContents());
+ }
+
+ }
+
+ /**
+ * No server was supplied, will throw an NPE under the covers
+ */
+ public void testUnckedException() throws Exception {
+ FakeClientServerInstance serverInstance = new FakeClientServerInstance(null);
+ try {
+ createFakeConnection(serverInstance);
+ fail("expected exception"); //$NON-NLS-1$
+ } catch (CommunicationException e) {
+ assertEquals("Unable to find a component used in logging on to MetaMatrix", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ public void testMethodInvocation() throws Exception {
+ ClientServiceRegistry csr = new ClientServiceRegistry();
+ csr.registerClientService(ILogon.class, new ILogon() {
+
+ public ResultsFuture<?> logoff()
+ throws InvalidSessionException,
+ MetaMatrixComponentException {
+ ResultsFuture<?> result = new ResultsFuture<Void>();
+ result.getResultsReceiver().exceptionOccurred(new MetaMatrixComponentException("some exception")); //$NON-NLS-1$
+ return result;
+ }
+
+ public LogonResult logon(Properties connectionProperties)
+ throws LogonException, MetaMatrixComponentException {
+ return new LogonResult();
+ }
+
+ // tests asynch where we don't care about the result
+ public ResultsFuture<?> ping() throws InvalidSessionException,
+ MetaMatrixComponentException {
+ return null;
+ }
+
+ @Override
+ public void assertIdentity(SessionToken sessionId)
+ throws InvalidSessionException,
+ MetaMatrixComponentException {
+ }
+
+ }, "foo"); //$NON-NLS-1$
+ csr.registerClientService(FakeService.class, new FakeServiceImpl(), "foo"); //$NON-NLS-1$
+ final FakeClientServerInstance serverInstance = new FakeClientServerInstance(csr);
+ SocketServerConnection connection = createFakeConnection(serverInstance);
+ ILogon logon = connection.getService(ILogon.class);
+ Future<?> result = logon.ping();
+ assertNull(result.get(0, TimeUnit.MILLISECONDS));
+ result = logon.logoff();
+ try {
+ result.get(0, TimeUnit.MICROSECONDS);
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (ExecutionException e) {
+ assertTrue(e.getCause() instanceof MetaMatrixComponentException);
+ }
+ FakeService service = connection.getService(FakeService.class);
+ Future<Integer> asynchInteger = service.asynchResult();
+ assertEquals(new Integer(5), asynchInteger.get(0, TimeUnit.MILLISECONDS));
+ try {
+ service.exceptionMethod();
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (MetaMatrixProcessingException e) {
+
+ }
+ ClientSideDQP dqp = connection.getService(ClientSideDQP.class);
+ try {
+ dqp.begin();
+ fail("exception expected"); //$NON-NLS-1$
+ } catch (XATransactionException e) {
+ e.printStackTrace();
+ assertEquals("Component not found: com.metamatrix.dqp.client.ClientSideDQP", e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ private SocketServerConnection createFakeConnection(
+ final FakeClientServerInstance serverInstance)
+ throws CommunicationException, ConnectionException {
+ SocketServerConnection connection = new SocketServerConnection(new SocketServerInstanceFactory() {
+
+ @Override
+ public SocketServerInstance getServerInstance(HostInfo info,
+ boolean ssl) throws CommunicationException, IOException {
+ return serverInstance;
+ }
+
+ }, false, new UrlServerDiscovery(new MMURL("foo", 1, false)), new Properties(), null); //$NON-NLS-1$
+ return connection;
+ }
+
+}
Modified: trunk/engine/src/main/java/com/metamatrix/common/application/Application.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/application/Application.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/common/application/Application.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -34,6 +34,7 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.DQPPlugin;
+import com.metamatrix.dqp.ResourceFinder;
import com.metamatrix.dqp.service.DQPServiceNames;
import com.metamatrix.dqp.util.LogConstants;
@@ -43,37 +44,8 @@
protected ApplicationEnvironment environment = new ApplicationEnvironment();
private ArrayList<String> installedServices = new ArrayList<String>();
- private ServiceLoader loader = new ServiceLoader();
/*
- * @see com.metamatrix.common.application.Application#initialize(java.util.Properties)
- */
- public void start(DQPConfigSource configSource) throws ApplicationInitializationException {
- DQPGuiceModule module = new DQPGuiceModule(configSource);
-
- Injector injector = Guice.createInjector(module);
-
- // Load services into DQP
- for(int i=0; i<DQPServiceNames.ALL_SERVICES.length; i++) {
- final String serviceName = DQPServiceNames.ALL_SERVICES[i];
- final Class<? extends ApplicationService> type = DQPServiceNames.ALL_SERVICE_CLASSES[i];
- if(injector.getBinding(Key.get(type)) == null){
- LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceIsNull", serviceName)); //$NON-NLS-1$
- }else{
- ApplicationService appService = injector.getInstance(type);
- appService = loader.loadService(serviceName, appService);
- String loggingContext = DQPServiceNames.SERVICE_LOGGING_CONTEXT[i];
- if (loggingContext != null) {
- appService = (ApplicationService)LogManager.createLoggingProxy(loggingContext, appService, new Class[] {type}, MessageLevel.DETAIL);
- }
- appService.initialize(configSource.getProperties());
- installService(serviceName, appService);
- LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceInstalled", serviceName)); //$NON-NLS-1$
- }
- }
- }
-
- /*
* @see com.metamatrix.common.application.Application#installService(com.metamatrix.common.application.ApplicationService)
*/
public final void installService(String type, ApplicationService service) throws ApplicationInitializationException {
Modified: trunk/engine/src/main/java/com/metamatrix/common/application/DQPConfigSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/application/DQPConfigSource.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/common/application/DQPConfigSource.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -52,8 +52,5 @@
*/
public Properties getProperties();
- public Map<String, Class<? extends ApplicationService>> getDefaultServiceClasses();
-
- public void updateBindings(Binder binder);
-
+ public ApplicationService getServiceInstance(Class<? extends ApplicationService> type);
}
Deleted: trunk/engine/src/main/java/com/metamatrix/common/application/DQPGuiceModule.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/application/DQPGuiceModule.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/common/application/DQPGuiceModule.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,62 +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.application;
-
-import java.util.Map;
-
-import com.google.inject.AbstractModule;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.dqp.service.DQPServiceNames;
-
-public class DQPGuiceModule extends AbstractModule {
-
- private DQPConfigSource configSource;
-
- public DQPGuiceModule(DQPConfigSource configSource) {
- this.configSource = configSource;
- }
-
- @Override
- protected void configure() {
- Map<String, Class<? extends ApplicationService>> defaults = configSource.getDefaultServiceClasses();
- for(int i=0; i<DQPServiceNames.ALL_SERVICES.length; i++) {
- final String serviceName = DQPServiceNames.ALL_SERVICES[i];
- String className = configSource.getProperties().getProperty("service."+serviceName+".classname"); //$NON-NLS-1$ //$NON-NLS-2$
- Class clazz = defaults.get(serviceName);
- if (clazz != null && className != null) {
- try {
- clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
- } catch (ClassNotFoundException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- }
- if (clazz != null) {
- bind(DQPServiceNames.ALL_SERVICE_CLASSES[i]).to(clazz);
- }
- }
-
- // inject the platform specific services.
- configSource.updateBindings(this.binder());
- }
-
-}
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/storage/file/FileStorageManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/storage/file/FileStorageManager.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/storage/file/FileStorageManager.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -254,7 +254,7 @@
return baos.toByteArray();
} catch(IOException e) {
- throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStoreageManager.batch_error")); //$NON-NLS-1$
+ throw new MetaMatrixComponentException(e, QueryExecPlugin.Util.getString("FileStorageManager.batch_error")); //$NON-NLS-1$
} finally {
if(oos != null) {
try {
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuditMessage.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -22,18 +22,8 @@
package com.metamatrix.dqp.service;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Date;
-import com.metamatrix.common.config.CurrentConfiguration;
-
public class AuditMessage {
- public static final String PROCESS_NAME = CurrentConfiguration.getInstance().getProcessName();
- public static final String HOST_NAME = CurrentConfiguration.getInstance().getConfigurationName();
-
private static final String RESOURCE_DELIMITER = ", "; //$NON-NLS-1$
private String context;
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -25,8 +25,10 @@
import java.util.Collection;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.core.CoreConstants;
+import com.metamatrix.platform.security.api.SessionToken;
import com.metamatrix.query.eval.SecurityFunctionEvaluator;
/**
@@ -48,6 +50,8 @@
public static final String DEFAULT_WSDL_USERNAME = CoreConstants.DEFAULT_ANON_USERNAME;
+ public static final String ENTITELEMENTS_ENABLED = "entitlements.enabled"; //$NON-NLS-1$
+
/**
* Determine which of a set of resources a connection does not have permission to
* perform the specified action.
@@ -65,4 +69,7 @@
* @return <code>true</code> iff server-side entitlements checking is enabled.
*/
boolean checkingEntitlements();
+
+ boolean isCallerInRole( SessionToken caller, String roleName ) throws AuthorizationMgmtException;
+
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -401,4 +401,6 @@
void clearClassLoaderCache() throws MetaMatrixComponentException;
boolean isFullyConfiguredVDB(VDBArchive vdb) throws MetaMatrixComponentException;
+
+ String getClusterName();
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/DQPServiceNames.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -23,6 +23,8 @@
package com.metamatrix.dqp.service;
import com.metamatrix.dqp.util.LogConstants;
+import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
/**
@@ -52,6 +54,11 @@
public static final String CONFIGURATION_SERVICE = "dqp.configuration"; //$NON-NLS-1$
public static final String REGISTRY_SERVICE = "platform.registry"; //$NON-NLS-1$
+
+ public static final String SESSION_SERVICE = "dqp.session"; //$NON-NLS-1$
+
+ public static final String MEMBERSHIP_SERVICE = "dqp.membership"; //$NON-NLS-1$
+
/**
* Array of all services a DQP may use.
@@ -64,6 +71,8 @@
VDB_SERVICE,
METADATA_SERVICE,
DATA_SERVICE,
+ SESSION_SERVICE,
+ MEMBERSHIP_SERVICE
};
public static final Class[] ALL_SERVICE_CLASSES = new Class[] {
@@ -74,6 +83,8 @@
VDBService.class,
MetadataService.class,
DataService.class,
+ SessionServiceInterface.class,
+ MembershipServiceInterface.class
};
public static final String[] SERVICE_LOGGING_CONTEXT = new String[] {
@@ -84,5 +95,7 @@
null,
null,
null,
+ null,
+ null
};
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -32,4 +32,6 @@
public static final String CTX_EXTENSION_SOURCE = "EXTENSION_MODULE"; //$NON-NLS-1$
public static final String CTX_COMMANDLOGGING = "COMMAND_LOG"; //$NON-NLS-1$
public static final String CTX_AUDITLOGGING = "AUDIT_LOG"; //$NON-NLS-1$
+ public static final String CTX_ADMIN_API = "ADMIN_API"; //$NON-NLS-1$
+ public static final String CTX_QUERY_SERVICE = "QUERY_SERVICE"; //$NON-NLS-1$
}
Deleted: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServiceInterface.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,504 +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.security.api.service;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
-import com.metamatrix.admin.api.objects.AdminOptions;
-import com.metamatrix.api.exception.ComponentNotFoundException;
-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.InvalidUserException;
-import com.metamatrix.api.exception.security.MembershipServiceException;
-import com.metamatrix.platform.admin.api.EntitlementMigrationReport;
-import com.metamatrix.platform.admin.api.PermissionDataNode;
-import com.metamatrix.platform.security.api.AuthorizationModel;
-import com.metamatrix.platform.security.api.AuthorizationPermission;
-import com.metamatrix.platform.security.api.AuthorizationPolicy;
-import com.metamatrix.platform.security.api.AuthorizationPolicyID;
-import com.metamatrix.platform.security.api.AuthorizationRealm;
-import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
-import com.metamatrix.platform.security.api.SessionToken;
-
-/**
- * This interface represents the API to the Authorization Service
- * and it defines the functionality that is accessible to clients.
- */
-public interface AuthorizationServiceInterface {
- public static String NAME = "AuthorizationService";
-
-
- /**
- * Return whether the specified account has authorization to access the specified resource.
- * This method returns false immediately upon encountering the first resource to which
- * the account does not have access.
- * @param sessionToken the session token of the principal whose access is being checked
- * @param contextName the name of the context for the caller (@see AuditContext)
- * @param request the permission that details the resource and the desired form of access
- * @return true if the specified principal is granted access to the requested resource,
- * or false otherwise
- * @throws InvalidSessionException if the session token for this cache is not valid
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation
- */
- boolean checkAccess( SessionToken sessionToken, String contextName, AuthorizationPermission request )
- throws InvalidSessionException, AuthorizationMgmtException;
-
- /**
- * Return whether the specified account has authorization to access the specified resource
- * and all its dependent resources.
- * This method returns false immediately upon encountering the first resource to which
- * the account does not have access.
- * @param sessionToken the session token of the principal whose access is being checked
- * @param contextName the name of the context for the caller (@see AuditContext)
- * @param request the permission that details the resource and the desired form of access
- * @param fetchDependants If <code>true</code>, search authorization store for all dependent
- * Permissions of the given request. Access is checked for <i>all</i> resources - the given
- * request and all dependents.
- * @return true if the specified principal is granted access to the requested resources,
- * or false otherwise
- * @throws InvalidSessionException if the session token for this cache is not valid
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation
- */
- boolean checkAccess( SessionToken sessionToken, String contextName, AuthorizationPermission request, boolean fetchDependants )
- throws InvalidSessionException, AuthorizationMgmtException;
-
- /**
- * Of those resources specified, return the subset for which the specified account does <i>not</i> have authorization
- * to access.
- * @param sessionToken the session token of the principal that is calling this method
- * @param contextName the name of the context for the caller (@see AuditContext)
- * @param requests the permissions that detail the resources and the desired form of access
- * @return the subset of <code>requests</code> that the account does <i>not</i> have access to
- * @throws InvalidSessionException if the session token for this cache is not valid
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation
- */
- Collection getInaccessibleResources( SessionToken sessionToken, String contextName, Collection requests )
- throws InvalidSessionException, AuthorizationMgmtException;
-
- /**
- * Returns a <code>List</code> of entitlements to the given element pattern in the given realm.
- * <p>The list contains objects of type {@link com.metamatrix.platform.security.api.UserEntitlementInfo UserEntitlementInfo}
- * which will contain all user entitlement information for each element found. Each of these objects
- * will contain 1 or more objects of type {@link com.metamatrix.platform.security.api.GranteeEntitlementEntry GranteeEntitlementEntry}
- * which contain the <i>Grantee</i>'s name the entitlement <i>Grantor</i> or entity specifying the <i>Grantee</i>
- * is entitled and the <i>Allowed Actions</i> the <i>Grantee</i> is entitled to perform on the element.</p>
- * The attributes availible are:
- * <ol>
- * <li value=1>VDB Name</li>
- * <li>VDB Version</li>
- * <li>Group Name (fully qualified)</li>
- * <li>Element Name (fully qualified)</li>
- * <ul>
- * <li>Grantee Name; Grantor Name; Allowed Actions (A <code>String[]</code> of one or more of {CREATE, READ, UPDATE, DELETE})</li>
- * <li> ... </li>
- * </ul>
- * </ol>
- * @param realm The realm in which the element must live.
- * @param groupNames the fully qualified group names - the resources - for which to look up permissions.
- * Collection of <code>String</code>.
- * @return The <code>List</code> of entitlements to the given element in the
- * given realm - May be empty but never null.
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation.
- * @throws ServiceStateException if the Authorization service is not taking requests.
- */
- List getGroupEntitlements(AuthorizationRealm realm, Collection groupNames)
- throws AuthorizationMgmtException;
-
- /**
- * Returns a <code>List</code> of entitlements to the given element pattern in the given realm.
- * <p>The list contains objects of type {@link com.metamatrix.platform.security.api.UserEntitlementInfo UserEntitlementInfo}
- * which will contain all user entitlement information for each element found. Each of these objects
- * will contain 1 or more objects of type {@link com.metamatrix.platform.security.api.GranteeEntitlementEntry GranteeEntitlementEntry}
- * which contain the <i>Grantee</i>'s name the entitlement <i>Grantor</i> or entity specifying the <i>Grantee</i>
- * is entitled and the <i>Allowed Actions</i> the <i>Grantee</i> is entitled to perform on the element.</p>
- * The attributes availible are:
- * <ol>
- * <li value=1>VDB Name</li>
- * <li>VDB Version</li>
- * <li>Group Name (fully qualified)</li>
- * <li>Element Name (fully qualified)</li>
- * <ul>
- * <li>Grantee Name; Grantor Name; Allowed Actions (A <code>String[]</code> of one or more of {CREATE, READ, UPDATE, DELETE})</li>
- * <li> ... </li>
- * </ul>
- * </ol>
- * @param realm The realm in which the element must live.
- * @param fullyQualifiedGroupName The resource for which to look up permissions.
- * @return The <code>List</code> of entitlements to the given element in the
- * given realm - May be empty but never null.
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation.
- */
- List getGroupEntitlements(AuthorizationRealm realm, String fullyQualifiedGroupName)
- throws AuthorizationMgmtException;
-
- /**
- * Returns a <code>List</code> of entitlements to the given element pattern in the given realm.
- * <p>The list contains objects of type {@link com.metamatrix.platform.security.api.UserEntitlementInfo UserEntitlementInfo}
- * which will contain all user entitlement information for each element found. Each of these objects
- * will contain 1 or more objects of type {@link com.metamatrix.platform.security.api.GranteeEntitlementEntry GranteeEntitlementEntry}
- * which contain the <i>Grantee</i>'s name the entitlement <i>Grantor</i> or entity specifying the <i>Grantee</i>
- * is entitled and the <i>Allowed Actions</i> the <i>Grantee</i> is entitled to perform on the element.</p>
- * The attributes availible are:
- * <ol>
- * <li value=1>VDB Name</li>
- * <li>VDB Version</li>
- * <li>Group Name (fully qualified)</li>
- * <li>Element Name (fully qualified)</li>
- * <ul>
- * <li>Grantee Name; Grantor Name; Allowed Actions (A <code>String[]</code> of one or more of {CREATE, READ, UPDATE, DELETE})</li>
- * <li> ... </li>
- * </ul>
- * </ol>
- * @param realm The realm in which the element must live.
- * @param elementNames The fully qualified element resource for which to look up permissions. Collection of <code>String</code>.
- * @return The <code>List</code> of entitlements to the given element in the
- * given realm - May be empty but never null.
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation.
- */
- List getElementEntitlements(AuthorizationRealm realm, Collection elementNames)
- throws AuthorizationMgmtException;
-
- /**
- * Returns a <code>List</code> of entitlements to the given element pattern in the given realm.
- * <p>The list contains objects of type {@link com.metamatrix.platform.security.api.UserEntitlementInfo UserEntitlementInfo}
- * which will contain all user entitlement information for each element found. Each of these objects
- * will contain 1 or more objects of type {@link com.metamatrix.platform.security.api.GranteeEntitlementEntry GranteeEntitlementEntry}
- * which contain the <i>Grantee</i>'s name the entitlement <i>Grantor</i> or entity specifying the <i>Grantee</i>
- * is entitled and the <i>Allowed Actions</i> the <i>Grantee</i> is entitled to perform on the element.</p>
- * The attributes availible are:
- * <ol>
- * <li value=1>VDB Name</li>
- * <li>VDB Version</li>
- * <li>Group Name (fully qualified)</li>
- * <li>Element Name (fully qualified)</li>
- * <ul>
- * <li>Grantee Name; Grantor Name; Allowed Actions (A <code>String[]</code> of one or more of {CREATE, READ, UPDATE, DELETE})</li>
- * <li> ... </li>
- * </ul>
- * </ol>
- * @param realm The realm in which the element must live.
- * @param elementName The fully qualified element resource for which to look up permissions.
- * @return The <code>List</code> of entitlements to the given element in the
- * given realm - May be empty but never null.
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation.
- */
- List getElementEntitlements(AuthorizationRealm realm, String elementName)
- throws AuthorizationMgmtException;
-
-////////////////////////////////////////////////////////////////////////////////
-// Admin methods
-////////////////////////////////////////////////////////////////////////////////
- /**
- * Obtain the names of all of the realms known to the system.
- * @param caller the session token of the principal that is attempting to access the realms.
- * @return the set of realm names
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or is expired
- * @throws AuthorizationException if the caller is unable to perform this operation
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- */
- Collection getRealmNames(SessionToken caller)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Return whether there is an existing policy with the specified ID.
- * @param caller the session token of the principal that is attempting to access the policies.
- * @param id the ID that is to be checked
- * @return true if a policy with the specified ID exists
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or is expired
- * @throws AuthorizationException if the caller is unable to perform this operation
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- * @see AuthorizationDomain.containsPolicy
- */
- boolean containsPolicy(SessionToken caller, AuthorizationPolicyID id )
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Locate the IDs of all of the policies that are accessible by the caller.
- * @param caller the session token of the principal that is attempting to access the policies.
- * @return the set of all policy IDs
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or is expired
- * @throws AuthorizationException if the caller is unable to perform this operation
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- * @see AuthorizationDomain.findAllPolicyIDs
- */
- Collection findAllPolicyIDs(SessionToken caller)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Locate the IDs of all of the policies that apply to the specified principal and that are accessible by the caller.
- * @param caller the session token of the principal that is attempting to access the policies.
- * @param principals the Set of UserGroupIDs and/or UserAccountIDs to whom the returned policies should apply to
- * (may not null, empty or invalid, all of which would result in an empty result)
- * @return the set of all policy IDs; never null but possibly empty
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or is expired
- * @throws AuthorizationException if the caller is unable to perform this operation
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- * @see AuthorizationModel.findAllPolicyIDs
- */
- Collection findPolicyIDs(SessionToken caller, Collection principals )
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Locate the policies that have the specified IDs. Any ID that is invalid is simply
- * ignored.
- * @param caller the session token of the principal that is attempting to access the
- * specified policies
- * @param policyIDs the policy IDs for which the policies are to be obtained
- * @return the set of entitlements that correspond to those specified IDs that are valid
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or is expired
- * @throws AuthorizationException if the caller is unable to perform this operation
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- * @see AuthorizationDomain.getPolicies
- */
- Collection getPolicies(SessionToken caller, Collection policyIDs)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Locate the policy that has the specified ID. Any ID that is invalid is simply
- * ignored.
- * @param caller the session token of the principal that is attempting to access the
- * specified policies
- * @param policyID the ID of the policy to be obtained
- * @return the policy that correspond to the specified ID
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or is expired
- * @throws AuthorizationException if the caller is unable to perform this operation
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- * @see AuthorizationDomain.getPolicy
- */
- AuthorizationPolicy getPolicy(SessionToken caller, AuthorizationPolicyID policyID)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Execute as a single transaction with the specified actions, and return
- * the set of IDs for the objects that were affected/modified by the action.
- * @param caller the session token of the principal that is attempting to access the policies.
- * @param actions the ordered list of actions that are to be performed
- * on metamodel within the repository.
- * @return The set of objects that were affected by this transaction.
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or has expired.
- * @throws AuthorizationException if the caller is unable to perform this operation.
- * @throws AuthorizationMgmtException if there were errors with the SPI. Causes rollback.
- * @throws IllegalArgumentException if the action is null.
- */
- Set executeTransaction(SessionToken caller, List actions)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Verify that caller is in the specified logical role.
- * @param caller The session token of the MetaMatrix principle involking an administrative method.
- * @return true if caller's session token is valid and he is a MetaMatrix administrator.
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- */
- boolean isCallerInRole( SessionToken caller, String roleName )
- throws AuthorizationMgmtException;
-
- /**
- * Obtain the names of all of the roles and their descriptions known to the system.
- * @param caller the session token of the principal that is attempting to access the roles.
- * @return a Map of role descriptions key by the role's name.
- * @throws InvalidSessionException if the <code>SessionToken</code> is not valid or is expired
- * @throws AuthorizationException if the caller is unable to perform this operation
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- */
- Map getRoleDescriptions(SessionToken caller)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Returns a collection <code>MetaMatrixPrincipalName</code> objects containing the name
- * of the principal along with its type which belong to the given role.
- * {@link com.metamatrix.security.api.MetaMatrixPrincipalName}
- * @param caller the session token of the principal that is attempting to access the roles.
- * @param roleName String name of MetaMatrix role for which principals
- * are sought
- * @throws InvalidSessionException if the administrative session is invalid
- * @throws MetaMatrixSecurityException if there is a problem internally with the MembershipService
- * @throws AuthorizationException if administrator does not have the authority to see the requested information
- * @throws ComponentNotFoundException if a component required by this method could not be found within the server
- */
- Collection getPrincipalsForRole(SessionToken caller, String roleName)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Returns a Collection of String names of MetaMatrix roles to which the
- * given principal is assigned.
- * @param caller the session token of the principal that is attempting to access the roles.
- * @param principal <code>MetaMatrixPrincipalName</code> for which roles are sought
- * @return The <code>Collection</code> of role names the principal is assigned.
- * @throws InvalidSessionException if the administrative session is invalid
- * @throws MetaMatrixSecurityException if there is a problem internally with the MembershipService
- * @throws AuthorizationException if administrator does not have the authority to see the requested information
- * @throws ComponentNotFoundException if a component required by this method could not be found within the server
- */
- Collection getRoleNamesForPrincipal(SessionToken caller, MetaMatrixPrincipalName principal)
- throws InvalidSessionException, AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Remove given Principal from <emph>ALL</emph> <code>AuthorizationPolicies</code> to
- * which he belongs.
- * @param caller the session token of the principal that is attempting to remove the Principal.
- * @param principal <code>MetaMatrixPrincipalName</code> which should be deleted.
- * @return true if at least one policy in which the principal had authorization
- * was found and deleted, false otherwise.
- * @throws AuthorizationException if administrator does not have the authority to perform the action.
- * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
- */
- boolean removePrincipalFromAllPolicies(SessionToken caller, MetaMatrixPrincipalName principal)
- throws AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Returns a <code>Collection</code> of <code>AuthorizationPolicyID</code>s
- * that have <code>AuthorizationPermission</code>s in the given <code>AuthorizationRealm</code>.<br>
- * <strong>NOTE:</strong> It is the responsibility of the caller to determine
- * which of the <code>AuthorizationPolicy</code>'s <code>AuthorizationPermission</code>s
- * are actually in the given <code>AuthorizationRealm</code>. The <code>AuthorizationPolicy</code>
- * may span <code>AuthorizationRealm</code>s.
- * @param caller The session token of the principal that is attempting to retrieve the policies.
- * @param realm The realm in which to search for <code>AuthorizationPermission</code>s.
- * @return The collection of <code>AuthorizationPolicyID</code>s that have permissions
- * in the given realm - possibly empty but never null.
- * @throws AuthorizationException if administrator does not have the authority to perform the action.
- * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
- */
- Collection getPolicyIDsWithPermissionsInRealm(SessionToken caller, AuthorizationRealm realm)
- throws AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Returns a <code>Collection</code> of <code>AuthorizationPolicyID</code>s
- * in the given <code>AuthorizationRealm</code>.
- * <br>This method will only work for Data Access Authorizations because the realm
- * is encoded in a Data Access policy name.
- * <strong>NOTE:</strong> It is the responsibility of the caller to determine
- * which of the <code>AuthorizationPolicy</code>'s <code>AuthorizationPermission</code>s
- * are actually in the given <code>AuthorizationRealm</code>. The <code>AuthorizationPolicy</code>
- * may span <code>AuthorizationRealm</code>s.
- * @param caller The session token of the principal that is attempting to retrieve the policies.
- * @param realm The realm in which to search for <code>AuthorizationPermission</code>s.
- * @return The collection of <code>AuthorizationPolicyID</code>s that have permissions
- * in the given realm - possibly empty but never null.
- * @throws AuthorizationException if administrator does not have the authority to perform the action.
- * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
- */
- Collection getPolicyIDsInRealm(SessionToken caller, AuthorizationRealm realm)
- throws AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Returns a <code>Collection</code> of <code>AuthorizationPolicy</code>s
- * that have <code>AuthorizationPermission</code>s in the given <code>AuthorizationRealm</code>.<br>
- * <strong>NOTE:</strong> It is the responsibility of the caller to determine
- * which of the <code>AuthorizationPolicy</code>'s <code>AuthorizationPermission</code>s
- * are actually in the given <code>AuthorizationRealm</code>. The <code>AuthorizationPolicy</code>
- * may span <code>AuthorizationRealm</code>s.
- * @param caller The session token of the principal that is attempting to retrieve the policies.
- * @param realm The realm in which to search for <code>AuthorizationPermission</code>s.
- * @return The collection of <code>AuthorizationPolicy</code>s that have permissions
- * in the given realm - possibly empty but never null.
- * @throws AuthorizationException if administrator does not have the authority to perform the action.
- * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
- */
- Collection getPoliciesInRealm(SessionToken caller, AuthorizationRealm realm)
- throws AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Returns a <code>Collection</code> of <code>AuthorizationPolicyID</code>s
- * that have <code>AuthorizationPermissions</code> that exist in the given
- * <emph>partial</emph> <code>AuthorizationRealm</code>.<br>
- * The implementation is such that all <code>AuthorizationPolicyID</code>s
- * whose <code>AuthorizationRealm</code> <emph>starts with</emph> the given
- * <code>AuthorizationRealm</code> are returned.
- * @param caller The session token of the principal that is attempting to retrieve the policies.
- * @param realm The <emph>partial</emph> realm in which to search for
- * <code>AuthorizationPermission</code>s whose realm name <emph>starts with</emph>
- * the given realm.
- * @return The collection of <code>AuthorizationPolicyID</code>s that have permissions
- * in the given partial realm - possibly empty but never null.
- * @throws AuthorizationException if administrator does not have the authority to perform the action.
- * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
- */
- public Collection getPolicyIDsInPartialRealm(SessionToken caller, AuthorizationRealm realm)
- throws AuthorizationException, AuthorizationMgmtException;
-
- /**
- * Returns a <code>Collection</code> of <code>AuthorizationPolicyID</code>s
- * that have <code>AuthorizationPermissions</code> on the given resource that
- * exists in the given <code>AuthorizationRealm</code>.<br>
- * @param caller The session token of the principal that is attempting to retrieve the policies.
- * @param realm The realm in which to search for <code>AuthorizationPermission</code>s.
- * @param resourceName The resource for which to search for <code>AuthorizationPermission</code>s.
- * @return The collection of <code>AuthorizationPolicyID</code>s that have permissions
- * on the given resource - possibly empty but never null.
- * @throws AuthorizationException if administrator does not have the authority to perform the action.
- * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
- */
- Collection getPolicIDsForResourceInRealm(SessionToken caller, AuthorizationRealm realm, String resourceName)
- throws AuthorizationException, AuthorizationMgmtException;
-
- public boolean hasPolicy(SessionToken caller, AuthorizationRealm realm, String policyName)
- throws AuthorizationMgmtException, InvalidUserException, MembershipServiceException;
-
-
- public void migratePolicies(SessionToken token,
- EntitlementMigrationReport rpt,
- String targetVDBName, String targetVDBVersion, Set targetNodes,
- Collection sourcePolicies, AdminOptions options) throws MetaMatrixComponentException,
- InvalidSessionException,
- AuthorizationException,
- AuthorizationMgmtException;
-
- /**
- * Takes a tree of <code>PermissionDataNodeImpl</code>s that have their <code>Resource</code>s
- * filled in and fills in all permissions on resources that are found in the given
- * <code>AuthorizationPolicyID</code>.<br></br>
- * If any permissions are found that have no corresponding data node, a <code>AuthorizationMgmtException</code>
- * is thrown noting the missing resource name(s).
- * @param root The node containing the resource (group or element full name)
- * for which to search for permission(s).
- * @param realm The realm in which to search.
- * @param tree The tree of PermissionDataNodes to fill in permissions for.
- * @return The root of the filled in tree.
- * If no permissions exist, the original is returned as the sole element in the list.
- * @throws AuthorizationMgmtException if there is a connection or communication error with the data source,
- * signifying that the method should be retried with a different connection; if there is an
- * unspecified or unknown error with the data source; or one or more permissions were found but
- * a corresponding <code>PermissionDataNodeImpl</code> could not be found.
- */
- PermissionDataNode fillPermissionNodeTree(PermissionDataNode root, AuthorizationPolicyID policyID)
- throws AuthorizationMgmtException;
-}
-
-
-
-
-
Deleted: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServicePropertyNames.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServicePropertyNames.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthorizationServicePropertyNames.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,103 +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.security.api.service;
-
-public class AuthorizationServicePropertyNames {
-
- /**
- * The environment property the determines whether data access authorization will
- * be performed.
- * <br> This property defaults to "false" - no entitlement checking.</br>
- */
- public static final String DATA_ACCESS_AUTHORIZATION_ENABLED = "metamatrix.authorization.dataaccess.CheckingEnabled"; //$NON-NLS-1$
-
- /**
- * The environment property the determines whether MetaBase authorization will
- * be performed.
- * <br> This property defaults to "false" - no entitlement checking.</br>
- */
- public static final String METABASE_AUTHORIZATION_ENABLED = "metamatrix.authorization.metabase.CheckingEnabled"; //$NON-NLS-1$
-
- /**
- * The environment property name for the class that is to be used for the ManagedConnectionFactory implementation.
- * This property is required (there is no default).
- */
- public static final String CONNECTION_FACTORY = "security.authorization.connection.Factory"; //$NON-NLS-1$
-
- /**
- * The environment property name for the number of times a method should be retried
- * with a new connection should a connection exception occur.
- * This property is optional.
- */
- public static final String CONNECTION_RETRIES = "security.authorization.connection.Retries"; //$NON-NLS-1$
-
- /**
- * The environment property name for the class of the driver.
- * This property is optional.
- */
- public static final String CONNECTION_DRIVER = "security.authorization.connection.Driver"; //$NON-NLS-1$
-
- /**
- * The environment property name for the protocol for connecting to the authorization store.
- * This property is optional.
- */
- public static final String CONNECTION_PROTOCOL = "security.authorization.connection.Protocol"; //$NON-NLS-1$
-
- /**
- * The environment property name for the name of the authorization store database.
- * This property is optional.
- */
- public static final String CONNECTION_DATABASE = "security.authorization.connection.Database"; //$NON-NLS-1$
-
- /**
- * The environment property name for the username that is to be used for connecting to the authorization store.
- * This property is optional.
- */
- public static final String CONNECTION_PRINCIPAL = "security.authorization.connection.Principal"; //$NON-NLS-1$
-
- /**
- * The environment property name for the password that is to be used for connecting to the authorization store.
- * This property is optional.
- */
- public static final String CONNECTION_PASSWORD = "security.authorization.connection.Password"; //$NON-NLS-1$
-
- /**
- * The environment property name for the maximum number of milliseconds that a authorization connection
- * may remain unused before it becomes a candidate for garbage collection.
- * This property is optional.
- */
- public static final String CONNECTION_POOL_MAXIMUM_AGE = "security.authorization.connection.MaximumAge"; //$NON-NLS-1$
-
- /**
- * The environment property name for the maximum number of concurrent users of a single authorization connection.
- * This property is optional.
- */
- public static final String CONNECTION_POOL_MAXIMUM_CONCURRENT_USERS = "security.authorization.connection.MaximumConcurrentReaders"; //$NON-NLS-1$
-
- /**
- * The default authorization factory class when no class is specified.
- */
- public static final String DEFAULT_FACTORY_CLASS="com.metamatrix.platform.security.authorization.spi.jdbc.JDBCAuthorizationTransactionFactory";
-
-}
-
Modified: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -30,8 +30,6 @@
import com.metamatrix.api.exception.security.InvalidPrincipalException;
import com.metamatrix.api.exception.security.MembershipServiceException;
import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.common.config.ResourceNames;
-import com.metamatrix.common.config.util.ConfigurationPropertyNames;
import com.metamatrix.core.CoreConstants;
import com.metamatrix.platform.security.api.Credentials;
import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
@@ -42,7 +40,7 @@
* and it defines the functionality that is accessible to clients.
*/
public interface MembershipServiceInterface extends ApplicationService {
- public static String NAME = ResourceNames.MEMBERSHIP_SERVICE;
+ public static String NAME = "MembershipService"; //$NON-NLS-1$
/**
* The environment property describing both the domain names and their required
@@ -50,21 +48,21 @@
* and in the form "A,X,...,D" where A, X and D are domain names.
* This property is required (there is no default).
*/
- public static final String DOMAIN_ORDER = ConfigurationPropertyNames.MEMBERSHIP_DOMAIN_ORDER;
+ public static final String DOMAIN_ORDER = "membership.DomainOrder"; //$NON-NLS-1$
/**
* The environment property name for the class that is to be used for the names of the domains.
* This property is required (there is no default).
*/
public static final String DOMAIN_NAME = "domainName"; //$NON-NLS-1$
- public static final String DEFAULT_ADMIN_USERNAME = "metamatrixadmin"; //$NON-NLS-1$
+ public static final String DEFAULT_ADMIN_USERNAME = "admin"; //$NON-NLS-1$
public static final String DEFAULT_WSDL_USERNAME = CoreConstants.DEFAULT_ANON_USERNAME;
- public static final String ADMIN_PASSWORD = ConfigurationPropertyNames.MEMBERSHIP_ADMIN_PASSWORD;
- public static final String ADMIN_USERNAME = ConfigurationPropertyNames.MEMBERSHIP_ADMIN_USERNAME;
+ public static final String ADMIN_PASSWORD = "membership.superUserPassword"; //$NON-NLS-1$
+ public static final String ADMIN_USERNAME = "membership.superUser"; //$NON-NLS-1$
public static final String DOMAIN_ACTIVE = "activate"; //$NON-NLS-1$
- public static final String ADMIN_HOSTS = "metamatrix.security.admin.allowedHosts"; //$NON-NLS-1$
- public static final String SECURITY_ENABLED = ConfigurationPropertyNames.MEMBERSHIP_SECURITY_ENABLED;
+ public static final String ADMIN_HOSTS = "membership.allowedHosts"; //$NON-NLS-1$
+ public static final String SECURITY_ENABLED = "membership.enabled"; //$NON-NLS-1$
public static final String DOMAIN_PROPERTIES = "propertiesFile"; //$NON-NLS-1$
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -56,7 +56,13 @@
*/
public interface SessionServiceInterface extends ApplicationService {
public static String NAME = "SessionService"; //$NON-NLS-1$
+
+ public static final String DEFAULT_MAX_SESSIONS = "5000"; //$NON-NLS-1$
+ public static final String DEFAULT_SESSION_TIMEOUT = "600000"; //$NON-NLS-1$
+ public static final String MAX_SESSIONS = "session.maxSessions"; //$NON-NLS-1$
+ public static final String SESSION_TIMEOUT = "session.timeoutInMilli"; //$NON-NLS-1$
+
/**
* Create a session for the given user authenticating against the given <code>Credentials</code>.
*/
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -44,12 +44,17 @@
import org.teiid.dqp.internal.cache.ResultSetCache;
import org.teiid.dqp.internal.cache.ResultSetCacheUtil;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Singleton;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.common.application.Application;
import com.metamatrix.common.application.ApplicationEnvironment;
+import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.DQPConfigSource;
+import com.metamatrix.common.application.ServiceLoader;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.buffer.BufferManager;
@@ -93,6 +98,7 @@
/**
* Implements the core DQP processing.
*/
+@Singleton
public class DQPCore extends Application implements ClientSideDQP {
static class ConnectorCapabilitiesCache {
@@ -149,15 +155,8 @@
private Map<RequestID, RequestWorkItem> requests = Collections.synchronizedMap(new HashMap<RequestID, RequestWorkItem>());
private Map<String, List<RequestID>> requestsByClients = Collections.synchronizedMap(new HashMap<String, List<RequestID>>());
private DQPContextCache contextCache;
-
- public DQPCore() {
-
- }
-
- public DQPCore(ApplicationEnvironment environment) {
- this.environment = environment;
- }
-
+ private ServiceLoader loader = new ServiceLoader();
+
/**
* perform a graceful shutdown by allowing in process work to complete
* TODO: this is not quite correct from a request perspective, since we need to re-queue in many instances,
@@ -584,17 +583,43 @@
return chunkSize;
}
- @Override
- public void start(DQPConfigSource configSource)
- throws ApplicationInitializationException {
- super.start(configSource);
+
+ /*
+ * @see com.metamatrix.common.application.Application#initialize(java.util.Properties)
+ */
+ public void start(DQPConfigSource configSource) throws ApplicationInitializationException {
+
+ // Load services into DQP
+ for(int i=0; i<DQPServiceNames.ALL_SERVICES.length; i++) {
+
+ final String serviceName = DQPServiceNames.ALL_SERVICES[i];
+ final Class<? extends ApplicationService> type = DQPServiceNames.ALL_SERVICE_CLASSES[i];
+
+ ApplicationService appService = configSource.getServiceInstance(type);
+ if (appService == null) {
+ LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceIsNull", serviceName)); //$NON-NLS-1$
+ continue;
+ }
+
+ appService = loader.loadService(serviceName, appService);
+ String loggingContext = DQPServiceNames.SERVICE_LOGGING_CONTEXT[i];
+ if (loggingContext != null) {
+ appService = (ApplicationService)LogManager.createLoggingProxy(loggingContext, appService, new Class[] {type}, MessageLevel.DETAIL);
+ }
+
+ appService.initialize(configSource.getProperties());
+ installService(serviceName, appService);
+ LogManager.logInfo(LogConstants.CTX_DQP, DQPPlugin.Util.getString("DQPLauncher.InstallService_ServiceInstalled", serviceName)); //$NON-NLS-1$
+ }
+
ConfigurationService cs = (ConfigurationService)this.getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE);
Properties p = configSource.getProperties();
if (cs != null) {
p = cs.getSystemProperties();
}
start(p);
- }
+ }
+
public void start(Properties props) {
ApplicationEnvironment env = this.getEnvironment();
Modified: trunk/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/main/resources/com/metamatrix/query/execution/i18n.properties 2009-06-26 22:06:04 UTC (rev 1088)
@@ -206,5 +206,5 @@
FileStoreageManager.no_directory=No directory specified for the file storage manager.
FileStoreageManager.not_a_directory={0} is not a valid storage manager directory.
FileStorageManager.error_getting_free_disk_space=Error while seeking free disk space for directory: {0}
-FileStorageManager.can_not_save_lobs=Can not save *Reference Lobs* into peristent disk storage.
-
+FileStorageManager.can_not_save_lobs=Can not save *Reference Lobs* into persistent disk storage.
+FileStorageManager.batch_error=Error while converting batched data to file storage.
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/config/TestDQPLauncher.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -33,10 +33,13 @@
import com.metamatrix.common.application.ApplicationService;
import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.dqp.service.AutoGenDataService;
+import com.metamatrix.dqp.service.BufferService;
import com.metamatrix.dqp.service.DQPServiceNames;
+import com.metamatrix.dqp.service.DataService;
import com.metamatrix.dqp.service.FakeAbstractService;
import com.metamatrix.dqp.service.FakeBufferService;
import com.metamatrix.dqp.service.FakeMetadataService;
+import com.metamatrix.dqp.service.MetadataService;
/**
*/
@@ -53,19 +56,17 @@
public void testLaunch() throws Exception {
DQPConfigSource configSource = Mockito.mock(DQPConfigSource.class);
Mockito.stub(configSource.getProperties()).toReturn(new Properties());
- HashMap<String, Class<? extends ApplicationService>> defaults = new HashMap<String, Class<? extends ApplicationService>>();
- Mockito.stub(configSource.getDefaultServiceClasses()).toReturn(defaults);
+
String[] services = new String[] {DQPServiceNames.BUFFER_SERVICE, DQPServiceNames.METADATA_SERVICE, DQPServiceNames.DATA_SERVICE};
- defaults.put(DQPServiceNames.BUFFER_SERVICE, FakeBufferService.class);
- defaults.put(DQPServiceNames.METADATA_SERVICE, FakeMetadataService.class);
- defaults.put(DQPServiceNames.DATA_SERVICE, AutoGenDataService.class);
+ Mockito.stub(configSource.getServiceInstance(BufferService.class)).toReturn(new FakeBufferService());
+ Mockito.stub(configSource.getServiceInstance(MetadataService.class)).toReturn(new FakeMetadataService());
+ Mockito.stub(configSource.getServiceInstance(DataService.class)).toReturn(new AutoGenDataService());
+
DQPCore dqpCore = new DQPCore();
dqpCore.start(configSource);
- DQPCore dqp = new DQPCore();
- dqp.start(configSource);
- assertNotNull("DQP should not be null", dqp); //$NON-NLS-1$
+ assertNotNull("DQP should not be null", dqpCore); //$NON-NLS-1$
// Check that bootstrapping occurred
for(int i=0; i<services.length; i++) {
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -25,9 +25,11 @@
import java.util.*;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.AuthorizationMgmtException;
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
+import com.metamatrix.platform.security.api.SessionToken;
/**
*/
@@ -154,4 +156,11 @@
String roleName) throws MetaMatrixComponentException {
return false;
}
+
+ @Override
+ public boolean isCallerInRole(SessionToken caller, String roleName)
+ throws AuthorizationMgmtException {
+ // rameshTODO Auto-generated method stub
+ return false;
+ }
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -74,7 +74,7 @@
String vdbName = "bqt"; //$NON-NLS-1$
String vdbVersion = "1"; //$NON-NLS-1$
- ApplicationEnvironment env = new ApplicationEnvironment();
+ final ApplicationEnvironment env = new ApplicationEnvironment();
env.bindService(DQPServiceNames.BUFFER_SERVICE, new FakeBufferService());
FakeMetadataService mdSvc = new FakeMetadataService();
mdSvc.addVdb(vdbName, vdbVersion, FakeMetadataFactory.exampleBQTCached());
@@ -88,7 +88,11 @@
vdbService.addModel(vdbName, vdbVersion, "BQT3", ModelInfo.PRIVATE, false); //$NON-NLS-1$
env.bindService(DQPServiceNames.VDB_SERVICE, vdbService);
- core = new DQPCore(env);
+ core = new DQPCore() {
+ public ApplicationEnvironment getEnvironment() {
+ return env;
+ }
+ };
core.start(new Properties());
}
Modified: trunk/server/pom.xml
===================================================================
--- trunk/server/pom.xml 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/pom.xml 2009-06-26 22:06:04 UTC (rev 1088)
@@ -55,6 +55,11 @@
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-txn-jbossts</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-embedded</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-common-core</artifactId>
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -40,6 +40,8 @@
import java.util.Set;
import java.util.StringTokenizer;
+import org.teiid.transport.SSLConfiguration;
+
import com.metamatrix.admin.AdminPlugin;
import com.metamatrix.admin.api.exception.AdminComponentException;
import com.metamatrix.admin.api.exception.AdminException;
@@ -102,7 +104,6 @@
import com.metamatrix.common.extensionmodule.exception.ExtensionModuleNotFoundException;
import com.metamatrix.common.extensionmodule.exception.InvalidExtensionModuleTypeException;
import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.net.ServerSocketConfiguration;
import com.metamatrix.common.util.LogContextsUtil;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.crypto.CryptoException;
@@ -813,7 +814,8 @@
ProcessObject hostProcess = (ProcessObject) hostProcesses.iterator().next();
mmPort = hostProcess.getPropertyValue(ProcessObject.SERVER_PORT);
- boolean useSSL = ServerSocketConfiguration.isSSLEnabled();
+ //boolean useSSL = SSLConfiguration.isSSLEnabled();
+ boolean useSSL = false;
String mmDriver = "com.metamatrix.jdbc.MMDriver"; //$NON-NLS-1$
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/ChannelListener.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/ChannelListener.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/ChannelListener.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,38 +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.platform.socket;
-
-import com.metamatrix.common.comm.exception.CommunicationException;
-
-public interface ChannelListener {
-
- public interface ChannelListenerFactory {
- ChannelListener createChannelListener(ObjectChannel channel);
- }
-
- void receivedMessage(Object msg) throws CommunicationException;
-
- void exceptionOccurred(Throwable t);
-
- void onConnection() throws CommunicationException;
-}
\ No newline at end of file
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SSLAwareChannelHandler.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SSLAwareChannelHandler.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SSLAwareChannelHandler.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,250 +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.platform.socket;
-
-import java.io.IOException;
-import java.net.SocketAddress;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.net.ssl.SSLEngine;
-
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.ChannelFutureListener;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.ChannelPipelineCoverage;
-import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.ChannelStateEvent;
-import org.jboss.netty.channel.DefaultChannelPipeline;
-import org.jboss.netty.channel.ExceptionEvent;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.SimpleChannelHandler;
-import org.jboss.netty.handler.codec.serialization.ObjectDecoder;
-import org.jboss.netty.handler.codec.serialization.ObjectEncoder;
-import org.jboss.netty.handler.ssl.SslHandler;
-
-import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
-import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-
-/**
- * Main class for creating Netty Nio Channels
- */
-
-(a)ChannelPipelineCoverage(ChannelPipelineCoverage.ALL)
-public class SSLAwareChannelHandler extends SimpleChannelHandler implements ChannelPipelineFactory {
-
- public class ObjectChannelImpl implements ObjectChannel {
- private final Channel channel;
-
- public ObjectChannelImpl(Channel channel) {
- this.channel = channel;
- }
-
- public void close() {
- channel.close();
- }
-
- public boolean isOpen() {
- return channel.isOpen();
- }
-
- public SocketAddress getRemoteAddress() {
- return channel.getRemoteAddress();
- }
-
- @Override
- public Object read() throws IOException,
- ClassNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public Future<?> write(Object msg) {
- final ChannelFuture future = channel.write(msg);
- future.addListener(completionListener);
- return new Future<Void>() {
-
- @Override
- public boolean cancel(boolean arg0) {
- return future.cancel();
- }
-
- @Override
- public Void get() throws InterruptedException,
- ExecutionException {
- future.await();
- if (!future.isSuccess()) {
- throw new ExecutionException(future.getCause());
- }
- return null;
- }
-
- @Override
- public Void get(long arg0, TimeUnit arg1)
- throws InterruptedException, ExecutionException,
- TimeoutException {
- if (future.await(arg0, arg1)) {
- if (!future.isSuccess()) {
- throw new ExecutionException(future.getCause());
- }
- return null;
- }
- throw new TimeoutException();
- }
-
- @Override
- public boolean isCancelled() {
- return future.isCancelled();
- }
-
- @Override
- public boolean isDone() {
- return future.isDone();
- }
- };
- }
- }
-
- private final ChannelListener.ChannelListenerFactory listenerFactory;
- private final SSLEngine engine;
- private final ClassLoader classLoader;
- private Map<Channel, ChannelListener> listeners = Collections.synchronizedMap(new HashMap<Channel, ChannelListener>());
- private AtomicLong objectsRead = new AtomicLong(0);
- private AtomicLong objectsWritten = new AtomicLong(0);
- private volatile int maxChannels;
-
- private ChannelFutureListener completionListener = new ChannelFutureListener() {
-
- @Override
- public void operationComplete(ChannelFuture arg0)
- throws Exception {
- if (arg0.isSuccess()) {
- objectsWritten.getAndIncrement();
- }
- }
-
- };
-
- public SSLAwareChannelHandler(ChannelListener.ChannelListenerFactory listenerFactory,
- SSLEngine engine, ClassLoader classloader) {
- this.listenerFactory = listenerFactory;
- this.engine = engine;
- this.classLoader = classloader;
- }
-
- @Override
- public void channelConnected(ChannelHandlerContext ctx,
- final ChannelStateEvent e) throws Exception {
- ChannelListener listener = this.listenerFactory.createChannelListener(new ObjectChannelImpl(e.getChannel()));
- synchronized (this.listeners) {
- this.listeners.put(e.getChannel(), listener);
- maxChannels = Math.max(maxChannels, this.listeners.size());
- }
- if (engine != null) {
- SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
- sslHandler.handshake(e.getChannel()).addListener(new ChannelFutureListener() {
- public void operationComplete(ChannelFuture arg0)
- throws Exception {
- onConnection(e.getChannel());
- }
- });
- } else {
- onConnection(e.getChannel());
- }
- }
-
- private void onConnection(Channel channel) throws Exception {
- ChannelListener listener = this.listeners.get(channel);
- if (listener != null) {
- listener.onConnection();
- }
- }
-
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx,
- ExceptionEvent e) throws Exception {
- ChannelListener listener = this.listeners.get(e.getChannel());
- if (listener != null) {
- listener.exceptionOccurred(e.getCause());
- }
- e.getChannel().close();
- }
-
- @Override
- public void messageReceived(ChannelHandlerContext ctx,
- MessageEvent e) throws Exception {
- objectsRead.getAndIncrement();
- ChannelListener listener = this.listeners.get(e.getChannel());
- if (listener != null) {
- listener.receivedMessage(e.getMessage());
- }
- }
-
- @Override
- public void channelDisconnected(ChannelHandlerContext ctx,
- ChannelStateEvent e) throws Exception {
- ChannelListener listener = this.listeners.remove(e.getChannel());
- if (listener != null) {
- listener.exceptionOccurred(new SingleInstanceCommunicationException(CommPlatformPlugin.Util.getString("SSLAwareChannelHandler.channel_closed"))); //$NON-NLS-1$
- }
- }
-
- public ChannelPipeline getPipeline() throws Exception {
- ChannelPipeline pipeline = new DefaultChannelPipeline();
-
- if (engine != null) {
- pipeline.addLast("ssl", new SslHandler(engine)); //$NON-NLS-1$
- }
- pipeline.addLast("decoder", new ObjectDecoder(1 << 24, classLoader)); //$NON-NLS-1$
- pipeline.addLast("encoder", new ObjectEncoder()); //$NON-NLS-1$
- pipeline.addLast("handler", this); //$NON-NLS-1$
- return pipeline;
- }
-
- public long getObjectsRead() {
- return this.objectsRead.get();
- }
-
- public long getObjectsWritten() {
- return this.objectsWritten.get();
- }
-
- public int getConnectedChannels() {
- return this.listeners.size();
- }
-
- public int getMaxConnectedChannels() {
- return this.maxChannels;
- }
-
-}
\ No newline at end of file
Modified: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -24,17 +24,18 @@
import java.util.Properties;
+import org.teiid.transport.SSLConfiguration;
+import org.teiid.transport.SocketListener;
+
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.comm.platform.socket.server.SocketListener;
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.api.Host;
import com.metamatrix.common.config.api.VMComponentDefnType;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.messaging.MessageBus;
-import com.metamatrix.common.net.ServerSocketConfiguration;
import com.metamatrix.common.queue.WorkerPoolStats;
import com.metamatrix.common.util.LogCommonConstants;
import com.metamatrix.common.util.PropertiesUtils;
@@ -120,9 +121,9 @@
};
logMessage(PlatformPlugin.Util.getString("SocketVMController.1", param)); //$NON-NLS-1$
- ServerSocketConfiguration helper = new ServerSocketConfiguration();
+ SSLConfiguration helper = new SSLConfiguration();
try {
- helper.init();
+ helper.init(props);
listener = new SocketListener(socketPort, bindaddress, this.clientServices, inputBufferSize, outputBufferSize, maxThreads, helper.getServerSSLEngine(), helper.isClientEncryptionEnabled(), PlatformProxyHelper.getSessionServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL));
} catch (Exception e) {
LogManager.logCritical(LogCommonConstants.CTX_CONTROLLER, e, PlatformPlugin.Util.getString("SocketVMController.2",param)); //$NON-NLS-1$
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/AdminAuthorizationInterceptor.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/AdminAuthorizationInterceptor.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/AdminAuthorizationInterceptor.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,145 +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.platform.socket.server;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.admin.RolesAllowed;
-import com.metamatrix.admin.api.server.AdminRoles;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.api.exception.security.AuthorizationException;
-import com.metamatrix.client.ExceptionUtil;
-import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.util.LogContextsUtil;
-import com.metamatrix.common.util.LogContextsUtil.PlatformAdminConstants;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.util.ArgCheck;
-import com.metamatrix.dqp.service.AuditMessage;
-import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.platform.security.api.service.AuthorizationServiceInterface;
-import com.metamatrix.platform.security.audit.AuditManager;
-
-/**
- * Call authorization service to make sure the current admin user has the
- * proper admin role(s) to perform the method.
- */
-public class AdminAuthorizationInterceptor implements InvocationHandler {
-
- private final Object service;
- private AuthorizationServiceInterface authAdmin;
-
-
- /**
- * Ctor.
- * @param securityContextFactory
- * @param authorizationService
- * @param methodNames
- * @since 4.3
- */
- public AdminAuthorizationInterceptor(
- AuthorizationServiceInterface authorizationService, Object service) {
- ArgCheck.isNotNull(authorizationService);
- this.authAdmin = authorizationService;
- this.service = service;
- }
-
- /**
- *
- * @param invocation
- * @param securityContext
- * @throws AuthorizationException
- * @throws MetaMatrixProcessingException
- * @since 4.3
- */
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- SessionToken adminToken = DQPWorkContext.getWorkContext().getSessionToken();
-
- Method serviceMethod = service.getClass().getMethod(method.getName(), method.getParameterTypes());
- RolesAllowed allowed = serviceMethod.getAnnotation(RolesAllowed.class);
- if (allowed == null) {
- allowed = method.getAnnotation(RolesAllowed.class);
- if (allowed == null) {
- allowed = serviceMethod.getDeclaringClass().getAnnotation(RolesAllowed.class);
- if (allowed == null) {
- allowed = method.getDeclaringClass().getAnnotation(RolesAllowed.class);
- }
- }
- }
- if (allowed == null || allowed.value() == null) {
- throw new MetaMatrixRuntimeException("Could not determine roles allowed for admin method"); //$NON-NLS-1$
- }
-
- boolean authorized = false;
- AuditMessage msg = new AuditMessage(PlatformAdminConstants.CTX_ADMIN_API, Arrays.toString(allowed.value())+"-request", adminToken.getUsername(), new Object[]{method.getName()}); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, LogContextsUtil.CommonConstants.CTX_AUDITLOGGING, msg);
-
- for (int i = 0; i < allowed.value().length; i++) {
- String requiredRoleName = allowed.value()[i];
- if (AdminRoles.RoleName.ANONYMOUS.equalsIgnoreCase(requiredRoleName)) {
- authorized = true;
- break;
- }
-
- if (authAdmin.isCallerInRole(adminToken, requiredRoleName)) {
- authorized = true;
- break;
- }
- }
- if (!authorized) {
- msg = new AuditMessage(PlatformAdminConstants.CTX_ADMIN_API, Arrays.toString(allowed.value())+"-denied", adminToken.getUsername(), new Object[]{method.getName()}); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, LogContextsUtil.CommonConstants.CTX_AUDITLOGGING, msg);
-
- Object[] msgParts = buildAuditMessage(adminToken, Arrays.toString(allowed.value()), method);
- String errMsg = CommPlatformPlugin.Util.getString("AdminAuthorizationInterceptor.Admin_not_authorized", msgParts); //$NON-NLS-1$
- throw ExceptionUtil.convertException(method, new AuthorizationException(errMsg));
- }
- try {
- return method.invoke(service, args);
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
-
- /**
- * Builds an audit msg using given values including method signature string from given invocation using method
- * name and argument values.
- * @param securityContext
- * @param adminToken
- * @param requiredRoleName
- * @param invocation
- * @return
- * @since 5.0
- */
- private Object[] buildAuditMessage(SessionToken adminToken, String requiredRoleName, Method invocation) {
- return new Object[] {adminToken.getUsername(), adminToken.getSessionID().toString(), requiredRoleName, invocation.getName()};
- }
-
-}
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ClientInstance.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ClientInstance.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ClientInstance.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,58 +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.platform.socket.server;
-
-import java.io.Serializable;
-
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.common.comm.api.Message;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.util.crypto.Cryptor;
-
-/**
- * Represents a ClientConnection from the server's point of view. This interface
- * can be used by a ServerListener implementation to manage the incoming
- * client connections, retrieve information about a particular connection,
- * and send a message to a particular connection in the asynchronous message scenario.
- */
-public interface ClientInstance {
-
- /**
- * Send a message to this particular client using the asynch message key.
- * @param message The message to send
- * @param messageKey The key sent with the asynch query
- * @throws CommunicationException If an error occurs during the send
- */
- void send(Message message, Serializable messageKey);
-
- /**
- * Shutdown the server's connection to the client.
- * @throws CommunicationException If an error occurs during the shutdown
- */
- void shutdown() throws CommunicationException;
-
- Cryptor getCryptor();
-
- DQPWorkContext getWorkContext();
-}
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/LogonImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/LogonImpl.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/LogonImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,192 +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.platform.socket.server;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.CredentialMap;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.api.exception.ComponentNotFoundException;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.api.exception.security.MetaMatrixAuthenticationException;
-import com.metamatrix.api.exception.security.SessionServiceException;
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.util.LogConstants;
-import com.metamatrix.dqp.client.ResultsFuture;
-import com.metamatrix.jdbc.api.ConnectionProperties;
-import com.metamatrix.platform.security.api.Credentials;
-import com.metamatrix.platform.security.api.ILogon;
-import com.metamatrix.platform.security.api.LogonResult;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
-import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
-import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.service.api.exception.ServiceException;
-import com.metamatrix.platform.service.api.exception.ServiceStateException;
-import com.metamatrix.platform.util.ProductInfoConstants;
-import com.metamatrix.server.ServerPlugin;
-
-public class LogonImpl implements ILogon {
-
- private SessionServiceInterface service;
- private String clusterName;
-
- public LogonImpl(SessionServiceInterface service, String clusterName) {
- this.service = service;
- this.clusterName = clusterName;
- }
-
- public LogonResult logon(Properties connProps) throws LogonException,
- ComponentNotFoundException {
-
- String applicationName = connProps.getProperty(MMURL.CONNECTION.APP_NAME);
- // user may be null if using trustedToken to log on
- String user = connProps.getProperty(MMURL.CONNECTION.USER_NAME);
- // password may be null if using trustedToken to log on
- String password = connProps.getProperty(MMURL.CONNECTION.PASSWORD);
- Credentials credential = null;
- if (password != null) {
- credential = new Credentials(password.toCharArray());
- }
-
- if(connProps.containsKey(ConnectionProperties.PROP_CREDENTIALS)) {
- handleCredentials(connProps, user, password);
- }
-
- Object payload = connProps.get(MMURL.CONNECTION.CLIENT_TOKEN_PROP);
-
- try {
- MetaMatrixSessionInfo sessionInfo = service.createSession(user,
- credential, (Serializable) payload, applicationName,
- connProps);
- // logon
- 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$
- return new LogonResult(sessionInfo.getSessionToken(), sessionInfo.getProductInfo(), clusterName);
- } catch (MetaMatrixAuthenticationException e) {
- throw new LogonException(e, e.getMessage());
- } catch (ServiceException e) {
- throw new ComponentNotFoundException(e, e.getMessage());
- } catch (SessionServiceException e) {
- throw new LogonException(e, e.getMessage());
- }
- }
-
- private void handleCredentials(Properties connProps, String user,
- String password) throws LogonException {
- // 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(ServerPlugin.Util.getString("LogonImpl.Invalid_use_of_credentials_and_token")); //$NON-NLS-1$
- }
-
- // Parse credentials and store CredentialMap as session token
- try {
- String credentials = connProps.getProperty(ConnectionProperties.PROP_CREDENTIALS);
- CredentialMap credentialMap = null;
- boolean defaultToLogon = false;
- if(credentials.startsWith(ConnectionProperties.DEFAULT_TO_LOGON)) {
- defaultToLogon = true;
- }
- int parenIndex = credentials.indexOf("("); //$NON-NLS-1$
- if(parenIndex >= 0) {
- credentialMap = CredentialMap.parseCredentials(credentials.substring(parenIndex));
- } else {
- credentialMap = new CredentialMap();
- }
- if(defaultToLogon) {
- credentialMap.setDefaultCredentialMode(CredentialMap.MODE_USE_DEFAULTS_GLOBALLY);
- Map<String, String> defaultCredentials = new HashMap<String, String>();
- defaultCredentials.put(CredentialMap.USER_KEYWORD, user);
- defaultCredentials.put(CredentialMap.PASSWORD_KEYWORD, password);
- credentialMap.setDefaultCredentials(defaultCredentials);
- } else {
- credentialMap.setDefaultCredentialMode(CredentialMap.MODE_IGNORE_DEFAULTS);
- }
- connProps.put(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD, credentialMap);
- } catch(ConnectorException e) {
- throw new LogonException(e.getMessage());
- }
-
- // Remove credentials from info properties
- connProps.remove(ConnectionProperties.PROP_CREDENTIALS);
- }
-
- private MetaMatrixSessionID updateDQPContext(MetaMatrixSessionInfo sessionInfo) {
- MetaMatrixSessionID sessionID = sessionInfo.getSessionID();
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- workContext.setSessionToken(sessionInfo.getSessionToken());
- workContext.setAppName(sessionInfo.getApplicationName());
- workContext.setTrustedPayload(sessionInfo.getTrustedToken());
- workContext.setVdbName(sessionInfo.getProductInfo(ProductInfoConstants.VIRTUAL_DB));
- workContext.setVdbVersion(sessionInfo.getProductInfo(ProductInfoConstants.VDB_VERSION));
- return sessionID;
- }
-
- public ResultsFuture<?> logoff() throws InvalidSessionException, MetaMatrixComponentException {
- try {
- this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
- } catch (SessionServiceException e) {
- throw new MetaMatrixComponentException(e);
- } catch (ServiceException e) {
- throw new MetaMatrixComponentException(e);
- }
- return null;
- }
-
- public ResultsFuture<?> ping() throws InvalidSessionException,
- MetaMatrixComponentException {
- try {
- this.service.pingServer(DQPWorkContext.getWorkContext().getSessionId());
- } catch (ServiceStateException e) {
- throw new MetaMatrixComponentException(e);
- }
- return null;
- }
-
- @Override
- public void assertIdentity(SessionToken sessionId)
- throws InvalidSessionException, MetaMatrixComponentException {
- MetaMatrixSessionInfo sessionInfo;
- try {
- sessionInfo = this.service.validateSession(sessionId.getSessionID());
- } catch (SessionServiceException e) {
- throw new MetaMatrixComponentException(e);
- } catch (ServiceException e) {
- throw new MetaMatrixComponentException(e);
- }
- if (!sessionInfo.getSessionToken().equals(sessionInfo.getSessionToken())) {
- throw new InvalidSessionException();
- }
- this.updateDQPContext(sessionInfo);
- }
-
-}
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,180 +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.platform.socket.server;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.concurrent.ExecutionException;
-
-import javax.crypto.SealedObject;
-
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.api.exception.ComponentNotFoundException;
-import com.metamatrix.api.exception.ExceptionHolder;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.comm.ClientServiceRegistry;
-import com.metamatrix.common.comm.api.Message;
-import com.metamatrix.common.comm.platform.socket.client.ServiceInvocationStruct;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.util.crypto.CryptoException;
-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.platform.security.api.ILogon;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.server.util.LogConstants;
-
-public class ServerWorkItem implements Runnable {
- private final ClientInstance socketClientInstance;
- private final Serializable messageKey;
- private final Message message;
- private final ClientServiceRegistry server;
- private final SessionServiceInterface sessionService;
-
- public ServerWorkItem(ClientInstance socketClientInstance,
- Serializable messageKey, Message message,
- ClientServiceRegistry server, SessionServiceInterface sessionService) {
- this.socketClientInstance = socketClientInstance;
- this.messageKey = messageKey;
- this.message = message;
- this.server = server;
- this.sessionService = sessionService;
- }
-
- /**
- * main entry point for remote method calls. encryption/decryption is
- * handled here so that it won't be done by the io thread
- */
- public void run() {
- DQPWorkContext.setWorkContext(this.socketClientInstance.getWorkContext());
- Message result = null;
- String service = null;
- final boolean encrypt = message.getContents() instanceof SealedObject;
- try {
- message.setContents(this.socketClientInstance.getCryptor().unsealObject(message.getContents()));
-
- if (!(message.getContents() instanceof ServiceInvocationStruct)) {
- throw new AssertionError("unknown message contents"); //$NON-NLS-1$
- }
- 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$
- }
- if (!(instance instanceof ILogon)) {
- DQPWorkContext workContext = this.socketClientInstance.getWorkContext();
- sessionService.validateSession(workContext.getSessionId());
- }
- service = serviceStruct.targetClass;
- ReflectionHelper helper = new ReflectionHelper(instance.getClass());
- Method m = helper.findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
- Object methodResult;
- try {
- methodResult = m.invoke(instance, serviceStruct.args);
- } catch (InvocationTargetException e) {
- throw e.getCause();
- }
- if (ResultsFuture.class.isAssignableFrom(m.getReturnType()) && methodResult != null) {
- ResultsFuture<Serializable> future = (ResultsFuture<Serializable>) methodResult;
- future.addCompletionListener(new ResultsFuture.CompletionListener<Serializable>() {
-
- public void onCompletion(
- ResultsFuture<Serializable> completedFuture) {
- Message asynchResult = new Message();
- try {
- asynchResult.setContents(completedFuture.get());
- } catch (InterruptedException e) {
- asynchResult.setContents(processException(e, serviceStruct.targetClass));
- } catch (ExecutionException e) {
- asynchResult.setContents(processException(e.getCause(), serviceStruct.targetClass));
- }
- sendResult(asynchResult, encrypt);
- }
-
- });
- } else { // synch call
- Message resultHolder = new Message();
- resultHolder.setContents((Serializable)methodResult);
- result = resultHolder;
- }
- } catch (Throwable t) {
- Message holder = new Message();
- holder.setContents(processException(t, service));
- result = holder;
- }
- if (result != null) {
- sendResult(result, encrypt);
- }
- }
-
- void sendResult(Message result, boolean encrypt) {
- if (encrypt) {
- try {
- result.setContents(socketClientInstance.getCryptor().sealObject(result.getContents()));
- } catch (CryptoException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- }
- socketClientInstance.send(result, messageKey);
- }
-
- private Serializable processException(Throwable e, String service) {
- String context = null;
- if (service != null) {
- context = this.server.getLoggingContextForService(service);
- }
- if (context == null) {
- context = LogConstants.CTX_ROUTER;
- }
- // Case 5558: Differentiate between system level errors and
- // processing errors. Only log system level errors as errors,
- // log the processing errors as warnings only
- if (e instanceof MetaMatrixProcessingException) {
- logProcessingException(e, context);
- } 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$
- }
-
- return new ExceptionHolder(e);
- }
-
- private void logProcessingException(Throwable e, String context) {
- Throwable cause = e;
- while (cause.getCause() != null && cause != cause.getCause()) {
- cause = cause.getCause();
- }
- 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$
- }
-
-}
\ No newline at end of file
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketClientInstance.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,159 +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.platform.socket.server;
-
-import java.io.Serializable;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.common.comm.ClientServiceRegistry;
-import com.metamatrix.common.comm.api.Message;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-import com.metamatrix.common.comm.platform.socket.ChannelListener;
-import com.metamatrix.common.comm.platform.socket.Handshake;
-import com.metamatrix.common.comm.platform.socket.ObjectChannel;
-import com.metamatrix.common.comm.platform.socket.SocketVMController;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.queue.WorkerPool;
-import com.metamatrix.common.util.crypto.CryptoException;
-import com.metamatrix.common.util.crypto.Cryptor;
-import com.metamatrix.common.util.crypto.DhKeyGenerator;
-import com.metamatrix.common.util.crypto.NullCryptor;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-
-/**
- * Sockets implementation of the communication framework class representing the server's view of a client connection.
- * Implements the server-side of the sockets messaging protocol.
- * The client side of the protocol is implemented in SocketServerInstance.
- * Users of this class are expected to provide a WorkerPool for processing incoming messages. Users must also call read().
- * Users also provide a ServerListener implementation. The ServerListener is the application level object
- * processing the application level messages.
- */
-public class SocketClientInstance implements ChannelListener, ClientInstance {
-
- private final ObjectChannel objectSocket;
- private final WorkerPool workerPool;
- private final ClientServiceRegistry server;
- private Cryptor cryptor;
- private boolean usingEncryption;
- private DhKeyGenerator keyGen;
- private DQPWorkContext workContext = new DQPWorkContext();
- private SessionServiceInterface sessionService;
-
- public SocketClientInstance(ObjectChannel objectSocket, WorkerPool workerPool, ClientServiceRegistry server, boolean isClientEncryptionEnabled, SessionServiceInterface sessionService) {
- this.objectSocket = objectSocket;
- this.workerPool = workerPool;
- this.server = server;
- this.usingEncryption = isClientEncryptionEnabled;
- this.sessionService = sessionService;
- SocketAddress address = this.objectSocket.getRemoteAddress();
- if (address instanceof InetSocketAddress) {
- InetSocketAddress addr = (InetSocketAddress)address;
- this.workContext.setClientAddress(addr.getAddress().getHostAddress());
- this.workContext.setClientHostname(addr.getHostName());
- }
- }
-
- public void send(Message message, Serializable messageKey) {
- if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT, MessageLevel.DETAIL)) {
- LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, " message: " + message + " for request ID:" + messageKey); //$NON-NLS-1$ //$NON-NLS-2$
- }
- message.setMessageKey(messageKey);
- objectSocket.write(message);
- }
-
- /**
- * @return Returns the cryptor.
- */
- public Cryptor getCryptor() {
- return this.cryptor;
- }
-
- public void exceptionOccurred(Throwable t) {
- LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, t, "Unhandled exception, closing client instance"); //$NON-NLS-1$
- }
-
- public void onConnection() throws CommunicationException {
- Handshake handshake = new Handshake();
- handshake.setVersion(SocketListener.getVersionInfo());
-
- if (usingEncryption) {
- keyGen = new DhKeyGenerator();
- byte[] publicKey;
- try {
- publicKey = keyGen.createPublicKey();
- } catch (CryptoException e) {
- throw new CommunicationException(e);
- }
- handshake.setPublicKey(publicKey);
- }
- this.objectSocket.write(handshake);
- }
-
- private void receivedHahdshake(Handshake handshake) throws CommunicationException {
- if (usingEncryption) {
- byte[] returnedPublicKey = handshake.getPublicKey();
-
- //ensure the key information
- if (returnedPublicKey == null) {
- throw new CommunicationException(CommPlatformPlugin.Util.getString("SocketClientInstance.invalid_sessionkey")); //$NON-NLS-1$
- }
-
- try {
- this.cryptor = keyGen.getSymmetricCryptor(returnedPublicKey);
- } catch (CryptoException e) {
- throw new CommunicationException(e);
- }
- this.keyGen = null;
- } else {
- this.cryptor = new NullCryptor();
- }
- }
-
- public void receivedMessage(Object msg) throws CommunicationException {
- if (msg instanceof Message) {
- processMessagePacket((Message)msg);
- } else if (msg instanceof Handshake) {
- receivedHahdshake((Handshake)msg);
- }
- }
-
- private void processMessagePacket(Message packet) {
- if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT, MessageLevel.DETAIL)) {
- LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, "processing message:" + packet); //$NON-NLS-1$
- }
- workerPool.execute(new ServerWorkItem(this, packet.getMessageKey(), packet, this.server, this.sessionService));
- }
-
- public void shutdown() throws CommunicationException {
- this.objectSocket.close();
- }
-
- public DQPWorkContext getWorkContext() {
- return this.workContext;
- }
-}
Deleted: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,136 +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.platform.socket.server;
-
-import java.net.InetSocketAddress;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import javax.net.ssl.SSLEngine;
-
-import org.jboss.netty.bootstrap.ServerBootstrap;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelFactory;
-import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
-
-import com.metamatrix.common.comm.ClientServiceRegistry;
-import com.metamatrix.common.comm.platform.socket.ChannelListener;
-import com.metamatrix.common.comm.platform.socket.ObjectChannel;
-import com.metamatrix.common.comm.platform.socket.SSLAwareChannelHandler;
-import com.metamatrix.common.comm.platform.socket.SocketVMController;
-import com.metamatrix.common.comm.platform.socket.ChannelListener.ChannelListenerFactory;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.queue.WorkerPool;
-import com.metamatrix.common.queue.WorkerPoolFactory;
-import com.metamatrix.common.queue.WorkerPoolStats;
-import com.metamatrix.common.util.ApplicationInfo;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.vm.controller.SocketListenerStats;
-
-/**
- * Server-side class to listen for new connection requests and create a SocketClientConnection for each connection request.
- */
-public class SocketListener implements ChannelListenerFactory {
- private ClientServiceRegistry server;
- private SSLAwareChannelHandler channelHandler;
- private Channel serverChanel;
- private boolean isClientEncryptionEnabled;
- private SessionServiceInterface sessionService;
- private WorkerPool workerPool;
- private ExecutorService nettyPool;
-
- /**
- *
- * @param port
- * @param bindaddress
- * @param server
- * @param inputBufferSize
- * @param outputBufferSize
- * @param workerPool
- * @param engine null if SSL is disabled
- */
- public SocketListener(int port, String bindAddress,
- ClientServiceRegistry server, int inputBufferSize,
- int outputBufferSize, int maxWorkers, SSLEngine engine, boolean isClientEncryptionEnabled, SessionServiceInterface sessionService) {
- this.isClientEncryptionEnabled = isClientEncryptionEnabled;
- this.sessionService = sessionService;
- if (port < 0 || port > 0xFFFF) {
- throw new IllegalArgumentException("port out of range:" + port); //$NON-NLS-1$
- }
-
- this.server = server;
- this.workerPool = WorkerPoolFactory.newWorkerPool("SocketWorker", maxWorkers); //$NON-NLS-1$
- this.nettyPool = Executors.newCachedThreadPool();
- if (LogManager.isMessageToBeRecorded(SocketVMController.SOCKET_CONTEXT, MessageLevel.DETAIL)) {
- LogManager.logDetail(SocketVMController.SOCKET_CONTEXT, "server = " + this.server + "binding to port:" + port); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- ChannelFactory factory = new NioServerSocketChannelFactory(nettyPool, nettyPool, Math.min(Runtime.getRuntime().availableProcessors(), maxWorkers));
-
- ServerBootstrap bootstrap = new ServerBootstrap(factory);
- this.channelHandler = new SSLAwareChannelHandler(this, engine, Thread.currentThread().getContextClassLoader());
- bootstrap.setPipelineFactory(channelHandler);
- if (inputBufferSize != 0) {
- bootstrap.setOption("receiveBufferSize", new Integer(inputBufferSize)); //$NON-NLS-1$
- }
- if (outputBufferSize != 0) {
- bootstrap.setOption("sendBufferSize", new Integer(outputBufferSize)); //$NON-NLS-1$
- }
- bootstrap.setOption("keepAlive", Boolean.TRUE); //$NON-NLS-1$
-
- this.serverChanel = bootstrap.bind(new InetSocketAddress(bindAddress, port));
- }
-
- public WorkerPoolStats getProcessPoolStats() {
- return this.workerPool.getStats();
- }
-
- public int getPort() {
- return ((InetSocketAddress)this.serverChanel.getLocalAddress()).getPort();
- }
-
- static String getVersionInfo() {
- return ApplicationInfo.getInstance().getMajorReleaseNumber();
- }
-
- public void stop() {
- this.serverChanel.close();
- this.workerPool.shutdownNow();
- this.nettyPool.shutdownNow();
- }
-
- public SocketListenerStats getStats() {
- SocketListenerStats stats = new SocketListenerStats();
- stats.objectsRead = this.channelHandler.getObjectsRead();
- stats.objectsWritten = this.channelHandler.getObjectsWritten();
- stats.sockets = this.channelHandler.getConnectedChannels();
- stats.maxSockets = this.channelHandler.getMaxConnectedChannels();
- return stats;
- }
-
- public ChannelListener createChannelListener(ObjectChannel channel) {
- return new SocketClientInstance(channel, this.workerPool, this.server, this.isClientEncryptionEnabled, this.sessionService);
- }
-
-}
\ No newline at end of file
Copied: trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java (from rev 1067, trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,396 @@
+/*
+ * 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.config;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.Properties;
+
+import com.metamatrix.common.CommonPlugin;
+import com.metamatrix.common.config.api.ComponentType;
+import com.metamatrix.common.config.api.ComponentTypeID;
+import com.metamatrix.common.config.api.Configuration;
+import com.metamatrix.common.config.api.ConfigurationID;
+import com.metamatrix.common.config.api.ConfigurationModelContainer;
+import com.metamatrix.common.config.api.Host;
+import com.metamatrix.common.config.api.HostID;
+import com.metamatrix.common.config.api.ResourceModel;
+import com.metamatrix.common.config.api.SharedResource;
+import com.metamatrix.common.config.api.VMComponentDefn;
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.config.model.BasicHost;
+import com.metamatrix.common.config.reader.CurrentConfigurationReader;
+import com.metamatrix.common.config.reader.PropertiesConfigurationReader;
+import com.metamatrix.common.properties.UnmodifiableProperties;
+import com.metamatrix.common.util.ApplicationInfo;
+import com.metamatrix.common.util.ErrorMessageKeys;
+import com.metamatrix.common.util.NetUtils;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.ReflectionHelper;
+
+/**
+ * <p>
+ * This class represents a single and universal framework for accessing
+ * the current configuration for an application or server VM. The current
+ * configuration contains the specification of runtime properties and
+ * component deployment information. Depending upon the bootstrap information,
+ * this framework may access the configuration information from a central
+ * repository or simply from a local file.
+ * </p>
+ * <p>
+ * This framework can be configured to periodically refresh the cached
+ * configuation information, and a separate thread is used to do this in
+ * the background. As such, the static <code>shutdown()</code> method
+ * should be called by applications when exiting. This method will block until
+ * this framework has successfully shutdown and cleaned up all resources,
+ * and will return gracefully if the method were already called.
+ * Note, however, that any call to this framework to obtain configuration
+ * information will restart the framework, requiring another eventual
+ * shutdown.
+ * </p>
+ */
+public final class CurrentConfiguration {
+ /*
+ * This property enables the overriding of the default {@link BOOTSTRAP_FILE_NAME}
+ */
+ public static final String BOOTSTRAP_FILE_PROPERTY_OVERRIDE = "teiid.bootstrap.file"; //$NON-NLS-1$
+
+ public static final String BOOTSTRAP_FILE_NAME = "teiid.properties"; //$NON-NLS-1$
+ public static final String CONFIGURATION_READER_CLASS_PROPERTY_NAME = "metamatrix.config.reader"; //$NON-NLS-1$
+ public static final String CLUSTER_NAME = "cluster.name"; //$NON-NLS-1$
+ public static final String CONFIGURATION_NAME= "configuration.name"; //$NON-NLS-1$
+ public static final String CLUSTER_MEMBERS = "cluster.unicast.members"; //$NON-NLS-1$
+
+ private CurrentConfigurationReader reader;
+ private Properties bootstrapProperties;
+ private Properties modifyableBootstrapProperties;
+ private Properties systemBootstrapProperties;
+ private String bindAddress;
+ private InetAddress hostAddress;
+ private String configurationName;
+ private String processName;
+
+ private static CurrentConfiguration INSTANCE = new CurrentConfiguration();
+
+ public static CurrentConfiguration getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Private constructor that prevents instantiation.
+ */
+ private CurrentConfiguration() {
+ setHostProperties(null);
+ }
+
+ private void setHostProperties(String bind) {
+ Host host = getDefaultHost();
+ this.configurationName = host.getFullName();
+ String hostName = host.getHostAddress();
+ if (bind == null) {
+ bind = host.getBindAddress();
+ }
+
+ boolean bindAddressDefined = (bind != null && bind.length() > 0);
+ boolean hostNameDefined = (hostName != null && hostName.length() > 0);
+
+ try {
+ if (hostNameDefined) {
+ this.hostAddress = NetUtils.resolveHostByName(hostName);
+ }
+
+ if (bindAddressDefined) {
+ this.bindAddress = bind;
+
+ if (!hostNameDefined) {
+ this.hostAddress = InetAddress.getByName(bindAddress);
+ }
+ }
+ else {
+ if (!hostNameDefined) {
+ this.hostAddress = NetUtils.getInstance().getInetAddress();
+ }
+ this.bindAddress = this.hostAddress.getHostAddress();
+ }
+ } catch (UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
+
+ // these properties will be used to identify the server in TCP based cluster setup.
+ String unicastMembers = bootstrapProperties.getProperty(CLUSTER_MEMBERS);
+ if (unicastMembers == null) {
+ unicastMembers = this.configurationName+"|"+this.hostAddress.getCanonicalHostName(); //$NON-NLS-1$
+ }
+ else {
+ unicastMembers = unicastMembers+","+this.configurationName+"|"+this.hostAddress.getCanonicalHostName(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ modifyableBootstrapProperties.setProperty(CLUSTER_MEMBERS, unicastMembers);
+ }
+
+ public boolean isAvailable() {
+ return this.reader != null;
+ }
+
+ /**
+ * Return the stringified representation of this application information object.
+ * @return the string form of this object; never null
+ */
+ public String getHostInfo() {
+ StringBuffer sb = new StringBuffer("Host Information"); //$NON-NLS-1$
+ sb.append('\n');
+ sb.append(" VM Name: " + processName ); //$NON-NLS-1$
+ sb.append('\n');
+ sb.append(" Hostname: " + hostAddress.getCanonicalHostName() ); //$NON-NLS-1$
+ sb.append('\n');
+ sb.append(" Version: ").append(ApplicationInfo.getInstance().getReleaseNumber()); //$NON-NLS-1$
+ sb.append('\n');
+ sb.append(" Build Date: ").append(ApplicationInfo.getInstance().getBuildDate()); //$NON-NLS-1$
+ return sb.toString();
+ }
+
+ public void setProcessName(String name) {
+ VMComponentDefn deployedVM;
+ try {
+ deployedVM = getConfiguration().getVMForHost(getDefaultHost().getName(), name);
+ } catch (ConfigurationException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+
+ if (deployedVM == null) {
+ throw new MetaMatrixRuntimeException(CommonPlugin.Util.getString("CurrentConfiguration.unknown_process", name)); //$NON-NLS-1$
+ }
+ this.processName = name;
+ setHostProperties(deployedVM.getBindAddress());
+ }
+
+ public String getBindAddress() {
+ return bindAddress;
+ }
+
+ public InetAddress getHostAddress() {
+ return hostAddress;
+ }
+
+ public String getConfigurationName() {
+ return configurationName;
+ }
+
+ public String getProcessName() {
+ return processName;
+ }
+
+ public String getClusterName() throws ConfigurationException {
+ Properties props = getResourceProperties(ResourceNames.JGROUPS);
+ return props.getProperty(CLUSTER_NAME, "Teiid-Cluster"); //$NON-NLS-1$
+ }
+
+ /**
+ * Get all of the configuration properties. The properties
+ * that are returned have default properties that are the bootstrap properties.
+ * @return the immutable properties; never null
+ * @throws ConfigurationException if the current configuration and/or
+ * bootstrap properties could not be obtained
+ */
+ public Properties getProperties() {
+ try {
+ ConfigurationModelContainer cmc = getReader().getConfigurationModel();
+ ComponentTypeID id = cmc.getConfiguration().getComponentTypeID();
+ Properties result = new Properties(getBootStrapProperties());
+ PropertiesUtils.putAll(result, cmc.getDefaultPropertyValues(id));
+ PropertiesUtils.putAll(result, cmc.getConfiguration().getProperties());
+ return new UnmodifiableProperties(result);
+ } catch (ConfigurationException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ }
+
+ /**
+ * Get the connection properties for the specified resource. The resourse name
+ * is dependent on the type of resource. For services, excluding connectors,
+ * the resource name will be the component type name {@link com.metamatrix.common.config.api.ComponentType}.
+ * For other types, they will generally have a predefined static variable
+ * called RESOURCE_NAME that will be used to ask for its properties.
+ * @param resourceName is the name of the resource to obtain properties for.
+ * @return the immutable properties; never null
+ * @throws ConfigurationException if the current configuration and/or
+ * bootstrap properties could not be obtained
+ */
+ public Properties getResourceProperties(String resourceName) throws ConfigurationException {
+ Properties result;
+
+ SharedResource sr = getReader().getConfigurationModel().getResource(resourceName);
+
+ Properties props;
+ if (sr != null) {
+ props = ResourceModel.getDefaultProperties(resourceName);
+ props.putAll(sr.getProperties());
+ } else {
+ props = new Properties();
+
+ }
+
+ // allow the system properties to override
+ PropertiesUtils.setOverrideProperies(props, getSystemBootStrapProperties());
+
+ result = new UnmodifiableProperties(props);
+
+ return result;
+ }
+
+ /**
+ * Get the current configuration that is to be used for deployment.
+ * @return the Configuration used for deployment
+ * @throws ConfigurationException if the current configuration could not be obtained
+ */
+ public Configuration getConfiguration() throws ConfigurationException {
+ Configuration config = getReader().getConfigurationModel().getConfiguration();
+ if ( config == null ) {
+ throw new ConfigurationException(ErrorMessageKeys.CONFIG_ERR_0021, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0021));
+ }
+ return config;
+ }
+
+
+ /**
+ * Get the current configuration that is to be used for deployment.
+ * @return the Configuration used for deployment
+ * @throws ConfigurationException if the current configuration could not be obtained
+ */
+ public ConfigurationModelContainer getConfigurationModel() throws ConfigurationException {
+ ConfigurationModelContainer config = null;
+ try {
+ config = getReader().getConfigurationModel();
+ } catch (UnsupportedOperationException e) {
+ }
+
+ if (config == null) {
+ throw new ConfigurationException(ErrorMessageKeys.CONFIG_ERR_0022,
+ CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0022));
+ }
+
+ return config;
+ }
+
+ /**
+ * Returns a <code>Collection</code> of type <code>ComponentType</code> that represent
+ * all the ComponentTypes defined.
+ * @param includeDeprecated true if class names that have been deprecated should be
+ * included in the returned list, or false if only non-deprecated constants should be returned.
+ * @return List of type <code>ComponentType</code>
+ * @throws ConfigurationException if an error occurred within or during communication with the Configuration Service.
+ * @see com.metamatrix.common.api.ComponentType
+ */
+ public Collection<ComponentType> getComponentTypes(boolean includeDeprecated) throws ConfigurationException {
+ return getReader().getConfigurationModel().getComponentTypes().values();
+ }
+
+
+ /**
+ * Returns the Host based on the current running machine.
+ * @return the full Host object
+ * @throws ConfigurationException if an error occurred within or during
+ * communication with the Configuration Service, or if there is no object
+ * for the given ID.
+ */
+ public Host getDefaultHost() {
+ String name = getBootStrapProperties().getProperty(CONFIGURATION_NAME, "embedded"); //$NON-NLS-1$
+ BasicHost host = new BasicHost(new ConfigurationID(name), new HostID(name), Host.HOST_COMPONENT_TYPE_ID);
+
+ Properties props = new Properties();
+ props.setProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR, System.getProperty("user.dir"))); //$NON-NLS-1$
+ props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
+ props.setProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY, System.getProperty("user.dir"))); //$NON-NLS-1$
+ props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS, "")); //$NON-NLS-1$
+ props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS, getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS, "")); //$NON-NLS-1$
+
+ host.setProperties(props);
+ return host;
+ }
+
+
+ /**
+ * Reset causes not just a refresh, but the bootstrapping process
+ * to occur again.
+ */
+ public static void reset() {
+ INSTANCE = new CurrentConfiguration();
+ }
+
+ public synchronized Properties getBootStrapProperties() {
+ if (bootstrapProperties == null) {
+ Properties systemBootStrapProps = getSystemBootStrapProperties();
+ Properties bootstrapProps = new Properties(systemBootStrapProps);
+ InputStream bootstrapPropStream = null;
+
+ String bootstrapfile = systemBootStrapProps.getProperty(BOOTSTRAP_FILE_PROPERTY_OVERRIDE, BOOTSTRAP_FILE_NAME);
+ try {
+ bootstrapPropStream = this.getClass().getClassLoader().getResourceAsStream(bootstrapfile);
+ if (bootstrapPropStream != null) {
+ bootstrapProps.load(bootstrapPropStream);
+ }
+ } catch (IOException e) {
+ throw new MetaMatrixRuntimeException(ErrorMessageKeys.CONFIG_ERR_0069, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0069, BOOTSTRAP_FILE_NAME));
+ } finally {
+ try {
+ if (bootstrapPropStream != null) {
+ bootstrapPropStream.close();
+ }
+ } catch (IOException e ) {
+ }
+ }
+ modifyableBootstrapProperties = bootstrapProps;
+ bootstrapProperties = new UnmodifiableProperties(bootstrapProps);
+ }
+ return bootstrapProperties;
+ }
+
+ public synchronized final Properties getSystemBootStrapProperties() {
+ if (systemBootstrapProperties == null) {
+ systemBootstrapProperties = new UnmodifiableProperties(System.getProperties());
+ }
+ return systemBootstrapProperties;
+ }
+
+ synchronized CurrentConfigurationReader getReader() throws ConfigurationException {
+ if (reader == null) {
+ // Get the default bootstrap properties from the System properties ...
+ Properties bootstrap = getBootStrapProperties();
+
+ String readerClassName = bootstrap.getProperty( CONFIGURATION_READER_CLASS_PROPERTY_NAME, PropertiesConfigurationReader.class.getName() );
+
+ try {
+ reader = (CurrentConfigurationReader)ReflectionHelper.create(readerClassName, null, Thread.currentThread().getContextClassLoader());
+ } catch (Exception e) {
+ throw new ConfigurationException(e);
+ }
+ }
+
+ return reader;
+ }
+}
Copied: trunk/server/src/main/java/com/metamatrix/common/config/ResourceNames.java (from rev 1067, trunk/common-internal/src/main/java/com/metamatrix/common/config/ResourceNames.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/config/ResourceNames.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/common/config/ResourceNames.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,43 @@
+/*
+ * 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.config;
+
+/**
+* ResourceNames defines the different resources that require
+* connection properties. These properties are loaded up by
+* the {@link CurrentConfiguration} and made available by calling
+* the method {@link #getResourceProperties}. The following
+* are the basis for the names:
+* - CompTypes, excluding connectors (e.g., Config Service, Session Service, etc).
+* - internal operations (e.g., Runtime Metadata, logging, cursors, etc.)
+*/
+public interface ResourceNames {
+
+
+ public static final String RUNTIME_METADATA_SERVICE = "RuntimeMetadataService"; //$NON-NLS-1$
+ public static final String MEMBERSHIP_SERVICE = "MembershipService"; //$NON-NLS-1$
+ public static final String XA_TRANSACTION_MANAGER = "XATransactionManager"; //$NON-NLS-1$
+ public static final String INDEXING_SERVICE = "IndexingService"; //$NON-NLS-1$
+ public static final String JGROUPS = "JGroups"; //$NON-NLS-1$
+ public static final String SSL = "SSL"; //$NON-NLS-1$
+}
Copied: trunk/server/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java (from rev 1067, trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/common/config/model/ComponentCryptoUtil.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,123 @@
+/*
+ * 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.config.model;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import com.metamatrix.common.config.CurrentConfiguration;
+import com.metamatrix.common.config.api.ComponentDefn;
+import com.metamatrix.common.config.api.ComponentType;
+import com.metamatrix.common.config.api.ComponentTypeDefn;
+import com.metamatrix.common.config.api.ConfigurationModelContainer;
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.object.PropertyDefinition;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.common.util.crypto.CryptoException;
+import com.metamatrix.common.util.crypto.CryptoUtil;
+import com.metamatrix.core.util.Assertion;
+
+
+/**
+ * Utilities for encrypting and decrypting properties of configuration ComponentDefns
+ * @since 4.3
+ */
+public class ComponentCryptoUtil {
+
+
+ /**
+ * Check whether the encrypted properties for the specified ComponentDefn can be decrypted.
+ * @param defn The ComponentDefn to check.
+ * @param componentTypeDefns Collection<ComponentTypeDefn> The ComponentTypeDefns containing the
+ * PropertyDefinitions for the specified ComponentDefn.
+ * @return true if the properties could be decrypted for that defn.
+ * @since 4.3
+ */
+ public static boolean checkPropertiesDecryptable(ComponentDefn defn, Collection componentTypeDefns) {
+ boolean result = true;
+
+ try {
+ decryptProperties(defn, componentTypeDefns);
+ } catch (CryptoException e) {
+ result = false;
+ }
+
+ return result;
+ }
+
+ /**
+ * Bails on the first masked property name that's contained in props but the value
+ * can't be decrypted. All masked properties that exist in props must be decryptable.
+ * @param props
+ * @param componentTypeIdentifier
+ * @return
+ * @since 4.3
+ */
+ public static boolean checkPropertiesDecryptable(Properties props,
+ Collection maskedPropertyNames) {
+ if (maskedPropertyNames != null) {
+ Iterator propItr = maskedPropertyNames.iterator();
+ while (propItr.hasNext()) {
+ String maskedPropName = (String)propItr.next();
+ String maskedValue = null;
+ if (props != null) {
+ maskedValue = props.getProperty(maskedPropName);
+ }
+ if (maskedValue != null && !CryptoUtil.canDecrypt(maskedValue)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public static Properties getDecryptedProperties(ComponentDefn defn) throws ConfigurationException, CryptoException {
+ ConfigurationModelContainer configModel = CurrentConfiguration.getInstance().getConfigurationModel();
+
+ ComponentType componentType = configModel.getComponentType(defn.getComponentTypeID().getName());
+ Assertion.isNotNull(componentType, "unknown component type"); //$NON-NLS-1$
+
+ Collection compTypeDefns = componentType.getComponentTypeDefinitions();
+ return decryptProperties(defn, compTypeDefns);
+ }
+
+ private static Properties decryptProperties(ComponentDefn defn,
+ Collection compTypeDefns) throws CryptoException {
+ Properties result = PropertiesUtils.clone(defn.getProperties(), false);
+ for ( Iterator compTypeDefnItr = compTypeDefns.iterator(); compTypeDefnItr.hasNext(); ) {
+ ComponentTypeDefn typeDefn = (ComponentTypeDefn) compTypeDefnItr.next();
+ PropertyDefinition propDefn = typeDefn.getPropertyDefinition();
+ String propName = propDefn.getName();
+ String propValue = result.getProperty(propName);
+ if ( propValue != null && propDefn.isMasked() ) {
+ propValue = CryptoUtil.getDecryptor().decrypt(propValue);
+ result.setProperty(propName, propValue);
+ }
+ }
+
+ return result;
+ }
+
+}
Copied: trunk/server/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java (from rev 1067, trunk/common-internal/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/common/config/model/PropertyValidations.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,140 @@
+/*
+ * 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.config.model;
+
+import java.util.Iterator;
+import java.util.List;
+
+import com.metamatrix.common.CommonPlugin;
+import com.metamatrix.common.config.CurrentConfiguration;
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.core.util.StringUtil;
+
+
+
+
+/**
+ * @since 4.3
+ */
+public class PropertyValidations {
+
+
+
+ public static final String UDP_MCAST_ADDR_PROPERTY = "udp.mcast_addr"; //$NON-NLS-1$
+ public static final String SYSTEM_NAME = CurrentConfiguration.CLUSTER_NAME;
+
+ private static final String MULTICAST_PORT_FORMAT = "224.255.255.255"; //$NON-NLS-1$
+
+
+ /**
+ * @see com.metamatrix.common.util.commandline.IPropertyValidation#isPropertyValid(java.lang.String, java.lang.String)
+ * @since 4.3
+ */
+ public void isPropertyValid(String key,
+ String value) throws ConfigurationException {
+
+ if (key == null) {
+ return;
+ }
+ if (key.equalsIgnoreCase(UDP_MCAST_ADDR_PROPERTY)) {
+ validate_multicast_port(key, value);
+ }
+
+ if (key.equalsIgnoreCase(SYSTEM_NAME)) {
+ validate_nonnull_and_contiguous("System Name", key, value);//$NON-NLS-1$
+ }
+ }
+
+ protected void validate_multicast_port(String key, String value) throws ConfigurationException {
+ if (value == null || value.trim().length() == 0) {
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_format", new Object[] {"MulticastPort", "Null", MULTICAST_PORT_FORMAT} )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ List parts = StringUtil.getTokens(value, "."); //$NON-NLS-1$
+ // the port must have 4 parts
+ if (parts.size() != 4) {
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_format", new Object[] {"MulticastPort", value, MULTICAST_PORT_FORMAT} )); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ validate_nonnull_and_contiguous("MulticastPort", key, value); //$NON-NLS-1$
+
+ // verify each part is numeric
+ for (Iterator it=parts.iterator(); it.hasNext();) {
+ String part = (String) it.next();
+ if (isInvalidNumeric(part )) {
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_numeric_value", new Object[] {part, ", must be between 0 and 255"} )); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ validate_port_range(key, part, 0, 255);
+ }
+
+
+ }
+
+ protected void validate_port_range(String key, String value, int start, int end) throws ConfigurationException {
+ if (value == null || value.trim().length() == 0) {
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_format", new Object[] {key, "Null", "Range " + start + " and " + end } )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ Long nbr = null;
+ try {
+ nbr = new Long(value);
+ } catch (NumberFormatException nfe) {
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_numeric_value", new Object[] {key, ", must be between " + start + " and " + end} )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ if (nbr.longValue() >= start && nbr.longValue() <= end) {
+
+ }else {
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_numeric_value", new Object[] {key, ", must be between " + start + " and " + end} )); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+
+ }
+
+ protected void validate_nonnull_and_contiguous(String display, String key, String value) throws ConfigurationException {
+ if (value == null || value.trim().length() == 0) {
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_contiguous_value", new Object[] {display} )); //$NON-NLS-1$
+ }
+
+ if (value.indexOf(" ") > 0) { //$NON-NLS-1$
+ throwException(CommonPlugin.Util.getString("PropertyValidation.Invalid_contiguous_value", new Object[] {display} )); //$NON-NLS-1$
+ }
+
+ }
+
+ protected void throwException(String msg) throws ConfigurationException {
+ throw new ConfigurationException(msg);
+
+ }
+
+ protected boolean isInvalidNumeric(String value) {
+ try {
+ new Long(value);
+ return false;
+ } catch (NumberFormatException nfe) {
+ return true;
+ }
+ }
+
+}
Copied: trunk/server/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java (from rev 1067, trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/common/config/reader/CurrentConfigurationReader.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,57 @@
+/*
+ * 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.config.reader;
+
+import com.metamatrix.common.config.api.ConfigurationModelContainer;
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+
+/**
+ * <p>
+ * This interface defines a self-contained reader for the current configuration,
+ * and should be used <i>only</i> by the {@link com.metamatrix.common.config.CurrentConfiguration CurrentConfiguration}
+ * framework. As such, this is an extremely low-level implementation that may
+ * <i>not</i> use anything but <code>com.metamatrix.common.util</code> components
+ * and only components that do not use {@link com.metamatrix.common.logging.LogManager LogManager}.
+ * </p>
+ * <p>
+ * Each class that implements this interface must supply a no-arg constructor.
+ * </p>
+ */
+public interface CurrentConfigurationReader {
+
+ // ------------------------------------------------------------------------------------
+ // C O N F I G U R A T I O N I N F O R M A T I O N
+ // ------------------------------------------------------------------------------------
+
+ /**
+ * Obtain the next startup configuration model. The implementation
+ * may <i>not</i> use logging but instead should rely upon returning
+ * an exception in the case of any errors.
+ * @return the serializable Configuration instance
+ * @throws ConfigurationException if an error occurred within or during
+ * communication with the repository.
+ */
+ ConfigurationModelContainer getConfigurationModel() throws ConfigurationException;
+
+}
+
Copied: trunk/server/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java (from rev 1067, trunk/common-internal/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,124 @@
+/*
+ * 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.config.reader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import com.metamatrix.common.CommonPlugin;
+import com.metamatrix.common.config.CurrentConfiguration;
+import com.metamatrix.common.config.api.Configuration;
+import com.metamatrix.common.config.api.ConfigurationModelContainer;
+import com.metamatrix.common.config.api.ConfigurationObjectEditor;
+import com.metamatrix.common.config.api.exceptions.ConfigurationConnectionException;
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.config.model.BasicConfigurationObjectEditor;
+import com.metamatrix.common.config.model.ConfigurationModelContainerImpl;
+import com.metamatrix.common.util.ErrorMessageKeys;
+
+/**
+ * <p>
+ * This class implements a self-contained reader for the current configuration,
+ * and should be used <i>only</i> by the {@link com.metamatrix.common.config.CurrentConfiguration CurrentConfiguration}
+ * framework. As such, this is an extremely low-level implementation that may
+ * <i>not</i> use anything but <code>com.metamatrix.common.util</code> components
+ * and only components that do not use {@link com.metamatrix.common.logging.LogManager LogManager}.
+ * </p>
+ * <p>
+ * Each class that implements this interface must supply a no-arg constructor.
+ * </p>
+ */
+public class PropertiesConfigurationReader implements CurrentConfigurationReader {
+
+ private ConfigurationModelContainer c;
+
+ /**
+ * The environment property name for the property file that contains the configuration.
+ */
+ public static final String FILENAME = "metamatrix.config.readerFile"; //$NON-NLS-1$
+
+ /**
+ * Default, no-arg constructor
+ * @throws ConfigurationException
+ * @throws ConfigurationConnectionException
+ */
+ public PropertiesConfigurationReader() throws ConfigurationConnectionException, ConfigurationException{
+ Properties env = CurrentConfiguration.getInstance().getBootStrapProperties();
+ String filename = env.getProperty(FILENAME);
+ Properties p = null;
+ if (filename != null) {
+ File f = new File(filename);
+ InputStream is = null;
+ try {
+ if (f.exists()) {
+ is = new FileInputStream(f);
+ } else {
+ is = this.getClass().getResourceAsStream(filename);
+ }
+ if (is == null) {
+ throw new ConfigurationConnectionException(ErrorMessageKeys.CONFIG_ERR_0064, CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_ERR_0064, filename));
+ }
+ p = new Properties(env);
+ p.load(is);
+ } catch (IOException e) {
+ throw new ConfigurationConnectionException(e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ } else {
+ p = env;
+ }
+
+ // Use the properties from the file to create a new Configuration object ...
+ ConfigurationObjectEditor coe = new BasicConfigurationObjectEditor(false);
+ Configuration currentConfiguration = coe.createConfiguration(PropertiesConfigurationReader.class.getSimpleName() + ':' + filename);
+ currentConfiguration = (Configuration)coe.modifyProperties(currentConfiguration, p, ConfigurationObjectEditor.SET);
+ c = new ConfigurationModelContainerImpl(currentConfiguration);
+ }
+
+ // ------------------------------------------------------------------------------------
+ // C O N F I G U R A T I O N I N F O R M A T I O N
+ // ------------------------------------------------------------------------------------
+
+ /**
+ * Obtain the next startup configuration model. The implementation
+ * may <i>not</i> use logging but instead should rely upon returning
+ * an exception in the case of any errors.
+ * @return the serializable Configuration instance
+ * @throws ConfigurationException if an error occurred within or during
+ * communication with the repository.
+ */
+ public ConfigurationModelContainer getConfigurationModel() throws ConfigurationException {
+ return c;
+ }
+
+}
+
Property changes on: trunk/server/src/main/java/com/metamatrix/common/config/reader/PropertiesConfigurationReader.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/server/src/main/java/com/metamatrix/common/net/ServerSocketConfiguration.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/net/ServerSocketConfiguration.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/common/net/ServerSocketConfiguration.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,165 +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.net;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.util.Arrays;
-import java.util.Properties;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-
-import com.metamatrix.common.comm.platform.socket.SocketUtil;
-import com.metamatrix.common.config.CurrentConfiguration;
-import com.metamatrix.common.config.ResourceNames;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.util.CommonPropertyNames;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.common.util.crypto.CryptoException;
-import com.metamatrix.common.util.crypto.CryptoUtil;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.Assertion;
-
-/**
- */
-public class ServerSocketConfiguration {
-
- private static final String SSL_ENABLED = "metamatrix.encryption.secure.sockets"; //$NON-NLS-1$
-
- private static final String KEYSTORE_FILENAME = "com.metamatrix.ssl.keystore.filename"; //$NON-NLS-1$
- private static final String KEYSTORE_PASSWORD = "com.metamatrix.ssl.keystore.Password"; //$NON-NLS-1$
- private static final String KEYSTORE_TYPE = "com.metamatrix.ssl.keystoretype"; //$NON-NLS-1$
- private static final String SSL_PROTOCOL = "com.metamatrix.ssl.protocol"; //$NON-NLS-1$
- private static final String KEY_MANAGER_ALGORITHM = "com.metamatrix.ssl.keymanagementalgorithm"; //$NON-NLS-1$
-
- private static final String TRUSTSTORE_FILENAME = "com.metamatrix.ssl.truststore.filename"; //$NON-NLS-1$
- private static final String TRUSTSTORE_PASSWORD = "com.metamatrix.ssl.truststore.Password"; //$NON-NLS-1$
- private static final String AUTHENTICATION_MODE = "com.metamatrix.ssl.authenticationMode"; //$NON-NLS-1$
- public static final String ONEWAY = "1-way"; //$NON-NLS-1$ - one way is the default
- public static final String TWOWAY = "2-way"; //$NON-NLS-1$
- public static final String ANONYMOUS = "anonymous"; //$NON-NLS-1$
-
- public static final String DEFAULT_SSL_PROTOCOL = "SSLv3"; //$NON-NLS-1$
- public static final String DEFAULT_KEYSTORE_TYPE = "JKS"; //$NON-NLS-1$
-
- public static final String UNENCRYPTED_CIPHER_SUITE = "SSL_RSA_WITH_NULL_SHA"; //$NON-NLS-1$
-
- /*
- * External SSL resource settings
- */
- private boolean ssl_enabled;
- private String sslProtocol = DEFAULT_SSL_PROTOCOL;
- private String keyManagerFactoryAlgorithm;
- private String keyStoreType = DEFAULT_KEYSTORE_TYPE;
- private String keyStoreFileName;
- private String keyStorePassword = ""; //$NON-NLS-1$
- private String trustStoreFileName;
- private String trustStorePassword = ""; //$NON-NLS-1$
- private String authenticationMode = ONEWAY;
-
- /*
- * Client encryption property. This may belong somewhere else
- */
- boolean client_encryption_enabled = false;
-
- public static boolean isSSLEnabled() {
- return CryptoUtil.isEncryptionEnabled() && PropertiesUtils.getBooleanProperty(CurrentConfiguration.getInstance().getProperties(), SSL_ENABLED, false);
- }
-
- public void init() throws ConfigurationException {
- Properties p = CurrentConfiguration.getInstance().getProperties();
- p = PropertiesUtils.clone(CurrentConfiguration.getInstance().getResourceProperties(ResourceNames.SSL), p, true);
- init(p);
- }
-
- public void init(Properties props) {
- ssl_enabled = PropertiesUtils.getBooleanProperty(props, SSL_ENABLED, false);
-
- client_encryption_enabled = PropertiesUtils.getBooleanProperty(props, CommonPropertyNames.CLIENT_ENCRYPTION_ENABLED, true);
-
- keyStoreFileName = props.getProperty(KEYSTORE_FILENAME);
- try {
- keyStorePassword = CryptoUtil.stringDecrypt(props.getProperty(KEYSTORE_PASSWORD, "")); //$NON-NLS-1$
- } catch (CryptoException err) {
- throw new MetaMatrixRuntimeException(err);
- }
-
- keyStoreType = props.getProperty(KEYSTORE_TYPE, DEFAULT_KEYSTORE_TYPE);
-
- keyManagerFactoryAlgorithm = props.getProperty(KEY_MANAGER_ALGORITHM, KeyManagerFactory.getDefaultAlgorithm());
-
- authenticationMode = props.getProperty(AUTHENTICATION_MODE);
-
- trustStoreFileName = props.getProperty(TRUSTSTORE_FILENAME);
- try {
- trustStorePassword = CryptoUtil.stringDecrypt(props.getProperty(TRUSTSTORE_PASSWORD, "")); //$NON-NLS-1$
- } catch (CryptoException err) {
- throw new MetaMatrixRuntimeException(err);
- }
-
- sslProtocol = props.getProperty(SSL_PROTOCOL, DEFAULT_SSL_PROTOCOL);
- }
-
- public SSLEngine getServerSSLEngine() throws IOException, GeneralSecurityException {
- if (!isServerSSLEnabled()) {
- return null;
- }
-
- // Use the SSLContext to create an SSLServerSocketFactory.
- SSLContext context = null;
-
- if (ANONYMOUS.equals(authenticationMode)) {
- context = SocketUtil.getAnonSSLContext();
- } else {
- context = SocketUtil.getSSLContext(keyStoreFileName,
- keyStorePassword,
- trustStoreFileName,
- trustStorePassword,
- keyManagerFactoryAlgorithm,
- keyStoreType,
- sslProtocol);
- }
-
- SSLEngine result = context.createSSLEngine();
- result.setUseClientMode(false);
- if (ANONYMOUS.equals(authenticationMode)) {
- Assertion.assertTrue(Arrays.asList(result.getSupportedCipherSuites()).contains(SocketUtil.ANON_CIPHER_SUITE));
- result.setEnabledCipherSuites(new String[] {
- SocketUtil.ANON_CIPHER_SUITE
- });
- }
- result.setNeedClientAuth(TWOWAY.equals(authenticationMode));
- return result;
- }
-
- public boolean isServerSSLEnabled() {
- return ssl_enabled && CryptoUtil.isEncryptionEnabled();
- }
-
- public boolean isClientEncryptionEnabled() {
- return CryptoUtil.isEncryptionEnabled() && client_encryption_enabled;
- }
-
-}
Copied: trunk/server/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java (from rev 1067, trunk/common-internal/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java)
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java (rev 0)
+++ trunk/server/src/main/java/com/metamatrix/common/util/CommonPropertyNames.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,117 @@
+/*
+ * 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.util;
+
+
+/**
+ * Class that defines common property constants
+ */
+public final class CommonPropertyNames {
+
+ public static final String DOMAIN_ID = "metamatrix.siteID"; //$NON-NLS-1$
+
+ public static final String RMI_CONTEXT_FACTORY = "metamatrix.deployment.rmiContextFactory"; //$NON-NLS-1$
+
+ public static final String BEAN_CONTEXT_FACTORY = "metamatrix.deployment.beanContextFactory"; //$NON-NLS-1$
+
+ public static final String DEFAULT_JNDI_URL = "metamatrix.deployment.defaultJndiURL"; //$NON-NLS-1$
+
+ /**
+ * <p>This property indicates the VM is running inside an
+ * ApplicationServer. If the property exists and is set to true</p>
+ * <p>This is an optional property</p>
+ */
+ public static final String APP_SERVER_VM = "metamatrix.appserver_vm"; //$NON-NLS-1$
+ /**
+ * <p>This property indicates the EJB server platform which the MetaMatrix
+ * server is running on. Currently the only two possible values are
+ * IBM's {@link #WEBSPHERE_PLATFORM WebSphere} server, and
+ * the {@link #WEBLOGIC_PLATFORM Weblogic} server. The MetaMatrix
+ * server</p>
+ * <p>This is a required property</p>
+ */
+ public static final String SERVER_PLATFORM = "metamatrix.deployment.platform"; //$NON-NLS-1$
+
+
+ /**
+ * <p>This constant defines one of the possible values for the
+ * {@link #SERVER_PLATFORM} property. It indicates that
+ * no application server is running.</p>
+ * <p>This is not a property, but rather a possible value for
+ * the {@link #SERVER_PLATFORM} property.</p>
+ */
+ public static final String STANDALONE_PLATFORM = "standalone"; //$NON-NLS-1$
+
+ /**
+ * This is the installation directory defined by the bootstrapping process.
+ * The bootstrapping information will provide this property by which the
+ * {@link #CurrentConfiguration.getProperty()} will return.
+ * @since 4.0
+ */
+ public static final String INSTALLATION_DIRECTORY = "metamatrix.installationDir"; //$NON-NLS-1$
+
+ /**
+ * This is the location the configuration models are located. This
+ * property is used by the installation and configuration persistent components.
+ */
+ public static final String CONFIG_MODELS_DIRECTORY = "metamatrix.config.modelsDir"; //$NON-NLS-1$
+
+ /**
+ * The date of installation of the MetaMatrix suite
+ */
+ public static final String INSTALL_DATE = "metamatrix.installationDate"; //$NON-NLS-1$
+
+
+ /**
+ * This is the property name of the MetaMatrixAdmin password.
+ */
+ public static final String ADMIN_PASSWORD = "metamatrix.admin.password"; //$NON-NLS-1$
+
+ /**
+ * This is the property name of the MetaMatrixAdmin username.
+ */
+ public static final String ADMIN_USERNAME = "metamatrix.admin.username"; //$NON-NLS-1$
+
+
+ /**
+ * If this property is set to true then client side encryption is enabled.
+ */
+ public static final String CLIENT_ENCRYPTION_ENABLED = "metamatrix.encryption.client.encryption"; //$NON-NLS-1$
+
+ /**
+ * This property indicates the encryption provider, if set to none encryption is disabled.
+ */
+ public static final String JCE_PROVIDER = "metamatrix.encryption.jce.provider"; //$NON-NLS-1$
+
+
+ /**
+ * Extension Module file types to cache in memory.
+ * Should be comma-delimited list of values as stored in
+ * JDBCNames.ExtensionFilesTable.ColumnName.FILE_TYPE.
+ * For example: "JAR File, Function Definition".
+ * Default is none.
+ */
+ public static final String EXTENSION_TYPES_TO_CACHE = "metamatrix.server.extensionTypesToCache"; //$NON-NLS-1$
+
+
+}
Modified: trunk/server/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -45,13 +45,18 @@
public interface MembershipServiceInterface extends ServiceInterface {
public static String NAME = ResourceNames.MEMBERSHIP_SERVICE;
+ public static final String MEMBERSHIP_ADMIN_PASSWORD = "security.membership.admin.password"; //$NON-NLS-1$
+ public static final String MEMBERSHIP_ADMIN_USERNAME = "security.membership.admin.username"; //$NON-NLS-1$
+ public static final String MEMBERSHIP_SECURITY_ENABLED = "security.membership.security.enabled"; //$NON-NLS-1$
+ public static final String MEMBERSHIP_DOMAIN_ORDER = "security.membership.DomainOrder"; //$NON-NLS-1$
+
/**
* The environment property describing both the domain names and their required
* order of search. Domain names are assumed to be in preferred search order
* and in the form "A,X,...,D" where A, X and D are domain names.
* This property is required (there is no default).
*/
- public static final String DOMAIN_ORDER = ConfigurationPropertyNames.MEMBERSHIP_DOMAIN_ORDER;
+ public static final String DOMAIN_ORDER = MEMBERSHIP_DOMAIN_ORDER;
/**
* The environment property name for the class that is to be used for the names of the domains.
* This property is required (there is no default).
@@ -61,11 +66,11 @@
public static final String DEFAULT_ADMIN_USERNAME = "metamatrixadmin"; //$NON-NLS-1$
public static final String DEFAULT_WSDL_USERNAME = CoreConstants.DEFAULT_ANON_USERNAME;
- public static final String ADMIN_PASSWORD = ConfigurationPropertyNames.MEMBERSHIP_ADMIN_PASSWORD;
- public static final String ADMIN_USERNAME = ConfigurationPropertyNames.MEMBERSHIP_ADMIN_USERNAME;
+ public static final String ADMIN_PASSWORD = MEMBERSHIP_ADMIN_PASSWORD;
+ public static final String ADMIN_USERNAME = MEMBERSHIP_ADMIN_USERNAME;
public static final String DOMAIN_ACTIVE = "activate"; //$NON-NLS-1$
public static final String ADMIN_HOSTS = "metamatrix.security.admin.allowedHosts"; //$NON-NLS-1$
- public static final String SECURITY_ENABLED = ConfigurationPropertyNames.MEMBERSHIP_SECURITY_ENABLED;
+ public static final String SECURITY_ENABLED = MEMBERSHIP_SECURITY_ENABLED;
public static final String DOMAIN_PROPERTIES = "propertiesFile"; //$NON-NLS-1$
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-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -37,6 +37,9 @@
import java.util.Map;
import java.util.Properties;
+import org.teiid.transport.AdminAuthorizationInterceptor;
+import org.teiid.transport.LogonImpl;
+
import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.admin.api.server.ServerAdmin;
import com.metamatrix.admin.server.ServerAdminImpl;
@@ -44,8 +47,6 @@
import com.metamatrix.api.exception.MultipleException;
import com.metamatrix.common.application.AbstractClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
-import com.metamatrix.common.comm.platform.socket.server.AdminAuthorizationInterceptor;
-import com.metamatrix.common.comm.platform.socket.server.LogonImpl;
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
@@ -232,7 +233,8 @@
@SuppressWarnings("unchecked")
private <T> T wrapAdminService(Class<T> iface, T impl) {
- return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, new AdminAuthorizationInterceptor(PlatformProxyHelper.getAuthorizationServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL), impl));
+ //return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, new AdminAuthorizationInterceptor(PlatformProxyHelper.getAuthorizationServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL), impl));
+ return impl;
}
/**
Modified: trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/server/admin/apiimpl/RuntimeMetadataAdminAPIImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -34,6 +34,8 @@
import java.util.Properties;
import java.util.Set;
+import org.teiid.transport.SSLConfiguration;
+
import com.metamatrix.admin.RolesAllowed;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
import com.metamatrix.admin.api.server.AdminRoles;
@@ -41,7 +43,6 @@
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.common.config.api.ConnectorBinding;
import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.net.ServerSocketConfiguration;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
@@ -838,12 +839,12 @@
boolean useSSL = false;
- try {
- useSSL = ServerSocketConfiguration.isSSLEnabled();
-
- } catch (Exception err) {
- throw new MetaMatrixRuntimeException(RuntimeMetadataPlugin.Util.getString("RuntimeMetadataAdminAPIImpl.Unable_to_determine_ssl_mode")); //$NON-NLS-1$
- }
+// try {
+// useSSL = SSLConfiguration.isSSLEnabled();
+//
+// } catch (Exception err) {
+// throw new MetaMatrixRuntimeException(RuntimeMetadataPlugin.Util.getString("RuntimeMetadataAdminAPIImpl.Unable_to_determine_ssl_mode")); //$NON-NLS-1$
+// }
// Encrypt connection props
try {
Modified: trunk/server/src/main/java/com/metamatrix/server/dqp/config/PlatformConfigSource.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/dqp/config/PlatformConfigSource.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/server/dqp/config/PlatformConfigSource.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -85,7 +85,6 @@
return dqpProps;
}
- @Override
public Map<String, Class<? extends ApplicationService>> getDefaultServiceClasses() {
Map<String, Class<? extends ApplicationService>> result = new HashMap<String, Class<? extends ApplicationService>>();
result.put(DQPServiceNames.BUFFER_SERVICE, PlatformBufferService.class);
@@ -97,7 +96,6 @@
return result;
}
- @Override
public void updateBindings(Binder binder) {
//TODO: this should really just be a child injector (guice 2)
binder.bind(AuthorizationServiceInterface.class).toInstance(PlatformProxyHelper.getAuthorizationServiceProxy(PlatformProxyHelper.ROUND_ROBIN_LOCAL));
@@ -110,5 +108,10 @@
binder.bind(Host.class).annotatedWith(Names.named(Configuration.HOST)).toInstance(host);
binder.bind(DQPContextCache .class).toInstance(ResourceFinder.getContextCache());
}
+
+ @Override
+ public ApplicationService getServiceInstance(Class<? extends ApplicationService> type) {
+ return null;
+ }
}
\ No newline at end of file
Modified: trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/main/java/com/metamatrix/server/dqp/service/PlatformAuthorizationService.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -212,4 +212,11 @@
}
}
+ @Override
+ public boolean isCallerInRole(SessionToken caller, String roleName)
+ throws AuthorizationMgmtException {
+ // rameshTODO Auto-generated method stub
+ return false;
+ }
+
}
Deleted: trunk/server/src/test/java/com/metamatrix/common/comm/platform/server/TestAdminAuthInterceptor.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/common/comm/platform/server/TestAdminAuthInterceptor.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/test/java/com/metamatrix/common/comm/platform/server/TestAdminAuthInterceptor.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,130 +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.platform.server;
-
-import java.lang.reflect.Proxy;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.admin.api.exception.AdminProcessingException;
-import com.metamatrix.admin.api.server.AdminRoles;
-import com.metamatrix.admin.api.server.ServerAdmin;
-import com.metamatrix.api.exception.security.AuthorizationException;
-import com.metamatrix.api.exception.security.AuthorizationMgmtException;
-import com.metamatrix.common.comm.platform.socket.server.AdminAuthorizationInterceptor;
-import com.metamatrix.core.util.SimpleMock;
-import com.metamatrix.platform.admin.api.ExtensionSourceAdminAPI;
-import com.metamatrix.platform.admin.apiimpl.ExtensionSourceAdminAPIImpl;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
-import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.platform.security.api.service.AuthorizationServiceInterface;
-
-
-/**
- * @since 4.3
- */
-public class TestAdminAuthInterceptor {
-
- @Before public void setUp() throws Exception {
- DQPWorkContext.getWorkContext().setSessionToken(new SessionToken(new MetaMatrixSessionID(1), "gojo")); //$NON-NLS-1$
- }
-
- @After public void tearDown() throws Exception {
- DQPWorkContext.setWorkContext(new DQPWorkContext());
- }
-
- @Test(expected=AdminProcessingException.class) public void testAddUserUDF_fail() throws AdminException {
- Set<String> userRoles = new HashSet<String>();
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
- serverAdmin.addUDF(null, null);
- }
-
- private <T> T getTestServerAdmin(final Set<String> userRoles, Class<T> iface) {
- return getTestServerAdmin(userRoles, iface, SimpleMock.createSimpleMock(iface));
- }
-
- @SuppressWarnings("unchecked")
- private <T> T getTestServerAdmin(final Set<String> userRoles, Class<T> iface, T impl) {
- AuthorizationServiceInterface service = Mockito.mock(AuthorizationServiceInterface.class);
- try {
- Mockito.stub(service.isCallerInRole((SessionToken)Mockito.anyObject(), Mockito.argThat(new BaseMatcher<String>() {
- @Override
- public boolean matches(Object arg0) {
- return userRoles.contains(arg0);
- }
-
- @Override
- public void describeTo(Description arg0) {
-
- }
- }))).toReturn(Boolean.TRUE);
- } catch (AuthorizationMgmtException e) {
- throw new RuntimeException(e);
- }
- AdminAuthorizationInterceptor authInterceptor = new AdminAuthorizationInterceptor(service, impl);
- return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, authInterceptor);
- }
-
- @Test public void testAddUDF_succeed() throws Exception {
- Set<String> userRoles = new HashSet<String>();
- userRoles.add(AdminRoles.RoleName.ADMIN_SYSTEM);
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
- serverAdmin.addUDF(null, null);
- }
-
- @Test public void testGetVDBs() throws Exception {
- Set<String> userRoles = new HashSet<String>();
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
- serverAdmin.getVDBs("*"); //$NON-NLS-1$
- }
-
- @Test(expected=AdminProcessingException.class) public void testReadOnlyFails() throws Exception {
- Set<String> userRoles = new HashSet<String>();
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
- serverAdmin.getSessions("*"); //$NON-NLS-1$
- }
-
- @Test(expected=AuthorizationException.class) public void testSubsystemReadOnlyFails() throws Exception {
- Set<String> userRoles = new HashSet<String>();
- ExtensionSourceAdminAPI serverAdmin = getTestServerAdmin(userRoles, ExtensionSourceAdminAPI.class, ExtensionSourceAdminAPIImpl.getInstance());
- serverAdmin.getSourceDescriptors();
- }
-
- @Test public void testBounce_succeed() throws Exception {
- Set<String> userRoles = new HashSet<String>();
- userRoles.add(AdminRoles.RoleName.ADMIN_PRODUCT);
- ServerAdmin serverAdmin = getTestServerAdmin(userRoles, ServerAdmin.class);
- serverAdmin.bounceSystem(false);
- }
-
-
-}
Deleted: trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestCommSockets.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,191 +0,0 @@
-/*
- * 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.
- */
-package com.metamatrix.common.comm.platform.socket.server;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-import java.net.InetSocketAddress;
-import java.util.Properties;
-
-import javax.net.ssl.SSLEngine;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.metamatrix.api.exception.ComponentNotFoundException;
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.comm.ClientServiceRegistry;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.common.comm.platform.socket.SocketUtil;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
-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.platform.security.api.ILogon;
-import com.metamatrix.platform.security.api.LogonResult;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.vm.controller.SocketListenerStats;
-
-public class TestCommSockets {
-
- SocketListener listener;
- private SocketServerConnectionFactory sscf;
- private InetSocketAddress addr;
-
- @Before public void setUp() {
- addr = new InetSocketAddress(0);
- }
-
- @After public void tearDown() throws Exception {
- if (listener != null) {
- listener.stop();
- }
- }
-
- @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$
- listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
- csr, 1024, 1024, 1, null, true, sessionService);
-
- try {
- Properties p = new Properties();
- p.setProperty(MMURL.CONNECTION.SERVER_URL, new MMURL(addr.getHostName(),
- listener.getPort() - 1, false).getAppServerURL()); //wrong port
- SocketServerConnectionFactory.getInstance().createConnection(p);
- fail("exception expected"); //$NON-NLS-1$
- } catch (CommunicationException e) {
-
- }
- }
-
- @Test public void testConnectWithoutPooling() throws Exception {
- Properties p = new Properties();
- p.setProperty("org.teiid.sockets.maxCachedInstances", String.valueOf(0)); //$NON-NLS-1$
- SocketServerConnection conn = helpEstablishConnection(false, null, true, p);
- SocketListenerStats stats = listener.getStats();
- assertEquals(2, stats.objectsRead); // handshake response, logon,
- assertEquals(1, stats.sockets);
- conn.shutdown();
- stats = listener.getStats();
- assertEquals(1, stats.maxSockets);
- assertEquals(3, stats.objectsRead); // handshake response, logon, logoff
- if (stats.sockets > 0) {
- // there is a timing issue here, since the effect of shutdown on the
- // server side can be delayed
- Thread.sleep(500);
- }
- stats = listener.getStats();
- assertEquals(0, stats.sockets);
- }
-
- @Test public void testConnectWithPooling() throws Exception {
- SocketServerConnection conn = helpEstablishConnection(false, null);
- SocketListenerStats stats = listener.getStats();
- assertEquals(2, stats.objectsRead); // handshake response, logon,
- assertEquals(1, stats.sockets);
- conn.shutdown();
- stats = listener.getStats();
- assertEquals(1, stats.maxSockets);
- assertEquals(3, stats.objectsRead); // handshake response, logon, logoff
- stats = listener.getStats();
- assertEquals(1, stats.sockets);
- conn = helpEstablishConnection(false, null);
- conn.shutdown();
- stats = listener.getStats();
- assertEquals(1, stats.sockets);
- assertEquals(1, stats.maxSockets);
- }
-
-
- @Test public void testConnectWithoutClientEncryption() throws Exception {
- SocketServerConnection conn = helpEstablishConnection(false, null, false, new Properties());
- assertTrue(conn.selectServerInstance().getCryptor() instanceof NullCryptor);
- conn.shutdown();
- }
-
- private SocketServerConnection helpEstablishConnection(boolean secure,
- SSLEngine serverSSL) throws CommunicationException, ConnectionException {
- return helpEstablishConnection(secure, serverSSL, true, new Properties());
- }
-
- private SocketServerConnection helpEstablishConnection(boolean secure,
- SSLEngine serverSSL, boolean isClientEncryptionEnabled, Properties socketConfig) throws CommunicationException,
- ConnectionException {
- if (listener == null) {
- SessionServiceInterface sessionService = mock(SessionServiceInterface.class);
- ClientServiceRegistry csr = new ClientServiceRegistry();
- csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster") { //$NON-NLS-1$
- @Override
- public LogonResult logon(Properties connProps)
- throws LogonException, ComponentNotFoundException {
- return new LogonResult();
- }
- }, "foo"); //$NON-NLS-1$
- listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
- csr, 1024, 1024, 1, serverSSL, isClientEncryptionEnabled, sessionService);
- SocketListenerStats stats = listener.getStats();
- assertEquals(0, stats.maxSockets);
- assertEquals(0, stats.objectsRead);
- assertEquals(0, stats.objectsWritten);
- assertEquals(0, stats.sockets);
- }
-
- Properties p = new Properties();
- p.setProperty(MMURL.CONNECTION.SERVER_URL, new MMURL(addr.getHostName(), listener.getPort(),
- secure).getAppServerURL());
- p.setProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, UrlServerDiscovery.class.getName());
- if (sscf == null) {
- sscf = new SocketServerConnectionFactory();
- sscf.init(socketConfig);
- }
- return sscf.createConnection(p);
- }
-
- @Test public void testSSLConnectWithNonSSLServer() throws Exception {
- try {
- helpEstablishConnection(true, null);
- fail("exception expected"); //$NON-NLS-1$
- } catch (CommunicationException e) {
-
- }
- }
-
- @Test public void testAnonSSLConnect() throws Exception {
- SSLEngine engine = SocketUtil.getAnonSSLContext().createSSLEngine();
- engine.setUseClientMode(false);
- engine.setEnabledCipherSuites(new String[] { SocketUtil.ANON_CIPHER_SUITE });
- Properties p = new Properties();
- p.setProperty(SocketUtil.TRUSTSTORE_FILENAME, SocketUtil.NONE);
- SocketServerConnection conn = helpEstablishConnection(true, engine, true, p);
- conn.shutdown();
- }
-
-}
Deleted: trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestLogonImpl.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-
-package com.metamatrix.common.comm.platform.socket.server;
-
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.mockito.Mockito;
-
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.platform.security.api.LogonResult;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
-import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-
-public class TestLogonImpl extends TestCase {
-
- public void testLogonResult() throws Exception {
- SessionServiceInterface ssi = Mockito
- .mock(SessionServiceInterface.class);
-
- String userName = "Fred"; //$NON-NLS-1$
- String applicationName = "test"; //$NON-NLS-1$
- String productName = "foo"; //$NON-NLS-1$
- Properties p = new Properties();
- p.setProperty(MMURL.CONNECTION.USER_NAME, userName);
- p.setProperty(MMURL.CONNECTION.APP_NAME, applicationName);
-
- MetaMatrixSessionInfo resultInfo = new MetaMatrixSessionInfo(
- new MetaMatrixSessionID(1), userName, 0, applicationName, new Properties(),
- null, null); //$NON-NLS-1$ //$NON-NLS-2$
-
- Mockito.stub(ssi.createSession(userName, null, null, applicationName,
- p)).toReturn(resultInfo);
-
- LogonImpl impl = new LogonImpl(ssi, "fakeCluster");
-
- LogonResult result = impl.logon(p);
- assertEquals(userName, result.getUserName());
- assertEquals(new MetaMatrixSessionID(1), result.getSessionID());
- }
-
- public void testCredentials() throws Exception {
- SessionServiceInterface ssi = Mockito.mock(SessionServiceInterface.class);
- LogonImpl impl = new LogonImpl(ssi, "fakeCluster");
- Properties p = new Properties();
- p.put(MMURL.CONNECTION.CLIENT_TOKEN_PROP, new Object());
- //invalid credentials
- p.setProperty(MMURL.JDBC.CREDENTIALS, "(...)");
-
- try {
- impl.logon(p);
- fail("exception expected");
- } catch (LogonException e) {
- assertEquals("Conflicting use of both client session token and credentials. ", e.getMessage());
- }
-
- p.remove(MMURL.CONNECTION.CLIENT_TOKEN_PROP);
-
- try {
- impl.logon(p);
- fail("exception expected");
- } catch (LogonException e) {
- assertEquals("Credentials string must contain \"system\" property.", e.getMessage());
- }
- }
-
-}
Deleted: trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/server/src/test/java/com/metamatrix/common/comm/platform/socket/server/TestSocketRemoting.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -1,222 +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.platform.socket.server;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import junit.framework.TestCase;
-
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.common.api.HostInfo;
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.comm.ClientServiceRegistry;
-import com.metamatrix.common.comm.api.Message;
-import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerInstance;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerInstanceFactory;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerInstanceImpl;
-import com.metamatrix.common.comm.platform.socket.client.UrlServerDiscovery;
-import com.metamatrix.common.util.crypto.Cryptor;
-import com.metamatrix.common.util.crypto.NullCryptor;
-import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.core.util.SimpleMock;
-import com.metamatrix.dqp.client.ClientSideDQP;
-import com.metamatrix.dqp.client.ResultsFuture;
-import com.metamatrix.platform.security.api.ILogon;
-import com.metamatrix.platform.security.api.LogonResult;
-import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-
-public class TestSocketRemoting extends TestCase {
-
- public interface FakeService {
-
- ResultsFuture<Integer> asynchResult();
-
- String exceptionMethod() throws MetaMatrixProcessingException;
-
- }
-
- private static class FakeServiceImpl implements FakeService {
-
- public ResultsFuture<Integer> asynchResult() {
- ResultsFuture<Integer> result = new ResultsFuture<Integer>();
- result.getResultsReceiver().receiveResults(new Integer(5));
- return result;
- }
-
- public String exceptionMethod() throws MetaMatrixProcessingException {
- throw new MetaMatrixProcessingException();
- }
-
- }
-
- private static class FakeClientServerInstance extends SocketServerInstanceImpl implements ClientInstance {
-
- ClientServiceRegistry clientServiceRegistry;
- private ResultsReceiver<Object> listener;
-
- public FakeClientServerInstance(ClientServiceRegistry clientServiceRegistry) {
- super();
- this.clientServiceRegistry = clientServiceRegistry;
- }
-
- public HostInfo getHostInfo() {
- return new HostInfo("fake", 1); //$NON-NLS-1$
- }
-
- public boolean isOpen() {
- return true;
- }
-
- @Override
- public void send(Message message, ResultsReceiver<Object> listener,
- Serializable messageKey) throws CommunicationException,
- InterruptedException {
- ServerWorkItem workItem = new ServerWorkItem(this, messageKey, message, clientServiceRegistry, SimpleMock.createSimpleMock(SessionServiceInterface.class));
- this.listener = listener;
- workItem.run();
- }
-
- public void shutdown() {
-
- }
-
- public Cryptor getCryptor() {
- return new NullCryptor();
- }
-
- public DQPWorkContext getWorkContext() {
- return new DQPWorkContext();
- }
-
- public void send(Message message, Serializable messageKey) {
- this.listener.receiveResults(message.getContents());
- }
-
- }
-
- /**
- * No server was supplied, will throw an NPE under the covers
- */
- public void testUnckedException() throws Exception {
- FakeClientServerInstance serverInstance = new FakeClientServerInstance(null);
- try {
- createFakeConnection(serverInstance);
- fail("expected exception"); //$NON-NLS-1$
- } catch (CommunicationException e) {
- assertEquals("Unable to find a component used in logging on to MetaMatrix", e.getMessage()); //$NON-NLS-1$
- }
- }
-
- public void testMethodInvocation() throws Exception {
- ClientServiceRegistry csr = new ClientServiceRegistry();
- csr.registerClientService(ILogon.class, new ILogon() {
-
- public ResultsFuture<?> logoff()
- throws InvalidSessionException,
- MetaMatrixComponentException {
- ResultsFuture<?> result = new ResultsFuture<Void>();
- result.getResultsReceiver().exceptionOccurred(new MetaMatrixComponentException("some exception")); //$NON-NLS-1$
- return result;
- }
-
- public LogonResult logon(Properties connectionProperties)
- throws LogonException, MetaMatrixComponentException {
- return new LogonResult();
- }
-
- // tests asynch where we don't care about the result
- public ResultsFuture<?> ping() throws InvalidSessionException,
- MetaMatrixComponentException {
- return null;
- }
-
- @Override
- public void assertIdentity(SessionToken sessionId)
- throws InvalidSessionException,
- MetaMatrixComponentException {
- }
-
- }, "foo"); //$NON-NLS-1$
- csr.registerClientService(FakeService.class, new FakeServiceImpl(), "foo"); //$NON-NLS-1$
- final FakeClientServerInstance serverInstance = new FakeClientServerInstance(csr);
- SocketServerConnection connection = createFakeConnection(serverInstance);
- ILogon logon = connection.getService(ILogon.class);
- Future<?> result = logon.ping();
- assertNull(result.get(0, TimeUnit.MILLISECONDS));
- result = logon.logoff();
- try {
- result.get(0, TimeUnit.MICROSECONDS);
- fail("exception expected"); //$NON-NLS-1$
- } catch (ExecutionException e) {
- assertTrue(e.getCause() instanceof MetaMatrixComponentException);
- }
- FakeService service = connection.getService(FakeService.class);
- Future<Integer> asynchInteger = service.asynchResult();
- assertEquals(new Integer(5), asynchInteger.get(0, TimeUnit.MILLISECONDS));
- try {
- service.exceptionMethod();
- fail("exception expected"); //$NON-NLS-1$
- } catch (MetaMatrixProcessingException e) {
-
- }
- ClientSideDQP dqp = connection.getService(ClientSideDQP.class);
- try {
- dqp.begin();
- fail("exception expected"); //$NON-NLS-1$
- } catch (XATransactionException e) {
- e.printStackTrace();
- assertEquals("Component not found: com.metamatrix.dqp.client.ClientSideDQP", e.getMessage()); //$NON-NLS-1$
- }
- }
-
- private SocketServerConnection createFakeConnection(
- final FakeClientServerInstance serverInstance)
- throws CommunicationException, ConnectionException {
- SocketServerConnection connection = new SocketServerConnection(new SocketServerInstanceFactory() {
-
- @Override
- public SocketServerInstance getServerInstance(HostInfo info,
- boolean ssl) throws CommunicationException, IOException {
- return serverInstance;
- }
-
- }, false, new UrlServerDiscovery(new MMURL("foo", 1, false)), new Properties(), null); //$NON-NLS-1$
- return connection;
- }
-
-}
Copied: trunk/server/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java (from rev 1067, trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java)
===================================================================
--- trunk/server/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java (rev 0)
+++ trunk/server/src/test/java/com/metamatrix/common/config/model/TestComponentCryptoUtil.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,150 @@
+/*
+ * 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.config.model;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.common.config.CurrentConfiguration;
+import com.metamatrix.common.config.api.ComponentTypeDefn;
+import com.metamatrix.common.config.api.ComponentTypeDefnID;
+import com.metamatrix.common.config.api.ConnectorBindingID;
+import com.metamatrix.common.config.reader.PropertiesConfigurationReader;
+import com.metamatrix.common.object.PropertyDefinitionImpl;
+import com.metamatrix.common.util.crypto.CryptoUtil;
+
+
+public class TestComponentCryptoUtil extends TestCase {
+
+
+ private static String ENCRYPTED;
+ private final static String NOT_ENCRYPTED = "not decrypted"; //$NON-NLS-1$
+
+
+ public TestComponentCryptoUtil(String name) throws Exception {
+ super(name);
+ }
+
+
+ public void setUp() throws Exception {
+ ENCRYPTED = new String(CryptoUtil.stringEncrypt("password")); //$NON-NLS-1$
+ }
+
+ public void testCheckPropertiesDecryptable() throws Exception {
+ BasicComponentDefn defn = new BasicConnectorBinding(null, new ConnectorBindingID(null, "binding"), null); //$NON-NLS-1$
+
+ //positive case
+ List componentTypeDefns = new ArrayList();
+
+ helpSetProperty(defn, componentTypeDefns, "prop1", ENCRYPTED, true); //$NON-NLS-1$
+ helpSetProperty(defn, componentTypeDefns, "prop2", NOT_ENCRYPTED, false); //$NON-NLS-1$
+
+ boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(defn, componentTypeDefns);
+ assertTrue(decryptable);
+
+
+
+ //negative case
+ componentTypeDefns = new ArrayList();
+
+ helpSetProperty(defn, componentTypeDefns, "prop1", ENCRYPTED, true); //$NON-NLS-1$
+ helpSetProperty(defn, componentTypeDefns, "prop2", NOT_ENCRYPTED, true); //$NON-NLS-1$
+
+ decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(defn, componentTypeDefns);
+ assertFalse(decryptable);
+
+ }
+
+
+
+ /**
+ * Helper method that sets a property on a ComponentDefn, and adds it to a list of ComponentTypeDefns
+ *
+ * @since 4.3
+ */
+ private void helpSetProperty(BasicComponentDefn defn, List componentTypeDefns, String key, String value, boolean isMasked) {
+ //set on the ComponentDefn
+ defn.addProperty(key, value);
+
+ //create a ComponentTypeDefn and add to the list
+ PropertyDefinitionImpl pd = new PropertyDefinitionImpl();
+ pd.setName(key);
+ pd.setMasked(isMasked);
+ ComponentTypeDefn ctd = new BasicComponentTypeDefn(new ComponentTypeDefnID(key), null, pd, false, false);
+ componentTypeDefns.add(ctd);
+ }
+
+ public void testCheckPropertiesDecryptableEmpty() throws Exception {
+ boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(new Properties(), new ArrayList());
+ assertTrue("Expected true ", decryptable); //$NON-NLS-1$
+ }
+
+ public void testCheckPropertiesDecryptableNull() throws Exception {
+ boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable((Properties)null, (Collection)null);
+ assertTrue("Expected true ", decryptable); //$NON-NLS-1$
+ }
+
+ public void testCheckPropertiesDecryptableNullProperties() throws Exception {
+ Collection maskedNames = new ArrayList();
+ maskedNames.add("Roberto"); //$NON-NLS-1$
+ maskedNames.add("Pietro"); //$NON-NLS-1$
+ maskedNames.add("Digiorno"); //$NON-NLS-1$
+ maskedNames.add("Digragorio"); //$NON-NLS-1$
+ boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable((Properties)null, maskedNames);
+ assertTrue("Expected true ", decryptable); //$NON-NLS-1$
+ }
+
+ public void testCheckPropertiesDecryptableFail() throws Exception {
+ String maskedPropName = "password"; //$NON-NLS-1$
+ Collection maskedNames = new ArrayList();
+ maskedNames.add(maskedPropName);
+
+ Properties props = new Properties();
+ props.setProperty(maskedPropName, "mm"); //$NON-NLS-1$
+
+ boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(props, maskedNames);
+ assertFalse("Expected not decryptable ", decryptable); //$NON-NLS-1$
+ }
+
+ public void testCheckPropertiesDecryptablePass() throws Exception {
+ String maskedPropName = "password"; //$NON-NLS-1$
+ Collection maskedNames = new ArrayList();
+ maskedNames.add(maskedPropName);
+
+ Properties props = new Properties();
+ props.setProperty(maskedPropName, ENCRYPTED); //$NON-NLS-1$
+
+ boolean decryptable = ComponentCryptoUtil.checkPropertiesDecryptable(props, maskedNames);
+ assertTrue("Expected decryptable ", decryptable); //$NON-NLS-1$
+ }
+
+
+
+}
+
+
Copied: trunk/server/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java (from rev 1067, trunk/common-internal/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java)
===================================================================
--- trunk/server/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java (rev 0)
+++ trunk/server/src/test/java/com/metamatrix/common/config/model/TestPropertyValidation.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -0,0 +1,69 @@
+/*
+ * 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.config.model;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+
+public class TestPropertyValidation extends TestCase {
+
+ /**
+ * @param name
+ */
+ public TestPropertyValidation(String name) {
+ super(name);
+
+ }
+
+ // ################################## TESTS ################################
+
+ public void testBoundariesMultiCastPort() throws Exception{
+ PropertyValidations val = new PropertyValidations();
+ val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.0.0.0" ); //$NON-NLS-1$
+
+ val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.255.255.255" ); //$NON-NLS-1$
+
+ }
+
+ public void testInvalidAlphaMultiCastPort() throws Exception{
+ try {
+ PropertyValidations val = new PropertyValidations();
+ val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.a.c.d" ); //$NON-NLS-1$
+ fail("224.a.c.d multicast port has alpha characters and is invalid"); //$NON-NLS-1$
+ } catch (ConfigurationException ce) {
+
+ }
+ }
+
+ public void testMissingNodesMultiCastPort() throws Exception{
+ try {
+ PropertyValidations val = new PropertyValidations();
+ val.isPropertyValid(PropertyValidations.UDP_MCAST_ADDR_PROPERTY, "224.10." ); //$NON-NLS-1$
+ fail("224.10. multicast port is missing nodes and is invalid"); //$NON-NLS-1$
+ } catch (ConfigurationException ce) {
+
+ }
+ }
+
+}
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/pom.xml 2009-06-26 22:06:04 UTC (rev 1088)
@@ -64,17 +64,6 @@
<!-- internal dependencies that are only used by integration testing -->
<dependency>
<groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-server</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
<artifactId>teiid-embedded</artifactId>
<version>${project.version}</version>
</dependency>
Modified: trunk/test-integration/src/test/java/com/metamatrix/cdk/TestLoopbackConnector.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/cdk/TestLoopbackConnector.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/cdk/TestLoopbackConnector.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -29,7 +29,7 @@
public class TestLoopbackConnector extends AbstractMMQueryTestCase {
- private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/dqp/dqp.properties"; //$NON-NLS-1$
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/dqp/dqp.properties;user=test"; //$NON-NLS-1$
private static final String VDB = "PartsSupplier"; //$NON-NLS-1$
@Test public void test() {
Modified: trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestCase3473.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestCase3473.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestCase3473.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -47,7 +47,7 @@
public class TestCase3473 extends TestCase {
- private static final String DQP_CONFIG_FILE = UnitTestUtil.getTestDataPath() + "/3473/3473.properties"; //$NON-NLS-1$
+ private static final String DQP_CONFIG_FILE = UnitTestUtil.getTestDataPath() + "/3473/3473.properties;user=test"; //$NON-NLS-1$
static Connection conn = null;
static String primaryUrl = "jdbc:metamatrix:test@" + DQP_CONFIG_FILE + ";version=1"; //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -59,7 +59,7 @@
*/
public class TestMMDatabaseMetaData {
- private static final String DQP_CONFIG_FILE = UnitTestUtil.getTestDataPath() + "/bqt/bqt.properties"; //$NON-NLS-1$
+ private static final String DQP_CONFIG_FILE = UnitTestUtil.getTestDataPath() + "/bqt/bqt.properties;user=test"; //$NON-NLS-1$
static Connection conn = null;
static String primaryUrl = "jdbc:metamatrix:QT_Ora9DS@" + DQP_CONFIG_FILE + ";version=1"; //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXQueryServices.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXQueryServices.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXQueryServices.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -48,7 +48,7 @@
*/
public void testXQueryCall() throws Exception {
Class.forName(EmbeddedDriver.class.getName());
- Connection conn = DriverManager.getConnection("jdbc:metamatrix:xq@" + UnitTestUtil.getTestDataPath() + "/xquery/xquery.properties;txnAutoWrap=OFF" ); //$NON-NLS-1$ //$NON-NLS-2$
+ Connection conn = DriverManager.getConnection("jdbc:metamatrix:xq@" + UnitTestUtil.getTestDataPath() + "/xquery/xquery.properties;txnAutoWrap=OFF;user=test" ); //$NON-NLS-1$ //$NON-NLS-2$
CallableStatement cs = conn.prepareCall("{? = call xqs.test}"); //$NON-NLS-1$
assertFalse(cs.execute());
SQLXML xml = cs.getSQLXML(1);
Modified: trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestPartsDatabaseMetadata.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestPartsDatabaseMetadata.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestPartsDatabaseMetadata.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -40,7 +40,7 @@
*/
public class TestPartsDatabaseMetadata extends AbstractMMQueryTestCase {
- private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/partssupplier/dqp.properties"; //$NON-NLS-1$
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/partssupplier/dqp.properties;user=test"; //$NON-NLS-1$
private static final String VDB = "PartsSupplier"; //$NON-NLS-1$
static DatabaseMetaData dbMetadata;
Modified: trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestResultSetMetadata.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestResultSetMetadata.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestResultSetMetadata.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -30,7 +30,7 @@
public class TestResultSetMetadata extends AbstractMMQueryTestCase {
- private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/partssupplier/dqp.properties"; //$NON-NLS-1$
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/partssupplier/dqp.properties;user=test"; //$NON-NLS-1$
private static final String VDB = "PartsSupplier"; //$NON-NLS-1$
public TestResultSetMetadata() {
Modified: trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestSystemVirtualModel.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestSystemVirtualModel.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestSystemVirtualModel.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -32,7 +32,7 @@
* Exercises each virtual table in the system model.
*/
public class TestSystemVirtualModel extends AbstractMMQueryTestCase {
- private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath()+ "/partssupplier/dqp.properties"; //$NON-NLS-1$
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath()+ "/partssupplier/dqp.properties;user=test"; //$NON-NLS-1$
private static final String VDB = "PartsSupplier"; //$NON-NLS-1$
public TestSystemVirtualModel() {
Modified: trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestVirtualDocWithVirtualProc.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestVirtualDocWithVirtualProc.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/com/metamatrix/systemmodel/TestVirtualDocWithVirtualProc.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -34,7 +34,7 @@
*/
public class TestVirtualDocWithVirtualProc extends AbstractMMQueryTestCase {
- private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/xml-vp/xmlvp.properties"; //$NON-NLS-1$
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/xml-vp/xmlvp.properties;user=test"; //$NON-NLS-1$
private static final String VDB = "xmlvp"; //$NON-NLS-1$
public TestVirtualDocWithVirtualProc() {
Modified: trunk/test-integration/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataInConnector.java
===================================================================
--- trunk/test-integration/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataInConnector.java 2009-06-26 22:01:00 UTC (rev 1087)
+++ trunk/test-integration/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataInConnector.java 2009-06-26 22:06:04 UTC (rev 1088)
@@ -7,7 +7,7 @@
public class TestMetadataInConnector extends AbstractMMQueryTestCase {
- private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/metadata/dqp.properties"; //$NON-NLS-1$
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() + "/metadata/dqp.properties;user=test"; //$NON-NLS-1$
private static final String VDB = "TestExtensions"; //$NON-NLS-1$
15 years, 6 months
teiid SVN: r1087 - trunk.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2009-06-26 18:01:00 -0400 (Fri, 26 Jun 2009)
New Revision: 1087
Modified:
trunk/pom.xml
Log:
TEIID-692 - remove SOAP project from TEIID. WS functionality will be supported by other JBoss projects in 6.2.
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-06-26 21:56:43 UTC (rev 1086)
+++ trunk/pom.xml 2009-06-26 22:01:00 UTC (rev 1087)
@@ -453,7 +453,6 @@
<module>txn-jbossts</module>
<module>connector-sdk</module>
<module>server</module>
- <module>soap</module>
<module>embedded</module>
<module>adminshell</module>
<module>test-integration</module>
15 years, 6 months
teiid SVN: r1086 - trunk.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2009-06-26 17:56:43 -0400 (Fri, 26 Jun 2009)
New Revision: 1086
Removed:
trunk/soap/
Log:
TEIID-692 - remove SOAP project from TEIID. WS functionality will be supported by other JBoss projects in 6.2.
15 years, 6 months
teiid SVN: r1085 - trunk/server/src/main/java/com/metamatrix/admin/server.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-06-24 18:13:24 -0400 (Wed, 24 Jun 2009)
New Revision: 1085
Modified:
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
Log:
Teiid-654 - Removing the use of the resource connection pool, this feature is no longer supported.
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-06-24 22:13:10 UTC (rev 1084)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-06-24 22:13:24 UTC (rev 1085)
@@ -1053,7 +1053,6 @@
resource.setLastUpdated(sr.getLastChangedDate());
resource.setLastUpdatedBy(sr.getLastChangedBy());
resource.setProperties(sr.getProperties());
- resource.setConnectionPoolIdentifier(sr.getProperty(Resource.RESOURCE_POOL));
results.add(resource);
}
}
15 years, 6 months
teiid SVN: r1084 - trunk/client/src/main/java/com/metamatrix/admin/objects.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-06-24 18:13:10 -0400 (Wed, 24 Jun 2009)
New Revision: 1084
Modified:
trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java
Log:
Teiid-654 - Removing the use of the resource connection pool, this feature is no longer supported.
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java 2009-06-24 20:36:17 UTC (rev 1083)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMResource.java 2009-06-24 22:13:10 UTC (rev 1084)
@@ -31,7 +31,6 @@
public class MMResource extends MMAdminObject implements Resource {
private String resourceType;
- private String connectionPoolIdentifier;
/**
* Constructor
@@ -49,7 +48,6 @@
StringBuffer result = new StringBuffer();
result.append(AdminPlugin.Util.getString("MMResource.MMResource")).append(getIdentifier()); //$NON-NLS-1$
result.append(AdminPlugin.Util.getString("MMResource.Type")).append(resourceType); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMResource.ConnectionPoolIdentifier")).append(connectionPoolIdentifier); //$NON-NLS-1$
result.append(AdminPlugin.Util.getString("MMResource.Created")).append(getCreatedDate()); //$NON-NLS-1$
result.append(AdminPlugin.Util.getString("MMResource.Created_By")).append(getCreatedBy()); //$NON-NLS-1$
result.append(AdminPlugin.Util.getString("MMResource.Updated")).append(getLastChangedDate()); //$NON-NLS-1$
@@ -61,30 +59,6 @@
/**
- * Return the Identifier for the Connection Pool Assigned
- *
- * @return Returns the String Identifier for the Assigned Connection Pool.
- * @since 4.3
- */
- public String getConnectionPoolIdentifier() {
- return this.connectionPoolIdentifier;
- }
-
-
-
- /**
- * Set the Connection Pool Assigned Identifier
- *
- * @param connectionPoolIdentifier The Identifier of the Connection Pool to set.
- * @since 4.3
- */
- public void setConnectionPoolIdentifier(String connectionPoolIdentifier) {
- this.connectionPoolIdentifier = connectionPoolIdentifier;
- }
-
-
-
- /**
* Get the Resource Type for this Resource
* @return Returns the String value of the Resource Type for this Resouce.
* @since 4.3
15 years, 6 months
teiid SVN: r1083 - trunk/engine/src/main/java/org/teiid/dqp/internal/process.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-06-24 16:36:17 -0400 (Wed, 24 Jun 2009)
New Revision: 1083
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Util.java
Log:
Teiid 653 - removed the deployed attribute from the admin objects
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Util.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Util.java 2009-06-24 20:35:25 UTC (rev 1082)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Util.java 2009-06-24 20:36:17 UTC (rev 1083)
@@ -29,7 +29,6 @@
public static MMQueueWorkerPool convertStats(final WorkerPoolStats src, String ... identifier) {
MMQueueWorkerPool pool = new MMQueueWorkerPool(identifier);
- pool.setDeployed(true);
pool.setRegistered(true);
pool.setQueued(src.getQueued());
pool.setThreads(src.getActiveThreads());
15 years, 6 months