[teiid-commits] teiid SVN: r2853 - in trunk: cache-jbosscache/src/main/java/org/teiid/cache/jboss and 12 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Wed Jan 19 11:19:45 EST 2011
Author: shawkins
Date: 2011-01-19 11:19:44 -0500 (Wed, 19 Jan 2011)
New Revision: 2853
Added:
trunk/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/
trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java
trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java
trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java
trunk/console/src/main/java/org/teiid/rhq/plugin/objects/RequestMetadata.java
trunk/console/src/main/java/org/teiid/rhq/plugin/objects/SessionMetadata.java
trunk/console/src/main/java/org/teiid/rhq/plugin/objects/TransactionMetadata.java
Removed:
trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java
trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java
trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java
Modified:
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
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/PlatformComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
trunk/console/src/main/resources/META-INF/rhq-plugin.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
Log:
forward merge of 7.1.1 and TEIID-1444 fix
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-01-19 16:19:44 UTC (rev 2853)
@@ -51,6 +51,7 @@
<h4>from 7.2</h4>
<ul>
<li>The default JDBC credentials are user/user - not admin/teiid
+ <li>Unordered limits are no longer pushed through conditions, dup removal, or UNION not all. This prevents the possibility of getting less results than the logical intent of the limit.
</ul>
<h4>from 7.1</h4>
<ul>
Modified: trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/ExpirationAwareCache.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -21,6 +21,9 @@
*/
package org.teiid.cache.jboss;
+import java.util.HashSet;
+import java.util.Set;
+
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
@@ -47,4 +50,20 @@
child.put(ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
return (V)child.put(key, value);
}
+
+ @Override
+ public Set<K> keys() {
+ HashSet keys = new HashSet();
+ Node<K, V> node = getRootNode();
+ Set<Node<K, V>> children = node.getChildren();
+ for (Node<K, V> child:children) {
+ for (K key:child.getData().keySet()) {
+ if ((key instanceof String) && (key.equals(ExpirationAlgorithmConfig.EXPIRATION_KEY))) {
+ continue;
+ }
+ keys.add(key);
+ }
+ }
+ return keys;
+ }
}
Modified: trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -78,9 +78,12 @@
@Override
public V remove(K key) {
Node<K, V> node = getRootNode();
- Node child = node.getChild(getFqn(key));
+ Fqn<String> fqn = getFqn(key);
+ Node child = node.getChild(fqn);
if (child != null) {
- return (V)child.remove(key);
+ V value = (V)child.remove(key);
+ node.removeChild(fqn);
+ return value;
}
return null;
}
@@ -88,7 +91,14 @@
@Override
public int size() {
Node<K, V> node = getRootNode();
- return node.getChildren().size();
+ int size = 0;
+ Set<Node<K,V>> nodes = new HashSet<Node<K, V>>(node.getChildren());
+ for (Node<K, V> child : nodes) {
+ if (!child.getData().isEmpty()) {
+ size++;
+ }
+ }
+ return size;
}
@Override
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -36,7 +36,7 @@
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 ID = "id"; //$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$
@@ -48,7 +48,7 @@
metaType.addItem(ASSOCIATED_SESSION, ASSOCIATED_SESSION, SimpleMetaType.STRING);
metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
metaType.addItem(SCOPE, SCOPE, SimpleMetaType.STRING);
- metaType.addItem(XID, XID, SimpleMetaType.STRING);
+ metaType.addItem(ID, ID, SimpleMetaType.STRING);
metaType.freeze();
}
@@ -73,7 +73,7 @@
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$
+ transaction.set(ID, SimpleValueSupport.wrap(object.getId()));
return transaction;
}
@@ -92,7 +92,7 @@
transaction.setAssociatedSession((String) 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$
+ transaction.setId((String) metaValueFactory.unwrap(compositeValue.get(ID)));
return transaction;
}
throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
Copied: trunk/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java (from rev 2852, branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java)
===================================================================
--- trunk/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java (rev 0)
+++ trunk/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -0,0 +1,45 @@
+/*
+ * 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 static org.junit.Assert.*;
+
+import org.jboss.metatype.api.values.MetaValue;
+import org.junit.Test;
+
+ at SuppressWarnings("nls")
+public class TestTransactionMetadata {
+
+ @Test public void testMapping() {
+ TransactionMetadata tm = new TransactionMetadata();
+ tm.setAssociatedSession("x");
+
+ TransactionMetadataMapper tmm = new TransactionMetadataMapper();
+ MetaValue mv = tmm.createMetaValue(tmm.getMetaType(), tm);
+
+ TransactionMetadata tm1 = tmm.unwrapMetaValue(mv);
+
+ assertEquals(tm.getAssociatedSession(), tm1.getAssociatedSession());
+ }
+
+}
Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -40,6 +40,7 @@
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.CompositeValue;
import org.jboss.metatype.api.values.CompositeValueSupport;
import org.jboss.metatype.api.values.GenericValueSupport;
import org.jboss.metatype.api.values.MetaValue;
@@ -47,15 +48,12 @@
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.Request.ProcessingState;
import org.teiid.adminapi.VDB.Status;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.RequestMetadataMapper;
-import org.teiid.adminapi.impl.SessionMetadataMapper;
-import org.teiid.adminapi.impl.TransactionMetadataMapper;
import org.teiid.rhq.plugin.objects.ExecutedResult;
+import org.teiid.rhq.plugin.objects.RequestMetadata;
+import org.teiid.rhq.plugin.objects.SessionMetadata;
+import org.teiid.rhq.plugin.objects.TransactionMetadata;
import org.teiid.rhq.plugin.util.DeploymentUtils;
import org.teiid.rhq.plugin.util.PluginConstants;
import org.teiid.rhq.plugin.util.ProfileServiceUtil;
@@ -68,7 +66,32 @@
private static final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
private static final String VDB_EXT = ".vdb"; //$NON-NLS-1$
+
+ //Session metadata fields
+ 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$
+ //Request metadata fields
+ 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 START_TIME = "startTime"; //$NON-NLS-1$
+ private static final String EXECUTION_ID = "executionId"; //$NON-NLS-1$
+ private static final String STATE = "processingState"; //$NON-NLS-1$
+
+ //Transaction metadata fields
+ private static final String SCOPE = "scope"; //$NON-NLS-1$
+ private static final String ASSOCIATED_SESSION = "associatedSession"; //$NON-NLS-1$
+
public DQPManagementView() {
}
@@ -77,7 +100,7 @@
*/
public Object getMetric(ProfileServiceConnection connection,
String componentType, String identifier, String metric,
- Map<String, Object> valueMap) {
+ Map<String, Object> valueMap) throws Exception {
Object resultObject = new Object();
if (componentType.equals(PluginConstants.ComponentType.Platform.NAME)) {
@@ -89,7 +112,7 @@
}
private Object getPlatformMetric(ProfileServiceConnection connection,
- String componentType, String metric, Map<String, Object> valueMap) {
+ String componentType, String metric, Map<String, Object> valueMap) throws Exception {
Object resultObject = new Object();
@@ -98,7 +121,7 @@
} else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
resultObject = new Double(getSessionCount(connection).doubleValue());
} else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
- Collection<Request> longRunningQueries = new ArrayList<Request>();
+ Collection<RequestMetadata> longRunningQueries = new ArrayList<RequestMetadata>();
getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
resultObject = new Double(longRunningQueries.size());
} else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
@@ -126,7 +149,7 @@
private Object getVdbMetric(ProfileServiceConnection connection,
String componentType, String identifier, String metric,
- Map<String, Object> valueMap) {
+ Map<String, Object> valueMap) throws Exception {
Object resultObject = new Object();
@@ -141,7 +164,7 @@
} else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
resultObject = new Double(getSessionCount(connection).doubleValue());
} else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
- Collection<Request> longRunningQueries = new ArrayList<Request>();
+ Collection<RequestMetadata> longRunningQueries = new ArrayList<RequestMetadata>();
getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
resultObject = new Double(longRunningQueries.size());
}
@@ -164,10 +187,10 @@
private void executePlatformOperation(ProfileServiceConnection connection,
ExecutedResult operationResult, final String operationName,
- final Map<String, Object> valueMap) {
- Collection<Request> resultObject = new ArrayList<Request>();
- Collection<Session> activeSessionsCollection = new ArrayList<Session>();
- Collection<Transaction> transactionsCollection = new ArrayList<Transaction>();
+ final Map<String, Object> valueMap) throws Exception {
+ Collection<RequestMetadata> resultObject = new ArrayList<RequestMetadata>();
+ Collection<SessionMetadata> activeSessionsCollection = new ArrayList<SessionMetadata>();
+ Collection<TransactionMetadata> transactionsCollection = new ArrayList<TransactionMetadata>();
if (operationName.equals(Platform.Operations.GET_LONGRUNNINGQUERIES)) {
List<String> fieldNameList = operationResult.getFieldNameList();
@@ -221,15 +244,8 @@
} else if (operationName.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
String vdbUrl = (String) valueMap.get(Operation.Value.VDB_URL);
String deployName = (String) valueMap.get(Operation.Value.VDB_DEPLOY_NAME);
- Object vdbVersion = valueMap.get(Operation.Value.VDB_VERSION);
- // strip off vdb extension if user added it
- if (deployName.endsWith(VDB_EXT)) {
- deployName = deployName.substring(0, deployName.lastIndexOf(VDB_EXT));
- }
- if (vdbVersion != null) {
- deployName = deployName + "." + ((Integer) vdbVersion).toString() + VDB_EXT; //$NON-NLS-1$
- }
- // add vdb extension if there was no version
+
+ // add vdb extension if missing
if (!deployName.endsWith(VDB_EXT)) {
deployName = deployName + VDB_EXT;
}
@@ -249,8 +265,8 @@
ExecutedResult operationResult, final String operationName,
final Map<String, Object> valueMap) throws Exception {
Collection<ArrayList<String>> sqlResultsObject = new ArrayList<ArrayList<String>>();
- Collection<Request> resultObject = new ArrayList<Request>();
- Collection<Session> activeSessionsCollection = new ArrayList<Session>();
+ Collection<RequestMetadata> resultObject = new ArrayList<RequestMetadata>();
+ Collection<SessionMetadata> activeSessionsCollection = new ArrayList<SessionMetadata>();
String vdbName = (String) valueMap.get(PluginConstants.ComponentType.VDB.NAME);
vdbName = formatVdbName(vdbName);
String vdbVersion = (String) valueMap.get(PluginConstants.ComponentType.VDB.VERSION);
@@ -565,12 +581,12 @@
throw new Exception("No property found with given name =" + property); //$NON-NLS-1$
}
- private Integer getQueryCount(ProfileServiceConnection connection) {
+ private Integer getQueryCount(ProfileServiceConnection connection) throws Exception {
Integer count = new Integer(0);
MetaValue requests = null;
- Collection<Request> requestsCollection = new ArrayList<Request>();
+ Collection<RequestMetadata> requestsCollection = new ArrayList<RequestMetadata>();
requests = getRequests(connection);
@@ -583,9 +599,9 @@
return count;
}
- private Integer getSessionCount(ProfileServiceConnection connection) {
+ private Integer getSessionCount(ProfileServiceConnection connection) throws Exception {
- Collection<Session> activeSessionsCollection = new ArrayList<Session>();
+ Collection<SessionMetadata> activeSessionsCollection = new ArrayList<SessionMetadata>();
MetaValue sessionMetaValue = getSessions(connection);
getSessionCollectionValue(sessionMetaValue, activeSessionsCollection);
return activeSessionsCollection.size();
@@ -677,13 +693,12 @@
return usedBufferSpace;
}
- private void getRequestCollectionValue(MetaValue pValue, Collection<Request> list) {
+ private void getRequestCollectionValue(MetaValue pValue, Collection<RequestMetadata> list) throws Exception {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
- RequestMetadataMapper rmm = new RequestMetadataMapper();
- RequestMetadata request = rmm.unwrapMetaValue(value);
+ RequestMetadata request = unwrapRequestMetaValue(value);
list.add(request);
} else {
throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
@@ -722,13 +737,12 @@
}
}
- public static <T> void getTransactionCollectionValue(MetaValue pValue, Collection<Transaction> list) {
+ public <T> void getTransactionCollectionValue(MetaValue pValue, Collection<TransactionMetadata> list) throws Exception {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
- TransactionMetadataMapper tmm = new TransactionMetadataMapper();
- Transaction transaction = tmm.unwrapMetaValue(value);
+ TransactionMetadata transaction = unwrapTransactionMetaValue(value);
list.add(transaction);
} else {
throw new IllegalStateException(pValue
@@ -738,13 +752,12 @@
}
}
- public static <T> void getSessionCollectionValue(MetaValue pValue,Collection<Session> list) {
+ public <T> void getSessionCollectionValue(MetaValue pValue,Collection<SessionMetadata> list) throws Exception {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
- SessionMetadataMapper rmm = new SessionMetadataMapper();
- Session session = rmm.unwrapMetaValue(value);
+ SessionMetadata session = unwrapSessionMetaValue(value);
list.add(session);
} else {
throw new IllegalStateException(pValue
@@ -754,14 +767,13 @@
}
}
- public static <T> void getSessionCollectionValueForVDB(MetaValue pValue,Collection<Session> list, String vdbName) throws Exception {
+ public <T> void getSessionCollectionValueForVDB(MetaValue pValue,Collection<SessionMetadata> list, String vdbName) throws Exception {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
if (value.getMetaType().isComposite()) {
if (ProfileServiceUtil.stringValue(((CompositeValueSupport)value).get("VDBName")).equals(vdbName)) { //$NON-NLS-1$
- SessionMetadataMapper rmm = new SessionMetadataMapper();
- Session session = rmm.unwrapMetaValue(value);
+ SessionMetadata session = unwrapSessionMetaValue(value);
list.add(session);
}
} else {
@@ -819,5 +831,66 @@
}
return reportResultList;
}
+
+ public SessionMetadata unwrapSessionMetaValue(MetaValue metaValue) throws Exception {
+ if (metaValue == null)
+ return null;
+ if (metaValue instanceof CompositeValue) {
+ CompositeValueSupport compositeValue = (CompositeValueSupport) metaValue;
+
+ SessionMetadata session = new SessionMetadata();
+ session.setApplicationName((String) ProfileServiceUtil.stringValue(compositeValue.get(APPLICATION_NAME)));
+ session.setCreatedTime((Long) ProfileServiceUtil.longValue(compositeValue.get(CREATED_TIME)));
+ session.setClientHostName((String) ProfileServiceUtil.stringValue(compositeValue.get(CLIENT_HOST_NAME)));
+ session.setIPAddress((String) ProfileServiceUtil.stringValue(compositeValue.get(IP_ADDRESS)));
+ session.setLastPingTime((Long) ProfileServiceUtil.longValue(compositeValue.get(LAST_PING_TIME)));
+ session.setSessionId((String) ProfileServiceUtil.stringValue(compositeValue.get(SESSION_ID)));
+ session.setUserName((String) ProfileServiceUtil.stringValue(compositeValue.get(USER_NAME)));
+ session.setVDBName((String) ProfileServiceUtil.stringValue(compositeValue.get(VDB_NAME)));
+ session.setVDBVersion((Integer) ProfileServiceUtil.integerValue(compositeValue.get(VDB_VERSION)));
+ session.setSecurityDomain((String) ProfileServiceUtil.stringValue(compositeValue.get(SECURITY_DOMAIN)));
+ return session;
+ }
+ throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$
+ }
+
+ public RequestMetadata unwrapRequestMetaValue(MetaValue metaValue) throws Exception {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ RequestMetadata request = new RequestMetadata();
+ request.setExecutionId((Long) ProfileServiceUtil.longValue(compositeValue.get(EXECUTION_ID)));
+ request.setSessionId((String) ProfileServiceUtil.stringValue(compositeValue.get(SESSION_ID)));
+ request.setStartTime((Long) ProfileServiceUtil.longValue(compositeValue.get(START_TIME)));
+ request.setCommand((String) ProfileServiceUtil.stringValue(compositeValue.get(COMMAND)));
+ request.setSourceRequest((Boolean) ProfileServiceUtil.booleanValue(compositeValue.get(SOURCE_REQUEST)));
+ request.setNodeId((Integer) ProfileServiceUtil.integerValue(compositeValue.get(NODE_ID)));
+ request.setTransactionId((String) ProfileServiceUtil.stringValue(compositeValue.get(TRANSACTION_ID)));
+ request.setState((ProcessingState) ProfileServiceUtil.getSimpleValue(compositeValue.get(STATE), ProcessingState.class));
+ return request;
+ }
+ throw new IllegalStateException("Unable to unwrap RequestMetadata " + metaValue); //$NON-NLS-1$
+ }
+
+ public TransactionMetadata unwrapTransactionMetaValue(MetaValue metaValue) throws Exception {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ TransactionMetadata transaction = new TransactionMetadata();
+ transaction.setAssociatedSession((String) ProfileServiceUtil.stringValue(compositeValue.get(ASSOCIATED_SESSION)));
+ transaction.setCreatedTime((Long) ProfileServiceUtil.longValue(compositeValue.get(CREATED_TIME)));
+ transaction.setScope((String) (String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
+ transaction.setId((String) (String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
+ return transaction;
+ }
+ throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
+ }
+
}
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -80,6 +80,8 @@
import org.rhq.plugins.jbossas5.ProfileServiceComponent;
import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
import org.teiid.rhq.admin.DQPManagementView;
+import org.teiid.rhq.plugin.deployer.Deployer;
+import org.teiid.rhq.plugin.deployer.RemoteDeployer;
import org.teiid.rhq.plugin.objects.ExecutedOperationResultImpl;
import org.teiid.rhq.plugin.objects.ExecutedResult;
import org.teiid.rhq.plugin.util.DeploymentUtils;
@@ -792,44 +794,15 @@
protected void createContentBasedResource(
CreateResourceReport createResourceReport) {
+
+ getDeployer().deploy(createResourceReport, createResourceReport.getResourceType());
- ResourcePackageDetails details = createResourceReport
- .getPackageDetails();
- PackageDetailsKey key = details.getKey();
- // This is the full path to a temporary file which was written by the UI
- // layer.
- String archivePath = key.getName();
-
- try {
- File archiveFile = new File(archivePath);
-
- if (!DeploymentUtils.hasCorrectExtension(archiveFile.getName(),
- resourceContext.getResourceType())) {
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport
- .setErrorMessage("Incorrect extension specified on filename [" //$NON-NLS-1$
- + archivePath + "]"); //$NON-NLS-1$
-
- }
-
- DeploymentManager deploymentManager = getConnection()
- .getDeploymentManager();
- DeploymentUtils
- .deployArchive(deploymentManager, archiveFile, false);
-
- deploymentName = archivePath;
- createResourceReport.setResourceName(archivePath);
- createResourceReport.setResourceKey(archivePath);
- createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
-
- } catch (Throwable t) {
- log.error("Error deploying application for report: " //$NON-NLS-1$
- + createResourceReport, t);
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setException(t);
- }
-
}
+
+ private Deployer getDeployer() {
+ ProfileServiceConnection profileServiceConnection = getConnection();
+ return new RemoteDeployer(profileServiceConnection, this.resourceContext);
+ }
private static String getResourceName(Configuration pluginConfig,
Configuration resourceConfig) {
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -104,7 +104,6 @@
} else if (name.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
valueMap.put(Operation.Value.VDB_URL, configuration.getSimple(Operation.Value.VDB_URL).getStringValue());
valueMap.put(Operation.Value.VDB_DEPLOY_NAME, configuration.getSimple(Operation.Value.VDB_DEPLOY_NAME).getStringValue());
- valueMap.put(Operation.Value.VDB_VERSION, configuration.getSimple(Operation.Value.VDB_VERSION).getIntegerValue());
}
}
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/deployer (from rev 2852, branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/deployer)
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -1,126 +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.rhq.plugin.deployer;
-
-import java.io.File;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.content.PackageDetailsKey;
-import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
-import org.rhq.core.domain.resource.CreateResourceStatus;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.pluginapi.inventory.CreateResourceReport;
-import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
-import org.teiid.rhq.plugin.util.DeploymentUtils;
-
-/**
- * Abstract base class capturing the common deploy functionality for embedded
- * and remote scenarios.
- *
- */
-public abstract class AbstractDeployer implements Deployer {
-
- private final Log log = LogFactory.getLog(this.getClass());
-
- private ProfileServiceConnection profileServiceConnection;
-
- protected AbstractDeployer(ProfileServiceConnection profileService) {
- this.profileServiceConnection = profileService;
- }
-
- public void deploy(CreateResourceReport createResourceReport, ResourceType resourceType) {
- File archiveFile = null;
- try {
- ResourcePackageDetails details = createResourceReport.getPackageDetails();
- PackageDetailsKey key = details.getKey();
-
- archiveFile = prepareArchive(key, resourceType);
-
- String archiveName = key.getName();
-
- if (!DeploymentUtils.hasCorrectExtension(archiveName, resourceType)) {
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setErrorMessage("Incorrect extension specified on filename [" + archiveName + "]");
- return;
- }
-
- // abortIfApplicationAlreadyDeployed(resourceType, archiveFile);
-
- Configuration deployTimeConfig = details.getDeploymentTimeConfiguration();
- @SuppressWarnings( { "ConstantConditions" })
-
- DeploymentManager deploymentManager = this.profileServiceConnection.getDeploymentManager();
-
- DeploymentUtils.deployArchive(deploymentManager, archiveFile, false);
-
- // Deployment was successful!
- createResourceReport.setResourceName(archiveName);
- createResourceReport.setResourceKey(archiveName);
- createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
-
- } catch (Throwable t) {
- log.error("Error deploying application for request [" + createResourceReport + "].", t);
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setException(t);
- } finally {
- if (archiveFile != null) {
- destroyArchive(archiveFile);
- }
- }
-
- }
-
- protected Log getLog() {
- return log;
- }
-
- protected ProfileServiceConnection getProfileServiceConnection() {
- return profileServiceConnection;
- }
-
- protected abstract File prepareArchive(PackageDetailsKey key,
- ResourceType resourceType);
-
- protected abstract void destroyArchive(File archive);
-
- // private void abortIfApplicationAlreadyDeployed(ResourceType resourceType,
- // File archiveFile) throws Exception {
- // String archiveFileName = archiveFile.getName();
- // KnownDeploymentTypes deploymentType =
- // ConversionUtils.getDeploymentType(resourceType);
- // String deploymentTypeString = deploymentType.getType();
- // ManagementView managementView =
- // profileServiceConnection.getManagementView();
- // managementView.load();
- // Set<ManagedDeployment> managedDeployments =
- // managementView.getDeploymentsForType(deploymentTypeString);
- // for (ManagedDeployment managedDeployment : managedDeployments) {
- // if (managedDeployment.getSimpleName().equals(archiveFileName))
- // throw new IllegalArgumentException("An application named '" +
- // archiveFileName
- // + "' is already deployed.");
- // }
- // }
-}
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java (from rev 2852, branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/AbstractDeployer.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -0,0 +1,126 @@
+/*
+ * 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.rhq.plugin.deployer;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.teiid.rhq.plugin.util.DeploymentUtils;
+
+/**
+ * Abstract base class capturing the common deploy functionality for embedded
+ * and remote scenarios.
+ *
+ */
+public abstract class AbstractDeployer implements Deployer {
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ private ProfileServiceConnection profileServiceConnection;
+
+ protected AbstractDeployer(ProfileServiceConnection profileService) {
+ this.profileServiceConnection = profileService;
+ }
+
+ public void deploy(CreateResourceReport createResourceReport, ResourceType resourceType) {
+ File archiveFile = null;
+ try {
+ ResourcePackageDetails details = createResourceReport.getPackageDetails();
+ PackageDetailsKey key = details.getKey();
+
+ archiveFile = prepareArchive(key, resourceType);
+
+ String archiveName = key.getName();
+
+ if (!DeploymentUtils.hasCorrectExtension(archiveName, resourceType)) {
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setErrorMessage("Incorrect extension specified on filename [" + archiveName + "]");
+ return;
+ }
+
+ // abortIfApplicationAlreadyDeployed(resourceType, archiveFile);
+
+ Configuration deployTimeConfig = details.getDeploymentTimeConfiguration();
+ @SuppressWarnings( { "ConstantConditions" })
+
+ DeploymentManager deploymentManager = this.profileServiceConnection.getDeploymentManager();
+
+ DeploymentUtils.deployArchive(deploymentManager, archiveFile, false);
+
+ // Deployment was successful!
+ createResourceReport.setResourceName(archiveName);
+ createResourceReport.setResourceKey(archiveName);
+ createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
+
+ } catch (Throwable t) {
+ log.error("Error deploying application for request [" + createResourceReport + "].", t);
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setException(t);
+ } finally {
+ if (archiveFile != null) {
+ destroyArchive(archiveFile);
+ }
+ }
+
+ }
+
+ protected Log getLog() {
+ return log;
+ }
+
+ protected ProfileServiceConnection getProfileServiceConnection() {
+ return profileServiceConnection;
+ }
+
+ protected abstract File prepareArchive(PackageDetailsKey key,
+ ResourceType resourceType);
+
+ protected abstract void destroyArchive(File archive);
+
+ // private void abortIfApplicationAlreadyDeployed(ResourceType resourceType,
+ // File archiveFile) throws Exception {
+ // String archiveFileName = archiveFile.getName();
+ // KnownDeploymentTypes deploymentType =
+ // ConversionUtils.getDeploymentType(resourceType);
+ // String deploymentTypeString = deploymentType.getType();
+ // ManagementView managementView =
+ // profileServiceConnection.getManagementView();
+ // managementView.load();
+ // Set<ManagedDeployment> managedDeployments =
+ // managementView.getDeploymentsForType(deploymentTypeString);
+ // for (ManagedDeployment managedDeployment : managedDeployments) {
+ // if (managedDeployment.getSimpleName().equals(archiveFileName))
+ // throw new IllegalArgumentException("An application named '" +
+ // archiveFileName
+ // + "' is already deployed.");
+ // }
+ // }
+}
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.rhq.plugin.deployer;
-
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.pluginapi.inventory.CreateResourceReport;
-
-/**
- * An abstraction of the deployment process.
- *
- */
-public interface Deployer {
-
- /**
- * Handles the deployment process end to end and updates the createResourceReport with
- * appropriate results.
- *
- * @param createResourceReport the report to get the deployment from
- * @param resourceType the target resource type
- */
- void deploy(CreateResourceReport createResourceReport, ResourceType resourceType);
-}
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java (from rev 2852, branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/Deployer.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -0,0 +1,41 @@
+/*
+ * 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.rhq.plugin.deployer;
+
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+
+/**
+ * An abstraction of the deployment process.
+ *
+ */
+public interface Deployer {
+
+ /**
+ * Handles the deployment process end to end and updates the createResourceReport with
+ * appropriate results.
+ *
+ * @param createResourceReport the report to get the deployment from
+ * @param resourceType the target resource type
+ */
+ void deploy(CreateResourceReport createResourceReport, ResourceType resourceType);
+}
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.rhq.plugin.deployer;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.managed.api.ComponentType;
-import org.jboss.managed.api.ManagedComponent;
-import org.rhq.core.domain.content.PackageDetailsKey;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.pluginapi.content.ContentContext;
-import org.rhq.core.pluginapi.content.ContentServices;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
-import org.rhq.plugins.jbossas5.util.ManagedComponentUtils;
-
-/**
- *
- */
-public class RemoteDeployer extends AbstractDeployer {
-
- private ResourceContext<?> resourceContext;
-
- /**
- * @param profileServiceConnection
- */
- public RemoteDeployer(ProfileServiceConnection profileServiceConnection, ResourceContext<?> resourceContext) {
- super(profileServiceConnection);
- this.resourceContext = resourceContext;
- }
-
- @Override
- protected void destroyArchive(File archive) {
- File tempDir = archive.getParentFile();
- archive.delete();
- tempDir.delete();
- }
-
- @Override
- protected File prepareArchive(PackageDetailsKey key, ResourceType resourceType) {
- //we're running in the agent. During the development of this functionality, there was
- //a time when the deployment only worked from within the JBossAS server home.
- //Further investigation never confirmed the problem again but since we have access to
- //server home directory anyway, why not stay on the safe side... ;)
- OutputStream os = null;
-
- try {
- File tempDir = createTempDirectory("teiid-deploy-content", null, getServerTempDirectory());
-
- File archiveFile = new File(key.getName());
-
- //this is to ensure that we only get the filename part no matter whether the key contains
- //full path or not.
- File contentCopy = new File(tempDir, archiveFile.getName());
-
- os = new BufferedOutputStream(new FileOutputStream(contentCopy));
- ContentContext contentContext = resourceContext.getContentContext();
- ContentServices contentServices = contentContext.getContentServices();
- contentServices.downloadPackageBitsForChildResource(contentContext, resourceType.getName(), key, os);
-
- return contentCopy;
- } catch (IOException e) {
- throw new IllegalStateException("Failed to copy the deployed archive to destination.", e);
- } finally {
- if (os != null) {
- try {
- os.close();
- } catch (IOException e) {
- getLog().warn("Failed to close the stream when copying deployment to destination.");
- }
- }
- }
- }
-
- private File getServerTempDirectory() {
- ManagementView managementView = getProfileServiceConnection().getManagementView();
- ManagedComponent serverConfigComponent = ManagedComponentUtils.getSingletonManagedComponent(managementView,
- new ComponentType("MCBean", "ServerConfig"));
- String serverTempDir = (String) ManagedComponentUtils.getSimplePropertyValue(serverConfigComponent,
- "serverTempDir");
-
- return new File(serverTempDir);
- }
-
- /**
- * TODO this should go somewhere nice...
- *
- * Creates a temporary directory in a given directory.
- * Reuses the logic of {@link File#createTempFile(String, String, File)} but the returned
- * file is a directory instead of a regular file.
- *
- * @param prefix the unique name prefix
- * @param suffix the unique name suffix
- * @param parentDirectory the parent directory to create the temp dir in
- *
- * @return the temporary directory
- *
- * @throws IOException on error
- */
- private static File createTempDirectory(String prefix, String suffix, File parentDirectory) throws IOException {
- // Let's reuse the algorithm the JDK uses to determine a unique name:
- // 1) create a temp file to get a unique name using JDK createTempFile
- // 2) then quickly delete the file and...
- // 3) convert it to a directory
-
- File tmpDir = File.createTempFile(prefix, suffix, parentDirectory); // create file with unique name
- boolean deleteOk = tmpDir.delete(); // delete the tmp file and...
- boolean mkdirsOk = tmpDir.mkdirs(); // ...convert it to a directory
-
- if (!deleteOk || !mkdirsOk) {
- throw new IOException("Failed to create temp directory named [" + tmpDir + "]");
- }
-
- return tmpDir;
- }
-}
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java (from rev 2852, branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/deployer/RemoteDeployer.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.rhq.plugin.deployer;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.content.ContentContext;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.rhq.plugins.jbossas5.util.ManagedComponentUtils;
+
+/**
+ *
+ */
+public class RemoteDeployer extends AbstractDeployer {
+
+ private ResourceContext<?> resourceContext;
+
+ /**
+ * @param profileServiceConnection
+ */
+ public RemoteDeployer(ProfileServiceConnection profileServiceConnection, ResourceContext<?> resourceContext) {
+ super(profileServiceConnection);
+ this.resourceContext = resourceContext;
+ }
+
+ @Override
+ protected void destroyArchive(File archive) {
+ File tempDir = archive.getParentFile();
+ archive.delete();
+ tempDir.delete();
+ }
+
+ @Override
+ protected File prepareArchive(PackageDetailsKey key, ResourceType resourceType) {
+ //we're running in the agent. During the development of this functionality, there was
+ //a time when the deployment only worked from within the JBossAS server home.
+ //Further investigation never confirmed the problem again but since we have access to
+ //server home directory anyway, why not stay on the safe side... ;)
+ OutputStream os = null;
+
+ try {
+ File tempDir = createTempDirectory("teiid-deploy-content", null, getServerTempDirectory());
+
+ File archiveFile = new File(key.getName());
+
+ //this is to ensure that we only get the filename part no matter whether the key contains
+ //full path or not.
+ File contentCopy = new File(tempDir, archiveFile.getName());
+
+ os = new BufferedOutputStream(new FileOutputStream(contentCopy));
+ ContentContext contentContext = resourceContext.getContentContext();
+ ContentServices contentServices = contentContext.getContentServices();
+ contentServices.downloadPackageBitsForChildResource(contentContext, resourceType.getName(), key, os);
+
+ return contentCopy;
+ } catch (IOException e) {
+ throw new IllegalStateException("Failed to copy the deployed archive to destination.", e);
+ } finally {
+ if (os != null) {
+ try {
+ os.close();
+ } catch (IOException e) {
+ getLog().warn("Failed to close the stream when copying deployment to destination.");
+ }
+ }
+ }
+ }
+
+ private File getServerTempDirectory() {
+ ManagementView managementView = getProfileServiceConnection().getManagementView();
+ ManagedComponent serverConfigComponent = ManagedComponentUtils.getSingletonManagedComponent(managementView,
+ new ComponentType("MCBean", "ServerConfig"));
+ String serverTempDir = (String) ManagedComponentUtils.getSimplePropertyValue(serverConfigComponent,
+ "serverTempDir");
+
+ return new File(serverTempDir);
+ }
+
+ /**
+ * TODO this should go somewhere nice...
+ *
+ * Creates a temporary directory in a given directory.
+ * Reuses the logic of {@link File#createTempFile(String, String, File)} but the returned
+ * file is a directory instead of a regular file.
+ *
+ * @param prefix the unique name prefix
+ * @param suffix the unique name suffix
+ * @param parentDirectory the parent directory to create the temp dir in
+ *
+ * @return the temporary directory
+ *
+ * @throws IOException on error
+ */
+ private static File createTempDirectory(String prefix, String suffix, File parentDirectory) throws IOException {
+ // Let's reuse the algorithm the JDK uses to determine a unique name:
+ // 1) create a temp file to get a unique name using JDK createTempFile
+ // 2) then quickly delete the file and...
+ // 3) convert it to a directory
+
+ File tmpDir = File.createTempFile(prefix, suffix, parentDirectory); // create file with unique name
+ boolean deleteOk = tmpDir.delete(); // delete the tmp file and...
+ boolean mkdirsOk = tmpDir.mkdirs(); // ...convert it to a directory
+
+ if (!deleteOk || !mkdirsOk) {
+ throw new IOException("Failed to create temp directory named [" + tmpDir + "]");
+ }
+
+ return tmpDir;
+ }
+}
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/objects/RequestMetadata.java (from rev 2852, branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/objects/RequestMetadata.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/objects/RequestMetadata.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/objects/RequestMetadata.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -0,0 +1,151 @@
+/*
+ * 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.rhq.plugin.objects;
+
+import java.util.Date;
+
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
+import org.teiid.core.util.HashCodeUtil;
+
+
+
+public class RequestMetadata {
+
+ private static final long serialVersionUID = -2779106368517784259L;
+
+ private long executionId;
+ private String sessionId;
+ private String command;
+ private long startTime;
+ private boolean sourceRequest;
+ private Integer nodeID;
+ private String transactionId;
+ private ProcessingState processingState = ProcessingState.PROCESSING;
+ private ThreadState threadState = ThreadState.RUNNING;
+
+ public long getExecutionId() {
+ return executionId;
+ }
+
+ public void setExecutionId(long id) {
+ this.executionId = id;
+ }
+
+ public ProcessingState getState() {
+ return processingState;
+ }
+
+ public void setState(ProcessingState state) {
+ this.processingState = state;
+ }
+
+ public ThreadState getThreadState() {
+ return threadState;
+ }
+
+ public void setThreadState(ThreadState threadState) {
+ this.threadState = threadState;
+ }
+
+ public String getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(String session) {
+ this.sessionId = session;
+ }
+
+ public long getStartTime() {
+ return this.startTime;
+ }
+
+ public void setStartTime(long time) {
+ this.startTime = time;
+ }
+
+ public String getCommand() {
+ return this.command;
+ }
+
+ public void setCommand(String cmd) {
+ this.command = cmd;
+ }
+
+ public boolean sourceRequest() {
+ return sourceRequest;
+ }
+
+ public void setSourceRequest(boolean sourceRequest) {
+ this.sourceRequest = sourceRequest;
+ }
+
+ public Integer getNodeId() {
+ return this.nodeID;
+ }
+
+ public void setNodeId(Integer nodeID) {
+ this.nodeID = nodeID;
+ }
+
+ public String getTransactionId() {
+ return this.transactionId;
+ }
+
+ public void setTransactionId(String id) {
+ this.transactionId = id;
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof RequestMetadata)) {
+ return false;
+ }
+ RequestMetadata value = (RequestMetadata)obj;
+ if (!sourceRequest()) {
+ return sessionId == value.sessionId && executionId == value.executionId;
+ }
+ return sessionId == value.sessionId && executionId == value.executionId && nodeID.equals(value.nodeID);
+ }
+
+ public int hashCode() {
+ return HashCodeUtil.hashCode((int)executionId, sessionId);
+ }
+
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("Request: sessionid=").append(sessionId);
+ str.append("; executionId=").append(executionId);
+ if (nodeID != null) {
+ str.append("; nodeId=").append(nodeID);
+ }
+ if (transactionId != null) {
+ str.append("; transactionId=").append(transactionId);
+ }
+ str.append("; sourceRequest=").append(sourceRequest);
+ str.append("; processingTime=").append(new Date(startTime));
+ str.append("; command=").append(command);
+
+ return str.toString();
+ }
+}
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/objects/SessionMetadata.java (from rev 2852, branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/objects/SessionMetadata.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/objects/SessionMetadata.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/objects/SessionMetadata.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -0,0 +1,198 @@
+/*
+ * 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.rhq.plugin.objects;
+
+import java.util.Date;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginContext;
+
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.client.security.SessionToken;
+
+
+
+/**
+ * Add and delete properties also in the Mapper class for correct wrapping for profile service.
+ */
+public class SessionMetadata {
+
+ private static final long serialVersionUID = 918638989081830034L;
+ private String applicationName;
+ private long lastPingTime = System.currentTimeMillis();
+ private long createdTime;
+ private String ipAddress;
+ private String clientHostName;
+ private String userName;
+ private String vdbName;
+ private int vdbVersion;
+ private String sessionId;
+ private String securityDomain;
+
+ //server session state
+ private transient VDBMetaData vdb;
+ private transient SessionToken sessionToken;
+ private transient LoginContext loginContext;
+ private transient Object securityContext;
+ private transient boolean embedded;
+
+ public String getApplicationName() {
+ return this.applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+ public long getCreatedTime() {
+ return this.createdTime;
+ }
+
+ public void setCreatedTime(long createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public String getClientHostName() {
+ return this.clientHostName;
+ }
+
+ public void setClientHostName(String clientHostname) {
+ this.clientHostName = clientHostname;
+ }
+
+ public String getIPAddress() {
+ return this.ipAddress;
+ }
+
+ public void setIPAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public long getLastPingTime() {
+ return this.lastPingTime;
+ }
+
+ public void setLastPingTime(long lastPingTime) {
+ this.lastPingTime = lastPingTime;
+ }
+
+ public String getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public String getUserName() {
+ return this.userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getVDBName() {
+ return this.vdbName;
+ }
+
+ public void setVDBName(String vdbName) {
+ this.vdbName = vdbName;
+ }
+
+ public int getVDBVersion() {
+ return this.vdbVersion;
+ }
+
+ public void setVDBVersion(int vdbVersion) {
+ this.vdbVersion = vdbVersion;
+ }
+
+ public String getSecurityDomain() {
+ return this.securityDomain;
+ }
+
+ public void setSecurityDomain(String domain) {
+ this.securityDomain = domain;
+ }
+
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("session: sessionid=").append(sessionId);
+ str.append("; userName=").append(userName);
+ str.append("; vdbName=").append(vdbName);
+ str.append("; vdbVersion=").append(vdbVersion);
+ str.append("; createdTime=").append(new Date(createdTime));
+ str.append("; applicationName=").append(applicationName);
+ str.append("; clientHostName=").append(clientHostName);
+ str.append("; IPAddress=").append(ipAddress);
+ str.append("; securityDomain=").append(securityDomain);
+ str.append("; lastPingTime=").append(new Date(lastPingTime));
+ return str.toString();
+ }
+
+ public VDBMetaData getVdb() {
+ return vdb;
+ }
+
+ public void setVdb(VDBMetaData vdb) {
+ this.vdb = vdb;
+ }
+
+ public SessionToken getSessionToken() {
+ return sessionToken;
+ }
+
+ public void setSessionToken(SessionToken sessionToken) {
+ this.sessionToken = sessionToken;
+ }
+
+ public LoginContext getLoginContext() {
+ return loginContext;
+ }
+
+ public void setLoginContext(LoginContext loginContext) {
+ this.loginContext = loginContext;
+ }
+
+ public Object getSecurityContext() {
+ return securityContext;
+ }
+
+ public void setSecurityContext(Object securityContext) {
+ this.securityContext = securityContext;
+ }
+
+ public Subject getSubject() {
+ return this.loginContext.getSubject();
+ }
+
+ public void setEmbedded(boolean embedded) {
+ this.embedded = embedded;
+ }
+
+ public boolean isEmbedded() {
+ return embedded;
+ }
+
+}
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/objects/TransactionMetadata.java (from rev 2852, branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/objects/TransactionMetadata.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/objects/TransactionMetadata.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/objects/TransactionMetadata.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -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.rhq.plugin.objects;
+
+import java.util.Date;
+
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.teiid.adminapi.Transaction;
+
+
+public class TransactionMetadata {
+
+ private static final long serialVersionUID = -8588785315218789068L;
+ private String associatedSession;
+ private String scope;
+ private String id;
+ private long createdTime;
+
+ public String getAssociatedSession() {
+ return associatedSession;
+ }
+
+ public void setAssociatedSession(String associatedSession) {
+ this.associatedSession = associatedSession;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public long getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(long time) {
+ this.createdTime = time;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append("Associated Session:").append(associatedSession); //$NON-NLS-1$
+ result.append("Scope:").append(scope); //$NON-NLS-1$
+ result.append("Id:").append(id); //$NON-NLS-1$
+ result.append("CreatedTime:").append(new Date(createdTime)); //$NON-NLS-1$
+ return result.toString();
+ }
+
+}
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -286,11 +286,35 @@
SimpleValue simple = (SimpleValue) v1;
return Double.valueOf(simple.getValue().toString());
}
- throw new Exception("Failed to convert value to boolean value"); //$NON-NLS-1$
+ throw new Exception("Failed to convert value to double value"); //$NON-NLS-1$
}
return null;
}
+ public static Long longValue(MetaValue v1) throws Exception {
+ if (v1 != null) {
+ MetaType type = v1.getMetaType();
+ if (type instanceof SimpleMetaType) {
+ SimpleValue simple = (SimpleValue) v1;
+ return Long.valueOf(simple.getValue().toString());
+ }
+ throw new Exception("Failed to convert value to long value"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public static Integer integerValue(MetaValue v1) throws Exception {
+ if (v1 != null) {
+ MetaType type = v1.getMetaType();
+ if (type instanceof SimpleMetaType) {
+ SimpleValue simple = (SimpleValue) v1;
+ return Integer.valueOf(simple.getValue().toString());
+ }
+ throw new Exception("Failed to convert value to integer value"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
public static <T> T getSimpleValue(ManagedComponent mc, String prop,
Class<T> expectedType) {
ManagedProperty mp = mc.getProperty(prop);
@@ -310,6 +334,24 @@
return null;
}
+ public static <T> T getSimpleValue(MetaValue prop,
+ Class<T> expectedType) {
+ if (prop != null) {
+ MetaType metaType = prop.getMetaType();
+ if (metaType.isSimple()) {
+ SimpleValue simpleValue = (SimpleValue) prop;
+ return expectedType.cast((simpleValue != null) ? simpleValue
+ .getValue() : null);
+ } else if (metaType.isEnum()) {
+ EnumValue enumValue = (EnumValue) prop;
+ return expectedType.cast((enumValue != null) ? enumValue
+ .getValue() : null);
+ }
+ throw new IllegalStateException(prop + " is not a simple type"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
public static <T> T getSimpleValue(ManagedCommon mc, String prop,
Class<T> expectedType) {
ManagedProperty mp = mc.getProperty(prop);
Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-01-19 16:19:44 UTC (rev 2853)
@@ -159,13 +159,10 @@
description="Deploy a VDB using a URL">
<parameters>
<c:simple-property displayName="VDB URL" name="vdbUrl"
- type="file" required="true" description="The URL of the VDB to deploy" />
+ type="file" required="true" description="The URL of the VDB's source file" />
<c:simple-property displayName="VDB Deploy File Name"
name="vdbDeployName" type="string" required="true"
description="The deployment file name to use. Must match the VDB Name you are deploying." />
- <c:simple-property displayName="VDB Version" name="vdbVersion"
- type="integer" required="false"
- description="The version to use for the deployed VDB (leave blank for overwrite of version one)" />
</parameters>
</operation>
@@ -515,7 +512,7 @@
</operation>
<operation name="reloadMaterializedView" displayName="Refresh a Materialized View"
- description="Refresh a given any Materialized View for this VDB">
+ description="Refresh a given Materialized View for this VDB">
<parameters>
<c:simple-property displayName="Materialized View Schema"
name="schema" type="string" required="true"
@@ -713,7 +710,7 @@
<service name="Translators" description="Teiid Translators"
class="TranslatorComponent" discovery="TranslatorDiscoveryComponent"
- createDeletePolicy="both" creationDataType="configuration">
+ createDeletePolicy="neither" creationDataType="configuration">
<resource-configuration>
<c:simple-property name="name" displayName="Name"
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -97,7 +97,7 @@
this.lobChunkSizeInKB = lobChunkSizeInKB;
}
- @ManagementProperty(description="The maximum number of query plans that are cached. Note: this is a memory based cache. (default 250)")
+ @ManagementProperty(description="The maximum number of query plans that are cached. Note: this is a memory based cache. (default 512)")
public int getPreparedPlanCacheMaxCount() {
return this.preparedPlanCacheMaxCount;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -695,7 +695,8 @@
this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
if (cacheFactory.isReplicated()) {
- matTables = new SessionAwareCache<CachedResults>();
+ matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, -1, -1));
+ matTables.setBufferManager(this.bufferManager);
}
dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -74,7 +74,7 @@
SessionAwareCache (final CacheFactory cacheFactory, final Cache.Type type, final CacheConfiguration config){
this.maxSize = config.getMaxEntries();
if(this.maxSize < 0){
- this.maxSize = DEFAULT_MAX_SIZE_TOTAL;
+ this.maxSize = Integer.MAX_VALUE;
}
this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -131,13 +131,11 @@
assertEquals(0, cache.getTotalCacheEntries());
}
- // set init size to negative number, which should default to 100 (default)
+ // set init size to negative number, which should default to max
@Test public void testNegativeSizeCacheUsesDefault() {
- SessionAwareCache<PreparedPlan> negativeSizedCache = new SessionAwareCache<PreparedPlan>(-1000);
- SessionAwareCache<PreparedPlan> defaultSizedCache = new SessionAwareCache<PreparedPlan>();
+ SessionAwareCache<PreparedPlan> negativeSizedCache = new SessionAwareCache<PreparedPlan>(-1);
- assertEquals(defaultSizedCache.getSpaceAllowed(), negativeSizedCache.getSpaceAllowed());
- assertEquals(SessionAwareCache.DEFAULT_MAX_SIZE_TOTAL, negativeSizedCache.getSpaceAllowed());
+ assertEquals(Integer.MAX_VALUE, negativeSizedCache.getSpaceAllowed());
}
//====Help methods====//
Modified: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -58,6 +58,7 @@
import org.teiid.query.resolver.QueryResolver;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.unittest.FakeMetadataFacade;
import org.teiid.query.unittest.FakeMetadataFactory;
@@ -82,7 +83,7 @@
ValidatorReport report = Validator.validate(userCommand, metadata);
if (report.hasItems()) {
- ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
+ ValidatorFailure firstFailure = report.getItems().iterator().next();
throw new QueryValidatorException(firstFailure.getMessage());
}
QueryRewriter.rewrite(userCommand, metadata, new CommandContext());
@@ -2661,5 +2662,40 @@
helpTestProcess(plan, expected, dataMgr, metadata);
}
+ @Test public void testNonQueryPushdownValidation() throws Exception {
+
+ FakeMetadataFacade metadata = FakeMetadataFactory.example1();
+
+ FakeMetadataObject pm1 = metadata.getStore().findObject("pm1",FakeMetadataObject.MODEL); //$NON-NLS-1$
+
+ FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
+ FakeMetadataObject in = FakeMetadataFactory.createParameter("pm1.sq1.in1", 2, SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
+
+ StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n"); //$NON-NLS-1$
+ procedure.append("BEGIN\n"); //$NON-NLS-1$
+ procedure.append("create local temporary table x (y string);\n"); //$NON-NLS-1$
+ procedure.append("update x set y = in1 || 'foo';\n"); //$NON-NLS-1$
+ procedure.append("update pm1.g1 set e1 = lookup('pm1.g1', 'e1', 'e2', in1);\n"); //$NON-NLS-1$
+ procedure.append("exec pm1.sq2(in1 || 'foo');\n"); //$NON-NLS-1$
+ procedure.append("END"); //$NON-NLS-1$
+
+ QueryNode sq2n1 = new QueryNode("pm1.sq1", procedure.toString()); //$NON-NLS-1$
+ FakeMetadataObject sq1 = FakeMetadataFactory.createVirtualProcedure("pm1.sq1", pm1, Arrays.asList(new FakeMetadataObject[] { in, rs2p1 }), sq2n1); //$NON-NLS-1$
+
+ metadata.getStore().addObject(rs2);
+ metadata.getStore().addObject(sq1);
+
+ String userUpdateStr = "EXEC pm1.sq1(1)"; //$NON-NLS-1$
+
+ FakeDataManager dataMgr = exampleDataManager(metadata);
+
+ ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
+
+ //Create expected results
+ List[] expected = new List[0];
+ helpTestProcess(plan, expected, dataMgr, metadata);
+ }
+
private static final boolean DEBUG = false;
}
Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-01-19 01:59:26 UTC (rev 2852)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-01-19 16:19:44 UTC (rev 2853)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.StringReader;
-import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -36,6 +35,7 @@
import java.util.regex.Pattern;
import org.teiid.jdbc.ConnectionImpl;
+import org.teiid.jdbc.TeiidDriver;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.runtime.RuntimePlugin;
@@ -169,7 +169,12 @@
@Override
public void logon(String databaseName, String user, String password) {
try {
- this.connection = (ConnectionImpl)DriverManager.getConnection("jdbc:teiid:"+databaseName+";ApplicationName=ODBC", user, password); //$NON-NLS-1$ //$NON-NLS-2$
+ java.util.Properties info = new java.util.Properties();
+ String url = "jdbc:teiid:"+databaseName+";ApplicationName=ODBC"; //$NON-NLS-1$ //$NON-NLS-2$
+ TeiidDriver driver = new TeiidDriver();
+ info.put("user", user); //$NON-NLS-1$
+ info.put("password", password); //$NON-NLS-1$
+ this.connection = (ConnectionImpl)driver.connect(url, info);
int hash = this.connection.getConnectionId().hashCode();
this.client.authenticationSucess(hash, hash);
sync();
More information about the teiid-commits
mailing list