teiid SVN: r1749 - in branches/JCA/jboss-integration/src: main/java/org/teiid/templates/connector and 2 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-01-15 17:01:27 -0500 (Fri, 15 Jan 2010)
New Revision: 1749
Added:
branches/JCA/jboss-integration/src/test/resources/connector-loopback.rar
Modified:
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
Log:
TEIID-833: adding support for adding custom connector types based on RAR file added to the system automatically
Modified: branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-01-15 18:29:16 UTC (rev 1748)
+++ branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-01-15 22:01:27 UTC (rev 1749)
@@ -22,6 +22,10 @@
package org.teiid.adminapi.jboss;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@@ -30,6 +34,8 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
@@ -488,9 +494,9 @@
private String getRarDeployerName(String rarName) throws AdminException{
try {
- Set<String> rarDeployments = getView().getDeploymentNamesForType("JavaEEResourceAdaptor");
+ Set<String> rarDeployments = getView().getDeploymentNamesForType("rar");
for (String name: rarDeployments) {
- if (name.endsWith(rarName)) {
+ if (name.endsWith(rarName+"/")) {
return name;
}
}
@@ -502,12 +508,30 @@
@Override
public void addConnectorType(String connectorName, URL rarURL) throws AdminException{
+ if (!connectorName.startsWith("connector-")) {
+ throw new AdminProcessingException("Teiid connector names must start with \"connector-\"");
+ }
+
if (!connectorName.endsWith(".rar")) {
connectorName = connectorName + ".rar";
}
+
+ String deployerName = getRarDeployerName(connectorName);
+ if (deployerName != null) {
+ throw new AdminProcessingException("A Connectory with name:"+connectorName+" already exists!");
+ }
+
ManagedUtil.deployArchive(getDeploymentManager(), connectorName, rarURL, false);
- //TODO: also need to add a template for the properties
+ //also need to add a template for the properties
+ try {
+ String connectorNameWithoutExt = connectorName.substring(0, connectorName.length()-4);
+ File jarFile = Admin.createConnectorTypeTemplate(connectorNameWithoutExt);
+ ManagedUtil.deployArchive(getDeploymentManager(), connectorNameWithoutExt+"-template.jar", jarFile.toURI().toURL(), false);
+ jarFile.delete();
+ } catch (IOException e) {
+ deleteConnectorType(connectorName);
+ }
}
@Override
@@ -518,9 +542,11 @@
String deployerName = getRarDeployerName(connectorName);
if (deployerName != null) {
ManagedUtil.removeArchive(getDeploymentManager(), deployerName);
+
+ //also need to delete template for the properties
+ String connectorNameWithoutExt = connectorName.substring(0, connectorName.length()-4);
+ ManagedUtil.removeArchive(getDeploymentManager(), connectorNameWithoutExt+"-template.jar");
}
-
- //TODO: also need to delete template for the properties
}
@Override
@@ -721,4 +747,38 @@
public Collection<PropertyDefinition> getDataSourcePropertyDefinitions() throws AdminException {
return getConnectorTypePropertyDefinitions(XA_DATA_SOURCE_TEMPLATE);
}
+
+ private static final String connectorTemplate =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
+ "<deployment xmlns=\"urn:jboss:bean-deployer:2.0\">\n" +
+ "<!-- This is Teiid connector type template - DO NOT DELETE -->\n"+
+ "<bean name=\"${name}\" class=\"org.teiid.templates.connector.ConnectorTypeTemplate\">\n" +
+ " <property name=\"info\"><inject bean=\"${name}-templateinfo\"/></property>\n" +
+ " <property name=\"targetTemplate\"><inject bean=\"NoTxConnectionFactoryTemplate\"/></property>\n" +
+ "</bean>\n" +
+ "<bean name=\"${name}-templateinfo\" class=\"org.teiid.templates.connector.ConnectorTypeTemplateInfo\">\n" +
+ " <constructor factoryMethod=\"createTemplateInfo\">\n" +
+ " <factory bean=\"DSDeploymentTemplateInfoFactory\"/>\n" +
+ " <parameter class=\"java.lang.Class\">org.teiid.templates.connector.ConnectorTypeTemplateInfo</parameter>\n" +
+ " <parameter class=\"java.lang.Class\">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>\n" +
+ " <parameter class=\"java.lang.String\">${name}</parameter>\n" +
+ " <parameter class=\"java.lang.String\">${name}</parameter>\n"+
+ " </constructor>\n" +
+ "</bean>\n"+
+ "</deployment>";
+
+ private static File createConnectorTypeTemplate(String name) throws IOException {
+ String content = connectorTemplate.replace("${name}", name);
+
+ File jarFile = File.createTempFile(name, ".jar");
+ JarOutputStream jo = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(jarFile)));
+
+ JarEntry je = new JarEntry("META-INF/jboss-beans.xml");
+ jo.putNextEntry(je);
+
+ jo.write(content.getBytes());
+
+ jo.close();
+ return jarFile;
+ }
}
Modified: branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java 2010-01-15 18:29:16 UTC (rev 1748)
+++ branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplateInfo.java 2010-01-15 22:01:27 UTC (rev 1749)
@@ -104,7 +104,9 @@
String description = descMetadata.getDescription();
fields.setDescription(description);
fields.setMetaType(metaType);
- fields.setField(Fields.DEFAULT_VALUE, ManagedUtil.wrap(metaType, metadata.getValue()));
+ if (metadata.getValue() != null && metadata.getValue().trim().length() > 0) {
+ fields.setField(Fields.DEFAULT_VALUE, ManagedUtil.wrap(metaType, metadata.getValue()));
+ }
fields.setField(Fields.READ_ONLY, false);
ManagedPropertyImpl dsTypeMP = new ManagedPropertyImpl(fields);
addProperty(dsTypeMP);
Modified: branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-01-15 18:29:16 UTC (rev 1748)
+++ branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-01-15 22:01:27 UTC (rev 1749)
@@ -244,4 +244,19 @@
Collection<PropertyDefinition> defs = admin.getDataSourcePropertyDefinitions();
System.out.println(defs);
}
+
+ @Test
+ public void testTemplate() throws Exception{
+ File f = new File(UnitTestUtil.getTestDataPath()+"/connector-loopback.rar");
+ admin.addConnectorType("connector-loopy", f.toURI().toURL());
+
+ Set<String> names = admin.getConnectorTypes();
+ assertTrue(names.contains("connector-loopy"));
+
+ }
+
+ @Test
+ public void testTemplateRemove() throws Exception{
+ admin.deleteConnectorType("connector-loopy");
+ }
}
Added: branches/JCA/jboss-integration/src/test/resources/connector-loopback.rar
===================================================================
(Binary files differ)
Property changes on: branches/JCA/jboss-integration/src/test/resources/connector-loopback.rar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 11 months
teiid SVN: r1748 - in branches/JCA: jboss-integration/src/main/java/org/teiid/jboss/deployers and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-01-15 13:29:16 -0500 (Fri, 15 Jan 2010)
New Revision: 1748
Modified:
branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
branches/JCA/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorBindingDeployer.java
Log:
TEIID-859: controlling the connector threads to be equal to connection pool size
Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-01-15 17:06:09 UTC (rev 1747)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-01-15 18:29:16 UTC (rev 1748)
@@ -95,14 +95,20 @@
private ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem> requestStates = new ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem>();
private SourceCapabilities cachedCapabilities;
-
+
public ConnectorManager(String name) {
+ this(name, DEFAULT_MAX_THREADS);
+ }
+
+ public ConnectorManager(String name, int maxThreads) {
if (name == null) {
throw new IllegalArgumentException("Connector name can not be null");
}
+ if (maxThreads <= 0) {
+ maxThreads = DEFAULT_MAX_THREADS;
+ }
this.connectorName = name;
- // TODO: DEFAULT_MAX_THREADS must be configurable rareddy
- this.workManager = new StatsCapturingWorkManager(this.connectorName, DEFAULT_MAX_THREADS);
+ this.workManager = new StatsCapturingWorkManager(this.connectorName, maxThreads);
}
public String getName() {
Modified: branches/JCA/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorBindingDeployer.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorBindingDeployer.java 2010-01-15 17:06:09 UTC (rev 1747)
+++ branches/JCA/jboss-integration/src/main/java/org/teiid/jboss/deployers/ConnectorBindingDeployer.java 2010-01-15 18:29:16 UTC (rev 1748)
@@ -62,7 +62,7 @@
ConnectorManager cm = null;
try {
- cm = createConnectorManger("java:"+connectorName);
+ cm = createConnectorManger("java:"+connectorName, data.getMaxSize());
cm.start();
cmGroup.addConnectorManager(cm);
} catch (ConnectorException e) {
@@ -82,8 +82,8 @@
}
- ConnectorManager createConnectorManger(String deployedConnectorName) {
- ConnectorManager mgr = new ConnectorManager(deployedConnectorName);
+ ConnectorManager createConnectorManger(String deployedConnectorName, int maxThreads) {
+ ConnectorManager mgr = new ConnectorManager(deployedConnectorName, maxThreads);
return mgr;
}
14 years, 11 months
teiid SVN: r1747 - in branches/JCA: build/kit-jboss-container/conf and 22 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-01-15 12:06:09 -0500 (Fri, 15 Jan 2010)
New Revision: 1747
Added:
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
branches/JCA/jboss-integration/src/test/resources/log4j.xml
Removed:
branches/JCA/client/src/main/java/com/metamatrix/admin/RolesAllowed.java
branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
branches/JCA/client/src/main/java/org/teiid/adminapi/AdminOptions.java
branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdminMBean.java
branches/JCA/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java
branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java
branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/MetaMatrixAdminException.java
branches/JCA/runtime/src/main/java/org/teiid/adminapi/impl/BaseAdmin.java
branches/JCA/runtime/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java
branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java
Modified:
branches/JCA/build/assembly/jboss-container/dependencies.xml
branches/JCA/build/kit-jboss-container/conf/jboss-log4j.xml
branches/JCA/build/kit-jboss-container/deploy/teiid-jboss-beans.xml
branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/api/Connection.java
branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java
branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
branches/JCA/client/src/main/java/org/teiid/adminapi/Admin.java
branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/PermissionNodeException.java
branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/JCA/jboss-integration/pom.xml
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
branches/JCA/runtime/src/main/java/org/teiid/TeiidConnectionFactory.java
Log:
TEIID-833, TEIID-910: Making the access to the Admin API totally over Profile Service. Now admin api is just wrapper over PS. The implementation of the wrapper is moved into the client rather than in server, any access controls now must be done over profile service connection
Modified: branches/JCA/build/assembly/jboss-container/dependencies.xml
===================================================================
--- branches/JCA/build/assembly/jboss-container/dependencies.xml 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/build/assembly/jboss-container/dependencies.xml 2010-01-15 17:06:09 UTC (rev 1747)
@@ -23,7 +23,6 @@
<include>org.jboss.teiid:teiid-runtime</include>
<include>org.jboss.teiid:teiid-engine</include>
<include>org.jboss.teiid:teiid-metadata</include>
- <include>org.jboss.teiid:teiid-jboss-integration</include>
</includes>
<binaries>
@@ -48,6 +47,7 @@
<moduleSet>
<includes>
<include>org.jboss.teiid:teiid-hibernate-dialect</include>
+ <include>org.jboss.teiid:teiid-jboss-integration</include>
</includes>
<binaries>
<includeDependencies>false</includeDependencies>
Modified: branches/JCA/build/kit-jboss-container/conf/jboss-log4j.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/conf/jboss-log4j.xml 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/build/kit-jboss-container/conf/jboss-log4j.xml 2010-01-15 17:06:09 UTC (rev 1747)
@@ -382,19 +382,19 @@
<!-- Teiid specific categoryies -->
<logger name="org.teiid">
- <level value="WARN" />
+ <level value="INFO" />
</logger>
<!-- un-comment to enable COMMAND log
<logger name="org.teiid.COMMAND_LOG" additivity="false">
- <level value="INFO"/>
+ <level value="DEBUG"/>
<appender-ref ref="COMMAND"/>
</logger>
-->
<!-- Un-comment to enable AUDIT log
<logger name="org.teiid.AUDIT_LOG" additivity="false">
- <level value="INFO"/>
+ <level value="DEBUG"/>
<appender-ref ref="AUDIT"/>
</logger>
-->
Modified: branches/JCA/build/kit-jboss-container/deploy/teiid-jboss-beans.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/deploy/teiid-jboss-beans.xml 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/build/kit-jboss-container/deploy/teiid-jboss-beans.xml 2010-01-15 17:06:09 UTC (rev 1747)
@@ -17,12 +17,6 @@
<interceptor-ref name="JndiAspect"/>
</bind>
-
- <!-- Add User specific beans here -->
- <bean name="teiid-admin" class="org.teiid.adminapi.jboss.Admin">
- <annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name="teiid/admin")</annotation>
- </bean>
-
<bean name="ContainerHelper" class="org.teiid.jboss.JBossContainerHelper">
<annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name="teiid/container-helper")</annotation>
<property name="VDBRepository"><inject bean="VDBRepository"/></property>
Deleted: branches/JCA/client/src/main/java/com/metamatrix/admin/RolesAllowed.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/admin/RolesAllowed.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/com/metamatrix/admin/RolesAllowed.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,36 +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;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Documented
-(a)Retention(value=RetentionPolicy.RUNTIME)
-(a)Target(value={ElementType.TYPE,ElementType.METHOD})
-public @interface RolesAllowed {
- String[] value();
-}
Deleted: branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,296 +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.objects;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.teiid.adminapi.PropertyDefinition;
-
-import com.metamatrix.admin.AdminPlugin;
-
-
-/**
- * @since 4.3
- */
-public class MMPropertyDefinition extends MMAdminObject implements PropertyDefinition {
- private static final long serialVersionUID = 6612838530524627205L;
- private String value = null;
- private Collection allowedValues = new ArrayList();
- private Object defaultValue = null;
- private String description = null;
- private String displayName = null;
- private String propertyType = "String"; //$NON-NLS-1$
- private String propertyTypeClassName = String.class.getName();
- private RestartType requiresRestart = RestartType.NONE;
- private boolean expert = false;
- private boolean masked = false;
- private boolean modifiable = true;
- private boolean required = false;
-
-
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.MMPropertyDefinition")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Display_name")).append(getDisplayName()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Description")).append(getDescription()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Value")).append(getValue()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Property_type")).append(getPropertyType()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Property_type_class_name")).append(getPropertyTypeClassName()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Default_value")).append(getDefaultValue()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Constrained_to_allow_values")).append(isConstrainedToAllowedValues()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Allowed_values")).append(getAllowedValues()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Required")).append(isRequired()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Expert")).append(isExpert()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Masked")).append(isMasked()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Modifiable")).append(isModifiable()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.RequiresRestart")).append(getRequiresRestart()); //$NON-NLS-1$
- return result.toString();
- }
-
-
-
-
- /**
- * Constructor.
- * @param identifierParts
- * @since 4.3
- */
- public MMPropertyDefinition(String[] identifierParts) {
- super(identifierParts);
- }
-
-
-
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getValue()
- * @since 4.3
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getAllowedValues()
- * @since 4.3
- */
- public Collection getAllowedValues() {
- return allowedValues;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getDefaultValue()
- * @since 4.3
- */
- public Object getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getDescription()
- * @since 4.3
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getDisplayName()
- * @since 4.3
- */
- public String getDisplayName() {
- return displayName;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getPropertyType()
- * @since 4.3
- */
- public String getPropertyType() {
- return propertyType;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getPropertyTypeClassName()
- * @since 4.3
- */
- public String getPropertyTypeClassName() {
- return propertyTypeClassName;
- }
-
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getRequiresRestart()
- * @since 4.3
- */
- public RestartType getRequiresRestart() {
- return requiresRestart;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isExpert()
- * @since 4.3
- */
- public boolean isExpert() {
- return expert;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isMasked()
- * @since 4.3
- */
- public boolean isMasked() {
- return masked;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isModifiable()
- * @since 4.3
- */
- public boolean isModifiable() {
- return modifiable;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isRequired()
- * @since 4.3
- */
- public boolean isRequired() {
- return required;
- }
-
-
-
-
-
-
- /**
- * @param allowedValues The allowedValues to set.
- * @since 4.3
- */
- public void setAllowedValues(Collection allowedValues) {
- this.allowedValues = allowedValues;
- }
-
- /**
- * @param defaultValue The defaultValue to set.
- * @since 4.3
- */
- public void setDefaultValue(Object defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- /**
- * @param description The description to set.
- * @since 4.3
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
-
- /**
- * @param displayName The displayName to set.
- * @since 4.3
- */
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
-
-
- /**
- * @param expert The value of expert to set.
- * @since 4.3
- */
- public void setExpert(boolean expert) {
- this.expert = expert;
- }
-
- /**
- * @param masked The value of masked to set.
- * @since 4.3
- */
- public void setMasked(boolean masked) {
- this.masked = masked;
- }
- /**
- * @param modifiable The value of modifiable to set.
- * @since 4.3
- */
- public void setModifiable(boolean modifiable) {
- this.modifiable = modifiable;
- }
-
- /**
- * @param propertyTypeAsString The propertyTypeAsString to set.
- * @since 4.3
- */
- public void setPropertyType(String propertyTypeAsString) {
- this.propertyType = propertyTypeAsString;
- }
-
- /**
- * @param propertyTypeClassName The propertyTypeName to set.
- * @since 4.3
- */
- public void setPropertyTypeClassName(String propertyTypeClassName) {
- this.propertyTypeClassName = propertyTypeClassName;
- }
-
-
- /**
- * @param required The value of required to set.
- * @since 4.3
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- /**
- * @param requiresRestart The value of requiresRestart to set.
- * @since 4.3
- */
- public void setRequiresRestart(RestartType requiresRestart) {
- this.requiresRestart = requiresRestart;
- }
-
- /**
- * @param value The value to set.
- * @since 4.3
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- @Override
- public boolean isConstrainedToAllowedValues() {
- return allowedValues != null && !allowedValues.isEmpty();
- }
-
-
-}
Deleted: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,241 +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.client;
-
-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.adminapi.Admin;
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminObject;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.client.ExceptionUtil;
-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.exception.ConnectionException;
-import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-
-/**
- * Singleton factory for ServerAdmins.
- * @since 4.3
- */
-public class ServerAdminFactory {
-
- private static final int DEFAULT_BOUNCE_WAIT = 2000;
-
- private final class ReconnectingProxy implements InvocationHandler {
-
- private Admin target;
- private ServerConnection registry;
- private Properties p;
- private boolean closed;
-
- public ReconnectingProxy(Properties p) throws ConnectionException, CommunicationException {
- this.p = p;
- this.registry = serverConnectionFactory.getConnection(p);
- }
-
- private synchronized Admin getTarget() throws AdminComponentException, CommunicationException {
- if (closed) {
- throw new AdminComponentException(CommPlatformPlugin.Util.getString("ERR.014.001.0001")); //$NON-NLS-1$
- }
- if (target != null && registry.isOpen()) {
- return target;
- }
- try {
- registry = serverConnectionFactory.getConnection(p);
- } catch (ConnectionException e) {
- throw new AdminComponentException(e.getMessage());
- }
- target = registry.getService(Admin.class);
- return target;
- }
-
- //## JDBC4.0-begin ##
- @Override
- //## JDBC4.0-end ##
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- if (method.getName().equals("close")) { //$NON-NLS-1$
- close();
- return null;
- }
- Throwable t = null;
- for (int i = 0; i < 3; i++) {
- try {
- return method.invoke(getTarget(), args);
- } catch (InvocationTargetException e) {
- if (ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
- // communication exception occurred, lose the old connection and try again.
- this.target = null;
- if (method.getName().endsWith("restart")) { //$NON-NLS-1$
- bounceSystem(true);
- return null;
- }
- continue;
- }
- throw e.getTargetException();
- } catch (CommunicationException e) {
- t = e;
- }
- }
- throw t;
- }
-
- public synchronized void close() {
- if (closed) {
- return;
- }
- this.closed = true;
- if (registry != null) {
- registry.close();
- }
- }
-
- public void bounceSystem(boolean waitUntilDone) {
- if (!waitUntilDone) {
- return;
- }
- //we'll wait 2 seconds for the server to come up
- try {
- Thread.sleep(bounceWait);
- } catch (InterruptedException e) {
- throw new MetaMatrixRuntimeException(e);
- }
-
- //we'll wait 30 seconds for the server to come back up
- for (int i = 0; i < 15; i++) {
- try {
- getTarget().getProcesses(AdminObject.WILDCARD);
- return;
- } catch (Exception e) {
- //reestablish a connection and retry
- try {
- Thread.sleep(bounceWait);
- } catch (InterruptedException ex) {
- throw new MetaMatrixRuntimeException(ex);
- }
- }
- }
- }
- }
-
- public static final String DEFAULT_APPLICATION_NAME = "Admin"; //$NON-NLS-1$
-
- /**Singleton instance*/
- private static ServerAdminFactory instance = new ServerAdminFactory(SocketServerConnectionFactory.getInstance(), DEFAULT_BOUNCE_WAIT);
-
- private ServerConnectionFactory serverConnectionFactory;
- private int bounceWait;
-
- ServerAdminFactory(ServerConnectionFactory connFactory, int bounceWait) {
- this.serverConnectionFactory = connFactory;
- this.bounceWait = bounceWait;
- }
-
- /**Get the singleton instance*/
- public static ServerAdminFactory getInstance() {
- return instance;
- }
-
-
- /**
- * Creates a ServerAdmin with the specified connection properties.
- * Uses the DEFAULT_APPLICATION_NAME as the application name.
- * @param userName
- * @param password
- * @param serverURL
- * @return
- * @throws LogonException
- * @throws AdminException
- * @throws CommunicationException
- * @throws LogonException
- * @since 4.3
- */
- public Admin createAdmin(String userName,
- char[] password,
- String serverURL) throws AdminException {
-
- return createAdmin(userName, password, serverURL, DEFAULT_APPLICATION_NAME);
-
- }
-
- /**
- * Creates a ServerAdmin with the specified connection properties.
- * @param userName
- * @param password
- * @param serverURL
- * @return
- * @throws LogonException
- * @throws AdminException
- * @throws CommunicationException
- * @throws LogonException
- * @since 4.3
- */
- public Admin createAdmin(String userName,
- char[] password,
- String serverURL,
- String applicationName) throws AdminException {
-
- if (userName == null || userName.trim().length() == 0) {
- throw new IllegalArgumentException(AdminPlugin.Util.getString("ERR.014.001.0099")); //$NON-NLS-1$
- }
-
- final Properties p = new Properties();
- p.setProperty(MMURL.CONNECTION.APP_NAME, applicationName);
- p.setProperty(MMURL.CONNECTION.USER_NAME, userName);
- if (password != null) {
- p.setProperty(MMURL.CONNECTION.PASSWORD, new String(password));
- }
- p.setProperty(MMURL.CONNECTION.SERVER_URL, serverURL);
- return createAdmin(p);
- }
-
- public Admin createAdmin(Properties p) throws AdminException {
- 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());
-
- try {
- Admin serverAdmin = (Admin)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Admin.class }, new ReconnectingProxy(p));
- return serverAdmin;
- } catch (ConnectionException e) {
- throw new AdminComponentException(e.getMessage());
- } catch (CommunicationException e) {
- throw new AdminComponentException(e.getMessage());
- }
- }
-
-}
Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -242,7 +242,7 @@
MMURL url = new MMURL(connectionProperties.getProperty(MMURL.CONNECTION.SERVER_URL));
- String discoveryStrategyName = connectionProperties.getProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, AdminApiServerDiscovery.class.getName());
+ String discoveryStrategyName = connectionProperties.getProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, URL);
ServerDiscovery discovery;
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/Admin.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/Admin.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -27,9 +27,6 @@
import java.util.Properties;
import java.util.Set;
-import com.metamatrix.admin.RolesAllowed;
-
-(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
public interface Admin {
public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE, CONNECTOR_RESULT_SET_CACHE};
@@ -149,24 +146,11 @@
void setRuntimeProperty(String propertyName, String propertyValue) 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;
-
- /**
* Get the Connector Types available in the configuration.
*
* @return Set of connector types.
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Set<String> getConnectorTypes() throws AdminException;
/**
@@ -176,7 +160,6 @@
* same name in the Collection but they will differ by VDB version.
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
Set<VDB> getVDBs() throws AdminException;
/**
@@ -186,7 +169,6 @@
* @throws AdminException if there's a system error.
* @return
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
VDB getVDB(String vdbName, int vbdVersion) throws AdminException;
/**
@@ -195,7 +177,6 @@
* @return Collection of {@link ConnectorBinding}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<ConnectorBinding> getConnectorBindings() throws AdminException;
/**
@@ -204,7 +185,6 @@
* @return null if not found a connector binding by the given name
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
ConnectorBinding getConnectorBinding(String deployedName) throws AdminException;
/**
@@ -214,7 +194,6 @@
* @return Collection of {@link ConnectorBinding}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, int vdbVersion) throws AdminException;
/**
@@ -225,7 +204,6 @@
* @return Collection of {@link QueueWorkerPool}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
WorkerPoolStatistics getWorkManagerStats(String identifier) throws AdminException;
@@ -238,7 +216,6 @@
* @return {@link ConnectionPoolStatistics}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
ConnectionPoolStatistics getConnectorConnectionPoolStats(String deployedName) throws AdminException;
@@ -247,7 +224,6 @@
* @return Collection of {@link String}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<String> getCacheTypes() throws AdminException;
/**
@@ -255,7 +231,6 @@
* @return Collection of {@link Session}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<Session> getSessions() throws AdminException;
/**
@@ -263,7 +238,6 @@
* @return Collection of {@link Request}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<Request> getRequests() throws AdminException;
/**
@@ -271,7 +245,6 @@
* @return Collection of {@link Request}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<Request> getRequestsForSession(long sessionId) throws AdminException;
@@ -281,7 +254,6 @@
* @return
* @throws AdminException
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<PropertyDefinition> getConnectorTypePropertyDefinitions(String connectorTypeIdentifier) throws AdminException;
@@ -290,7 +262,6 @@
* @return
* @throws AdminException
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
Collection<Transaction> getTransactions() throws AdminException;
/**
@@ -302,7 +273,6 @@
* @return Collection of {@link org.teiid.adminapi.ProcessObject ProcessObject}
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException;
@@ -312,7 +282,6 @@
* @param deployedName
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void startConnectorBinding(ConnectorBinding binding) throws AdminException;
/**
@@ -320,7 +289,6 @@
*
* @param deployedName identifier for {@link org.teiid.adminapi.ConnectorBinding}
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void stopConnectorBinding(ConnectorBinding binding) throws AdminException;
/**
@@ -329,7 +297,6 @@
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void clearCache(String cacheType) throws AdminException;
/**
@@ -339,7 +306,6 @@
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void terminateSession(long sessionId) throws AdminException;
/**
@@ -350,7 +316,6 @@
*
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void cancelRequest(long sessionId, long requestId) throws AdminException;
/**
@@ -361,7 +326,6 @@
* @param status Active, InActive, Delete
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
public void changeVDBStatus(String name, String version, int status)
throws AdminException;
@@ -370,7 +334,6 @@
* @param transactionId
* @throws AdminException
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void terminateTransaction(String transactionId) throws AdminException;
/**
@@ -379,14 +342,12 @@
* @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
* @throws AdminException
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void shutdown(int millisToWait) throws AdminException;
/**
* Restart System
* @throws AdminException if there's a system error.
*/
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
void restart() throws AdminException;
/**
Deleted: branches/JCA/client/src/main/java/org/teiid/adminapi/AdminOptions.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/AdminOptions.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/AdminOptions.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,195 +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 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.
- // *************************************************************************
- private static final long serialVersionUID = 2809137776857876224L;
-
- /**
- * 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();
- }
-
-}
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -22,9 +22,11 @@
package org.teiid.adminapi;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
-public abstract class TeiidAdmin implements TeiidAdminMBean, Serializable {
+public abstract class TeiidAdmin implements Admin, Serializable {
@Override
public void addUDF(byte[] modelFileContents, String classpath)
@@ -63,10 +65,9 @@
}
@Override
- public String importDataRoles(String vdbName, String vdbVersion,
- char[] data, AdminOptions options) throws AdminException {
- // rameshTODO Auto-generated method stub
- return null;
+ public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
+ ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
+ //list.add(manager.getProcess());
+ return list;
}
-
}
Deleted: branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdminMBean.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdminMBean.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdminMBean.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,27 +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 org.teiid.adminapi;
-
-
-public interface TeiidAdminMBean extends Admin {
-}
Deleted: branches/JCA/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java
===================================================================
--- branches/JCA/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/test/java/com/metamatrix/admin/api/objects/TestAdminOptions.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,254 +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.objects;
-
-import org.teiid.adminapi.AdminOptions;
-
-import junit.framework.TestCase;
-
-
-
-/**
- * @since 4.3
- */
-public class TestAdminOptions extends TestCase {
-
- /**
- * Constructor for TestAdminOptions.
- * @param name
- */
- public TestAdminOptions(String name) {
- super(name);
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_1_Option() {
- int theOptions = AdminOptions.OnConflict.EXCEPTION;
- AdminOptions opts = new AdminOptions(theOptions);
- assertTrue(opts.containsOption(theOptions));
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_2_Options() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- opts.addOption(option_2);
-
- assertTrue(opts.containsOption(option_1));
- assertTrue(opts.containsOption(option_2));
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_3_Options() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
- int option_3 = AdminOptions.OnConflict.OVERWRITE;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- opts.addOption(option_2);
- opts.addOption(option_3);
-
- assertTrue(opts.containsOption(option_1));
- assertTrue(opts.containsOption(option_2));
- assertTrue(opts.containsOption(option_3));
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_4_Options() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
- int option_3 = AdminOptions.OnConflict.OVERWRITE;
- int option_4 = AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- opts.addOption(option_2);
- opts.addOption(option_3);
- opts.addOption(option_4);
-
- assertTrue(opts.containsOption(option_1));
- assertTrue(opts.containsOption(option_2));
- assertTrue(opts.containsOption(option_3));
- assertTrue(opts.containsOption(option_4));
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_Bogus_Added() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int bogus = 0;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- try {
- opts.addOption(bogus);
- fail("AdminOptions addOptions method took an invalid option: " + bogus); //$NON-NLS-1$
- } catch (Exception err) {
- }
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_1_Option_DoesNotContain_2() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
- int option_3 = AdminOptions.OnConflict.OVERWRITE;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- assertTrue(opts.containsOption(option_1));
-
- assertFalse(opts.containsOption(option_2));
- assertFalse(opts.containsOption(option_3));
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_2_Option_DoesNotContain_1() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
- int option_3 = AdminOptions.OnConflict.OVERWRITE;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- opts.addOption(option_2);
-
- assertTrue(opts.containsOption(option_1));
- assertTrue(opts.containsOption(option_2));
-
- assertFalse(opts.containsOption(option_3));
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_ORed() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
-
- AdminOptions opts = new AdminOptions(option_1 | option_2);
-
- assertTrue(opts.containsOption(option_1));
- assertTrue(opts.containsOption(option_2));
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_Bogus_0() {
- int bogus = 0;
-
- try {
- new AdminOptions(bogus);
- fail("AdminOptions ctor took an invalid option: " + bogus); //$NON-NLS-1$
- } catch (Exception err) {
- }
- }
-
- /**
- * Test method for 'com.metamatrix.admin.api.objects.AdminOptions.AdminOptions(int)'
- */
- public void testMMAdminOptions_ORed_Bogus_Added() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
- int bogus = -1;
-
- AdminOptions opts = new AdminOptions(option_1 | option_2);
- try {
- opts.addOption(bogus);
- fail("AdminOptions addOptions method took an invalid option: " + bogus); //$NON-NLS-1$
- } catch (Exception err) {
- }
- }
-
- /**
- * Test method for 'com.metamatrix.admin.objects.MMAdminOptions.toString()'
- */
- public void testToStringOne() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- assertEquals("[OnConflict_EXCEPTION]", opts.toString()); //$NON-NLS-1$
- }
-
- /**
- * Test method for 'com.metamatrix.admin.objects.MMAdminOptions.toString()'
- */
- public void testToStringTwo() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_4 = AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR;
-
- AdminOptions opts = new AdminOptions(option_1);
- opts.addOption(option_4);
-
- assertEquals("[OnConflict_EXCEPTION, BINDINGS_IGNORE_DECRYPT_ERROR]", opts.toString()); //$NON-NLS-1$
- }
-
- /**
- * Test method for 'com.metamatrix.admin.objects.MMAdminOptions.toString()'
- */
- public void testToStringAll() {
- int option_1 = AdminOptions.OnConflict.EXCEPTION;
- int option_2 = AdminOptions.OnConflict.IGNORE;
- int option_3 = AdminOptions.OnConflict.OVERWRITE;
- int option_4 = AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR;
-
- AdminOptions opts = new AdminOptions(option_1);
-
- opts.addOption(option_2);
- opts.addOption(option_3);
- opts.addOption(option_4);
-
- assertEquals("[OnConflict_OVERWRITE, OnConflict_IGNORE, OnConflict_EXCEPTION, BINDINGS_IGNORE_DECRYPT_ERROR]", opts.toString()); //$NON-NLS-1$
- }
-}
Deleted: branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java
===================================================================
--- branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,63 +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.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 org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminComponentException;
-
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.api.ServerConnectionFactory;
-import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
-
-public class TestSeverAdminFactory {
-
- @Test public void testBounce() throws Exception {
- ServerConnectionFactory scf = mock(ServerConnectionFactory.class);
- ServerConnection sc = mock(ServerConnection.class);
- Admin sa = mock(Admin.class);
- stubVoid(sa).toThrow(new AdminComponentException(new SingleInstanceCommunicationException())).on().restart();
- stub(sc.getService(Admin.class)).toReturn(sa);
- stub(scf.getConnection((Properties)anyObject())).toReturn(sc);
-
- ServerAdminFactory saf = new ServerAdminFactory(scf, 1);
- 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)).restart();
-
- //here's the test we issue to see that the system is up after the bounce
- verify(sa, times(1)).getProcesses("*"); //$NON-NLS-1$
- }
-
-}
Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -225,14 +225,6 @@
String getUrl() {
return this.url;
}
-
- /**
- * @see com.metamatrix.jdbc.api.Connection#getAdminAPI()
- * @since 4.3
- */
- public synchronized Admin getAdminAPI() throws SQLException {
- return this.serverConn.getService(Admin.class);
- }
/**
* Connection identifier of this connection
Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/api/Connection.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/api/Connection.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/api/Connection.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -24,23 +24,13 @@
import java.sql.SQLException;
-import org.teiid.adminapi.Admin;
-
/**
* MetaMatrix extensions to the standard JDBC Connection interface.
*/
public interface Connection extends java.sql.Connection {
- /**
- * Retrieve an administrative object used to control MM Query.
- * @return EmbeddedAdmin object to administer the MM Query component
- * corresponding to this connection.
- * @throws SQLException
- */
- Admin getAdminAPI() throws SQLException;
-
int getVDBVersion() throws SQLException;
}
Modified: branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/api/AbstractQueryTest.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -80,17 +80,7 @@
@After public void tearDown() throws Exception {
closeConnection();
}
-
- public Admin getAdmin() {
- try {
- assertNotNull(this.internalConnection);
- com.metamatrix.jdbc.api.Connection conn = (com.metamatrix.jdbc.api.Connection) this.internalConnection;
- return conn.getAdminAPI();
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
+
public void setConnection(Connection c) {
this.internalConnection = c;
}
Deleted: branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/MetaMatrixAdminException.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/MetaMatrixAdminException.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/MetaMatrixAdminException.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,80 +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.admin.api.exception;
-
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-
-/**
- * Base exception of any specifically-administrative business exceptions
- */
-public class MetaMatrixAdminException extends MetaMatrixProcessingException {
-
- /**
- * No-arg CTOR
- */
- public MetaMatrixAdminException( ) {
- super( );
- }
-
-
- /**
- * Construct an instance with the message specified.
- *
- * @param message A message describing the exception
- */
- public MetaMatrixAdminException( String message ) {
- super( message );
- }
-
- /**
- * Construct an instance with the message and error code specified.
- *
- * @param message A message describing the exception
- * @param code The error code
- */
- public MetaMatrixAdminException( String code, String message ) {
- super( code, message );
- }
-
- /**
- * Construct an instance from a message and an exception to chain to this one.
- *
- * @param message A message describing the exception
- * @param e An exception to nest within this one
- */
- public MetaMatrixAdminException( Throwable e, String message ) {
- super( e, message );
- }
-
- /**
- * Construct an instance from a message and a code and an exception to
- * chain to this one.
- *
- * @param e An exception to nest within this one
- * @param message A message describing the exception
- * @param code A code denoting the exception
- */
- public MetaMatrixAdminException( Throwable e, String code, String message ) {
- super( e, code, message );
- }
-}
Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/PermissionNodeException.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/PermissionNodeException.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/platform/admin/api/exception/PermissionNodeException.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -26,8 +26,10 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
-public class PermissionNodeException extends MetaMatrixAdminException {
+
+public class PermissionNodeException extends MetaMatrixProcessingException {
// The missing resource name
private String resourceName;
Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -357,7 +357,7 @@
}
message = new CommandLogMessage(System.currentTimeMillis(), qr.getRequestID().toString(), id.getNodeID(), transactionID, modelName, connectorName, qr.getWorkContext().getConnectionID(), principal, finalRowCnt, isCancelled, errorOccurred, context);
}
- LogManager.log(MessageLevel.INFO, LogConstants.CTX_COMMANDLOGGING, message);
+ LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
}
/**
Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -560,7 +560,7 @@
}
message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getConnectionID(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, isCancelled, errorOccurred);
}
- LogManager.log(MessageLevel.INFO, LogConstants.CTX_COMMANDLOGGING, message);
+ LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
}
ProcessorDataManager getDataTierManager() {
Modified: branches/JCA/jboss-integration/pom.xml
===================================================================
--- branches/JCA/jboss-integration/pom.xml 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/jboss-integration/pom.xml 2010-01-15 17:06:09 UTC (rev 1747)
@@ -96,7 +96,58 @@
<artifactId>teiid-jboss-embedded</artifactId>
<scope>test</scope>
</dependency>
+
+ <!-- these for just running profile service remotely -->
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnp-client</artifactId>
+ <version>5.0.3.GA</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <classifier>client</classifier>
+ <version>2.1.1.GA</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>2.5.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ <version>1.0.0.GA</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-remoting-aspects</artifactId>
+ <version>1.0.1.GA</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>oswego-concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>1.3.4-jboss-update1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>runtime</scope>
+ </dependency>
+
</dependencies>
</project>
Modified: branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -31,10 +31,6 @@
import java.util.Properties;
import java.util.Set;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.aop.microcontainer.aspects.jmx.JMX;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.logging.Logger;
@@ -50,6 +46,7 @@
import org.jboss.metatype.api.values.MetaValueFactory;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
@@ -61,12 +58,11 @@
import org.teiid.adminapi.PropertyDefinition;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
-import org.teiid.adminapi.TeiidAdminMBean;
+import org.teiid.adminapi.TeiidAdmin;
import org.teiid.adminapi.Transaction;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.Visibility;
import org.teiid.adminapi.WorkerPoolStatistics;
-import org.teiid.adminapi.impl.BaseAdmin;
import org.teiid.adminapi.impl.ConnectionPoolStatisticsMetadata;
import org.teiid.adminapi.impl.ConnectorBindingMetaData;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -79,9 +75,10 @@
import com.metamatrix.core.CoreConstants;
-@JMX(name="jboss.teiid:service=teiid-admin", exposedInterface=TeiidAdminMBean.class, registerDirectly=true)
-public class Admin extends BaseAdmin implements TeiidAdminMBean{
+public class Admin extends TeiidAdmin {
protected Logger log = Logger.getLogger(getClass());
+ private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
+
private static final String TEIID_RUNTIME_ENGINE = "teiid/runtime-engine";
private static final String XA_DATA_SOURCE_TEMPLATE = "XADataSourceTemplate";
private static final long serialVersionUID = 7081309086056911304L;
@@ -92,27 +89,31 @@
private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp");
private static ComponentType DSTYPE = new ComponentType("DataSource", "XA");
- private ManagementView getView() throws AdminComponentException {
- try {
- InitialContext context = new InitialContext();
- ManagementView managementView = (ManagementView)context.lookup("java:ManagementView");
- managementView.load();
- return managementView;
- } catch (NamingException e) {
- throw new AdminComponentException(e);
- }
+
+ private ManagementView view;
+ private DeploymentManager deploymentMgr;
+
+ public Admin(ProfileService ps) {
+ this.view = ps.getViewManager();
+ this.view.load();
+
+ this.deploymentMgr = ps.getDeploymentManager();
+ try {
+ this.deploymentMgr.loadProfile(DEFAULT_PROFILE_KEY);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
- private DeploymentManager getDeploymentManager() throws AdminComponentException {
- try {
- InitialContext context = new InitialContext();
- ProfileService ps = (ProfileService) context.lookup("ProfileService");
- return ps.getDeploymentManager();
- } catch (NamingException e) {
- throw new AdminComponentException(e);
- }
+ private ManagementView getView() {
+ this.view.load();
+ return this.view;
}
+ private DeploymentManager getDeploymentManager() {
+ return this.deploymentMgr;
+ }
+
@Override
public Collection<ConnectorBinding> getConnectorBindings() throws AdminException {
ArrayList<ConnectorBinding> bindings = new ArrayList<ConnectorBinding>();
@@ -234,6 +235,12 @@
MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
mc.getProperty("config-property").setValue(metaValue);
}
+ try {
+ getView().updateComponent(mc);
+ getView().load();
+ } catch (Exception e) {
+ throw new AdminComponentException(e);
+ }
}
@Override
Added: branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java (rev 0)
+++ branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -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.jboss;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.profileservice.spi.ProfileService;
+import org.teiid.adminapi.AdminComponentException;
+
+public class AdminProvider {
+
+ public static Admin getLocal() throws AdminComponentException {
+ ProfileConnection pc = new ProfileConnection();
+ return new Admin(pc.connect(null, null, null));
+ }
+
+ public static Admin getRemote(String provideURL, String userid, String password) throws AdminComponentException {
+ ProfileConnection pc = new ProfileConnection();
+ return new Admin(pc.connect(provideURL, userid, password));
+ }
+
+ public static Admin getRemote(String provideURL) throws AdminComponentException {
+ ProfileConnection pc = new ProfileConnection();
+ return new Admin(pc.connect(provideURL, null, null));
+ }
+
+ /**
+ * Connection to profile service from a remote VM or local connection
+ */
+ static private class ProfileConnection {
+ private static final String PROFILE_SERVICE_JNDI_NAME = "ProfileService";
+ private static final String SECURE_PROFILE_SERVICE_JNDI_NAME = "SecureProfileService/remote";
+ private static final String JNDI_LOGIN_INITIAL_CONTEXT_FACTORY = "org.jboss.security.jndi.JndiLoginInitialContextFactory";
+ private static final String NAMING_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
+ private static final String JNP_TIMEOUT_JNP_INIT_PROP = "jnp.timeout";
+ private static final String JNP_SOTIMEOUT_JNP_INIT_PROP = "jnp.sotimeout";
+ private static final String JNP_DISABLE_DISCOVERY_JNP_INIT_PROP = "jnp.disableDiscovery";
+
+ /**
+ * This is the timeout (in milliseconds) for the initial attempt to establish the remote connection.
+ */
+ private static final int JNP_TIMEOUT = 60 * 1000; // 60 seconds
+
+ /**
+ * This is the timeout (in milliseconds) for methods invoked on the remote ProfileService. NOTE: This timeout comes
+ * into play if the JBossAS instance has gone down since the original JNP connection was made.
+ */
+ private static final int JNP_SO_TIMEOUT = 60 * 1000; // 60 seconds
+
+ /**
+ * A flag indicating that the discovery process should not attempt to automatically discover (via multicast) naming
+ * servers running the JBoss HA-JNDI service if it fails to connect to the specified jnp URL.
+ */
+ private static final boolean JNP_DISABLE_DISCOVERY = true;
+
+ public ProfileService connect(String providerURL, String user, String password) throws AdminComponentException {
+ ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ // local connection
+ if (providerURL == null) {
+ InitialContext ic = new InitialContext();
+ return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
+ }
+
+ Properties env = new Properties();
+ env.setProperty(Context.PROVIDER_URL, providerURL);
+ if (user != null) {
+ // authenticated remote login
+ env.setProperty(Context.INITIAL_CONTEXT_FACTORY, JNDI_LOGIN_INITIAL_CONTEXT_FACTORY);
+ env.setProperty(Context.SECURITY_PRINCIPAL, user);
+ env.setProperty(Context.SECURITY_CREDENTIALS, password);
+ env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP, String.valueOf(JNP_DISABLE_DISCOVERY));
+ InitialContext ic = new InitialContext(env);
+ return (ProfileService)ic.lookup(SECURE_PROFILE_SERVICE_JNDI_NAME);
+ }
+
+ // un-authenticated remote login
+ env.setProperty(Context.INITIAL_CONTEXT_FACTORY, NAMING_CONTEXT_FACTORY);
+ env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP, "true");
+ env.setProperty(JNP_TIMEOUT_JNP_INIT_PROP, String.valueOf(JNP_TIMEOUT));
+ env.setProperty(JNP_SOTIMEOUT_JNP_INIT_PROP, String.valueOf(JNP_SO_TIMEOUT));
+ env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP, String.valueOf(JNP_DISABLE_DISCOVERY));
+ env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ InitialContext ic = new InitialContext(env);
+ return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
+ } catch(NamingException e) {
+ throw new AdminComponentException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(originalContextClassLoader);
+ }
+ }
+ }
+}
Modified: branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -5,7 +5,6 @@
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
import java.io.File;
import java.util.Collection;
@@ -38,7 +37,7 @@
//if (!Bootstrap.getInstance().isStarted()) Bootstrap.getInstance().bootstrap();
ds = new ServerDatasourceConnection();
conn = (com.metamatrix.jdbc.api.Connection)ds.getConnection("admin");
- admin = conn.getAdminAPI();
+ admin = AdminProvider.getRemote( "jnp://localhost:1099");
}
@After
@@ -121,12 +120,8 @@
admin.terminateSession(s.getSessionId());
}
- try {
- sessions = admin.getSessions();
- fail("Should have terminated this connection");
- } catch(Exception e) {
- //ok
- }
+ sessions = admin.getSessions();
+ assertTrue(sessions.size() == 0);
}
Added: branches/JCA/jboss-integration/src/test/resources/log4j.xml
===================================================================
--- branches/JCA/jboss-integration/src/test/resources/log4j.xml (rev 0)
+++ branches/JCA/jboss-integration/src/test/resources/log4j.xml 2010-01-15 17:06:09 UTC (rev 1747)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
+ </layout>
+ </appender>
+
+
+ <root>
+ <priority value="WARN"/>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Modified: branches/JCA/runtime/src/main/java/org/teiid/TeiidConnectionFactory.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/TeiidConnectionFactory.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/runtime/src/main/java/org/teiid/TeiidConnectionFactory.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -29,11 +29,8 @@
import javax.resource.spi.XATerminator;
import javax.resource.spi.work.WorkManager;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.impl.BaseAdmin;
import org.teiid.dqp.internal.process.DQPConfiguration;
-import com.metamatrix.admin.objects.MMProcess;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.api.ServerConnectionFactory;
@@ -96,24 +93,10 @@
this.clientServices = (ClientServiceRegistry)instance;
}
}
-
- /**
- * ConnectionFactory and DQPCore lifecycles need to be tied together, but when this class starts
- * all services may not be up, however by the time a user logs in for a connection all the services will be up.
- * So, send a proxy of this service first and replace with actual one later.
- */
- private Admin getAdminAPI() {
- Admin admin = ContainerUtil.lookup("teiid/admin");
- if (admin instanceof BaseAdmin) {
- ((BaseAdmin) admin).setManager(this);
- }
- return admin;
- }
-
- public MMProcess getProcess() {
-
+// public MMProcess getProcess() {
+//
// Properties props = this.bootProperties;
//
// String hostName = getAddress().getHostName();
@@ -147,6 +130,6 @@
// process.setPort(this.socketTransport.getPort());
// }
// return process;
- return null;
- }
+// return null;
+// }
}
Deleted: branches/JCA/runtime/src/main/java/org/teiid/adminapi/impl/BaseAdmin.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/adminapi/impl/BaseAdmin.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/runtime/src/main/java/org/teiid/adminapi/impl/BaseAdmin.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.teiid.TeiidConnectionFactory;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.ProcessObject;
-import org.teiid.adminapi.TeiidAdmin;
-
-
-public abstract class BaseAdmin extends TeiidAdmin {
- private TeiidConnectionFactory manager;
-
- public void setManager(TeiidConnectionFactory manager) {
- this.manager = manager;
- }
-
- @Override
- public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
- ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
- list.add(manager.getProcess());
- return list;
- }
-}
Deleted: branches/JCA/runtime/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/runtime/src/main/java/org/teiid/transport/AdminAuthorizationInterceptor.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,142 +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 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.adminapi.AdminProcessingException;
-import org.teiid.adminapi.AdminRoles;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.admin.RolesAllowed;
-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.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 AdminProcessingException("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(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(), requiredRoleName, invocation.getName()};
- }
-
-}
Deleted: branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java 2010-01-14 17:18:34 UTC (rev 1746)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java 2010-01-15 17:06:09 UTC (rev 1747)
@@ -1,121 +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;
-
-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.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.api.exception.security.AuthorizationMgmtException;
-import com.metamatrix.core.util.SimpleMock;
-import com.metamatrix.dqp.service.AuthorizationService;
-import com.metamatrix.platform.security.api.SessionToken;
-
-
-/**
- * @since 4.3
- */
-public class TestAdminAuthInterceptor {
-
- @Before public void setUp() throws Exception {
- DQPWorkContext.setWorkContext(new DQPWorkContext());
- DQPWorkContext.getWorkContext().setSessionToken(new SessionToken(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>();
- Admin serverAdmin = getTestServerAdmin(userRoles, Admin.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(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);
- Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
- serverAdmin.addUDF(null, null);
- }
-
- @Test public void testGetVDBs() throws Exception {
- Set<String> userRoles = new HashSet<String>();
- 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>();
- 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);
- Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
- serverAdmin.restart();
- }
-
-
-}
14 years, 11 months
teiid SVN: r1746 - trunk/console/src/main/java/org/teiid/rhq/plugin.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-01-14 12:18:34 -0500 (Thu, 14 Jan 2010)
New Revision: 1746
Modified:
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
Log:
TEIID-807: Updating constants
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-01-14 16:38:15 UTC (rev 1745)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-01-14 17:18:34 UTC (rev 1746)
@@ -50,47 +50,18 @@
private final Log LOG = LogFactory.getLog(PlatformComponent.class);
/**
- * Property is used to identify an unreachable system
- */
- protected static final String UNREACHABLE_NAME = "UNREACHABLE_PLATFORM"; //$NON-NLS-1$
-
- /**
* @see org.teiid.rhq.plugin.Facet#getComponentType()
* @since 4.3
*/
@Override
String getComponentType() {
- return ConnectionConstants.ComponentType.PLATFORM;
+ return null;
}
@Override
public AvailabilityType getAvailability() {
- if (!connMgr.hasServersDefined()) {
- this.isAvailable = false;
- return AvailabilityType.DOWN;
-
- }
- Connection connection = null;
- try {
-
- LOG.debug("Checking availability of " + this.getComponentIdentifier()); //$NON-NLS-1$
- connection = getConnection();
- if (connection.isAlive()) {
- LOG.info("Availability of " + this.getComponentIdentifier() + " is up"); //$NON-NLS-1$ //$NON-NLS-2$
- this.isAvailable = true;
- return AvailabilityType.UP;
- }
- } catch (InvalidPluginConfigurationException ipce) {
- // dont log anything, already done when getconnection is called
- } catch (Throwable err) {
- LOG.error("Unknown exception occured when checking availability for resource " + this.getComponentIdentifier(), err); //$NON-NLS-1$
- } finally {
- connection.close();
- }
- LOG.error("Availability of " + this.getComponentIdentifier() + " is down"); //$NON-NLS-1$ //$NON-NLS-2$
- this.isAvailable = false;
- return AvailabilityType.DOWN;
+ return AvailabilityType.UP;
}
@@ -112,7 +83,6 @@
public void stop() {
// TODO Auto-generated method stub
super.stop();
- connMgr.shutdown();
}
@Override
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2010-01-14 16:38:15 UTC (rev 1745)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2010-01-14 17:18:34 UTC (rev 1746)
@@ -24,14 +24,10 @@
import java.util.HashSet;
import java.util.Set;
-import javax.naming.InitialContext;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.profileservice.spi.ProfileService;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
@@ -39,18 +35,13 @@
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
/**
* This is the parent node for a MetaMatrix system
*/
public class PlatformDiscoveryComponent implements ResourceDiscoveryComponent {
-
- private static final Log LOG = LogFactory
- .getLog(PlatformDiscoveryComponent.class);
-
- public static final String p = "connectorAddress"; //$NON-NLS-1$
-
private final Log log = LogFactory.getLog(this.getClass());
/**
@@ -66,25 +57,14 @@
Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
- InitialContext ic = new InitialContext();
- ProfileService ps = (ProfileService) ic.lookup(PluginConstants.PROFILE_SERVICE);
+ ManagedComponent mc = ProfileServiceUtil.getManagedComponent(
+ new ComponentType(PluginConstants.ComponentType.Runtime.TYPE,
+ PluginConstants.ComponentType.Runtime.SUBTYPE),
+ PluginConstants.ComponentType.Runtime.TEIID_RUNTIME_ENGINE);
- ManagementView vm = ps.getViewManager();
- vm.load();
- ComponentType type = new ComponentType(PluginConstants.CONNECTION_FACTORY_TYPE, PluginConstants.NO_TX_SUBTYPE);
- ManagedComponent mc = vm.getComponent(PluginConstants.TEIID_RUNTIME_ENGINE,
- type);
-
- /*
- * Currently this uses a hardcoded remote address for access to the
- * MBean server This needs to be switched to check if we e.g. run inside
- * a JBossAS to which we have a connection already that we can reuse.
- */
- Configuration c = new Configuration(); // TODO get from
- // defaultPluginConfig
-
+ Configuration c = new Configuration();
String managerName = mc.getName();
-
+
c.put(new PropertySimple("objectName", managerName));
/**
*
@@ -94,9 +74,9 @@
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
discoveryContext.getResourceType(), // ResourceType
managerName, // Resource Key
- PluginConstants.TEIID_ENGINE_RESOURCE_NAME, // Resource Name
+ PluginConstants.ComponentType.Runtime.TEIID_ENGINE_RESOURCE_NAME, // Resource Name
null, // Version TODO can we get that from discovery ?
- PluginConstants.TEIID_ENGINE_RESOURCE_DESCRIPTION, // Description
+ PluginConstants.ComponentType.Runtime.TEIID_ENGINE_RESOURCE_DESCRIPTION, // Description
c, // Plugin Config
null // Process info from a process scan
);
@@ -105,6 +85,6 @@
discoveredResources.add(detail);
log.info("Discovered Teiid instance: " + managerName);
return discoveredResources;
-
+
}
}
\ No newline at end of file
14 years, 11 months
teiid SVN: r1745 - in trunk/test-integration/db/src/main: resources and 1 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2010-01-14 11:38:15 -0500 (Thu, 14 Jan 2010)
New Revision: 1745
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/TransactionFactory.java
trunk/test-integration/db/src/main/resources/ctc_tests/deploy.properties
trunk/test-integration/db/src/main/resources/qe-test.properties
Log:
Teiid 781 - changed the txnautowrap to "off"
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/TransactionFactory.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/client/TransactionFactory.java 2010-01-14 16:15:49 UTC (rev 1744)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/client/TransactionFactory.java 2010-01-14 16:38:15 UTC (rev 1745)
@@ -22,6 +22,7 @@
package org.teiid.test.client;
import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.TestLogger;
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
import org.teiid.test.framework.exception.QueryTestFailedException;
@@ -54,9 +55,9 @@
public static final String LOCAL_TRANSACTION = "local"; //$NON-NLS-1$
public static final String XATRANSACTION = "xa"; //$NON-NLS-1$
public static final String JNDI_TRANSACTION = "jndi"; //$NON-NLS-1$
- public static final String OFFWRAP_TRANSACTION = "offwrap"; //$NON-NLS-1$
- public static final String ONWRAP_TRANSACTION = "onwrap"; //$NON-NLS-1$
- public static final String AUTOWRAP_TRANSACTION = "autowrap"; //$NON-NLS-1$
+ public static final String OFFWRAP_TRANSACTION = "off"; //$NON-NLS-1$
+ public static final String ONWRAP_TRANSACTION = "on"; //$NON-NLS-1$
+ public static final String AUTOWRAP_TRANSACTION = "auto"; //$NON-NLS-1$
}
@@ -72,7 +73,8 @@
throw new TransactionRuntimeException(TRANSACTION_TYPE + " property was not specified" );
}
- System.out.println("Create TransactionContainer: " + type);
+
+ TestLogger.log("==== Create Transaction-Option: " + type);
if (type.equalsIgnoreCase(TRANSACTION_TYPES.LOCAL_TRANSACTION)) {
transacton = new LocalTransaction();
@@ -96,6 +98,7 @@
throw new TransactionRuntimeException("Invalid property value of " + type + " for " + TRANSACTION_TYPE );
}
+ TestLogger.log("==== TransactionContainer: " + transacton.getClass().getName());
return transacton;
}
Modified: trunk/test-integration/db/src/main/resources/ctc_tests/deploy.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/ctc_tests/deploy.properties 2010-01-14 16:15:49 UTC (rev 1744)
+++ trunk/test-integration/db/src/main/resources/ctc_tests/deploy.properties 2010-01-14 16:38:15 UTC (rev 1745)
@@ -6,7 +6,7 @@
#vdb.definition=./${vdb}
-teiid.home=./teiid_home
+teiid.home=./target/teiid_home
----
Modified: trunk/test-integration/db/src/main/resources/qe-test.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/qe-test.properties 2010-01-14 16:15:49 UTC (rev 1744)
+++ trunk/test-integration/db/src/main/resources/qe-test.properties 2010-01-14 16:38:15 UTC (rev 1745)
@@ -41,8 +41,8 @@
# transaction types
# See the TransactionFactory for the list of types
-transaction-option=autowrap
-#transaction-option=local
+#transaction-option=auto
+transaction-option=off
# resultmode options:
# - compare : compare actual results to expected results
@@ -108,6 +108,6 @@
#
#
-BQT2=1
-BQT1=2
-SP=3
+#BQT2=1
+#BQT1=2
+#SP=3
14 years, 11 months