teiid SVN: r1967 - trunk/engine/src/main/java/com/metamatrix/query/parser.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-16 15:05:16 -0400 (Tue, 16 Mar 2010)
New Revision: 1967
Modified:
trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java
Log:
TEIID-145 updating system property name
Modified: trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java 2010-03-16 18:29:29 UTC (rev 1966)
+++ trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java 2010-03-16 19:05:16 UTC (rev 1967)
@@ -37,7 +37,7 @@
public boolean aggregatesAllowed = false;
// treat a double quoted variable as variable instead of string
- public boolean ansiQuotedIdentifiers=Boolean.valueOf(System.getProperty("teiid.ansi_quoted_identifiers", Boolean.TRUE.toString())).booleanValue(); //$NON-NLS-1$
+ public boolean ansiQuotedIdentifiers=Boolean.valueOf(System.getProperty("org.teiid.ansiQuotedIdentifiers", Boolean.TRUE.toString())).booleanValue(); //$NON-NLS-1$
public boolean cache;
14 years, 2 months
teiid SVN: r1966 - in trunk: build/kit-jboss-container/deploy/teiid and 14 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-16 14:29:29 -0400 (Tue, 16 Mar 2010)
New Revision: 1966
Added:
trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
trunk/test-integration/db/src/test/java/org/teiid/adminapi/
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
trunk/test-integration/db/src/test/resources/
trunk/test-integration/db/src/test/resources/TransactionsRevisited.vdb
trunk/test-integration/db/src/test/resources/connector-loopback.rar
trunk/test-integration/db/src/test/resources/log4j.xml
Removed:
trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb
trunk/jboss-integration/src/test/resources/connector-loopback.rar
trunk/jboss-integration/src/test/resources/log4j.xml
trunk/test-integration/db/resources/
Modified:
trunk/adminshell/src/main/resources/scripts/adminapi.bsh
trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/main/java/org/teiid/adminapi/Model.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
Log:
TEIID-833: fixed few misc errors. (1) moved the admin tests to integration-db (2) fixed ping based on invalid session (3) removed admin api calls "shutdown" and "restart"
Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-03-16 18:29:29 UTC (rev 1966)
@@ -100,29 +100,19 @@
/**
* Assign a {@link ConnectorBinding} to a {@link VDB}'s Model
*
- * @param vdbName
- * Name of the VDB
- * @param vdbVersion
- * Version of the VDB
- * @param modelName
- * Name of the Model to map Connector Binding
- * @param connectorBindingName
- * Name of the ConnectorBinding
- * @throws AdminException
- * if there's a system error or if there's a user input error.
- * @since 4.3
+ * @param vdbName Name of the VDB
+ * @param vdbVersion Version of the VDB
+ * @param modelName Name of the Model to map Connector Binding
+ * @param sourceName sourceName for the model
+ * @param jndiName JNDI names to which the source name needs to map to
+ * @throws AdminException if there's a system error or if there's a user input error.
*/
-void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String connectorBindingName) {
- debug("Assigning Connector Binding " + connectorBindingName + " to Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
+void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String sourceName, String jndiName) throws AdminException{
+ debug("Assigning Connector Binding, source name:" + sourceName +" to JNDI resource: "+jndiName+ " for Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
checkAdmin();
- internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, connectorBindingName);
+ internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, sourceName, jndiName);
}
-void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String[] connectorBindingNames) {
- debug("Assigning Connector Bindings " + connectorBindingNames + " to Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
- checkAdmin();
- internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, connectorBindingNames);
-}
/**
* Adds JDBC XA Data Source in the container.
@@ -538,30 +528,7 @@
internalAdmin.cancelRequest(sessionId, requestId);
}
-/**
- * Stop the Teiid. If millisToWait is >0, then close to incoming queries, wait the time period
- * for work to stop, then stop the MM Query. Otherwise, stop immediately, aborting all running queries.
- * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
- * @throws AdminException
- */
-void shutdown(int millisToWait) {
- checkAdmin();
- internalAdmin.shutdown(millisToWait);
- disconnect();
-}
-/**
- * Restart System
- * @throws AdminException if there's a system error.
- */
-void restart() {
- checkAdmin();
- internalAdmin.restart();
- disconnect();
-}
-
-
-
//*********************************************************************************************
// Utility Methods
//
Modified: trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-03-16 18:29:29 UTC (rev 1966)
@@ -72,7 +72,7 @@
<property name="adminSocketConfiguration"><inject bean="AdminSocketConfiguration"/></property>
<property name="workManager"><inject bean="WorkManager"/></property>
<property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
- <property name="TransactionManager"><inject bean="TransactionManager"/></property>
+ <property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
<property name="authorizationService"><inject bean="AuthorizationService"/></property>
<property name="sessionService"><inject bean="SessionService"/></property>
<property name="bufferService"><inject bean="BufferService"/></property>
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -22,7 +22,6 @@
package org.teiid.adminapi;
-import java.io.InputStream;
import java.net.URL;
import java.util.Collection;
import java.util.Properties;
@@ -82,7 +81,7 @@
* @return InputStream of contents of the rar file
* @throws AdminException if there's a system error.
*/
- InputStream exportConnectorType(String name) throws AdminException;
+ byte[] exportConnectorType(String name) throws AdminException;
/**
* Deploy a {@link ConnectorBinding} to Configuration
@@ -111,7 +110,7 @@
* @throws AdminException
* if there's a system error.
*/
- InputStream exportConnectorBinding(String deployedName) throws AdminException;
+ char[] exportConnectorBinding(String deployedName) throws AdminException;
/**
* Deploy a {@link VDB} file.
@@ -140,7 +139,7 @@
* @return InputStream of the VDB
* @throws AdminException if there's a system error.
*/
- InputStream exportVDB(String vdbName, int vdbVersion) throws AdminException;
+ byte[] exportVDB(String vdbName, int vdbVersion) throws AdminException;
/**
* Set a process level property.
Modified: trunk/client/src/main/java/org/teiid/adminapi/Model.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Model.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/Model.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -66,5 +66,12 @@
* Associated Source Names for the Models (Connector Bindings)
* @return String
*/
- List<String> getSourceNames();
+ List<String> getSourceNames();
+
+ /**
+ * Get the configured JNDI name for the given source name.
+ * @param sourceName - name of the source
+ * @return null if none configured.
+ */
+ String getSourceJndiName(String sourceName);
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -165,6 +165,7 @@
return new ArrayList<String>(this.sources.getMap().keySet());
}
+ @Override
public String getSourceJndiName(String sourceName) {
SourceMappingMetadata s = this.sources.getMap().get(sourceName);
if (s == null) {
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -35,19 +35,27 @@
import org.jboss.metatype.spi.values.MetaMapper;
public class RequestMetadataMapper extends MetaMapper<RequestMetadata> {
+ private static final String TRANSACTION_ID = "transactionId"; //$NON-NLS-1$
+ private static final String NODE_ID = "nodeId"; //$NON-NLS-1$
+ private static final String SOURCE_REQUEST = "sourceRequest"; //$NON-NLS-1$
+ private static final String COMMAND = "command"; //$NON-NLS-1$
+ private static final String PROCESSING_TIME = "processingTime"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
+ private static final String EXECUTION_ID = "executionId"; //$NON-NLS-1$
private static final MutableCompositeMetaType metaType;
private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
static {
- metaType = new MutableCompositeMetaType(RequestMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("executionId", "executionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("processingTime", "processingTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("command", "command", SimpleMetaType.STRING);
- metaType.addItem("sourceRequest", "sourceRequest", SimpleMetaType.BOOLEAN_PRIMITIVE);
- metaType.addItem("nodeId", "nodeId", SimpleMetaType.INTEGER_PRIMITIVE);
- metaType.addItem("transactionId", "transactionId", SimpleMetaType.STRING);
+ metaType = new MutableCompositeMetaType(RequestMetadata.class.getName(), "The Request meta data"); //$NON-NLS-1$
+ metaType.addItem(EXECUTION_ID, EXECUTION_ID, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(PROCESSING_TIME, PROCESSING_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(COMMAND, COMMAND, SimpleMetaType.STRING);
+ metaType.addItem(SOURCE_REQUEST, SOURCE_REQUEST, SimpleMetaType.BOOLEAN_PRIMITIVE);
+ metaType.addItem(NODE_ID, NODE_ID, SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem(TRANSACTION_ID, TRANSACTION_ID, SimpleMetaType.STRING);
metaType.freeze();
}
@@ -69,17 +77,17 @@
CompositeMetaType composite = (CompositeMetaType) metaType;
CompositeValueSupport request = new CompositeValueSupport(composite);
- request.set("executionId", SimpleValueSupport.wrap(object.getExecutionId()));
- request.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
- request.set("processingTime", SimpleValueSupport.wrap(object.getProcessingTime()));
- request.set("command", SimpleValueSupport.wrap(object.getCommand()));
- request.set("sourceRequest", SimpleValueSupport.wrap(object.sourceRequest()));
- request.set("nodeId", SimpleValueSupport.wrap(object.getNodeId()));
- request.set("transactionId",SimpleValueSupport.wrap(object.getTransactionId()));
+ request.set(EXECUTION_ID, SimpleValueSupport.wrap(object.getExecutionId()));
+ request.set(SESSION_ID, SimpleValueSupport.wrap(object.getSessionId()));
+ request.set(PROCESSING_TIME, SimpleValueSupport.wrap(object.getProcessingTime()));
+ request.set(COMMAND, SimpleValueSupport.wrap(object.getCommand()));
+ request.set(SOURCE_REQUEST, SimpleValueSupport.wrap(object.sourceRequest()));
+ request.set(NODE_ID, SimpleValueSupport.wrap(object.getNodeId()));
+ request.set(TRANSACTION_ID,SimpleValueSupport.wrap(object.getTransactionId()));
return request;
}
- throw new IllegalArgumentException("Cannot convert request " + object);
+ throw new IllegalArgumentException("Cannot convert RequestMetadata " + object); //$NON-NLS-1$
}
@Override
@@ -91,16 +99,16 @@
CompositeValue compositeValue = (CompositeValue) metaValue;
RequestMetadata request = new RequestMetadata();
- request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get("executionId")));
- request.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
- request.setProcessingTime((Long) metaValueFactory.unwrap(compositeValue.get("processingTime")));
- request.setCommand((String) metaValueFactory.unwrap(compositeValue.get("command")));
- request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get("sourceRequest")));
- request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get("nodeId")));
- request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get("transactionId")));
+ request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get(EXECUTION_ID)));
+ request.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
+ request.setProcessingTime((Long) metaValueFactory.unwrap(compositeValue.get(PROCESSING_TIME)));
+ request.setCommand((String) metaValueFactory.unwrap(compositeValue.get(COMMAND)));
+ request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get(SOURCE_REQUEST)));
+ request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get(NODE_ID)));
+ request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get(TRANSACTION_ID)));
return request;
}
- throw new IllegalStateException("Unable to unwrap request " + metaValue);
+ throw new IllegalStateException("Unable to unwrap RequestMetadata " + metaValue); //$NON-NLS-1$
}
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -49,7 +49,7 @@
private String userName;
private String vdbName;
private int vdbVersion;
- private long sessionId;
+ private long sessionId = -1; // invalid session
private String securityDomain;
//server session state
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -35,21 +35,31 @@
import org.jboss.metatype.spi.values.MetaMapper;
public class SessionMetadataMapper extends MetaMapper<SessionMetadata> {
+ private static final String SECURITY_DOMAIN = "securityDomain"; //$NON-NLS-1$
+ private static final String VDB_VERSION = "VDBVersion"; //$NON-NLS-1$
+ private static final String VDB_NAME = "VDBName"; //$NON-NLS-1$
+ private static final String USER_NAME = "userName"; //$NON-NLS-1$
+ private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
+ private static final String LAST_PING_TIME = "lastPingTime"; //$NON-NLS-1$
+ private static final String IP_ADDRESS = "IPAddress"; //$NON-NLS-1$
+ private static final String CLIENT_HOST_NAME = "clientHostName"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String APPLICATION_NAME = "applicationName"; //$NON-NLS-1$
private static final MutableCompositeMetaType metaType;
private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
static {
- metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("applicationName", "applicationName", SimpleMetaType.STRING);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("clientHostName", "clientHostName", SimpleMetaType.STRING);
- metaType.addItem("IPAddress", "IPAddress", SimpleMetaType.STRING);
- metaType.addItem("lastPingTime", "lastPingTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("userName", "userName", SimpleMetaType.STRING);
- metaType.addItem("VDBName", "VDBName", SimpleMetaType.STRING);
- metaType.addItem("VDBVersion", "VDBVersion", SimpleMetaType.INTEGER_PRIMITIVE);
- metaType.addItem("securityDomain", "SecurityDomain", SimpleMetaType.STRING);
+ metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data"); //$NON-NLS-1$
+ metaType.addItem(APPLICATION_NAME, APPLICATION_NAME, SimpleMetaType.STRING);
+ metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(CLIENT_HOST_NAME, CLIENT_HOST_NAME, SimpleMetaType.STRING);
+ metaType.addItem(IP_ADDRESS, IP_ADDRESS, SimpleMetaType.STRING);
+ metaType.addItem(LAST_PING_TIME, LAST_PING_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(USER_NAME, USER_NAME, SimpleMetaType.STRING);
+ metaType.addItem(VDB_NAME, VDB_NAME, SimpleMetaType.STRING);
+ metaType.addItem(VDB_VERSION, VDB_VERSION, SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem(SECURITY_DOMAIN, SECURITY_DOMAIN, SimpleMetaType.STRING);
metaType.freeze();
}
@@ -71,20 +81,20 @@
CompositeMetaType composite = (CompositeMetaType) metaType;
CompositeValueSupport session = new CompositeValueSupport(composite);
- session.set("applicationName", SimpleValueSupport.wrap(object.getName()));
- session.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
- session.set("clientHostName", SimpleValueSupport.wrap(object.getClientHostName()));
- session.set("IPAddress", SimpleValueSupport.wrap(object.getIPAddress()));
- session.set("lastPingTime", SimpleValueSupport.wrap(object.getLastPingTime()));
- session.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
- session.set("userName", SimpleValueSupport.wrap(object.getUserName()));
- session.set("VDBName",SimpleValueSupport.wrap(object.getVDBName()));
- session.set("VDBVersion", SimpleValueSupport.wrap(object.getVDBVersion()));
- session.set("securityDomain", SimpleValueSupport.wrap(object.getSecurityDomain()));
+ session.set(APPLICATION_NAME, SimpleValueSupport.wrap(object.getName()));
+ session.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
+ session.set(CLIENT_HOST_NAME, SimpleValueSupport.wrap(object.getClientHostName()));
+ session.set(IP_ADDRESS, SimpleValueSupport.wrap(object.getIPAddress()));
+ session.set(LAST_PING_TIME, SimpleValueSupport.wrap(object.getLastPingTime()));
+ session.set(SESSION_ID, SimpleValueSupport.wrap(object.getSessionId()));
+ session.set(USER_NAME, SimpleValueSupport.wrap(object.getUserName()));
+ session.set(VDB_NAME,SimpleValueSupport.wrap(object.getVDBName()));
+ session.set(VDB_VERSION, SimpleValueSupport.wrap(object.getVDBVersion()));
+ session.set(SECURITY_DOMAIN, SimpleValueSupport.wrap(object.getSecurityDomain()));
return session;
}
- throw new IllegalArgumentException("Cannot convert session " + object);
+ throw new IllegalArgumentException("Cannot convert session " + object); //$NON-NLS-1$
}
@Override
@@ -96,19 +106,19 @@
CompositeValue compositeValue = (CompositeValue) metaValue;
SessionMetadata session = new SessionMetadata();
- session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get("applicationName")));
- session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
- session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get("clientHostName")));
- session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get("IPAddress")));
- session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get("lastPingTime")));
- session.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
- session.setUserName((String) metaValueFactory.unwrap(compositeValue.get("userName")));
- session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get("VDBName")));
- session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get("VDBVersion")));
- session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get("securityDomain")));
+ session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get(APPLICATION_NAME)));
+ session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
+ session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_HOST_NAME)));
+ session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get(IP_ADDRESS)));
+ session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get(LAST_PING_TIME)));
+ session.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
+ session.setUserName((String) metaValueFactory.unwrap(compositeValue.get(USER_NAME)));
+ session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get(VDB_NAME)));
+ session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get(VDB_VERSION)));
+ session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get(SECURITY_DOMAIN)));
return session;
}
- throw new IllegalStateException("Unable to unwrap session " + metaValue);
+ throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$
}
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -36,15 +36,19 @@
import org.jboss.metatype.spi.values.MetaMapper;
public class TransactionMetadataMapper extends MetaMapper<TransactionMetadata> {
+ private static final String XID = "xid"; //$NON-NLS-1$
+ private static final String SCOPE = "scope"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String ASSOCIATED_SESSION = "associatedSession"; //$NON-NLS-1$
private static final MutableCompositeMetaType metaType;
private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
static {
- metaType = new MutableCompositeMetaType(TransactionMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("associatedSession", "associatedSession", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("scope", "scope", SimpleMetaType.STRING);
- metaType.addItem("xid", "xid", SimpleMetaType.STRING);
+ metaType = new MutableCompositeMetaType(TransactionMetadata.class.getName(), "The Transaction domain meta data"); //$NON-NLS-1$
+ metaType.addItem(ASSOCIATED_SESSION, ASSOCIATED_SESSION, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SCOPE, SCOPE, SimpleMetaType.STRING);
+ metaType.addItem(XID, XID, SimpleMetaType.STRING);
metaType.freeze();
}
@@ -66,14 +70,14 @@
CompositeMetaType composite = (CompositeMetaType) metaType;
CompositeValueSupport transaction = new CompositeValueSupport(composite);
- transaction.set("associatedSession", SimpleValueSupport.wrap(object.getAssociatedSession()));
- transaction.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
- transaction.set("scope", SimpleValueSupport.wrap(object.getScope()));
- transaction.set("id", SimpleValueSupport.wrap(object.getId()));
+ transaction.set(ASSOCIATED_SESSION, SimpleValueSupport.wrap(object.getAssociatedSession()));
+ transaction.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
+ transaction.set(SCOPE, SimpleValueSupport.wrap(object.getScope()));
+ transaction.set("id", SimpleValueSupport.wrap(object.getId())); //$NON-NLS-1$
return transaction;
}
- throw new IllegalArgumentException("Cannot convert session " + object);
+ throw new IllegalArgumentException("Cannot convert TransactionMetadata " + object); //$NON-NLS-1$
}
@Override
@@ -85,12 +89,12 @@
CompositeValue compositeValue = (CompositeValue) metaValue;
TransactionMetadata transaction = new TransactionMetadata();
- transaction.setAssociatedSession((Long) metaValueFactory.unwrap(compositeValue.get("associatedSession")));
- transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
- transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get("scope")));
- transaction.setId((String) metaValueFactory.unwrap(compositeValue.get("id")));
+ transaction.setAssociatedSession((Long) metaValueFactory.unwrap(compositeValue.get(ASSOCIATED_SESSION)));
+ transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
+ transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get(SCOPE)));
+ transaction.setId((String) metaValueFactory.unwrap(compositeValue.get("id"))); //$NON-NLS-1$
return transaction;
}
- throw new IllegalStateException("Unable to unwrap transaction " + metaValue);
+ throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
}
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -23,11 +23,13 @@
package org.teiid.adminapi.impl;
import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
import org.teiid.adminapi.WorkerPoolStatistics;
/**
* This class is a holder for all the statistics gathered about a worker pool.
*/
+(a)MetaMapping(WorkerPoolStatisticsMetadataMapper.class)
public class WorkerPoolStatisticsMetadata extends AdminObjectImpl implements WorkerPoolStatistics {
private static final long serialVersionUID = -4917902925523802295L;
Added: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -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.impl;
+
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class WorkerPoolStatisticsMetadataMapper extends MetaMapper<WorkerPoolStatisticsMetadata> {
+ private static final String MAX_THREADS = "maxThreads"; //$NON-NLS-1$
+ private static final String HIGHEST_QUEUED = "highestQueued"; //$NON-NLS-1$
+ private static final String QUEUED = "queued"; //$NON-NLS-1$
+ private static final String QUEUE_NAME = "queueName"; //$NON-NLS-1$
+ private static final String TOTAL_SUBMITTED = "totalSubmitted"; //$NON-NLS-1$
+ private static final String TOTAL_COMPLETED = "totalCompleted"; //$NON-NLS-1$
+ private static final String HIGHEST_ACTIVE_THREADS = "highestActiveThreads"; //$NON-NLS-1$
+ private static final String ACTIVE_THREADS = "activeThreads"; //$NON-NLS-1$
+ private static final MutableCompositeMetaType metaType;
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ static {
+ metaType = new MutableCompositeMetaType(WorkerPoolStatisticsMetadata.class.getName(), "The Worker Pool statistics"); //$NON-NLS-1$
+ metaType.addItem(ACTIVE_THREADS, "ActiveThreads", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(HIGHEST_ACTIVE_THREADS, "HighestActiveThreads", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(TOTAL_COMPLETED, "TotalCompleted", SimpleMetaType.LONG_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(TOTAL_SUBMITTED, "TotalSubmitted", SimpleMetaType.LONG_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(QUEUE_NAME, "QueueName", SimpleMetaType.STRING); //$NON-NLS-1$
+ metaType.addItem(QUEUED, "Queued", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(HIGHEST_QUEUED, "HighestQueued", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.addItem(MAX_THREADS, "MaxThreads", SimpleMetaType.INTEGER_PRIMITIVE); //$NON-NLS-1$
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return WorkerPoolStatisticsMetadata.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, WorkerPoolStatisticsMetadata object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport transaction = new CompositeValueSupport(composite);
+
+ transaction.set(ACTIVE_THREADS, SimpleValueSupport.wrap(object.getActiveThreads()));
+ transaction.set(HIGHEST_ACTIVE_THREADS, SimpleValueSupport.wrap(object.getHighestActiveThreads()));
+ transaction.set(TOTAL_COMPLETED, SimpleValueSupport.wrap(object.getTotalCompleted()));
+ transaction.set(TOTAL_SUBMITTED, SimpleValueSupport.wrap(object.getTotalSubmitted()));
+ transaction.set(QUEUE_NAME, SimpleValueSupport.wrap(object.getQueueName()));
+ transaction.set(QUEUED, SimpleValueSupport.wrap(object.getQueued()));
+ transaction.set(HIGHEST_QUEUED, SimpleValueSupport.wrap(object.getHighestQueued()));
+ transaction.set(MAX_THREADS, SimpleValueSupport.wrap(object.getMaxThreads()));
+
+ return transaction;
+ }
+ throw new IllegalArgumentException("Cannot convert Worker Pool Statistics " + object); //$NON-NLS-1$
+ }
+
+ @Override
+ public WorkerPoolStatisticsMetadata unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
+ stats.setActiveThreads((Integer) metaValueFactory.unwrap(compositeValue.get(ACTIVE_THREADS)));
+ stats.setHighestActiveThreads((Integer) metaValueFactory.unwrap(compositeValue.get(HIGHEST_ACTIVE_THREADS)));
+ stats.setTotalCompleted((Long) metaValueFactory.unwrap(compositeValue.get(TOTAL_COMPLETED)));
+ stats.setTotalSubmitted((Long) metaValueFactory.unwrap(compositeValue.get(TOTAL_SUBMITTED)));
+ stats.setQueueName((String) metaValueFactory.unwrap(compositeValue.get(QUEUE_NAME)));
+ stats.setQueued((Integer) metaValueFactory.unwrap(compositeValue.get(QUEUED)));
+ stats.setHighestQueued((Integer) metaValueFactory.unwrap(compositeValue.get(HIGHEST_QUEUED)));
+ stats.setMaxThreads((Integer) metaValueFactory.unwrap(compositeValue.get(MAX_THREADS)));
+ return stats;
+ }
+ throw new IllegalStateException("Unable to unwrap transaction " + metaValue); //$NON-NLS-1$
+ }
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadataMapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -23,10 +23,10 @@
package org.teiid.adminapi.jboss;
import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -81,10 +81,13 @@
import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.adminapi.impl.TransactionMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
import org.teiid.connector.api.Connector;
import org.teiid.jboss.IntegrationPlugin;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
+import com.metamatrix.core.util.FileUtils;
+
public class Admin extends TeiidAdmin {
private static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(ProfileKey.DEFAULT);
@@ -171,18 +174,20 @@
}
@Override
- public InputStream exportConnectorBinding(String deployedName) throws AdminException {
+ public char[] exportConnectorBinding(String deployedName) throws AdminException {
ManagedComponent mc = getConnectorBindingComponent(deployedName);
if (mc != null) {
- return exportDeployment(mc.getDeployment().getName());
+ return new String(exportDeployment(mc.getDeployment().getName()).toByteArray()).toCharArray();
}
return null;
}
- private InputStream exportDeployment(String url) throws AdminComponentException {
+ private ByteArrayOutputStream exportDeployment(String url) throws AdminComponentException {
try {
URL contentURL = new URL(url);
- return contentURL.openStream();
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ FileUtils.write(contentURL.openStream(), bos, FileUtils.DEFAULT_BUFFER_SIZE);
+ return bos;
} catch (MalformedURLException e) {
throw new AdminComponentException(e);
} catch (IOException e) {
@@ -392,10 +397,10 @@
}
@Override
- public InputStream exportVDB(String vdbName, int vdbVersion) throws AdminException{
+ public byte[] exportVDB(String vdbName, int vdbVersion) throws AdminException{
ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
if (mc != null) {
- return exportDeployment(mc.getDeployment().getName());
+ return exportDeployment(mc.getDeployment().getName()).toByteArray();
}
return null;
}
@@ -619,22 +624,22 @@
}
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");//$NON-NLS-1$
+
+ ManagedUtil.removeArchive(getDeploymentManager(), deployerName);
}
}
@Override
- public InputStream exportConnectorType(String connectorName) throws AdminException {
+ public byte[] exportConnectorType(String connectorName) throws AdminException {
if (!connectorName.endsWith(".rar")) {//$NON-NLS-1$
connectorName = connectorName + ".rar";//$NON-NLS-1$
}
String deployerName = getRarDeployerName(connectorName);
if (deployerName != null) {
- return exportDeployment(deployerName);
+ return exportDeployment(deployerName).toByteArray();
}
return null;
}
@@ -698,7 +703,7 @@
try {
ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
MetaValue value = ManagedUtil.executeOperation(mc, "getWorkManagerStatistics", SimpleValueSupport.wrap(identifier));//$NON-NLS-1$
- return (WorkerPoolStatistics)MetaValueFactory.getInstance().unwrap(value, WorkerPoolStatistics.class);
+ return (WorkerPoolStatistics)MetaValueFactory.getInstance().unwrap(value, WorkerPoolStatisticsMetadata.class);
} catch (Exception e) {
throw new AdminComponentException(e.getMessage(), e);
}
Deleted: trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java
===================================================================
--- trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -1,66 +0,0 @@
-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);
- ds.setAutoCommitTxn("AUTO");
- 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();
- boolean hasResults = statement.execute(sql);
- if (hasResults) {
- ResultSet results = statement.getResultSet();
- 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();
- }
- else {
- System.out.println("update count is="+statement.getUpdateCount());
- }
- statement.close();
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- }
-}
Deleted: trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -1,312 +0,0 @@
-package org.teiid.adminapi.jboss;
-
-
-import static junit.framework.Assert.*;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminFactory;
-import org.teiid.adminapi.ConnectionPoolStatistics;
-import org.teiid.adminapi.ConnectorBinding;
-import org.teiid.adminapi.PropertyDefinition;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Transaction;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.WorkerPoolStatistics;
-
-import com.metamatrix.core.util.ObjectConverterUtil;
-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();
- //admin = AdminProvider.getRemote( "jnp://localhost:1099", "javaduke", "anotherduke");
- admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mm://localhost:31443");
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @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-7.0.0-SNAPSHOT", p);
-
- binding = admin.getConnectorBinding("test-mysql-cb");
-
- assertNotNull(binding);
-
- assertEquals("java:DerbyDS", binding.getPropertyValue("SourceJNDIName"));
-
- admin.stopConnectorBinding(binding);
-
- admin.startConnectorBinding(binding);
-
- admin.setConnectorBindingProperty("test-mysql-cb", "SourceJNDIName", "DummyDS");
-
- binding = admin.getConnectorBinding("test-mysql-cb");
-
- assertEquals("DummyDS", binding.getPropertyValue("SourceJNDIName"));
-
- 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);
-
- Collection<ConnectorBinding> bindings = admin.getConnectorBindingsInVDB("TransactionsRevisited",1);
- assertEquals(2, bindings.size());
-
- admin.deleteVDB("TransactionsRevisited", 1);
-
- assertNull(admin.getVDB("TransactionsRevisited", 1));
- }
-
-
- @Test public void testSessions() throws Exception{
- Collection<Session> sessions = admin.getSessions();
- System.out.println(sessions);
- assertTrue(sessions.size() >= 1);
- for (Session s: sessions) {
- assertEquals("ramesh@teiid-security", s.getUserName());
- }
-
- for (Session s:sessions) {
- admin.terminateSession(s.getSessionId());
- }
-
- sessions = admin.getSessions();
- assertTrue(sessions.size() == 0);
- }
-
-
- @Test public void testRequests() throws Exception {
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- if (vdb == null) {
- File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb");
- admin.deployVDB(f.getName(), f.toURI().toURL());
- }
-
- Runnable work = new Runnable() {
- public void run() {
- for (int i = 0; i < 5; i++) {
- try {
- execute(ds, "TransactionsRevisited", "select * from pm1.g1");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- };
- Thread t = new Thread(work);
- t.start();
-
- try {
- Collection<Request> requests = admin.getRequests();
- assertTrue(requests.size() > 0);
- }finally {
- t.join();
- }
-
- long sessionId = 0;
- Collection<Session> sessions = admin.getSessions();
- for (Session s:sessions) {
- sessionId = s.getSessionId();
- }
-
- t = new Thread(work);
- t.start();
-
- try {
- Collection<Request> requests = admin.getRequestsForSession(sessionId);
- assertTrue(requests.size() >= 0);
- } finally {
- t.join();
- admin.deleteVDB("TransactionsRevisited", 1);
- }
- }
-
- @Test
- public void testCache() throws Exception {
- Collection<String> caches = admin.getCacheTypes();
- assertEquals(4, caches.size());
-
- admin.clearCache("CODE_TABLE_CACHE");
- }
-
- @Test
- public void testTransactions() throws Exception {
-
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- if (vdb == null) {
- File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb");
- admin.deployVDB(f.getName(), f.toURI().toURL());
- }
-
- Runnable work = new Runnable() {
- public void run() {
- try {
- for (int i = 0; i < 10; i++) {
- int v = i+200;
- execute(ds, "TransactionsRevisited", "insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("+v+",'"+v+"',"+v+",'"+v+"')");
- }
- execute(ds, "TransactionsRevisited", "delete from vm.g1 where pm1e1 >= 200");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
-
- Thread t = new Thread(work);
- t.start();
- Thread.sleep(2000);
- try {
- Collection<Transaction> txns = admin.getTransactions();
- assertTrue(txns.size() >= 0);
- } finally {
- t.join();
- admin.deleteVDB("TransactionsRevisited", 1);
- }
- }
-
- @Test
- public void testWorkmanagerStats() throws Exception {
- WorkerPoolStatistics stats = admin.getWorkManagerStats("runtime");
- System.out.println(stats);
- }
-
- @Test
- public void testConnectionPool() throws Exception {
- ConnectionPoolStatistics stats = admin.getConnectorConnectionPoolStats("mysql-connector-binding");
- System.out.println(stats);
- }
-
- @Test
- public void testConnectorTypeProperties() throws Exception {
- Collection<PropertyDefinition> defs = admin.getConnectorTypePropertyDefinitions("connector-jdbc-7.0.0-SNAPSHOT");
- for (PropertyDefinition pd:defs) {
- System.out.println(pd.getName());
- if (pd.getName().equals("ExtensionTranslationClassName")) {
- assertEquals("Extension SQL Translation Class", pd.getDisplayName());
- assertEquals(true, pd.isAdvanced());
- assertEquals(true, pd.isRequired());
- assertEquals(false, pd.isMasked());
- assertEquals(true, pd.isModifiable());
-
- HashSet<String> values = new HashSet<String>();
- values.add("org.teiid.connector.jdbc.h2.H2Translator");
- values.add("org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator");
- values.add("org.teiid.connector.jdbc.mysql.MySQL5Translator");
- values.add("org.teiid.connector.jdbc.derby.DerbySQLTranslator");
- values.add("org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator");
- values.add("org.teiid.connector.jdbc.db2.DB2SQLTranslator");
- values.add("org.teiid.connector.jdbc.access.AccessSQLTranslator");
- values.add("org.teiid.connector.jdbc.mysql.MySQLTranslator");
- values.add("org.teiid.connector.jdbc.translator.Translator");
- values.add("org.teiid.connector.jdbc.oracle.OracleSQLTranslator");
- assertEquals(values, pd.getAllowedValues());
- }
- }
- }
-
- @Test
- public void testConnectorTypes() throws Exception {
- Set<String> defs = admin.getConnectorTypes();
- assertTrue(defs.contains("connector-salesforce-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-jdbc-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-text-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-loopback-7.0.0-SNAPSHOT"));
- assertTrue(defs.contains("connector-ldap-7.0.0-SNAPSHOT"));
- System.out.println(defs);
- }
-
- @Test
- public void testPropertyDefsForDS() throws Exception {
- 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"));
-
- admin.deleteConnectorType("connector-loopy");
-
- names = admin.getConnectorTypes();
- assertTrue(!names.contains("connector-loopy"));
- }
-
- @Test
- public void testExportVDB() throws Exception{
- File f = new File(UnitTestUtil.getTestScratchPath()+"/Admin.vdb");
-
- assertTrue(!f.exists());
-
- InputStream in = admin.exportVDB("Admin", 1);
- if (in != null) {
- ObjectConverterUtil.write(in, f);
- }
-
- assertTrue(f.exists());
- f.delete();
- }
-
- @Test public void testAssignConnectorBinding() throws Exception {
-
- admin.assignBindingToModel("TransactionsRevisited", 1, "pm1", "mysql", "jndi:FOO");
- }
-
- @Test public void testVDB() throws Exception {
-
- admin.getVDB("TransactionsRevisited", 1);
- }
-}
Deleted: trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb
===================================================================
(Binary files differ)
Deleted: trunk/jboss-integration/src/test/resources/connector-loopback.rar
===================================================================
(Binary files differ)
Deleted: trunk/jboss-integration/src/test/resources/log4j.xml
===================================================================
--- trunk/jboss-integration/src/test/resources/log4j.xml 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/jboss-integration/src/test/resources/log4j.xml 2010-03-16 18:29:29 UTC (rev 1966)
@@ -1,19 +0,0 @@
-<?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: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -155,7 +155,7 @@
ic.lookup(mapping.getJndiName());
} catch (NamingException e) {
valid = false;
- String msg = RuntimePlugin.Util.getString("jndi_not_found", mapping.getJndiName(),mapping.getName()); //$NON-NLS-1$
+ String msg = RuntimePlugin.Util.getString("jndi_not_found", deployment.getName(), deployment.getVersion(), mapping.getJndiName(),mapping.getName()); //$NON-NLS-1$
model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -92,6 +92,7 @@
public ResultsFuture<?> logoff() throws InvalidSessionException {
this.service.closeSession(DQPWorkContext.getWorkContext().getSessionId());
+ DQPWorkContext.getWorkContext().getSession().setSessionId(-1);
return ResultsFuture.NULL_FUTURE;
}
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-03-15 21:54:11 UTC (rev 1965)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-03-16 18:29:29 UTC (rev 1966)
@@ -283,7 +283,7 @@
vdb_delete_failed=Failed to delete the cached metadata files due to:
vdb_deployed=VDB "{0}" deployed.
vdb_undeployed=VDB "{0}" undeployed.
-jndi_not_found=Jndi resource = "{0}" not found for Source Name = "{1}"
+jndi_not_found=For {0}.{1} VDB, JNDI resource "{2}" not found for Source Name "{3}"
system_vdb_load_error=System.vdb needs to be loaded before any other VDBs.
fail_to_deploy="{0}" Can not be deployed because model "{1}" is not fully configured.
failed_to_retrive_metadata="{0}" Can not be deployed because model "{1}" can not retrieve metadata.
Copied: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java (from rev 1961, trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java)
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/BaseConnection.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -0,0 +1,66 @@
+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 = "admin";
+ static String password = "teiid";
+
+ 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);
+ ds.setAutoCommitTxn("DETECT");
+ 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();
+ boolean hasResults = statement.execute(sql);
+ if (hasResults) {
+ ResultSet results = statement.getResultSet();
+ 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();
+ }
+ else {
+ System.out.println("update count is="+statement.getUpdateCount());
+ }
+ statement.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
+ }
+ }
+}
Copied: trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java (from rev 1962, trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java)
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-16 18:29:29 UTC (rev 1966)
@@ -0,0 +1,348 @@
+package org.teiid.adminapi.jboss;
+
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.sql.Connection;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminFactory;
+import org.teiid.adminapi.ConnectionPoolStatistics;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.PropertyDefinition;
+import org.teiid.adminapi.Request;
+import org.teiid.adminapi.Session;
+import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.WorkerPoolStatistics;
+
+import com.metamatrix.core.util.ObjectConverterUtil;
+import com.metamatrix.core.util.UnitTestUtil;
+
+public class TestConnectorBindings extends BaseConnection {
+ static ServerDatasourceConnection ds;
+ static Admin admin;
+
+ @Before
+ public void setUp() throws Exception {
+ //if (!Bootstrap.getInstance().isStarted()) Bootstrap.getInstance().bootstrap();
+ ds = new ServerDatasourceConnection();
+ //admin = AdminProvider.getRemote( "jnp://localhost:1099", "javaduke", "anotherduke");
+ admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mm://localhost:31443"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ installVDB();
+ }
+
+ @After
+ public void tearDown() {
+ admin.close();
+ }
+
+ @AfterClass
+ public static void end() throws Exception {
+ admin = AdminFactory.getInstance().createAdmin("admin", "admin".toCharArray(), "mm://localhost:31443"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (vdb != null) {
+ admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ }
+ admin.close();
+ }
+
+ @Test public void testConnectorBinding() throws Exception {
+ ConnectorBinding binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ if (binding != null) {
+ admin.deleteConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+ }
+
+ Properties p = new Properties();
+ p.setProperty("jndi-name", "test-mysql-cb"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("rar-name", "connector-jdbc-7.0.0-SNAPSHOT.rar"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("CapabilitiesClass", "org.teiid.connector.jdbc.derby.DerbyCapabilities"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("XaCapable", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("SourceJNDIName", "java:DerbyDS"); //$NON-NLS-1$ //$NON-NLS-2$
+ admin.addConnectorBinding("test-mysql-cb","connector-jdbc-7.0.0-SNAPSHOT", p); //$NON-NLS-1$ //$NON-NLS-2$
+
+ binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ assertNotNull(binding);
+
+ assertEquals("java:DerbyDS", binding.getPropertyValue("SourceJNDIName")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ admin.stopConnectorBinding(binding);
+
+ admin.startConnectorBinding(binding);
+
+ admin.setConnectorBindingProperty("test-mysql-cb", "SourceJNDIName", "DummyDS"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ assertEquals("DummyDS", binding.getPropertyValue("SourceJNDIName")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ admin.deleteConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ binding = admin.getConnectorBinding("test-mysql-cb"); //$NON-NLS-1$
+
+ assertNull(binding);
+ }
+
+ @Test public void testVDBDeploy() throws Exception {
+
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (vdb != null) {
+ admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ }
+
+ installVDB();
+
+ assertNotNull(admin.getVDB("TransactionsRevisited", 1)); //$NON-NLS-1$
+
+ Set<VDB> vdbs = admin.getVDBs();
+ assertTrue(vdbs.size() >= 1);
+
+ Collection<ConnectorBinding> bindings = admin.getConnectorBindingsInVDB("TransactionsRevisited",1); //$NON-NLS-1$
+ assertEquals(2, bindings.size());
+
+ admin.deleteVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+
+ assertNull(admin.getVDB("TransactionsRevisited", 1)); //$NON-NLS-1$
+ }
+
+
+ @Test public void testSessions() throws Exception{
+ Connection c = ds.getConnection("TransactionsRevisited");
+ Collection<Session> sessions = admin.getSessions();
+
+ int size = sessions.size();
+ assertTrue( size >= 1);
+
+ Session found = null;
+ for (Session s: sessions) {
+ if (s.getUserName().equals("admin@teiid-security")) {
+ found = s;
+ break;
+ }
+ }
+
+ assertNotNull(found);
+
+ admin.terminateSession(found.getSessionId());
+
+ sessions = admin.getSessions();
+ assertTrue(sessions.size() == (size-1));
+ }
+
+
+ @Test public void testRequests() throws Exception {
+ Runnable work = new Runnable() {
+ public void run() {
+ for (int i = 0; i < 5; i++) {
+ try {
+ execute(ds, "TransactionsRevisited", "select * from pm1.g1"); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ };
+ Thread t = new Thread(work);
+ t.start();
+
+ // can not really stop and take reading here..
+ try {
+ Collection<Request> requests = admin.getRequests();
+ assertTrue(requests.size() >= 0);
+ }finally {
+ t.join();
+ }
+
+ long sessionId = 0;
+ Collection<Session> sessions = admin.getSessions();
+ for (Session s:sessions) {
+ sessionId = s.getSessionId();
+ }
+
+ t = new Thread(work);
+ t.start();
+
+ try {
+ Collection<Request> requests = admin.getRequestsForSession(sessionId);
+ assertTrue(requests.size() >= 0);
+ } finally {
+ t.join();
+ }
+ }
+
+ @Test
+ public void testCache() throws Exception {
+ Collection<String> caches = admin.getCacheTypes();
+ assertEquals(4, caches.size());
+
+ admin.clearCache("CODE_TABLE_CACHE"); //$NON-NLS-1$
+ }
+
+ @Ignore
+ @Test
+ public void testTransactions() throws Exception {
+ Runnable work = new Runnable() {
+ public void run() {
+ try {
+ for (int i = 0; i < 10; i++) {
+ int v = i+200;
+ execute(ds, "TransactionsRevisited", "insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("+v+",'"+v+"',"+v+",'"+v+"')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ }
+ execute(ds, "TransactionsRevisited", "delete from vm.g1 where pm1e1 >= 200"); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ Thread t = new Thread(work);
+ t.start();
+ Thread.sleep(2000);
+ try {
+ Collection<Transaction> txns = admin.getTransactions();
+ assertTrue(txns.size() >= 0);
+ } finally {
+ t.join();
+ }
+ }
+
+ private static void installVDB() throws AdminException, MalformedURLException {
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (vdb == null) {
+ File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb"); //$NON-NLS-1$
+ admin.deployVDB(f.getName(), f.toURI().toURL());
+ }
+ }
+
+ @Test
+ public void testWorkmanagerStats() throws Exception {
+ WorkerPoolStatistics stats = admin.getWorkManagerStats("runtime"); //$NON-NLS-1$
+ System.out.println(stats);
+ assertNotNull(stats);
+ }
+
+ @Test
+ public void testConnectionPool() throws Exception {
+ ConnectionPoolStatistics stats = admin.getConnectorConnectionPoolStats("mysql-connector-binding"); //$NON-NLS-1$
+ System.out.println(stats);
+ assertNotNull(stats);
+ }
+
+ @Test
+ public void testConnectorTypeProperties() throws Exception {
+ Collection<PropertyDefinition> defs = admin.getConnectorTypePropertyDefinitions("connector-jdbc-7.0.0-SNAPSHOT"); //$NON-NLS-1$
+ for (PropertyDefinition pd:defs) {
+ System.out.println(pd.getName());
+ if (pd.getName().equals("ExtensionTranslationClassName")) { //$NON-NLS-1$
+ assertEquals("Extension SQL Translation Class", pd.getDisplayName()); //$NON-NLS-1$
+ assertEquals(true, pd.isAdvanced());
+ assertEquals(true, pd.isRequired());
+ assertEquals(false, pd.isMasked());
+ assertEquals(true, pd.isModifiable());
+
+ HashSet<String> values = new HashSet<String>();
+ values.add("org.teiid.connector.jdbc.h2.H2Translator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.mysql.MySQL5Translator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.derby.DerbySQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.db2.DB2SQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.access.AccessSQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.mysql.MySQLTranslator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.translator.Translator"); //$NON-NLS-1$
+ values.add("org.teiid.connector.jdbc.oracle.OracleSQLTranslator"); //$NON-NLS-1$
+ assertEquals(values, pd.getAllowedValues());
+ }
+ }
+ }
+
+ @Test
+ public void testConnectorTypes() throws Exception {
+ Set<String> defs = admin.getConnectorTypes();
+ assertTrue(defs.contains("connector-salesforce-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-jdbc-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-text-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-loopback-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ assertTrue(defs.contains("connector-ldap-7.0.0-SNAPSHOT")); //$NON-NLS-1$
+ System.out.println(defs);
+ }
+
+ @Test
+ public void testPropertyDefsForDS() throws Exception {
+ Collection<PropertyDefinition> defs = admin.getDataSourcePropertyDefinitions();
+ System.out.println(defs);
+ assertNotNull(defs);
+ assertTrue(defs.size() > 1);
+ }
+
+ @Test
+ public void testTemplate() throws Exception{
+ File f = new File(UnitTestUtil.getTestDataPath()+"/connector-loopback.rar"); //$NON-NLS-1$
+ admin.addConnectorType("connector-loopy", f.toURI().toURL()); //$NON-NLS-1$
+
+ Set<String> names = admin.getConnectorTypes();
+ assertTrue(names.contains("connector-loopy")); //$NON-NLS-1$
+
+ admin.deleteConnectorType("connector-loopy"); //$NON-NLS-1$
+
+ names = admin.getConnectorTypes();
+ //assertTrue(!names.contains("connector-loopy")); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testExportVDB() throws Exception{
+ File f = new File(UnitTestUtil.getTestScratchPath()+"/TransactionsRevisited.vdb"); //$NON-NLS-1$
+
+ assertTrue(!f.exists());
+
+ byte[] contents = admin.exportVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ if (contents != null) {
+ ObjectConverterUtil.write(contents, f.getCanonicalPath());
+ }
+
+ assertTrue(f.exists());
+ f.delete();
+ }
+
+ @Test public void testAssignConnectorBinding() throws Exception {
+ admin.assignBindingToModel("TransactionsRevisited", 1, "pm1", "mysql", "jndi:FOO"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ boolean checked = false;
+ VDB vdb = admin.getVDB("TransactionsRevisited", 1); //$NON-NLS-1$
+ List<Model> models = vdb.getModels();
+ for (Model model:models) {
+ if (model.getName().equals("pm1")) { //$NON-NLS-1$
+ List<String> sources = model.getSourceNames();
+ for (String source:sources) {
+ if (source.equals("mysql")) { //$NON-NLS-1$
+ assertEquals("jndi:FOO", model.getSourceJndiName(source)); //$NON-NLS-1$
+ checked = true;
+ }
+ }
+ }
+ }
+
+ assertTrue("Test not veryfied", checked); //$NON-NLS-1$
+ }
+}
Copied: trunk/test-integration/db/src/test/resources (from rev 1965, trunk/test-integration/db/resources)
Copied: trunk/test-integration/db/src/test/resources/TransactionsRevisited.vdb (from rev 1965, trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb)
===================================================================
(Binary files differ)
Property changes on: trunk/test-integration/db/src/test/resources/TransactionsRevisited.vdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/test-integration/db/src/test/resources/connector-loopback.rar (from rev 1965, trunk/jboss-integration/src/test/resources/connector-loopback.rar)
===================================================================
(Binary files differ)
Property changes on: trunk/test-integration/db/src/test/resources/connector-loopback.rar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/test-integration/db/src/test/resources/log4j.xml (from rev 1965, trunk/jboss-integration/src/test/resources/log4j.xml)
===================================================================
--- trunk/test-integration/db/src/test/resources/log4j.xml (rev 0)
+++ trunk/test-integration/db/src/test/resources/log4j.xml 2010-03-16 18:29:29 UTC (rev 1966)
@@ -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>
14 years, 2 months
teiid SVN: r1965 - trunk/connectors.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-15 17:54:11 -0400 (Mon, 15 Mar 2010)
New Revision: 1965
Modified:
trunk/connectors/pom.xml
Log:
TEIID-833
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2010-03-15 21:00:07 UTC (rev 1964)
+++ trunk/connectors/pom.xml 2010-03-15 21:54:11 UTC (rev 1965)
@@ -66,6 +66,11 @@
<artifactId>jboss-vfs</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
14 years, 2 months
teiid SVN: r1964 - in trunk/console/src: main/java/org/teiid/rhq/plugin and 2 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-03-15 17:00:07 -0400 (Mon, 15 Mar 2010)
New Revision: 1964
Modified:
trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
Log:
- Removed required fields for VDB
- Change "Connector Binding" to "Source Name"
- Added VDB Status as metric and summary trait
- Added type to logical model in VDB configuration
- Split models into separate sections in one table
- Add Connector Binding to JNDI name in source models table
- Changed DS Runtime Engine to Data Services
Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-03-15 21:00:07 UTC (rev 1964)
@@ -90,9 +90,27 @@
Object resultObject = new Object();
- // if (metric.equals(ComponentType.Metric.HIGH_WATER_MARK)) {
- // resultObject = new Double(getHighWatermark(identifier));
- // }
+ if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
+ //TODO remove version parameter after AdminAPI is changed
+ resultObject = getVDBStatus((String)valueMap.get(VDB.NAME), 1);
+ } else if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
+ resultObject = new Double(getQueryCount().doubleValue());
+ } else {
+ if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
+ resultObject = new Double(getSessionCount().doubleValue());
+ } else {
+ if (metric
+ .equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
+ Integer longRunningQueryLimit = (Integer) valueMap
+ .get(PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT);
+ Collection<RequestMetadata> longRunningQueries = getLongRunningQueries(longRunningQueryLimit);
+ resultObject = new Double(longRunningQueries.size());
+ }
+ }
+ }
return resultObject;
}
@@ -102,7 +120,7 @@
*/
public void executeOperation(ExecutedResult operationResult,
- final Map valueMap) {
+ final Map<String, Object> valueMap) {
if (operationResult.getComponentType().equals(
PluginConstants.ComponentType.Platform.NAME)) {
@@ -245,7 +263,27 @@
return sessionCollection;
}
+
+ public String getVDBStatus(String vdbName, int version) {
+
+ ManagedComponent mcVdb = null;
+ try {
+ mcVdb = ProfileServiceUtil
+ .getManagedComponent(new org.jboss.managed.api.ComponentType(
+ PluginConstants.ComponentType.VDB.TYPE,
+ PluginConstants.ComponentType.VDB.SUBTYPE), vdbName);
+ } catch (NamingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return ProfileServiceUtil.getSimpleValue(mcVdb,
+ "status", String.class);
+ }
+
public static MetaValue executeManagedOperation(ManagedComponent mc,
String operation, MetaValue... args) throws Exception {
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-03-15 21:00:07 UTC (rev 1964)
@@ -179,7 +179,16 @@
+ " named " + this.getComponentName());
}
+
+ protected void setMetricArguments(String name,
+ Configuration configuration, Map<String, Object> argumentMap) {
+ // moved this logic up to the associated implemented class
+ throw new InvalidPluginConfigurationException(
+ "Not implemented on component type " + this.getComponentType()
+ + " named " + this.getComponentName());
+ }
+
protected void execute(final ExecutedResult result, final Map valueMap) {
DQPManagementView dqp = new DQPManagementView();
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-03-15 21:00:07 UTC (rev 1964)
@@ -27,12 +27,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hyperic.sigar.test.GetPass;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.teiid.rhq.admin.DQPManagementView;
import org.teiid.rhq.comm.ConnectionConstants;
import org.teiid.rhq.plugin.util.PluginConstants;
@@ -46,11 +45,11 @@
*
*/
public class VDBComponent extends Facet {
- private final Log LOG = LogFactory
- .getLog(VDBComponent.class);
+ private final Log LOG = LogFactory.getLog(VDBComponent.class);
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.teiid.rhq.plugin.Facet#getComponentName()
*/
@Override
@@ -73,9 +72,20 @@
} else if (name.equals(Platform.Operations.GET_PROPERTIES)) {
String key = ConnectionConstants.IDENTIFIER;
valueMap.put(key, getComponentIdentifier());
+ } else if (name.equals(Platform.Operations.KILL_SESSION)) {
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(
+ Operation.Value.SESSION_ID).getLongValue());
}
}
+
+ @Override
+ protected void setMetricArguments(String name,
+ Configuration configuration, Map<String, Object> valueMap) {
+ // Parameter logic for VDB Metrics
+ String key = VDB.NAME;
+ valueMap.put(key, this.resourceConfiguration.getSimpleValue("name", null));
+ }
@Override
public void getValues(MeasurementReport report,
@@ -84,6 +94,7 @@
DQPManagementView view = new DQPManagementView();
Map<String, Object> valueMap = new HashMap<String, Object>();
+ setMetricArguments(VDB.NAME, null, valueMap);
for (MeasurementScheduleRequest request : requests) {
String name = request.getName();
@@ -96,23 +107,30 @@
if (request
.getName()
.equals(
- PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double) metricReturnObject));
+ PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
+ report.addData(new MeasurementDataTrait(request, (String)metricReturnObject));
} else {
if (request
.getName()
.equals(
- PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
+ PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
report.addData(new MeasurementDataNumeric(request,
(Double) metricReturnObject));
} else {
if (request
.getName()
.equals(
- PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double) metricReturnObject));
+ PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
+ report.addData(new MeasurementDataTrait(request,
+ (String) metricReturnObject));
+ } else {
+ if (request
+ .getName()
+ .equals(
+ PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
+ report.addData(new MeasurementDataNumeric(
+ request, (Double) metricReturnObject));
+ }
}
}
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java 2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java 2010-03-15 21:00:07 UTC (rev 1964)
@@ -37,11 +37,9 @@
import org.jboss.managed.plugins.ManagedObjectImpl;
import org.jboss.metatype.api.types.MetaType;
import org.jboss.metatype.api.values.CollectionValueSupport;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.EnumValue;
+import org.jboss.metatype.api.values.EnumValueSupport;
import org.jboss.metatype.api.values.GenericValueSupport;
import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.rhq.core.domain.configuration.Configuration;
@@ -144,7 +142,7 @@
PropertyList sourceModelsList = new PropertyList("sourceModels");
configuration.put(sourceModelsList);
- PropertyList logicalModelsList = new PropertyList("virtualModels");
+ PropertyList logicalModelsList = new PropertyList("logicalModels");
configuration.put(logicalModelsList);
PropertyList errorList = new PropertyList("errorList");
@@ -179,7 +177,10 @@
getSourceMappingValue(connectorBinding.getValue(), sourceList);
String visibility = ((SimpleValueSupport) managedObject
.getProperty("visible").getValue()).getValue().toString();
+ String type = ((EnumValueSupport) managedObject
+ .getProperty("modelType").getValue()).getValue().toString();
+
// Get any model errors/warnings
MetaValue errors = managedObject.getProperty("errors").getValue();
if (errors != null) {
@@ -218,6 +219,7 @@
} else {
PropertyMap model = new PropertyMap("model",
new PropertySimple("name", modelName),
+ new PropertySimple("type", type),
new PropertySimple("visibility", visibility));
logicalModelsList.add(model);
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-03-15 21:00:07 UTC (rev 1964)
@@ -64,7 +64,7 @@
public final static String TYPE = "ConnectionFactory"; //$NON-NLS-1$
public final static String SUBTYPE = "NoTx"; //$NON-NLS-1$
public final static String TEIID_RUNTIME_ENGINE = "org.teiid.jboss.deployers.RuntimeEngineDeployer"; //$NON-NLS-1$
- public final static String TEIID_ENGINE_RESOURCE_NAME = "Data Service Runtime Engine"; //$NON-NLS-1$
+ public final static String TEIID_ENGINE_RESOURCE_NAME = "Data Services"; //$NON-NLS-1$
public final static String TEIID_ENGINE_RESOURCE_DESCRIPTION = "JBoss Enterprise Data Service Runtime Engine"; //$NON-NLS-1$
public static interface Operations {
@@ -106,7 +106,16 @@
public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
}
+
+ public static interface Metrics {
+ public final static String STATUS = "status"; //$NON-NLS-1$
+ public final static String QUERY_COUNT = "queryCount"; //$NON-NLS-1$
+ public final static String SESSION_COUNT = "sessionCount"; //$NON-NLS-1$
+ public final static String LONG_RUNNING_QUERIES = "longRunningQueries"; //$NON-NLS-1$
+
+ }
+
}
public interface Model {
Modified: trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml 2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml 2010-03-15 21:00:07 UTC (rev 1964)
@@ -251,38 +251,42 @@
</results>
</operation>
+ <metric displayName="Status" defaultOn="true" dataType="trait" displayType="summary"
+ category="availability" property="status"
+ description="The status of this VDB" />
+
<content name="vdb" displayName="VDB Archive" category="deployable"
isCreationType="true">
</content>
-
+
<resource-configuration>
<c:group name="general" displayName="General"
hiddenByDefault="false">
<c:simple-property name="name" type="string"
- description="The Virtual Database Name" />
+ description="The Virtual Database Name" required="false"/>
<c:simple-property name="version" type="string"
- description="The Virtual Database Version" />
+ description="The Virtual Database Version" required="false"/>
<c:simple-property name="description" type="string"
- description="The Virtual Database Description" />
+ description="The Virtual Database Description" required="false"/>
<c:simple-property name="status" type="string"
- description="The Virtual Database Status">
+ description="The Virtual Database Status" required="false" summary="true">
<c:property-options>
<c:option value="ACTIVE" name="ACTIVE" />
<c:option value="INACTIVE" name="INACTIVE" default="true"/>
</c:property-options>
</c:simple-property>
<c:simple-property name="url" type="string"
- description="The Virtual Database URL" />
+ description="The Virtual Database URL" required="false"/>
</c:group>
- <c:group name="sourceModels" displayName="Source Models"
+ <c:group name="Models" displayName="Models"
hiddenByDefault="false">
<c:list-property name="sourceModels" description="The source models for this VDB">
<c:map-property name="model">
<c:simple-property name="name" displayName="Name"
description="Name of the model" required="true" readOnly="true"/>
- <c:simple-property name="sourceName" displayName="Connector Binding"
- description="Connector binding for this model" required="false" readOnly="true"/>
- <c:simple-property name="jndiName" displayName="JNDI Name"
+ <c:simple-property name="sourceName" displayName="Source Name"
+ description="Source name for this model" required="false" readOnly="true"/>
+ <c:simple-property name="jndiName" displayName="Connector Binding JNDI Name"
description="JNDI name for this connector binding" required="false"/>
<c:simple-property name="visibility"
displayName="Visible" description="Visibility of the model"
@@ -304,13 +308,12 @@
</c:simple-property>
</c:map-property>
</c:list-property>
- </c:group>
- <c:group name="virtualModels" displayName="Logical Models"
- hiddenByDefault="false">
- <c:list-property name="virtualModels" description="The logical models for this VDB">
+ <c:list-property name="logicalModels" description="The logical models for this VDB">
<c:map-property name="model">
<c:simple-property name="name" displayName="Name"
description="Name of the model" required="true" />
+ <c:simple-property name="type" displayName="Type"
+ description="type of logical model" required="true" />
<c:simple-property name="visibility"
displayName="Visible" description="Visbility of the model"
required="true">
@@ -335,7 +338,8 @@
</c:list-property>
</c:group>
</resource-configuration>
-
+
+
<!--
<operation name="getProperties" displayName="View VDB properties"
description="List the properties of this VDB"> <results>
14 years, 2 months
teiid SVN: r1963 - in trunk/metadata: src/main/java/org/teiid/metadata/index and 5 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-15 14:24:28 -0400 (Mon, 15 Mar 2010)
New Revision: 1963
Added:
trunk/metadata/src/test/java/org/
trunk/metadata/src/test/java/org/teiid/
trunk/metadata/src/test/java/org/teiid/metadata/
trunk/metadata/src/test/java/org/teiid/metadata/index/
trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
Removed:
trunk/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java
Modified:
trunk/metadata/pom.xml
Log:
TEIID-833
Modified: trunk/metadata/pom.xml
===================================================================
--- trunk/metadata/pom.xml 2010-03-15 17:15:42 UTC (rev 1962)
+++ trunk/metadata/pom.xml 2010-03-15 18:24:28 UTC (rev 1963)
@@ -57,6 +57,12 @@
<artifactId>jboss-vfs</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Deleted: trunk/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java 2010-03-15 17:15:42 UTC (rev 1962)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java 2010-03-15 18:24:28 UTC (rev 1963)
@@ -1,102 +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.metadata.index;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.plugins.context.zip.ZipEntryContext;
-import org.teiid.metadata.CompositeMetadataStore;
-import org.teiid.metadata.TransformationMetadata;
-
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.LRUCache;
-import com.metamatrix.query.function.metadata.FunctionMetadataReader;
-import com.metamatrix.query.function.metadata.FunctionMethod;
-import com.metamatrix.query.metadata.QueryMetadataInterface;
-
-public class VDBMetadataFactory {
-
- public static LRUCache<URL, QueryMetadataInterface> VDB_CACHE = new LRUCache<URL, QueryMetadataInterface>(10);
-
- public static QueryMetadataInterface getVDBMetadata(String vdbFile) {
- try {
- return getVDBMetadata(new File(vdbFile).toURI().toURL(), null);
- } catch (IOException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- }
-
- public static QueryMetadataInterface getVDBMetadata(URL vdbURL, URL udfFile) throws IOException {
- QueryMetadataInterface vdbmetadata = VDB_CACHE.get(vdbURL);
- if (vdbmetadata != null) {
- return vdbmetadata;
- }
-
- try {
- VFS.init();
- VDBContext vdbContext = new VDBContext(vdbURL);
- VirtualFile vdbFile = new VirtualFile(vdbContext.getRoot());
-
- List<VirtualFile> children = vdbFile.getChildrenRecursively(new VirtualFileFilter() {
- @Override
- public boolean accepts(VirtualFile file) {
- return file.getName().endsWith(IndexConstants.NAME_DELIM_CHAR+IndexConstants.INDEX_EXT);
- }
- });
-
- IndexMetadataFactory imf = new IndexMetadataFactory();
- for (VirtualFile f: children) {
- imf.addIndexFile(f);
- }
-
- Collection <FunctionMethod> methods = null;
- if (udfFile != null) {
- methods = FunctionMetadataReader.loadFunctionMethods(udfFile.openStream());
- }
-
- vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(imf.getMetadataStore())), null, methods);
- VDB_CACHE.put(vdbURL, vdbmetadata);
- return vdbmetadata;
- } catch (URISyntaxException e) {
- throw new IOException(e);
- }
- }
-
-
- private static class VDBContext extends ZipEntryContext{
- private static final long serialVersionUID = -6504988258841073415L;
-
- protected VDBContext(URL url) throws IOException, URISyntaxException {
- super(url,false);
- }
- }
-}
Copied: trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java (from rev 1961, trunk/metadata/src/main/java/org/teiid/metadata/index/VDBMetadataFactory.java)
===================================================================
--- trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java (rev 0)
+++ trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java 2010-03-15 18:24:28 UTC (rev 1963)
@@ -0,0 +1,102 @@
+/*
+ * 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.metadata.index;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.plugins.context.zip.ZipEntryContext;
+import org.teiid.metadata.CompositeMetadataStore;
+import org.teiid.metadata.TransformationMetadata;
+
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.LRUCache;
+import com.metamatrix.query.function.metadata.FunctionMetadataReader;
+import com.metamatrix.query.function.metadata.FunctionMethod;
+import com.metamatrix.query.metadata.QueryMetadataInterface;
+
+public class VDBMetadataFactory {
+
+ public static LRUCache<URL, QueryMetadataInterface> VDB_CACHE = new LRUCache<URL, QueryMetadataInterface>(10);
+
+ public static QueryMetadataInterface getVDBMetadata(String vdbFile) {
+ try {
+ return getVDBMetadata(new File(vdbFile).toURI().toURL(), null);
+ } catch (IOException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ }
+
+ public static QueryMetadataInterface getVDBMetadata(URL vdbURL, URL udfFile) throws IOException {
+ QueryMetadataInterface vdbmetadata = VDB_CACHE.get(vdbURL);
+ if (vdbmetadata != null) {
+ return vdbmetadata;
+ }
+
+ try {
+ VFS.init();
+ VDBContext vdbContext = new VDBContext(vdbURL);
+ VirtualFile vdbFile = new VirtualFile(vdbContext.getRoot());
+
+ List<VirtualFile> children = vdbFile.getChildrenRecursively(new VirtualFileFilter() {
+ @Override
+ public boolean accepts(VirtualFile file) {
+ return file.getName().endsWith(IndexConstants.NAME_DELIM_CHAR+IndexConstants.INDEX_EXT);
+ }
+ });
+
+ IndexMetadataFactory imf = new IndexMetadataFactory();
+ for (VirtualFile f: children) {
+ imf.addIndexFile(f);
+ }
+
+ Collection <FunctionMethod> methods = null;
+ if (udfFile != null) {
+ methods = FunctionMetadataReader.loadFunctionMethods(udfFile.openStream());
+ }
+
+ vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(imf.getMetadataStore())), null, methods);
+ VDB_CACHE.put(vdbURL, vdbmetadata);
+ return vdbmetadata;
+ } catch (URISyntaxException e) {
+ throw new IOException(e);
+ }
+ }
+
+
+ private static class VDBContext extends ZipEntryContext{
+ private static final long serialVersionUID = -6504988258841073415L;
+
+ protected VDBContext(URL url) throws IOException, URISyntaxException {
+ super(url,false);
+ }
+ }
+}
Property changes on: trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 2 months
teiid SVN: r1962 - in trunk: client/src/main/java/org/teiid/adminapi and 11 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-15 13:15:42 -0400 (Mon, 15 Mar 2010)
New Revision: 1962
Added:
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java
Removed:
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java
Modified:
trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb
trunk/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
Log:
TEIID-910, TEIID-833: Adding the provision to update the VDBMetadata artifact through ProfileService. Using this JON and Admin API can issue "assignConnectorBinding" calls on the VDB.
Modified: trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
===================================================================
--- trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml 2010-03-15 17:15:42 UTC (rev 1962)
@@ -10,9 +10,15 @@
<bean name="VDBParserDeployer" class="org.teiid.deployers.VDBParserDeployer">
<property name="objectSerializer"><inject bean="ObjectSerializer"/></property>
+ <property name="managedObjectFactory"><inject bean="ManagedObjectFactory"/></property>
</bean>
-
+ <bean name="VDBMetaDataInstanceClassFactory" class="org.teiid.jboss.deployers.VDBMetaDataInstanceClassFactory">
+ <constructor>
+ <parameter><inject bean="ManagedObjectFactory"/></parameter>
+ </constructor>
+ </bean>
+
<bean name="DynamicVDBDeployer" class="org.teiid.deployers.DynamicVDBDeployer">
</bean>
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -35,27 +35,19 @@
/**
* Assign a {@link ConnectorBinding} to a {@link VDB}'s Model
*
- * @param connectorBindingName
- * Name of the ConnectorBinding
- * @param vdbName
- * Name of the VDB
- * @param vdbVersion
- * Version of the VDB
- * @param modelName
- * Name of the Model to map Connector Binding
- * @throws AdminException
- * if there's a system error or if there's a user input error.
+ * @param vdbName Name of the VDB
+ * @param vdbVersion Version of the VDB
+ * @param modelName Name of the Model to map Connector Binding
+ * @param sourceName sourceName for the model
+ * @param jndiName JNDI names to which the source name needs to map to
+ * @throws AdminException if there's a system error or if there's a user input error.
*/
void assignBindingToModel(String vdbName,
int vdbVersion,
String modelName,
- String connectorBindingName) throws AdminException;
+ String sourceName,
+ String jndiName) throws AdminException;
- void assignBindingsToModel(String vdbName,
- int vdbVersion,
- String modelName,
- String[] connectorBindingName) throws AdminException;
-
/**
* Set/update the property for the Connector Binding identified by the given deployed name.
* @param deployedName
@@ -338,20 +330,6 @@
void terminateTransaction(String transactionId) throws AdminException;
/**
- * Stop the Teiid. If millisToWait is >0, then close to incoming queries, wait the time period
- * for work to stop, then stop the MM Query. Otherwise, stop immediately, aborting all running queries.
- * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
- * @throws AdminException
- */
- void shutdown(int millisToWait) throws AdminException;
-
- /**
- * Restart System
- * @throws AdminException if there's a system error.
- */
- void restart() throws AdminException;
-
- /**
* Adds JDBC XA Data Source in the container.
* @param dsName - name of the source
* @param properties - properties
Modified: trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -29,13 +29,6 @@
public abstract class TeiidAdmin implements Admin, Serializable {
@Override
- public void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String connectorBindingName)
- throws AdminException {
- throw new AdminProcessingException("feature coming soon..");
- }
-
-
- @Override
public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
//list.add(manager.getProcess());
@@ -43,16 +36,6 @@
}
@Override
- public void restart() throws AdminException {
- throw new AdminProcessingException("feature coming soon..");
- }
-
- @Override
- public void shutdown(int millisToWait) throws AdminException {
- throw new AdminProcessingException("feature coming soon..");
- }
-
- @Override
public void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException {
throw new AdminProcessingException("feature coming soon..");
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -69,15 +69,26 @@
public void setProperties(Properties props) {
this.properties.clear();
- for (String key:props.stringPropertyNames()) {
- addProperty(key, props.getProperty(key));
+ if (props != null) {
+ for (String key:props.stringPropertyNames()) {
+ addProperty(key, props.getProperty(key));
+ }
}
}
- protected List<PropertyMetadata> getJAXBProperties(){
+ public List<PropertyMetadata> getJAXBProperties(){
return properties;
}
+ public void setJAXBProperties(List<PropertyMetadata> props){
+ this.properties.clear();
+ if (props != null) {
+ for (PropertyMetadata prop:props) {
+ addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+
@Override
public String getPropertyValue(String name) {
PropertyMetadata prop = this.properties.getMap().get(name);
@@ -103,7 +114,7 @@
*/
public <T> T addAttchment(Class<T> type, T attachment) {
if (type == null)
- throw new IllegalArgumentException("Null type");
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
Object result = this.attachments.put(type.getName(), attachment);
if (result == null)
return null;
@@ -113,7 +124,7 @@
public Object addAttchment(String key, Object attachment) {
if (key == null)
- throw new IllegalArgumentException("Null type");
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
Object result = this.attachments.put(key, attachment);
if (result == null)
return null;
@@ -130,7 +141,7 @@
*/
public <T> T removeAttachment(Class<T> type) {
if (type == null)
- throw new IllegalArgumentException("Null type");
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
Object result = this.attachments.remove(type.getName());
if (result == null)
return null;
@@ -139,7 +150,7 @@
public Object removeAttachment(String key) {
if (key == null)
- throw new IllegalArgumentException("Null type");
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
Object result = this.attachments.remove(key);
if (result == null)
return null;
@@ -155,7 +166,7 @@
*/
public <T> T getAttachment(Class<T> type) {
if (type == null)
- throw new IllegalArgumentException("Null type");
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
Object result = this.attachments.get(type.getName());
if (result == null)
return null;
@@ -164,7 +175,7 @@
public Object getAttachment(String key) {
if (key == null)
- throw new IllegalArgumentException("Null type");
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
Object result = this.attachments.get(key);
if (result == null)
return null;
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -42,13 +42,13 @@
@Override
@ManagementProperty(description="RAR file name", readOnly=true)
public String getRARFileName() {
- return getPropertyValue("rar-name");
+ return getPropertyValue("rar-name"); //$NON-NLS-1$
}
@Override
@ManagementProperty(description="JNDI name", readOnly=true)
public String getJNDIName() {
- return getPropertyValue("jndi-name");
+ return getPropertyValue("jndi-name"); //$NON-NLS-1$
}
public void setComponentType(Object type) {
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -75,7 +75,7 @@
@XmlElement(name = "validation-error")
protected List<ValidationError> errors;
- @ManagementProperty(description="Model Name", readOnly=true)
+ @ManagementProperty(description="Model Name")
@ManagementObjectID(type="model")
@XmlAttribute(name = "name", required = true)
public String getName() {
@@ -88,24 +88,24 @@
}
@Override
- @ManagementProperty(description = "Is Model Source model", readOnly=true)
+ @ManagementProperty(description = "Is Model Source model")
public boolean isSource() {
return ModelType.parseString(modelType.toUpperCase()) == ModelType.PHYSICAL;
}
@Override
- @ManagementProperty(description = "Is Model Visible", readOnly=true)
+ @ManagementProperty(description = "Is Model Visible")
public boolean isVisible() {
return this.visible;
}
@Override
- @ManagementProperty(description = "Model Type", readOnly=true)
+ @ManagementProperty(description = "Model Type")
public Type getModelType() {
return Type.valueOf(modelType);
}
- @ManagementProperty(description = "Path to model file inside the archive", readOnly=true)
+ @ManagementProperty(description = "Path to model file inside the archive")
public String getPath() {
return path;
}
@@ -115,21 +115,21 @@
}
@Override
- @ManagementProperty(description = "Does Model supports multi-source bindings", readOnly=true)
+ @ManagementProperty(description = "Does Model supports multi-source bindings")
public boolean isSupportsMultiSourceBindings() {
String supports = getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY);
return Boolean.parseBoolean(supports);
}
@Override
- @ManagementProperty(description = "Properties", readOnly=true)
public Properties getProperties() {
return new Properties(super.getProperties());
}
@Override
@XmlElement(name = "property", type = PropertyMetadata.class)
- protected List<PropertyMetadata> getJAXBProperties(){
+ @ManagementProperty(description = "Model Properties", managed=true)
+ public List<PropertyMetadata> getJAXBProperties(){
return super.getJAXBProperties();
}
@@ -154,6 +154,12 @@
return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
}
+ public void setSourceMappings(List<SourceMappingMetadata> sources){
+ for (SourceMappingMetadata source: sources) {
+ addSourceMapping(source.getName(), source.getJndiName());
+ }
+ }
+
@Override
public List<String> getSourceNames() {
return new ArrayList<String>(this.sources.getMap().keySet());
@@ -206,7 +212,7 @@
this.value = msg;
}
- @ManagementProperty (description="Error Message", readOnly = true)
+ @ManagementProperty (description="Error Message")
@ManagementObjectID(type="error")
public String getValue() {
return value;
@@ -216,7 +222,7 @@
this.value = value;
}
- @ManagementProperty (description="Severity", readOnly = true)
+ @ManagementProperty (description="Severity")
public String getSeverity() {
return severity;
}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -1,110 +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.lang.reflect.Type;
-import java.util.Properties;
-
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.PropertiesMetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
-import org.jboss.metatype.spi.values.MetaMapper;
-
-public class ModelMetadataMapper extends MetaMapper<ModelMetaData> {
- private static final MutableCompositeMetaType metaType;
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- static {
- metaType = new MutableCompositeMetaType(ModelMetaData.class.getName(), "The Model meta data");
- metaType.addItem("name", "name", SimpleMetaType.STRING);
- metaType.addItem("visible", "visible", SimpleMetaType.BOOLEAN_PRIMITIVE);
- metaType.addItem("modelType", "modelType", SimpleMetaType.STRING);
-
-
-
- //metaType.addItem("properties", "properties", new MapCompositeMetaType());
- metaType.freeze();
- }
-
- @Override
- public Type mapToType() {
- return ModelMetaData.class;
- }
-
- @Override
- public MetaType getMetaType() {
- return metaType;
- }
-
- @Override
- public MetaValue createMetaValue(MetaType metaType, ModelMetaData object) {
- if (object == null)
- return null;
- if (metaType instanceof CompositeMetaType) {
- CompositeMetaType composite = (CompositeMetaType) metaType;
- CompositeValueSupport request = new CompositeValueSupport(composite);
-
- request.set("modelType", SimpleValueSupport.wrap(object.getModelType().name()));
- request.set("visible", SimpleValueSupport.wrap(object.isVisible()));
- request.set("name",SimpleValueSupport.wrap(object.getName()));
- request.set("properties", new PropertiesMetaValue(object.getProperties()));
-
- return request;
- }
- throw new IllegalArgumentException("Cannot convert request " + object);
- }
-
- @Override
- public ModelMetaData unwrapMetaValue(MetaValue metaValue) {
- if (metaValue == null)
- return null;
-
- if (metaValue instanceof CompositeValue) {
- CompositeValue compositeValue = (CompositeValue) metaValue;
-
- ModelMetaData model = new ModelMetaData();
- String type = (String) metaValueFactory.unwrap(compositeValue.get("modelType"));
- if (type != null) {
- model.setModelType(type);
- }
- else {
- model.setModelType("PHYSICAL");
- }
-
- model.setVisible((Boolean) metaValueFactory.unwrap(compositeValue.get("visible")));
- model.setName((String) metaValueFactory.unwrap(compositeValue.get("name")));
- model.setProperties((Properties) metaValueFactory.unwrap(compositeValue.get("properties")));
- return model;
- }
- throw new IllegalStateException("Unable to unwrap request " + metaValue);
- }
-
-}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -29,6 +29,11 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
/**
* <pre>
* <complexType name="property">
@@ -45,6 +50,7 @@
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "property")
+(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
public class PropertyMetadata implements Serializable{
private static final long serialVersionUID = -5040224539939758816L;
@@ -61,10 +67,13 @@
this.value = value;
}
+ @ManagementProperty(description="property key")
+ @ManagementObjectID(type="property")
public String getName() {
return name;
}
+ @ManagementProperty(description="property value")
public String getValue() {
return value;
}
@@ -78,6 +87,6 @@
}
public String toString() {
- return this.name+"="+this.value;
+ return this.name+"="+this.value; //$NON-NLS-1$
}
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -55,7 +55,7 @@
this.jndiName = jndiName;
}
- @ManagementProperty (description="Source Name", readOnly = true)
+ @ManagementProperty (description="Source Name")
@ManagementObjectID(type="sourceMapping")
public String getName() {
return name;
@@ -69,7 +69,7 @@
public String getJndiName() {
// this default could be controlled if needed.
if (this.jndiName == null) {
- return "java:"+name;
+ return "java:"+name; //$NON-NLS-1$
}
return jndiName;
}
@@ -79,6 +79,6 @@
}
public String toString() {
- return getName()+":"+getJndiName();
+ return getName()+":"+getJndiName(); //$NON-NLS-1$
}
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -37,14 +37,14 @@
import org.jboss.managed.api.annotation.ManagementComponent;
import org.jboss.managed.api.annotation.ManagementObject;
import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="vdb"))
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="vdb"), properties=ManagementProperties.EXPLICIT)
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "", propOrder = {
"description",
@@ -91,7 +91,7 @@
// auto add sytem model.
}
- @ManagementProperty(description="Name of the VDB", readOnly=true)
+ @ManagementProperty(description="Name of the VDB")
@ManagementObjectID(type="vdb")
@XmlAttribute(name = "name", required = true)
public String getName() {
@@ -104,7 +104,7 @@
}
@Override
- @ManagementProperty(description="VDB Status")
+ @ManagementProperty(description="VDB Status", readOnly=true)
public Status getStatus() {
String status = getPropertyValue(STATUS_KEY);
if (status != null) {
@@ -128,7 +128,7 @@
}
@Override
- @ManagementProperty(description = "The VDB file url", readOnly=true)
+ @ManagementProperty(description = "The VDB file url")
public String getUrl() {
return this.fileUrl;
}
@@ -143,12 +143,24 @@
return new ArrayList<Model>(this.models.getMap().values());
}
+ /**
+ * This method required to make the JNDI assignment on the model work; if not present Management framework
+ * treating "models" as ReadOnly property.
+ * @param models
+ */
+ public void setModels(List<Model> models) {
+ for (Model obj : models) {
+ ModelMetaData model = (ModelMetaData) obj;
+ addModel(model);
+ }
+ }
+
public void addModel(ModelMetaData m) {
this.models.getMap().put(m.getName(), m);
}
-
+
@Override
- @ManagementProperty(description = "Description", readOnly=true)
+ @ManagementProperty(description = "Description")
public String getDescription() {
return this.description;
}
@@ -204,7 +216,6 @@
return getName()+"."+getVersion()+ models.getMap().values(); //$NON-NLS-1$
}
- @ManagementOperation(description = "Get the model with given name")
public ModelMetaData getModel(String modelName) {
return this.models.getMap().get(modelName);
}
@@ -228,9 +239,7 @@
this.securityRoleMappings.getMap().put(data.getRefName(), data);
}
- // this one manages the Management API
@Override
- @ManagementProperty(description = "Properties", readOnly=true)
public Properties getProperties() {
return super.getProperties();
}
@@ -238,7 +247,8 @@
// This one manages the JAXB binding
@Override
@XmlElement(name = "property", type = PropertyMetadata.class)
- protected List<PropertyMetadata> getJAXBProperties(){
+ @ManagementProperty(description = "VDB Properties", managed=true)
+ public List<PropertyMetadata> getJAXBProperties(){
return super.getJAXBProperties();
}
Modified: trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -25,7 +25,10 @@
import org.teiid.connector.basic.DefaultConnectorLogger;
public interface LogConstants {
- // add the new contexts to the Log4JUtil.java class, for configuration purpose
+ /*
+ * important:
+ * Must need to add the new contexts to the Log4JUtil.java class, for configuration purpose
+ */
public static final String CTX_SESSION = "SESSION"; //$NON-NLS-1$
public static final String CTX_MEMBERSHIP = "MEMBERSHIP"; //$NON-NLS-1$
public static final String CTX_AUTHORIZATION = "AUTHORIZATION"; //$NON-NLS-1$
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -47,7 +47,10 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
import org.jboss.metatype.api.values.CollectionValueSupport;
import org.jboss.metatype.api.values.MapCompositeValueSupport;
import org.jboss.metatype.api.values.MetaValue;
@@ -446,7 +449,11 @@
}
vdb.setVersion(ManagedUtil.getSimpleValue(mc, "version", Integer.class));//$NON-NLS-1$
vdb.setUrl(mc.getDeployment().getName());
- vdb.setProperties(ManagedUtil.getPropertiesValue(mc, "properties"));//$NON-NLS-1$
+ ManagedProperty prop = mc.getProperty("JAXBProperties"); //$NON-NLS-1$
+ List<ManagedObject> properties = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(prop.getValue());
+ for (ManagedObject managedProperty:properties) {
+ vdb.addProperty(ManagedUtil.getSimpleValue(managedProperty, "name", String.class), ManagedUtil.getSimpleValue(managedProperty, "value", String.class)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
// models
ManagedProperty mp = mc.getProperty("models");//$NON-NLS-1$
@@ -461,15 +468,19 @@
return vdb;
}
- private ModelMetaData buildModel(ManagedObject mc) {
+ private ModelMetaData buildModel(ManagedObject managedModel) {
ModelMetaData model = new ModelMetaData();
- model.setName(ManagedUtil.getSimpleValue(mc, "name", String.class));//$NON-NLS-1$
- model.setVisible(ManagedUtil.getSimpleValue(mc, "visible", Boolean.class));//$NON-NLS-1$
- model.setModelType(ManagedUtil.getSimpleValue(mc, "modelType", String.class));//$NON-NLS-1$
- model.setProperties(ManagedUtil.getPropertiesValue(mc, "properties"));//$NON-NLS-1$
+ model.setName(ManagedUtil.getSimpleValue(managedModel, "name", String.class));//$NON-NLS-1$
+ model.setVisible(ManagedUtil.getSimpleValue(managedModel, "visible", Boolean.class));//$NON-NLS-1$
+ model.setModelType(ManagedUtil.getSimpleValue(managedModel, "modelType", String.class));//$NON-NLS-1$
+
+ ManagedProperty prop = managedModel.getProperty("JAXBProperties"); //$NON-NLS-1$
+ List<ManagedObject> properties = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(prop.getValue());
+ for (ManagedObject managedProperty:properties) {
+ model.addProperty(ManagedUtil.getSimpleValue(managedProperty, "name", String.class), ManagedUtil.getSimpleValue(managedProperty, "value", String.class)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
-
- ManagedProperty sourceMappings = mc.getProperty("sourceMappings");//$NON-NLS-1$
+ ManagedProperty sourceMappings = managedModel.getProperty("sourceMappings");//$NON-NLS-1$
if (sourceMappings != null){
List<ManagedObject> mappings = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(sourceMappings.getValue());
for (ManagedObject mo:mappings) {
@@ -479,7 +490,7 @@
}
}
- ManagedProperty validationErrors = mc.getProperty("errors");//$NON-NLS-1$
+ ManagedProperty validationErrors = managedModel.getProperty("errors");//$NON-NLS-1$
if (validationErrors != null) {
List<ManagedObject> errors = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(validationErrors.getValue());
if (errors != null) {
@@ -872,44 +883,52 @@
@Override
- public void assignBindingsToModel(String vdbName, int vdbVersion, String modelName, String[] connectorBindingNames) throws AdminException {
+ public void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String sourceName, String jndiName) throws AdminException {
-// ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
-// if (mc == null) {
-// throw new AdminProcessingException("VDB with name = "+vdbName + " version = "+ vdbVersion + " not found in configuration");
-// }
-// VDBMetaData vdb = buildVDB(mc);
-// ModelMetaData model = vdb.getModel(modelName);
-// if (model == null) {
-// throw new AdminProcessingException("Model name = "+modelName+" not found in the VDB with name = "+vdbName + " version = "+ vdbVersion);
-// }
-//
-// String referenceName = model.getConnectorReference();
-// ArrayList<MetaValue> newBindings = new ArrayList<MetaValue>();
-// for (String name:connectorBindingNames) {
-// newBindings.add(new SimpleValueSupport(SimpleMetaType.STRING, name));
-// }
-//
-// ManagedProperty mappings = mc.getProperty("connectorMappings");
-// MetaValue[] elements = ((CollectionValueSupport)mappings.getValue()).getElements();
-// ArrayList<MetaValue> modifiedElements = new ArrayList<MetaValue>();
-// for (MetaValue mv:elements) {
-// MetaValue value = ((CompositeValueSupport)mv).get("refName");
-// if (value != null && ManagedUtil.stringValue(value).equals(referenceName)) {
-// CollectionValueSupport bindings = (CollectionValueSupport)((CompositeValueSupport)mv).get("resourceNames");
-// bindings.setElements(newBindings.toArray(new MetaValue[newBindings.size()]));
-// }
-// else {
-// modifiedElements.add(mv);
-// }
-// }
-//
-// try {
-// getView().updateComponent(mc);
-// } catch (Exception e) {
-// throw new AdminComponentException(e.getMessage(), e);
-// }
- throw new AdminProcessingException("feature coming soon..");//$NON-NLS-1$
+ ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
+ if (mc == null) {
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
+ }
+
+ ManagedProperty mp = mc.getProperty("models");//$NON-NLS-1$
+ List<ManagedObject> models = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(mp.getValue());
+ ManagedObject managedModel = null;
+ if (models != null && !models.isEmpty()) {
+ for(ManagedObject mo:models) {
+ String name = ManagedUtil.getSimpleValue(mo, "name", String.class); //$NON-NLS-1$
+ if (modelName.equals(name)) {
+ managedModel = mo;
+ }
+ }
+ }
+
+ if (managedModel == null) {
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("model_not_found", modelName, vdbName, vdbVersion)); //$NON-NLS-1$
+ }
+
+ ManagedProperty sourceMappings = managedModel.getProperty("sourceMappings");//$NON-NLS-1$
+ if (sourceMappings != null){
+ List<ManagedObject> mappings = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(sourceMappings.getValue());
+ for (ManagedObject mo:mappings) {
+ String sName = ManagedUtil.getSimpleValue(mo, "name", String.class);//$NON-NLS-1$
+ if (sName.equals(sourceName)) {
+ ManagedProperty jndiProperty = mo.getProperty("jndiName"); //$NON-NLS-1$
+ if (jndiProperty == null) {
+ jndiProperty = new WritethroughManagedPropertyImpl(mo, new DefaultFieldsImpl("jndiName")); //$NON-NLS-1$
+ }
+ jndiProperty.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, jndiName));
+ }
+ }
+ } else {
+ //TODO: this can be in the default situation when no source mappings are specified
+ throw new AdminProcessingException(IntegrationPlugin.Util.getString("sourcename_not_found", sourceName, vdbName, vdbVersion, modelName)); //$NON-NLS-1$
+ }
+
+ try {
+ getView().updateComponent(mc);
+ } catch (Exception e) {
+ throw new AdminComponentException(e.getMessage(), e);
+ }
}
}
Added: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -0,0 +1,82 @@
+/*
+ * 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.jboss.deployers;
+
+import java.util.List;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.jboss.ManagedUtil;
+
+public class VDBMetaDataInstanceClassFactory extends AbstractInstanceClassFactory<VDBMetaData> {
+
+ public VDBMetaDataInstanceClassFactory() {
+ }
+
+ public VDBMetaDataInstanceClassFactory(ManagedObjectFactory mof) {
+ super(mof);
+ }
+
+ @Override
+ public Class<VDBMetaData> getType() {
+ return VDBMetaData.class;
+ }
+
+ @Override
+ public void setValue(BeanInfo beanInfo, ManagedProperty property, VDBMetaData vdb, MetaValue value) {
+
+ if (property.getName().equals("models")) { //$NON-NLS-1$
+ List<ManagedObject> models = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(property.getValue());
+ for(ManagedObject managedModel:models) {
+ String modelName = ManagedUtil.getSimpleValue(managedModel, "name", String.class); //$NON-NLS-1$
+ ModelMetaData model = vdb.getModel(modelName);
+
+ ManagedProperty sourceMappings = managedModel.getProperty("sourceMappings");//$NON-NLS-1$
+ if (sourceMappings != null){
+ List<ManagedObject> mappings = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(sourceMappings.getValue());
+ for (ManagedObject mo:mappings) {
+ String name = ManagedUtil.getSimpleValue(mo, "name", String.class);//$NON-NLS-1$
+ String jndiName = ManagedUtil.getSimpleValue(mo, "jndiName", String.class);//$NON-NLS-1$
+ model.addSourceMapping(name, jndiName);
+ }
+ }
+ }
+ }
+ else if (property.getName().equals("JAXBProperties")) { //$NON-NLS-1$
+ List<ManagedObject> properties = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(property.getValue());
+ for (ManagedObject managedProperty:properties) {
+ vdb.addProperty(ManagedUtil.getSimpleValue(managedProperty, "name", String.class), ManagedUtil.getSimpleValue(managedProperty, "value", String.class)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ else {
+ super.setValue(beanInfo, property, vdb, value);
+ }
+ }
+
+}
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetaDataInstanceClassFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/VDBMetadataComponentMapper.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -40,7 +40,7 @@
protected ManagedObject getComponent(Object attachment, PersistedComponent component, boolean create) {
VDBMetaData metadata = (VDBMetaData)attachment;
String vdbName = metadata.getName()+"_"+metadata.getVersion(); //$NON-NLS-1$
- if (vdbName.equals(component.getOriginalName())) {
+ if (vdbName.equals(component.getName())) {
return getMOF().initManagedObject(metadata, VDBMetaData.class, vdbName, vdbName);
}
throw new IllegalStateException("could not find deployment " + component.getOriginalName());//$NON-NLS-1$
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2010-03-15 17:15:42 UTC (rev 1962)
@@ -32,4 +32,7 @@
bad_vdb_extension=The extension of the file name must be either ".vdb" for designer vdb or "xxx-vdb.xml" for dynamic VDBs
bad_connector_type_name="Teiid connector type names must start with \"connector-\""
connector_type_exists=Connector type with name:"{0}" already exists!
-connector_type_not_found=Connector Type template "{0}" not found in the configuration.
\ No newline at end of file
+connector_type_not_found=Connector Type template "{0}" not found in the configuration.
+vdb_not_found=VDB with name "{0}" version "{1}" not found in configuration
+model_not_found=Model name "{0}" not found in the VDB with name "{1}" version "{2}"
+sourcename_not_found=No source name {0} found in the model: {1}.{2}.{3}
\ No newline at end of file
Modified: trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
--- trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/jboss-integration/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -28,7 +28,6 @@
import com.metamatrix.core.util.ObjectConverterUtil;
import com.metamatrix.core.util.UnitTestUtil;
-@Ignore
public class TestConnectorBindings extends BaseConnection {
ServerDatasourceConnection ds;
Admin admin;
@@ -302,14 +301,12 @@
}
@Test public void testAssignConnectorBinding() throws Exception {
+
+ admin.assignBindingToModel("TransactionsRevisited", 1, "pm1", "mysql", "jndi:FOO");
+ }
+
+ @Test public void testVDB() throws Exception {
- VDB vdb = admin.getVDB("TransactionsRevisited", 1);
- if (vdb == null) {
- admin.deleteVDB("TransactionsRevisited", 1);
- File f = UnitTestUtil.getTestDataFile("TransactionsRevisited.vdb");
- admin.deployVDB(f.getName(), f.toURI().toURL());
- }
-
- admin.assignBindingsToModel("TransactionsRevisited", 1, "pm1", new String[] {"java:foo", "java:bar"});
+ admin.getVDB("TransactionsRevisited", 1);
}
}
Modified: trunk/jboss-integration/src/test/resources/TransactionsRevisited.vdb
===================================================================
(Binary files differ)
Modified: trunk/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/runtime/src/main/java/org/teiid/deployers/DynamicVDBDeployer.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -26,13 +26,19 @@
import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.virtual.VirtualFile;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.core.CoreConstants;
+
public class DynamicVDBDeployer extends AbstractVFSParsingDeployer<VDBMetaData> {
public DynamicVDBDeployer() {
super(VDBMetaData.class);
- setSuffix("-vdb.xml");
+ setSuffix("-vdb.xml"); //$NON-NLS-1$
}
@Override
@@ -42,8 +48,18 @@
vdb.setUrl(unit.getRoot().toURL().toExternalForm());
vdb.setDynamic(true);
- log.debug("VDB "+unit.getRoot().getName()+" has been parsed.");
+ // Add system model to the deployed VDB
+ ModelMetaData system = new ModelMetaData();
+ system.setName(CoreConstants.SYSTEM_MODEL);
+ system.setVisible(true);
+ system.setModelType(Model.Type.PHYSICAL.name());
+ system.addSourceMapping(CoreConstants.SYSTEM_MODEL, CoreConstants.SYSTEM_MODEL);
+ system.setSupportsMultiSourceBindings(false);
+ vdb.addModel(system);
+
+ LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+unit.getRoot().getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+
// The loading of metadata from data sources will be done during the real deploy
// as the resources are guaranteed to be available by that time.
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -35,11 +35,11 @@
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.logging.Logger;
import org.jboss.virtual.VirtualFile;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.metadata.runtime.MetadataStore;
@@ -51,13 +51,14 @@
import org.teiid.metadata.index.IndexMetadataFactory;
import org.teiid.runtime.RuntimePlugin;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogConstants;
import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.util.FileUtils;
import com.metamatrix.query.function.metadata.FunctionMethod;
import com.metamatrix.query.metadata.QueryMetadataInterface;
public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> {
- protected Logger log = Logger.getLogger(getClass());
private VDBRepository vdbRepository;
private ConnectorManagerRepository connectorManagerRepository;
private DQPContextCache contextCache;
@@ -73,7 +74,7 @@
public void deploy(DeploymentUnit unit, VDBMetaData deployment) throws DeploymentException {
if (this.vdbRepository.getVDB(deployment.getName(), deployment.getVersion()) != null) {
this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
- log.info(RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
}
List<String> errors = deployment.getValidityErrors();
@@ -81,15 +82,6 @@
throw new DeploymentException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
}
- // Add system model to the deployed VDB
- ModelMetaData system = new ModelMetaData();
- system.setName(CoreConstants.SYSTEM_MODEL);
- system.setVisible(true);
- system.setModelType(Model.Type.PHYSICAL.name());
- system.addSourceMapping("system", "system"); //$NON-NLS-1$ //$NON-NLS-2$
- system.setSupportsMultiSourceBindings(false);
- deployment.addModel(system);
-
// get the metadata store of the VDB (this is build in parse stage)
CompositeMetadataStore store = unit.getAttachment(CompositeMetadataStore.class);
@@ -106,6 +98,10 @@
unit.addAttachment(CompositeMetadataStore.class, store);
}
+ if (store == null) {
+ LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", deployment.getName(), deployment.getVersion())); //$NON-NLS-1$
+ }
+
// check if this is a VDB with index files, if there are then build the TransformationMetadata
TransformationMetadata metadata = null;
IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);
@@ -133,7 +129,7 @@
try {
saveMetadataStore((VFSDeploymentUnit)unit, deployment, metadata.getMetadataStore());
} catch (IOException e1) {
- log.warn(RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion()), e1); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", deployment.getName()+"."+deployment.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
}
boolean valid = validateSources(deployment);
@@ -142,26 +138,26 @@
if (valid) {
deployment.setStatus(VDB.Status.ACTIVE);
}
- log.info(RuntimePlugin.Util.getString("vdb_deployed",deployment)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",deployment)); //$NON-NLS-1$
}
private boolean validateSources(VDBMetaData deployment) {
boolean valid = true;
for(Model m:deployment.getModels()) {
ModelMetaData model = (ModelMetaData)m;
- for (String sourceName:model.getSourceNames()) {
- if (sourceName.equals(CoreConstants.SYSTEM_MODEL)) {
+ List<SourceMappingMetadata> mappings = model.getSourceMappings();
+ for (SourceMappingMetadata mapping:mappings) {
+ if (mapping.getName().equals(CoreConstants.SYSTEM_MODEL)) {
continue;
}
- String jndiName = model.getSourceJndiName(sourceName);
try {
InitialContext ic = new InitialContext();
- ic.lookup(jndiName);
+ ic.lookup(mapping.getJndiName());
} catch (NamingException e) {
valid = false;
- String msg = RuntimePlugin.Util.getString("jndi_not_found", jndiName,sourceName); //$NON-NLS-1$
+ String msg = RuntimePlugin.Util.getString("jndi_not_found", mapping.getJndiName(),mapping.getName()); //$NON-NLS-1$
model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
- log.info(msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
}
}
}
@@ -210,10 +206,10 @@
try {
deleteMetadataStore((VFSDeploymentUnit)unit, deployment);
} catch (IOException e) {
- log.warn(RuntimePlugin.Util.getString("vdb_delete_failed", e.getMessage())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_delete_failed", e.getMessage())); //$NON-NLS-1$
}
- log.info(RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", deployment)); //$NON-NLS-1$
}
public void setContextCache(DQPContextCache cache) {
@@ -258,9 +254,9 @@
return this.serializer.loadAttachment(cacheFile, MetadataStore.class);
}
} catch (IOException e) {
- log.warn(RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
- log.warn(RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -26,6 +26,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
@@ -34,8 +35,12 @@
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
import org.jboss.virtual.VirtualFile;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -46,6 +51,8 @@
import org.teiid.runtime.RuntimePlugin;
import org.xml.sax.SAXException;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogConstants;
import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.core.vdb.VdbConstants;
@@ -53,8 +60,7 @@
/**
* This file loads the "vdb.xml" file inside a ".vdb" file, along with all the metadata in the .INDEX files
*/
-public class VDBParserDeployer extends BaseMultipleVFSParsingDeployer<VDBMetaData> {
- protected Logger log = Logger.getLogger(getClass());
+public class VDBParserDeployer extends BaseMultipleVFSParsingDeployer<VDBMetaData> implements ManagedObjectCreator {
private ObjectSerializer serializer;
public VDBParserDeployer() {
@@ -122,7 +128,7 @@
UDFMetaData udf = getInstance(metadata, UDFMetaData.class);
if (vdb == null) {
- log.error(RuntimePlugin.Util.getString("invlaid_vdb_file",unit.getRoot().getName())); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",unit.getRoot().getName())); //$NON-NLS-1$
return null;
}
@@ -163,7 +169,7 @@
if (model.getModelType().equals(Model.Type.FUNCTION)) {
String path = ((ModelMetaData)model).getPath();
if (path == null) {
- path = model.getName()+VdbConstants.MODEL_EXT;
+ throw new DeploymentException(RuntimePlugin.Util.getString("invalid_udf_file", model.getName())); //$NON-NLS-1$
}
udf.buildFunctionModelFile(path);
}
@@ -173,7 +179,16 @@
unit.addAttachment(UDFMetaData.class, udf);
}
- log.debug("VDB "+unit.getRoot().getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
+ // Add system model to the deployed VDB
+ ModelMetaData system = new ModelMetaData();
+ system.setName(CoreConstants.SYSTEM_MODEL);
+ system.setVisible(true);
+ system.setModelType(Model.Type.PHYSICAL.name());
+ system.addSourceMapping(CoreConstants.SYSTEM_MODEL, CoreConstants.SYSTEM_MODEL);
+ system.setSupportsMultiSourceBindings(false);
+ vdb.addModel(system);
+
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
return vdb;
}
@@ -215,4 +230,31 @@
public void setObjectSerializer(ObjectSerializer serializer) {
this.serializer = serializer;
}
+
+ private ManagedObjectFactory mof;
+
+ @Override
+ public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String, ManagedObject> managedObjects)
+ throws DeploymentException {
+
+ ManagedObject vdbMO = managedObjects.get(VDBMetaData.class.getName());
+ if (vdbMO != null) {
+ VDBMetaData vdb = (VDBMetaData) vdbMO.getAttachment();
+ for (Model m : vdb.getModels()) {
+ if (m.getName().equals(CoreConstants.SYSTEM_MODEL)) {
+ continue;
+ }
+ ManagedObject mo = this.mof.initManagedObject(m, ModelMetaData.class, m.getName(),m.getName());
+ if (mo == null) {
+ throw new DeploymentException("could not create managed object");
+ }
+ managedObjects.put(mo.getName(), mo);
+ }
+ }
+ }
+
+ public void setManagedObjectFactory(ManagedObjectFactory mof) {
+ this.mof = mof;
+ }
+
}
Modified: trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -110,7 +110,13 @@
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_TRANSPORT);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_ADMIN_API);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_QUERY_PLANNER);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_RUNTIME);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_FUNCTION_TREE);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_QUERY_RESOLVER);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_XML_PLANNER);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_XML_PLAN);
+
contexts.add("com.arjuna"); //$NON-NLS-1$
contexts.add("org.jboss"); //$NON-NLS-1$
contexts.add("org.teiid"); //$NON-NLS-1$
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-03-15 17:15:42 UTC (rev 1962)
@@ -291,4 +291,6 @@
udf_model_not_found=User Defined Function (UDF) model "{0}" not found in the VDB
duplicate_vdb=VDB with given name and version already exists! {0}.{1}
system_vdb_not_found=System.vdb not found in classpath
-failed_to_deployed=Failed to deploy {0}
\ No newline at end of file
+failed_to_deployed=Failed to deploy {0}
+invalid_udf_file=No "path" information found to load the FUNCTION model {0}; FUNCTION model must have path information.
+failed_matadata_load=Failed to load metadata for VDB {0}.{1}
\ No newline at end of file
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2010-03-12 21:47:08 UTC (rev 1961)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2010-03-15 17:15:42 UTC (rev 1962)
@@ -206,7 +206,7 @@
api.addConnectorBinding(ds.getName(),ds.getConnectorType(), ds.getProperties());
- api.assignBindingToModel(vdb.getName(), vdb.getVersion(), m.getName(), ds.getName());
+ api.assignBindingToModel(vdb.getName(), vdb.getVersion(), m.getName(), ds.getName(), ds.getProperty("jndi-name"));
api.startConnectorBinding(api.getConnectorBinding(ds.getName()));
} else {
14 years, 2 months