Author: rareddy
Date: 2009-12-18 22:45:09 -0500 (Fri, 18 Dec 2009)
New Revision: 1685
Added:
branches/JCA/jboss-integration/src/test/java/org/
branches/JCA/jboss-integration/src/test/java/org/teiid/
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
branches/JCA/jboss-integration/src/test/resources/TransactionsRevisited.vdb
Removed:
branches/JCA/build/kit-jboss-container/deploy/teiid-connector-metadata.rar
branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/
branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/admin/
Modified:
branches/JCA/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java
branches/JCA/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java
branches/JCA/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java
branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.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/main/java/org/teiid/adminapi/jboss/ManagedUtil.java
branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java
branches/JCA/pom.xml
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java
Log:
TEIID-910: adding VDB specific Admin API methods
Deleted: branches/JCA/build/kit-jboss-container/deploy/teiid-connector-metadata.rar
===================================================================
(Binary files differ)
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java
===================================================================
---
branches/JCA/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -22,6 +22,7 @@
package org.teiid.adminapi;
+import java.net.URL;
import java.util.Properties;
import com.metamatrix.admin.RolesAllowed;
@@ -124,23 +125,15 @@
void deleteConnectorBinding(String deployedName) throws AdminException;
/**
- * Import a {@link VDB} file.
- * <br>A VDB file with internal definitions. Thise is the default VDB export
configuration
- * begining with MetaMatrix version 4.3.</br>
- *
- * @param name
- * VDB Name
- * @param vdbFile
- * byte array of the VDB Archive
- * @param options The perferred options when executing this method. There are choices
about
- * what to do when a connector binding with the given identifier already exists in
the system.
+ * Deploy a {@link VDB} file.
+ * @param name Name of the VDB file to save under
+ * @param URL VDB file location.
* @throws AdminException
* if there's a system error.
* @return the {@link VDB} representing the current property values and runtime
state.
* @since 4.3
*/
- VDB addVDB(String name,
- byte[] vdbFile, AdminOptions options) throws AdminException;
+ public void deployVDB(String fileName, URL vdbURL) throws AdminException;
/**
@@ -149,7 +142,7 @@
* @param version
* @throws AdminException
*/
- void deleteVDB(String vdbName, String version) throws AdminException;
+ void deleteVDB(String vdbName, int vdbVersion) throws AdminException;
/**
* Get the {@link LogConfiguration}
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java 2009-12-19
03:37:05 UTC (rev 1684)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -48,21 +48,23 @@
Set<String> getConnectorTypes() throws AdminException;
/**
- * Get the VDBs that correspond to the specified identifier pattern.
+ * Get the VDBs that currently deployed in the system
*
- * @param vdbIdentifier the unique identifier for for a {@link VDB} in the system
- * <ul>
- * <li> <code>"*"</code> - for all VDBs in the
system
- * <li> <code>"name"</code> or
<code>"name*"</code> - for all the VDBs that begin with given name
- * <li><code>"name<{@link
AdminObject#DELIMITER_CHAR}>version"</code> - for single VDB
- * </ul>
* @return Collection of {@link VDB}s. There could be multiple VDBs with the
* same name in the Collection but they will differ by VDB version.
* @throws AdminException if there's a system error.
- * @since 4.3
*/
@RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
- Collection<VDB> getVDBs(String vdbIdentifier) throws AdminException;
+ Set<VDB> getVDBs() throws AdminException;
+
+ /**
+ * Get the VDB
+ * @param vdbName
+ * @param vbdVersion
+ * @throws AdminException if there's a system error.
+ * @return
+ */
+ VDB getVDB(String vdbName, int vbdVersion) throws AdminException;
/**
* Get the Connector Bindings that are available in the configuration
@@ -88,7 +90,7 @@
* @throws AdminException if there's a system error.
* @since 4.3
*/
- Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, String
vdbVersion) throws AdminException;
+ Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, int
vdbVersion) throws AdminException;
/**
* Get the Extension Modules that correspond to the specified identifier pattern
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java 2009-12-19
03:37:05 UTC (rev 1684)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -39,32 +39,17 @@
/**
* Start Connector Binding
*
- * @param connectorBindingIdentifier identifier for {@link
org.teiid.adminapi.ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector
bindings in the system
- * <li> <code>"name*"</code> - for all connector
bindings that begin with given name
- * <li><code>"name"</code> - for single connector
binding by the given name
- * </ul>
+ * @param deployedName
* @throws AdminException if there's a system error.
- * @since 4.3
*/
- void startConnectorBinding(String connectorBindingIdentifier) throws AdminException;
+ void startConnectorBinding(String deployedName) throws AdminException;
/**
* Stop Connector Binding
*
- * @param connectorBindingIdentifier identifier for {@link
org.teiid.adminapi.ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector
bindings in the system
- * <li> <code>"name*"</code> - for all connector
bindings that begin with given name
- * <li><code>"name"</code> - for single connector
binding by the given name
- * </ul>
- * @param stopNow If true, stop the process forcefully. If false, wait until any
pending work is done.
- * @throws AdminException - if there's a system error.
- * @since 4.3
+ * @param deployedName identifier for {@link org.teiid.adminapi.ConnectorBinding}
*/
- void stopConnectorBinding(String connectorBindingIdentifier,
- boolean stopNow) throws AdminException;
+ void stopConnectorBinding(String deployedName, boolean stopNow) throws
AdminException;
/**
* Clear the cache or caches specified by the cacheIdentifier.
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2009-12-19
03:37:05 UTC (rev 1684)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -60,13 +60,6 @@
}
@Override
- public VDB addVDB(String name, byte[] vdbFile, AdminOptions options)
- throws AdminException {
- // rameshTODO Auto-generated method stub
- return null;
- }
-
- @Override
public void assignBindingToModel(String connectorBindingName,
String vdbName, String vdbVersion, String modelName)
throws AdminException {
@@ -107,12 +100,8 @@
}
- @Override
- public void deleteVDB(String vdbName, String version) throws AdminException {
- // rameshTODO Auto-generated method stub
-
- }
+
@Override
public char[] exportConfiguration() throws AdminException {
// rameshTODO Auto-generated method stub
@@ -205,12 +194,6 @@
return null;
}
- @Override
- public Collection<ConnectorBinding> getConnectorBindingsInVDB(
- String vdbName, String vdbVersion) throws AdminException {
- // rameshTODO Auto-generated method stub
- return null;
- }
@Override
public Collection<PropertyDefinition> getConnectorTypePropertyDefinitions(
@@ -261,12 +244,8 @@
return null;
}
- @Override
- public Collection<VDB> getVDBs(String vdbIdentifier) throws AdminException {
- // rameshTODO Auto-generated method stub
- return null;
- }
+
@Override
public void cancelRequest(String identifier) throws AdminException {
// rameshTODO Auto-generated method stub
@@ -304,21 +283,8 @@
}
- @Override
- public void startConnectorBinding(String connectorBindingIdentifier)
- throws AdminException {
- // rameshTODO Auto-generated method stub
-
- }
@Override
- public void stopConnectorBinding(String connectorBindingIdentifier,
- boolean stopNow) throws AdminException {
- // rameshTODO Auto-generated method stub
-
- }
-
- @Override
public void terminateSession(String identifier) throws AdminException {
// rameshTODO Auto-generated method stub
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java 2009-12-19 03:37:05 UTC
(rev 1684)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java 2009-12-19 03:45:09 UTC
(rev 1685)
@@ -22,7 +22,6 @@
package org.teiid.adminapi;
-import java.net.URL;
import java.util.Collection;
import java.util.List;
@@ -71,7 +70,7 @@
* Get the URL for the VDB
* @return
*/
- public URL getUrl();
+ public String getUrl();
/**
* Get the description of the VDB
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
---
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -113,6 +113,12 @@
public void addConnectorBinding(String binding) {
this.connectorBindings.add(binding);
}
+
+ public void setConnectorBinding(List<String> bindings) {
+ this.connectorBindings.clear();
+ this.connectorBindings.addAll(bindings);
+ }
+
public void setSupportsMultiSourceBindings(boolean supports) {
this.supportsMultiSourceBindings = supports;
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2009-12-19
03:37:05 UTC (rev 1684)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -21,7 +21,6 @@
*/
package org.teiid.adminapi.impl;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -44,7 +43,7 @@
private static final long serialVersionUID = -4723595252013356436L;
private HashSet<ModelMetaData> models = new HashSet<ModelMetaData>();
- private URL fileUrl = null;
+ private String fileUrl = null;
private int version = 1;
private Status status;
private String description;
@@ -91,11 +90,11 @@
@Override
@ManagementProperty(description = "The VDB file url", readOnly=true)
- public URL getUrl() {
+ public String getUrl() {
return this.fileUrl;
}
- public void setUrl(URL url) {
+ public void setUrl(String url) {
this.fileUrl = url;
}
@@ -134,6 +133,10 @@
this.errors.add(error);
}
+ public void setValidityErrors(ArrayList<String> errors) {
+ this.errors = errors;
+ }
+
@Override
@ManagementProperty(description = "Is VDB Valid", readOnly=true)
public boolean isValid() {
Modified: branches/JCA/jboss-integration/pom.xml
===================================================================
--- branches/JCA/jboss-integration/pom.xml 2009-12-19 03:37:05 UTC (rev 1684)
+++ branches/JCA/jboss-integration/pom.xml 2009-12-19 03:45:09 UTC (rev 1685)
@@ -11,6 +11,40 @@
<version>7.0.0-SNAPSHOT</version>
<description>JBoss specific integration layer for teiid</description>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>target/jboss-embedded</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-jboss-embedded</artifactId>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>target/jboss-embedded</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.jboss.teiid</groupId>
@@ -26,6 +60,13 @@
</dependency>
<dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.man</groupId>
<artifactId>jboss-managed</artifactId>
<scope>provided</scope>
@@ -49,6 +90,13 @@
<version>2.0.6.GA</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-jboss-embedded</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
-</project>
\ No newline at end of file
+</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 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -22,6 +22,7 @@
package org.teiid.adminapi.jboss;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -35,52 +36,65 @@
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.managed.api.ComponentType;
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.ManagedOperation.Impact;
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.jboss.managed.api.annotation.ManagementParameter;
-import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.metatype.api.types.MapCompositeMetaType;
import org.jboss.metatype.api.values.MapCompositeValueSupport;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileService;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminObject;
import org.teiid.adminapi.AdminProcessingException;
import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Model;
import org.teiid.adminapi.TeiidAdminMBean;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.Visibility;
import org.teiid.adminapi.impl.BaseAdmin;
import org.teiid.adminapi.impl.ConnectorBindingMetaData;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
-@ManagementObject(description="Teiid Admin Interface",
componentType=@ManagementComponent(type="teiid",subtype="admin"),
properties=ManagementProperties.EXPLICIT, isRuntime=true)
+import com.metamatrix.core.CoreConstants;
+
@JMX(name="jboss.teiid:service=teiid-admin",
exposedInterface=TeiidAdminMBean.class, registerDirectly=true)
public class Admin extends BaseAdmin implements TeiidAdminMBean{
private static final long serialVersionUID = 7081309086056911304L;
- private ManagementView managementView = null;
+ private static ComponentType VDBTYPE = new ComponentType("teiid",
"vdb");
+ private static ComponentType MODELTYPE = new ComponentType("teiid",
"model");
+ private static ComponentType NOTXTYPE = new ComponentType("ConnectionFactory",
"NoTx");
+ private static ComponentType TXTYPE = new ComponentType("ConnectionFactory",
"Tx");
private ManagementView getView() throws AdminComponentException {
- if (this.managementView == null) {
- try {
- InitialContext context = new InitialContext();
- this.managementView =
(ManagementView)context.lookup("java:ManagementView");
- this.managementView.load();
- } catch (NamingException e) {
- throw new AdminComponentException(e);
- }
+ try {
+ InitialContext context = new InitialContext();
+ ManagementView managementView =
(ManagementView)context.lookup("java:ManagementView");
+ managementView.load();
+ return managementView;
+ } catch (NamingException e) {
+ throw new AdminComponentException(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);
}
- return this.managementView;
}
@Override
- @ManagementOperation(description="Get names of avaialable connector bindings",
impact=Impact.ReadOnly)
public Collection<ConnectorBinding> getConnectorBindings() throws AdminException
{
ArrayList<ConnectorBinding> bindings = new ArrayList<ConnectorBinding>();
findConnectorBindings(bindings, "NoTx");
@@ -89,17 +103,72 @@
}
@Override
- @ManagementOperation(description="Get names of avaialable connector bindings",
impact=Impact.ReadOnly)
public ConnectorBinding getConnectorBinding(String deployedName) throws AdminException
{
- Collection<ConnectorBinding> bindings = getConnectorBindings();
- for(ConnectorBinding cb:bindings) {
- if (cb.getName().equals(deployedName)) {
- return cb;
+ ManagedComponent mc = getConnectorBindingComponent(deployedName);
+ if (mc != null) {
+ return buildConnectorBinding(mc);
+ }
+ return null;
+ }
+
+ private ManagedComponent getConnectorBindingComponent(String deployedName) throws
AdminProcessingException {
+ try {
+ Set<ManagedComponent> components = getView().getComponentsForType(NOTXTYPE);
+ for (ManagedComponent mc: components) {
+ if (isConnectorBinding(mc)) {
+ String name = ManagedUtil.getSimpleValue(mc, "name", String.class);
+ if (name.equals(deployedName)) {
+ return mc;
+ }
+ }
}
+
+ components = getView().getComponentsForType(TXTYPE);
+ for (ManagedComponent mc: components) {
+ if (isConnectorBinding(mc)) {
+ String name = ManagedUtil.getSimpleValue(mc, "name", String.class);
+ if (name.equals(deployedName)) {
+ return mc;
+ }
+ }
+ }
+ } catch(Exception e) {
+ throw new AdminProcessingException(e.getMessage(), e);
}
return null;
}
+ private ConnectorBinding buildConnectorBinding(ManagedComponent mc) {
+ ConnectorBindingMetaData connector = new ConnectorBindingMetaData();
+ connector.setName(mc.getName());
+ connector.setComponentType(mc.getType());
+
+ for (String key:mc.getProperties().keySet()) {
+ ManagedProperty property = mc.getProperty(key);
+ MetaValue value = property.getValue();
+
+ //TODO: All properties need to be added
+ if (value != null) {
+ if(value instanceof SimpleValueSupport) {
+ connector.addProperty(key, ManagedUtil.stringValue(value));
+ }
+ else if (value.getMetaType() instanceof MapCompositeValueSupport) {
+ MapCompositeValueSupport v1 = (MapCompositeValueSupport)value;
+ MapCompositeMetaType metaType = v1.getMetaType();
+ for (String configProperty:metaType.keySet()) {
+ connector.addProperty(configProperty,
ManagedUtil.stringValue(v1.get(configProperty)));
+ }
+ }
+ }
+ }
+ return connector;
+ }
+
+ private boolean isConnectorBinding(ManagedComponent mc) {
+ String connectionDefinition = ManagedUtil.getSimpleValue(mc,
"connection-definition", String.class);
+ return "org.teiid.connector.api.Connector".equals(connectionDefinition);
+ }
+
private void findConnectorBindings(ArrayList<ConnectorBinding> bindings, String
subType) throws AdminException {
try {
ComponentType type = new ComponentType("ConnectionFactory", subType);
@@ -140,11 +209,6 @@
}
@Override
- @ManagementOperation(description="Add a new Connector Binding",
- impact=Impact.WriteOnly,
- params={@ManagementParameter(name="deploymentName", description="Name
of the Connector Binding"),
- @ManagementParameter(name="typeName", description="Connector Type
Template name"),
- @ManagementParameter(name="properties", description="Properties for
the Connector Binding")})
public void addConnectorBinding(String deploymentName, String typeName, Properties
properties) throws AdminException{
try {
if (getConnectorBinding(deploymentName) != null) {
@@ -197,20 +261,57 @@
@Override
public void deleteConnectorBinding(String deployedName) throws AdminException {
- ConnectorBindingMetaData cb =
(ConnectorBindingMetaData)getConnectorBinding(deployedName);
- if (cb != null) {
+ ManagedComponent mc = getConnectorBindingComponent(deployedName);
+ if (mc != null) {
+ ManagedUtil.removeArchive(getDeploymentManager(),mc.getDeployment().getName());
+ }
+ }
+
+ @Override
+ public void startConnectorBinding(String deployedName) throws AdminException {
+ ManagedComponent mc = getConnectorBindingComponent(deployedName);
+ if (mc != null) {
try {
- ManagedComponent mc = getView().getComponent(cb.getName(),
(ComponentType)cb.getComponentType());
- if (mc != null) {
- getView().removeComponent(mc);
- }
+ ManagedUtil.execute(getDeploymentManager().start(deployedName), "Failed to start
Connector Binding = " + deployedName);
} catch (Exception e) {
- throw new AdminComponentException(e.getMessage(), e);
+ ManagedUtil.handleException(e);
}
}
}
+
+ @Override
+ public void stopConnectorBinding(String deployedName,boolean stopNow) throws
AdminException {
+ ManagedComponent mc = getConnectorBindingComponent(deployedName);
+ if (mc != null) {
+ try {
+ ManagedUtil.execute(getDeploymentManager().stop(deployedName), "Failed to Stop
Connector Binding = " + deployedName);
+ } catch (Exception e) {
+ ManagedUtil.handleException(e);
+ }
+ }
+ }
@Override
+ public Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, int
vdbVersion) throws AdminException {
+ HashMap<String, ConnectorBinding> bindingMap = new HashMap<String,
ConnectorBinding>();
+ VDB vdb = getVDB(vdbName, vdbVersion);
+ if (vdb != null) {
+ for (Model model:vdb.getModels()) {
+ if (model.isSource()) {
+ for (String bindingName : model.getConnectorBindingNames()) {
+ ConnectorBinding binding = getConnectorBinding(bindingName);
+ if (binding != null) {
+ bindingMap.put(bindingName, binding);
+ }
+ }
+ }
+ }
+ }
+ return bindingMap.values();
+ }
+
+
+ @Override
public Set<String> getConnectorTypes() throws AdminException{
Set<String> names = getView().getTemplateNames();
HashSet<String> matched = new HashSet<String>();
@@ -227,4 +328,103 @@
regEx = regEx.replaceAll(AdminObject.ESCAPED_DELIMITER, "");
//$NON-NLS-1$
return value.matches(regEx);
}
+
+ @Override
+ public void deployVDB(String fileName, URL vdbURL) throws AdminException {
+ if (!fileName.endsWith(".vdb") &&
!fileName.endsWith("-vdb.xml")) {
+ throw new AdminProcessingException("The extension of the file name must be either
.vdb designer vdbs or -vdb.xml for dynamic VDBs");
+ }
+ ManagedUtil.deployArchive(getDeploymentManager(), fileName, vdbURL, false);
+ }
+
+
+ @Override
+ public void deleteVDB(String vdbName, int vdbVersion) throws AdminException {
+ ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
+ if (mc != null) {
+ ManagedUtil.removeArchive(getDeploymentManager(), mc.getDeployment().getName());
+ }
+ }
+
+ @Override
+ public VDB getVDB(String vdbName, int vdbVersion) throws AdminException{
+ ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
+ if (mc != null) {
+ return buildVDB(mc);
+ }
+ return null;
+ }
+
+ private ManagedComponent getVDBManagedComponent(String vdbName, int vdbVersion) throws
AdminException{
+ try {
+ ComponentType type = new ComponentType("teiid", "vdb");
+ Set<ManagedComponent> vdbComponents = getView().getComponentsForType(type);
+ for (ManagedComponent mc: vdbComponents) {
+ String name = ManagedUtil.getSimpleValue(mc, "name", String.class);
+ int version = ManagedUtil.getSimpleValue(mc, "version", Integer.class);
+ if (name.equals(vdbName) && version == vdbVersion) {
+ return mc;
+ }
+ }
+ return null;
+ } catch (Exception e) {
+ throw new AdminComponentException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Set<VDB> getVDBs() throws AdminException {
+ try {
+ Set<VDB> vdbs = new HashSet<VDB>();
+ Set<ManagedComponent> vdbComponents = getView().getComponentsForType(VDBTYPE);
+ for (ManagedComponent mc: vdbComponents) {
+ vdbs.add(buildVDB(mc));
+ }
+ return vdbs;
+ } catch (Exception e) {
+ throw new AdminComponentException(e.getMessage(), e);
+ }
+ }
+
+ private VDB buildVDB(ManagedComponent mc) {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName(ManagedUtil.getSimpleValue(mc, "name", String.class));
+ vdb.setDescription(ManagedUtil.getSimpleValue(mc, "description",
String.class));
+ vdb.setStatus(VDB.Status.valueOf(ManagedUtil.getSimpleValue(mc, "status",
String.class)));
+ vdb.setVersion(ManagedUtil.getSimpleValue(mc, "version", Integer.class));
+ vdb.setUrl(mc.getDeployment().getName());
+
+ ArrayList<String> errors = new ArrayList<String>();
+ ManagedUtil.getCollectionValue(mc, "validityErrors", errors, String.class);
+ vdb.setValidityErrors(errors);
+
+ ManagedDeployment deployment = mc.getDeployment();
+ Collection<ManagedComponent> models = deployment.getComponents().values();
+ for (ManagedComponent mm:models) {
+ if (mm.getType().equals(MODELTYPE)) {
+ String modelName = ManagedUtil.getSimpleValue(mc, "name", String.class);
+ if (!modelName.equals(CoreConstants.SYSTEM_MODEL)) {
+ vdb.addModel(buildModel(mm));
+ }
+ }
+ }
+ return vdb;
+ }
+
+ private ModelMetaData buildModel(ManagedComponent mc) {
+ ModelMetaData model = new ModelMetaData();
+ model.setName(ManagedUtil.getSimpleValue(mc, "name", String.class));
+ model.setModelURI(ManagedUtil.getSimpleValue(mc, "modeluri", String.class));
+ model.setModelType(ManagedUtil.getSimpleValue(mc, "modeltype",
String.class));
+ model.setPath(ManagedUtil.getSimpleValue(mc, "modelpath", String.class));
+ model.setUuid(ManagedUtil.getSimpleValue(mc, "uuid", String.class));
+ model.setSupportsMultiSourceBindings(ManagedUtil.getSimpleValue(mc,
"supportsMultiSourceBindings", Boolean.class));
+ model.setVisibility(Visibility.valueOf(ManagedUtil.getSimpleValue(mc,
"visibility", String.class)));
+
+ ArrayList<String> bindings = new ArrayList<String>();
+ ManagedUtil.getCollectionValue(mc, "connectorBindingNames", bindings,
String.class);
+ model.setConnectorBinding(bindings);
+
+ return model;
+ }
}
Modified:
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java
===================================================================
---
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/ManagedUtil.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -23,16 +23,30 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import java.util.Map;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.types.MetaType;
import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.EnumValue;
import org.jboss.metatype.api.values.MapCompositeValueSupport;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.spi.DeploymentOption;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
import com.metamatrix.core.MetaMatrixRuntimeException;
@@ -84,6 +98,42 @@
return null;
}
+ public static <T> T getSimpleValue(ManagedComponent mc, String prop,
Class<T> expectedType) {
+ ManagedProperty mp = mc.getProperty(prop);
+ if (mp != null) {
+ MetaType metaType = mp.getMetaType();
+ if (metaType.isSimple()) {
+ SimpleValue simpleValue = (SimpleValue)mp.getValue();
+ return expectedType.cast((simpleValue != null) ? simpleValue.getValue() :
null);
+ }
+ else if (metaType.isEnum()) {
+ EnumValue enumValue = (EnumValue)mp.getValue();
+ return expectedType.cast((enumValue != null) ? enumValue.getValue() : null);
+ }
+ throw new IllegalStateException(prop+ " is not a simple type");
+ }
+ return null;
+ }
+
+ public static <T> void getCollectionValue(ManagedComponent mc, String prop,
Collection<T> list, Class<T> expectedType) {
+ ManagedProperty mp = mc.getProperty(prop);
+ if (mp != null) {
+ MetaType metaType = mp.getMetaType();
+ if (metaType.isCollection()) {
+ CollectionValue collectionValue = (CollectionValue)mp.getValue();
+ for(MetaValue value:collectionValue.getElements()) {
+ if (value.getMetaType().isSimple()) {
+ SimpleValue simpleValue = (SimpleValue)value;
+ list.add(expectedType.cast(simpleValue.getValue()));
+ }
+ else {
+ throw new IllegalStateException(prop+ " is not a simple type");
+ }
+ }
+ }
+ }
+ }
+
public static SimpleValue wrap(MetaType type, String value) {
if (type instanceof SimpleMetaType) {
SimpleMetaType st = (SimpleMetaType)type;
@@ -136,4 +186,67 @@
}
throw new MetaMatrixRuntimeException("Failed to convert from String value to
\""+ type.getClassName() +"\" type");
}
+
+
+ public static void deployArchive(DeploymentManager deploymentManager, String fileName,
URL resourceURL, boolean deployExploded) throws AdminProcessingException {
+
+ List<DeploymentOption> deploymentOptions = new
ArrayList<DeploymentOption>();
+ deploymentOptions.add(DeploymentOption.FailIfExists);
+ if (deployExploded) {
+ deploymentOptions.add(DeploymentOption.Explode);
+ }
+
+ // try to deploy
+ DeploymentProgress progress = null;
+ try {
+ progress = deploymentManager.distribute(fileName, resourceURL,
deploymentOptions.toArray(new DeploymentOption[deploymentOptions.size()]));
+ execute(progress, fileName+" Distribute failed for unknown reason.");
+ } catch (Exception e) {
+ handleException(e);
+ }
+
+ // Now that we've successfully distributed the deployment, we need to
+ // start it.
+ String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
+ try {
+ progress = deploymentManager.start(deploymentNames);
+ execute(progress, "Start of the deployment Failed");
+ } catch(Exception e) {
+ try {
+ // if failed to start remove it.
+ execute(deploymentManager.remove(deploymentNames), "Failed to remove the
deployment");
+ } catch (Exception e1) {
+ handleException(e1);
+ }
+ handleException(e);
+ }
+ }
+
+ public static void handleException(Exception e) throws AdminProcessingException {
+ if (e instanceof AdminProcessingException) {
+ throw (AdminProcessingException)e;
+ }
+ throw new AdminProcessingException(e.getMessage(), e);
+ }
+
+ public static void execute(DeploymentProgress progress, String errorMessage) throws
AdminProcessingException {
+ progress.run();
+ DeploymentStatus status = progress.getDeploymentStatus();
+
+ if (status.isFailed()) {
+ if (status.getFailure() != null) {
+ throw new AdminProcessingException(status.getFailure().getMessage(),
status.getFailure());
+ }
+ throw new AdminProcessingException(errorMessage);
+ }
+ }
+
+ public static void removeArchive(DeploymentManager deploymentManager, String...
deploymentNames) throws AdminProcessingException{
+ try {
+ execute(deploymentManager.remove(deploymentNames), "Failed to remove the
deployment");
+ } catch (Exception e) {
+ handleException(e);
+ }
+ }
+
}
Modified:
branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java
===================================================================
---
branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/jboss-integration/src/main/java/org/teiid/templates/connector/ConnectorTypeTemplate.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -36,7 +36,13 @@
import org.teiid.adminapi.jboss.ManagedUtil;
/**
- * The connection factory template implementation.
+ * The connection factory template implementation. Here the idea is
"targetTemplate" is the actual template we store
+ * the information under, which is the "connection factory" that container
generates. However, we have got data
+ * passed under Teiid owned template. Now this classe'ss JOB is to transfer the
properties from the source template
+ * into target template and write the target template.
+ *
+ * When the properties are written to target template, and source has a new property that
is not defined in target, that
+ * property will be written as "config-property"
*/
public class ConnectorTypeTemplate implements DeploymentTemplate {
@@ -58,20 +64,19 @@
return deploymentBaseName;
}
- public VirtualFile applyTemplate(DeploymentTemplateInfo connectorInfo) throws Exception
{
+ public VirtualFile applyTemplate(DeploymentTemplateInfo sourceInfo) throws Exception {
try {
- ManagedProperty rar = connectorInfo.getProperties().get("rar-name");
+ ManagedProperty rar = sourceInfo.getProperties().get("rar-name");
String rarName = ManagedUtil.stringValue(rar.getValue());
if (!isValidRar(rarName)) {
throw new AdminProcessingException("Invalid RAR specified; please supply correct
RAR file. "+rarName);
}
- DeploymentTemplateInfo targetInfo = getTargetTemplate().getInfo();
+ DeploymentTemplateInfo targetInfo = this.targetTemplate.getInfo();
// override these properties always.
targetInfo.getProperties().get("connection-definition").setValue(SimpleValueSupport.wrap("org.teiid.connector.api.Connector"));
- connectorInfo.getProperties().get("connection-definition").setValue(SimpleValueSupport.wrap("org.teiid.connector.api.Connector"));
//config-properties list
Map<String, String> configProps = new HashMap<String, String>();
@@ -81,11 +86,12 @@
// walk through the supplied properties and assign properly to either template
// or config-properties.
- for (String key:connectorInfo.getProperties().keySet()) {
+ for (String key:sourceInfo.getProperties().keySet()) {
ManagedProperty mp = propertyMap.get(key);
if (mp != null) {
- MetaValue value = connectorInfo.getProperties().get(key).getValue();
+ // property found in target, so just add as value
+ MetaValue value = sourceInfo.getProperties().get(key).getValue();
if (ManagedUtil.sameValue(mp.getDefaultValue(), value)) {
continue;
}
@@ -95,7 +101,8 @@
}
}
else {
- mp = connectorInfo.getProperties().get(key);
+ // property not found in the target; add as "config-property"
+ mp = sourceInfo.getProperties().get(key);
if (ManagedUtil.sameValue(mp.getDefaultValue(), mp.getValue())) {
continue;
}
@@ -111,7 +118,7 @@
MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
targetInfo.getProperties().get("config-property").setValue(metaValue);
}
- return getTargetTemplate().applyTemplate(targetInfo);
+ return this.targetTemplate.applyTemplate(targetInfo);
} catch (NoSuchDeploymentException e) {
throw new AdminComponentException(e.getMessage(), e);
@@ -121,7 +128,7 @@
}
private boolean isValidRar(String rarName) {
- return true;
+ return rarName != null;
}
@Override
@@ -133,10 +140,6 @@
this.info = info;
}
- private DeploymentTemplate getTargetTemplate() {
- return this.targetTemplate;
- }
-
public void setTargetTemplate(DeploymentTemplate target) {
this.targetTemplate = target;
}
Added:
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
===================================================================
---
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
(rev 0)
+++
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -0,0 +1,61 @@
+package org.teiid.adminapi.jboss;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.teiid.jdbc.TeiidDataSource;
+
+
+public class BaseConnection {
+ static String user = "ramesh";
+ static String password = "mm";
+
+ interface ConnectionFactory{
+ Connection getConnection(String vdbName) throws Exception;
+ }
+
+ static class ServerDatasourceConnection implements ConnectionFactory {
+ public Connection getConnection(String vdbName) throws Exception {
+ TeiidDataSource ds = new TeiidDataSource();
+ ds.setUser(user);
+ ds.setPassword(password);
+ ds.setServerName("localhost");
+ ds.setPortNumber(31000);
+ ds.setDatabaseName(vdbName);
+ return ds.getConnection();
+ }
+ }
+
+ public void execute(ConnectionFactory connF, String vdbName, String sql) throws
Exception {
+ Connection connection = connF.getConnection(vdbName);
+ try {
+ connection.getMetaData();
+ Statement statement = connection.createStatement();
+
+ ResultSet results = statement.executeQuery(sql);
+
+ ResultSetMetaData metadata = results.getMetaData();
+ int columns = metadata.getColumnCount();
+
+ while(results.next()) {
+ for (int i = 0; i < columns; i++) {
+ System.out.print(results.getString(i+1));
+ System.out.print(",");
+ }
+ System.out.println("");
+ }
+ System.out.println("Done getting results!");
+ results.close();
+ statement.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
+ }
+ }
+}
Added:
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
(rev 0)
+++
branches/JCA/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -0,0 +1,80 @@
+package org.teiid.adminapi.jboss;
+
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.io.File;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.VDB;
+
+import com.metamatrix.core.util.UnitTestUtil;
+
+
+public class TestConnectorBindings extends BaseConnection {
+ ServerDatasourceConnection ds;
+ Admin admin;
+
+ @Before
+ public void setUp() throws Exception {
+ //if (!Bootstrap.getInstance().isStarted()) Bootstrap.getInstance().bootstrap();
+ ds = new ServerDatasourceConnection();
+ com.metamatrix.jdbc.api.Connection conn =
(com.metamatrix.jdbc.api.Connection)ds.getConnection("admin");
+ admin = conn.getAdminAPI();
+ }
+
+ @Test public void testConnectorBinding() throws Exception {
+ ConnectorBinding binding = admin.getConnectorBinding("test-mysql-cb");
+
+ assertNull(binding);
+
+ Properties p = new Properties();
+ p.setProperty("jndi-name", "test-mysql-cb");
+ p.setProperty("rar-name", "connector-jdbc-7.0.0-SNAPSHOT.rar");
+ p.setProperty("CapabilitiesClass",
"org.teiid.connector.jdbc.derby.DerbyCapabilities");
+ p.setProperty("XaCapable", "true");
+ p.setProperty("SourceJNDIName", "java:DerbyDS");
+ admin.addConnectorBinding("test-mysql-cb","connector-jdbc-template",
p);
+
+ binding = admin.getConnectorBinding("test-mysql-cb");
+
+ assertNotNull(binding);
+
+ admin.deleteConnectorBinding("test-mysql-cb");
+
+ binding = admin.getConnectorBinding("test-mysql-cb");
+
+ assertNull(binding);
+ }
+
+ @Test public void testVDBDeploy() throws Exception {
+
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1);
+ if (vdb != null) {
+ admin.deleteVDB("TransactionsRevisited", 1);
+ }
+
+ assertNull(admin.getVDB("TransactionsRevisited", 1));
+
+ File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb");
+
+ admin.deployVDB(f.getName(), f.toURI().toURL());
+
+ assertNotNull(admin.getVDB("TransactionsRevisited", 1));
+
+ Set<VDB> vdbs = admin.getVDBs();
+ assertTrue(vdbs.size() >= 1);
+
+// admin.deleteVDB("TransactionsRevisited", 1);
+//
+// assertNull(admin.getVDB("TransactionsRevisited", 1));
+ }
+
+}
Added: branches/JCA/jboss-integration/src/test/resources/TransactionsRevisited.vdb
===================================================================
(Binary files differ)
Property changes on:
branches/JCA/jboss-integration/src/test/resources/TransactionsRevisited.vdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/JCA/pom.xml
===================================================================
--- branches/JCA/pom.xml 2009-12-19 03:37:05 UTC (rev 1684)
+++ branches/JCA/pom.xml 2009-12-19 03:45:09 UTC (rev 1685)
@@ -366,6 +366,12 @@
<artifactId>teiid-runtime</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-jboss-embedded</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- External dependencies -->
<dependency>
@@ -516,6 +522,7 @@
<module>hibernate-dialect</module>
<module>jboss-integration</module>
<module>connector-sdk</module>
+ <module>jboss-embedded</module>
</modules>
<distributionManagement>
Modified:
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
---
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -520,7 +520,7 @@
}
@Override
- public void deleteVDB(String vdbName, String vdbVersion) throws AdminException {
+ public void deleteVDB(String vdbName, int vdbVersion) throws AdminException {
//super.changeVDBStatus(vdbName, vdbVersion, VDB.DELETED);
}
Modified:
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
===================================================================
---
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -25,10 +25,8 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
-import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
import org.teiid.adminapi.Cache;
@@ -44,10 +42,7 @@
import org.teiid.adminapi.Transaction;
import org.teiid.adminapi.VDB;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
import com.metamatrix.server.serverapi.RequestInfo;
@@ -123,7 +118,7 @@
@Override
- public Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName,
String vdbVersion) throws AdminException{
+ public Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName,
int vdbVersion) throws AdminException{
// try {
// VDBArchive vdb = getConfigurationService().getVDB(vdbName, vdbVersion);
// if (vdb != null) {
Modified: branches/JCA/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java
===================================================================
---
branches/JCA/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -48,7 +48,7 @@
model.setSupportsMultiSourceBindings(false);
}
- def.setUrl(unit.getRoot().toURL());
+ def.setUrl(unit.getRoot().toURL().toExternalForm());
log.debug("VDB "+unit.getRoot().getName()+" has been parsed.");
return def;
}
Modified: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
---
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -97,7 +97,7 @@
// merge mainfest and def
def = merge(def, manifest);
- def.setUrl(unit.getRoot().toURL());
+ def.setUrl(unit.getRoot().toURL().toExternalForm());
// add the entries and determine their visibility
VirtualFile root = unit.getRoot();
Modified:
branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java
===================================================================
---
branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java 2009-12-19
03:37:05 UTC (rev 1684)
+++
branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/TestAdminAuthInterceptor.java 2009-12-19
03:45:09 UTC (rev 1685)
@@ -102,7 +102,7 @@
@Test public void testGetVDBs() throws Exception {
Set<String> userRoles = new HashSet<String>();
Admin serverAdmin = getTestServerAdmin(userRoles, Admin.class);
- serverAdmin.getVDBs("*"); //$NON-NLS-1$
+ serverAdmin.getVDBs(); //$NON-NLS-1$
}
@Test(expected=AdminProcessingException.class) public void testReadOnlyFails() throws
Exception {