teiid SVN: r1764 - in trunk/engine/src/main/java/com/metamatrix/common/buffer: impl and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-01-21 00:11:37 -0500 (Thu, 21 Jan 2010)
New Revision: 1764
Modified:
trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java
Log:
TEIID-913 adding back the ability to reserve buffers in the buffermanager and increasing the default for max open files.
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java 2010-01-21 03:59:24 UTC (rev 1763)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/BufferManager.java 2010-01-21 05:11:37 UTC (rev 1764)
@@ -72,8 +72,7 @@
/**
* Optional property - this values specifies how many open file descriptors should be cached
* in the storage directory. Increasing this value in heavy load may improve performance
- * but will use more file descriptors, which are a limited system resource. The default
- * is 32.
+ * but will use more file descriptors, which are a limited system resource.
*/
public static final String MAX_OPEN_FILES = "metamatrix.buffer.maxOpenFiles"; //$NON-NLS-1$
/**
@@ -88,7 +87,8 @@
public static int DEFAULT_CONNECTOR_BATCH_SIZE = 2048;
public static int DEFAULT_PROCESSOR_BATCH_SIZE = 1024;
- public static int DEFAULT_MAX_PROCESSING_BATCHES = 16;
+ public static int DEFAULT_MAX_PROCESSING_BATCHES = 8;
+ public static int DEFAULT_RESERVE_BUFFERS = 64;
/**
* Get the batch size to use during query processing.
@@ -105,8 +105,35 @@
TupleBuffer createTupleBuffer(List elements, String groupName, TupleSourceType tupleSourceType)
throws MetaMatrixComponentException;
+ /**
+ * Return the maximum number of batches that can be temporarily held potentially
+ * across even a blocked exception.
+ * @return
+ */
int getMaxProcessingBatches();
+ /**
+ * Creates a new {@link FileStore}. See {@link FileStore#setCleanupReference(Object)} to
+ * automatically cleanup the underlying resources.
+ * @param name
+ * @return
+ */
FileStore createFileStore(String name);
+ /**
+ * Reserve up to count buffers for use. Wait will cause the process to block until
+ * all of the requested or half of the total buffers are available.
+ * @param count
+ * @param wait
+ * @return
+ * @throws MetaMatrixComponentException
+ */
+ int reserveBuffers(int count, boolean wait) throws MetaMatrixComponentException;
+
+ /**
+ * Releases the buffers reserved by a call to {@link BufferManager#reserveBuffers(int, boolean)}
+ * @param count
+ */
+ void releaseBuffers(int count);
+
}
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-01-21 03:59:24 UTC (rev 1763)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-01-21 05:11:37 UTC (rev 1764)
@@ -26,6 +26,8 @@
import java.util.ListIterator;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
import javax.xml.transform.Source;
@@ -60,6 +62,10 @@
private int connectorBatchSize = BufferManager.DEFAULT_CONNECTOR_BATCH_SIZE;
private int processorBatchSize = BufferManager.DEFAULT_PROCESSOR_BATCH_SIZE;
private int maxProcessingBatches = BufferManager.DEFAULT_MAX_PROCESSING_BATCHES;
+ private int reserveBatches = BufferManager.DEFAULT_RESERVE_BUFFERS;
+ private int maxReserveBatches = BufferManager.DEFAULT_RESERVE_BUFFERS;
+ private ReentrantLock lock = new ReentrantLock(true);
+ private Condition batchesFreed = lock.newCondition();
private StorageManager diskMgr;
@@ -169,6 +175,40 @@
}
return types;
}
+
+ @Override
+ public void releaseBuffers(int count) {
+ lock.lock();
+ try {
+ this.reserveBatches += count;
+ batchesFreed.signalAll();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ @Override
+ public int reserveBuffers(int count, boolean wait) throws MetaMatrixComponentException {
+ lock.lock();
+ try {
+ while (wait && count > this.reserveBatches && this.reserveBatches < this.maxReserveBatches / 2) {
+ try {
+ batchesFreed.await();
+ } catch (InterruptedException e) {
+ throw new MetaMatrixComponentException(e);
+ }
+ }
+ this.reserveBatches -= count;
+ if (this.reserveBatches >= 0) {
+ return count;
+ }
+ int result = count + this.reserveBatches;
+ this.reserveBatches = 0;
+ return result;
+ } finally {
+ lock.unlock();
+ }
+ }
public void shutdown() {
}
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java 2010-01-21 03:59:24 UTC (rev 1763)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/FileStorageManager.java 2010-01-21 05:11:37 UTC (rev 1764)
@@ -48,7 +48,8 @@
*/
public class FileStorageManager implements StorageManager {
- private static final String FILE_PREFIX = "b_"; //$NON-NLS-1$
+ private static final int DEFAULT_MAX_OPEN_FILES = 256;
+ private static final String FILE_PREFIX = "b_"; //$NON-NLS-1$
private class FileInfo {
private File file;
@@ -155,7 +156,7 @@
}
// Initialization
- private int maxOpenFiles = 32;
+ private int maxOpenFiles = DEFAULT_MAX_OPEN_FILES;
private long maxFileSize = 2L * 1024L * 1024L * 1024L; // 2GB
private String directory;
private File dirFile;
@@ -200,7 +201,7 @@
}
// Set up max number of open file descriptors
- maxOpenFiles = PropertiesUtils.getIntProperty(props, BufferManager.MAX_OPEN_FILES, 32);
+ maxOpenFiles = PropertiesUtils.getIntProperty(props, BufferManager.MAX_OPEN_FILES, DEFAULT_MAX_OPEN_FILES);
// Set the max file size
maxFileSize = PropertiesUtils.getIntProperty(props, BufferManager.MAX_FILE_SIZE, 2048) * 1024L * 1024L; // Multiply by 1MB
14 years, 11 months
teiid SVN: r1763 - in trunk/engine/src: test/java/com/metamatrix/query/processor/relational and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-01-20 22:59:24 -0500 (Wed, 20 Jan 2010)
New Revision: 1763
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java
trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java
Log:
TEIID-925 further refining the dup remove strategy for performance.
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java 2010-01-21 03:49:48 UTC (rev 1762)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/SortUtility.java 2010-01-21 03:59:24 UTC (rev 1763)
@@ -95,7 +95,7 @@
private List<TupleBuffer> activeTupleBuffers = new ArrayList<TupleBuffer>();
private int masterSortIndex;
- private int dupRemoveSublists = 1; //used to control the number of sublists needed for dup remove
+ private int collected;
// Phase constants for readability
private static final int INITIAL_SORT = 1;
@@ -158,7 +158,8 @@
}
private TupleBuffer createTupleBuffer() throws MetaMatrixComponentException {
- return bufferManager.createTupleBuffer(this.schema, this.groupName, TupleSourceType.PROCESSOR);
+ TupleBuffer tb = bufferManager.createTupleBuffer(this.schema, this.groupName, TupleSourceType.PROCESSOR);
+ return tb;
}
/**
@@ -173,48 +174,63 @@
workingTuples = new TreeSet<List<?>>(comparator);
}
}
-
- int maxRows = bufferManager.getMaxProcessingBatches() * bufferManager.getProcessorBatchSize();
- while(!doneReading && workingTuples.size() < maxRows) {
- try {
- List<?> tuple = sourceID.nextTuple();
-
- if (tuple == null) {
- doneReading = true;
- break;
- }
-
- workingTuples.add(tuple);
- } catch(BlockedException e) {
- if ((workingTuples.size() < maxRows/2 && mode != Mode.DUP_REMOVE)
- || (workingTuples.size() < (dupRemoveSublists/4)*bufferManager.getProcessorBatchSize() && activeTupleBuffers.size() < dupRemoveSublists)) {
- throw e; //block if no work can be performed
- }
- break;
- }
- }
-
- if(workingTuples.isEmpty()) {
- break;
- }
+ int totalReservedBuffers = 0;
+ try {
+ int maxRows = bufferManager.getMaxProcessingBatches() * bufferManager.getProcessorBatchSize();
+ while(!doneReading) {
+ if (workingTuples.size() == maxRows) {
+ int reserved = bufferManager.reserveBuffers(1, false);
+ if (reserved == 0) {
+ break;
+ }
+ totalReservedBuffers += 1;
+ maxRows += bufferManager.getProcessorBatchSize();
+ }
+ try {
+ List<?> tuple = sourceID.nextTuple();
+
+ if (tuple == null) {
+ doneReading = true;
+ break;
+ }
+ if (workingTuples.add(tuple)) {
+ this.collected++;
+ }
+ } catch(BlockedException e) {
+ if (mode != Mode.DUP_REMOVE
+ || (this.output != null && collected < this.output.getRowCount() * 2)
+ || (this.output == null && this.workingTuples.isEmpty() && this.activeTupleBuffers.isEmpty())) {
+ throw e; //block if no work can be performed
+ }
+ break;
+ }
+ }
- TupleBuffer sublist = createTupleBuffer();
- activeTupleBuffers.add(sublist);
- if (this.mode == Mode.SORT) {
- //perform a stable sort
- Collections.sort((List<List<?>>)workingTuples, comparator);
- }
- for (List<?> list : workingTuples) {
- sublist.addTuple(list);
- }
- workingTuples = null;
- sublist.saveBatch();
+ if(workingTuples.isEmpty()) {
+ break;
+ }
+
+ TupleBuffer sublist = createTupleBuffer();
+ activeTupleBuffers.add(sublist);
+ if (this.mode == Mode.SORT) {
+ //perform a stable sort
+ Collections.sort((List<List<?>>)workingTuples, comparator);
+ }
+ for (List<?> list : workingTuples) {
+ sublist.addTuple(list);
+ }
+ workingTuples = null;
+
+ sublist.saveBatch();
+ } finally {
+ bufferManager.releaseBuffers(totalReservedBuffers);
+ }
}
if (this.activeTupleBuffers.isEmpty()) {
activeTupleBuffers.add(createTupleBuffer());
}
- this.dupRemoveSublists = Math.min(dupRemoveSublists * 2, bufferManager.getMaxProcessingBatches() * 2);
+ this.collected = 0;
this.phase = MERGE;
}
@@ -224,45 +240,54 @@
TupleBuffer merged = createTupleBuffer();
- int maxSortIndex = Math.min(this.bufferManager.getMaxProcessingBatches() * 2, activeTupleBuffers.size());
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.TRACE)) {
- LogManager.logTrace(LogConstants.CTX_DQP, "Merging", maxSortIndex, "sublists out of", activeTupleBuffers.size()); //$NON-NLS-1$ //$NON-NLS-2$
+ int maxSortIndex = Math.min(activeTupleBuffers.size(), this.bufferManager.getMaxProcessingBatches());
+ int reservedBuffers = 0;
+ if (activeTupleBuffers.size() > maxSortIndex) {
+ reservedBuffers = bufferManager.reserveBuffers(activeTupleBuffers.size() - maxSortIndex, true);
}
- // initialize the sublists with the min value
- for(int i = 0; i<maxSortIndex; i++) {
- TupleBuffer activeID = activeTupleBuffers.get(i);
- SortedSublist sortedSublist = new SortedSublist();
- sortedSublist.its = activeID.createIndexedTupleSource();
- sortedSublist.index = i;
- if (activeID == output) {
- sortedSublist.limit = output.getRowCount();
- }
- incrementWorkingTuple(sublists, sortedSublist);
+ maxSortIndex += reservedBuffers;
+ try {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.TRACE)) {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Merging", maxSortIndex, "sublists out of", activeTupleBuffers.size()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ // initialize the sublists with the min value
+ for(int i = 0; i<maxSortIndex; i++) {
+ TupleBuffer activeID = activeTupleBuffers.get(i);
+ SortedSublist sortedSublist = new SortedSublist();
+ sortedSublist.its = activeID.createIndexedTupleSource();
+ sortedSublist.index = i;
+ if (activeID == output) {
+ sortedSublist.limit = output.getRowCount();
+ }
+ incrementWorkingTuple(sublists, sortedSublist);
+ }
+
+ // iteratively process the lowest tuple
+ while (sublists.size() > 0) {
+ SortedSublist sortedSublist = sublists.remove(sublists.size() - 1);
+ merged.addTuple(sortedSublist.tuple);
+ if (this.output != null && sortedSublist.index > masterSortIndex) {
+ this.output.addTuple(sortedSublist.tuple); //a new distinct row
+ }
+ incrementWorkingTuple(sublists, sortedSublist);
+ }
+
+ // Remove merged sublists
+ for(int i=0; i<maxSortIndex; i++) {
+ TupleBuffer id = activeTupleBuffers.remove(0);
+ if (id != this.output) {
+ id.remove();
+ }
+ }
+ merged.saveBatch();
+ this.activeTupleBuffers.add(merged);
+ masterSortIndex = masterSortIndex - maxSortIndex + 1;
+ if (masterSortIndex < 0) {
+ masterSortIndex = this.activeTupleBuffers.size() - 1;
+ }
+ } finally {
+ this.bufferManager.releaseBuffers(reservedBuffers);
}
-
- // iteratively process the lowest tuple
- while (sublists.size() > 0) {
- SortedSublist sortedSublist = sublists.remove(sublists.size() - 1);
- merged.addTuple(sortedSublist.tuple);
- if (this.output != null && sortedSublist.index > masterSortIndex) {
- this.output.addTuple(sortedSublist.tuple); //a new distinct row
- }
- incrementWorkingTuple(sublists, sortedSublist);
- }
-
- // Remove merged sublists
- for(int i=0; i<maxSortIndex; i++) {
- TupleBuffer id = activeTupleBuffers.remove(0);
- if (id != this.output) {
- id.remove();
- }
- }
- merged.saveBatch();
- this.activeTupleBuffers.add(merged);
- masterSortIndex = masterSortIndex - maxSortIndex + 1;
- if (masterSortIndex < 0) {
- masterSortIndex = this.activeTupleBuffers.size() - 1;
- }
}
// Close sorted source (all others have been removed)
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java 2010-01-21 03:49:48 UTC (rev 1762)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/relational/TestSortNode.java 2010-01-21 03:59:24 UTC (rev 1763)
@@ -295,6 +295,7 @@
}
tsid.addTuple(Arrays.asList(2));
+ tsid.addTuple(Arrays.asList(3));
su.sort();
assertEquals(Arrays.asList(2), ts.nextTuple());
}
14 years, 11 months
teiid SVN: r1762 - in trunk/client/src: main/java/org/teiid/netty/handler/codec/serialization and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-01-20 22:49:48 -0500 (Wed, 20 Jan 2010)
New Revision: 1762
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java
trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java
Log:
TEIID-916 fix for stream corruption during a timeout.
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2010-01-20 20:25:36 UTC (rev 1761)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2010-01-21 03:49:48 UTC (rev 1762)
@@ -41,7 +41,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -84,7 +83,7 @@
private Map<Serializable, ResultsReceiver<Object>> asynchronousListeners = new ConcurrentHashMap<Serializable, ResultsReceiver<Object>>();
- private ReentrantLock readLock = new ReentrantLock();
+ private boolean hasReader;
public SocketServerInstanceImpl() {
@@ -318,18 +317,29 @@
TimeoutException {
long timeoutMillis = (int)Math.min(unit.toMillis(timeout), Integer.MAX_VALUE);
long start = System.currentTimeMillis();
- boolean reading = false;
while (!isDone()) {
- try {
- if ((reading = readLock.tryLock(timeoutMillis, TimeUnit.MILLISECONDS)) == true && !isDone()) {
- receivedMessage(socketChannel.read());
+ boolean reading = false;
+ synchronized (SocketServerInstanceImpl.this) {
+ if (!hasReader) {
+ hasReader = true;
+ reading = true;
+ } else if (!isDone()) {
+ SocketServerInstanceImpl.this.wait(Math.max(1, timeoutMillis));
}
- } catch (SocketTimeoutException e) {
- } catch (Exception e) {
- exceptionOccurred(e);
- } finally {
- if (reading) {
- readLock.unlock();
+ }
+ if (reading) {
+ try {
+ if (!isDone()) {
+ receivedMessage(socketChannel.read());
+ }
+ } catch (SocketTimeoutException e) {
+ } catch (Exception e) {
+ exceptionOccurred(e);
+ } finally {
+ synchronized (SocketServerInstanceImpl.this) {
+ hasReader = false;
+ SocketServerInstanceImpl.this.notifyAll();
+ }
}
}
if (!isDone()) {
Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java 2010-01-20 20:25:36 UTC (rev 1761)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java 2010-01-21 03:49:48 UTC (rev 1762)
@@ -65,7 +65,7 @@
buffer = new byte[4];
}
fillBuffer();
- int dataLen = ((buffer[0] & 0xff << 24) + (buffer[1] & 0xff << 16) + (buffer[2] & 0xff << 8) + (buffer[3] & 0xff << 0));
+ int dataLen = getIntFromBytes(buffer);
if (dataLen <= 0) {
throw new StreamCorruptedException("invalid data length: " + dataLen); //$NON-NLS-1$
}
@@ -87,6 +87,10 @@
return new CompactObjectInputStream(bais, classLoader).readObject();
}
+ static int getIntFromBytes(byte[] buffer) {
+ return ((buffer[0] & 0xff) << 24) + ((buffer[1] & 0xff) << 16) + ((buffer[2] & 0xff) << 8) + (buffer[3] & 0xff);
+ }
+
private void fillBuffer() throws IOException, EOFException {
while (count < buffer.length) {
int read = in.read(buffer, count, buffer.length - count);
Modified: trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java
===================================================================
--- trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java 2010-01-20 20:25:36 UTC (rev 1761)
+++ trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java 2010-01-21 03:49:48 UTC (rev 1762)
@@ -67,4 +67,13 @@
assertEquals(obj, result);
}
+ @Test public void testLargeIntConversion() throws Exception {
+ int testValue = 204503404;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+ dos.writeInt(testValue);
+ dos.close();
+ assertEquals(testValue, ObjectDecoderInputStream.getIntFromBytes(baos.toByteArray()));
+ }
+
}
14 years, 11 months
teiid SVN: r1761 - trunk/console.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-01-20 15:25:36 -0500 (Wed, 20 Jan 2010)
New Revision: 1761
Modified:
trunk/console/pom.xml
Log:
Updated Teiid version
Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml 2010-01-20 20:22:54 UTC (rev 1760)
+++ trunk/console/pom.xml 2010-01-20 20:25:36 UTC (rev 1761)
@@ -5,7 +5,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>6.3.0-SNAPSHOT</version>
+ <version>7.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
14 years, 11 months
teiid SVN: r1760 - in trunk/engine/src/main/java: org/teiid/dqp/internal/process and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-01-20 15:22:54 -0500 (Wed, 20 Jan 2010)
New Revision: 1760
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
Log:
TEIID-936 fixing the timeslicing mechanism to prevent query hangs
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java 2010-01-20 18:29:36 UTC (rev 1759)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java 2010-01-20 20:22:54 UTC (rev 1760)
@@ -32,6 +32,7 @@
import com.metamatrix.common.buffer.TupleBatch;
import com.metamatrix.common.buffer.BufferManager.TupleSourceType;
import com.metamatrix.common.log.LogManager;
+import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.Assertion;
import com.metamatrix.dqp.util.LogConstants;
@@ -41,6 +42,12 @@
public class QueryProcessor implements BatchProducer {
+ public static class ExpiredTimeSliceException extends MetaMatrixRuntimeException {
+
+ }
+
+ private static ExpiredTimeSliceException EXPIRED_TIME_SLICE = new ExpiredTimeSliceException();
+
public interface ProcessorFactory {
QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext) throws MetaMatrixProcessingException, MetaMatrixComponentException;
}
@@ -92,16 +99,19 @@
while (true) {
try {
return nextBatchDirect();
+ } catch (ExpiredTimeSliceException e) {
+ if (!nonBlocking) {
+ throw e;
+ }
} catch (BlockedException e) {
- if (nonBlocking) {
- try {
- Thread.sleep(DEFAULT_WAIT);
- } catch (InterruptedException err) {
- throw new MetaMatrixComponentException(err);
- }
- continue;
+ if (!nonBlocking) {
+ throw e;
}
- throw e;
+ try {
+ Thread.sleep(DEFAULT_WAIT);
+ } catch (InterruptedException err) {
+ throw new MetaMatrixComponentException(err);
+ }
}
}
}
@@ -162,7 +172,7 @@
closeProcessing();
}
if (result == null) {
- throw BlockedException.INSTANCE; //expired timeslice
+ throw EXPIRED_TIME_SLICE;
}
return result;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-01-20 18:29:36 UTC (rev 1759)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-01-20 20:22:54 UTC (rev 1760)
@@ -187,6 +187,9 @@
}
} catch (BlockedException e) {
LogManager.logDetail(LogConstants.CTX_DQP, "############# PW EXITING on", requestID, "- processor blocked ###########"); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (QueryProcessor.ExpiredTimeSliceException e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "############# PW reenqueueing ", requestID, "- time slice expired ###########"); //$NON-NLS-1$ //$NON-NLS-2$
+ this.moreWork();
} catch (Throwable e) {
LogManager.logDetail(LogConstants.CTX_DQP, e, "############# PW EXITING on", requestID, "- error occurred ###########"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -490,13 +493,10 @@
resultsReceiver.receiveResults(response);
}
- private static List getParameterInfo(StoredProcedure procedure) {
- List params = procedure.getParameters();
- List paramInfos = new ArrayList(params.size());
+ private static List<ParameterInfo> getParameterInfo(StoredProcedure procedure) {
+ List<ParameterInfo> paramInfos = new ArrayList<ParameterInfo>();
- Iterator iter = params.iterator();
- while(iter.hasNext()) {
- SPParameter param = (SPParameter) iter.next();
+ for (SPParameter param : procedure.getParameters()) {
ParameterInfo info = new ParameterInfo(param.getParameterType(), param.getResultSetColumns().size());
paramInfos.add(info);
}
14 years, 11 months
teiid SVN: r1759 - in trunk/console: .settings and 5 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2010-01-20 13:29:36 -0500 (Wed, 20 Jan 2010)
New Revision: 1759
Added:
trunk/console/.classpath
trunk/console/.project
trunk/console/.settings/
trunk/console/.settings/org.eclipse.jdt.core.prefs
trunk/console/.settings/org.maven.ide.eclipse.prefs
trunk/console/src/main/java/org/teiid/rhq/plugin/ModelComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/ModelDiscoveryComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
Removed:
trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorDiscoveryComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/HostComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/HostDiscoveryComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessDiscoveryComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/SystemComponent.java
Modified:
trunk/console/pom.xml
trunk/console/src/assembly/assemble-artifacts.xml
trunk/console/src/main/java/org/teiid/rhq/comm/ConnectionConstants.java
trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
Log:
TEIID-807: Adding discovery of more resources and restructuring tree
Added: trunk/console/.classpath
===================================================================
--- trunk/console/.classpath (rev 0)
+++ trunk/console/.classpath 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/console/.project
===================================================================
--- trunk/console/.project (rev 0)
+++ trunk/console/.project 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>teiid-console</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: trunk/console/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/console/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/console/.settings/org.eclipse.jdt.core.prefs 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,5 @@
+#Wed Nov 25 10:51:47 CST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/console/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- trunk/console/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ trunk/console/.settings/org.maven.ide.eclipse.prefs 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,9 @@
+#Wed Jan 20 12:26:36 CST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=true
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/pom.xml 2010-01-20 18:29:36 UTC (rev 1759)
@@ -5,7 +5,7 @@
<parent>
<artifactId>teiid</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.0.0-SNAPSHOT</version>
+ <version>6.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/console/src/assembly/assemble-artifacts.xml
===================================================================
--- trunk/console/src/assembly/assemble-artifacts.xml 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/assembly/assemble-artifacts.xml 2010-01-20 18:29:36 UTC (rev 1759)
@@ -4,7 +4,7 @@
<property name="embedded.temp.dir" value="${temp.dir}/embedded"/>
<!-- this contains jars to be included in the embedded war -->
- <property name="embedded.jar" value="${basedir}/target/distribution/jbedsp-embedded-plugin-${product.version}.jar"/>
+ <property name="embedded.jar" value="${basedir}/target/distribution/teiid-embedded-plugin-${product.version}.jar"/>
<property name="enterprise.temp.dir" value="${temp.dir}/enterprise"/>
<!-- this is the plugin to be deployed to JON that get sent to the agent -->
Modified: trunk/console/src/main/java/org/teiid/rhq/comm/ConnectionConstants.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/comm/ConnectionConstants.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/comm/ConnectionConstants.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -91,14 +91,7 @@
}
}
- public interface Host {
- public final static String TYPE = "Runtime.Host"; //$NON-NLS-1$
-
- public static interface Operations {
- public final static String GET_HOSTS = "getHosts"; //$NON-NLS-1$
-
- }
- }
+
public interface Process {
@@ -160,6 +153,27 @@
}
public interface Resource {
+
+ public interface VDB {
+ public final static String TYPE = "teiid"; //$NON-NLS-1$
+ public final static String SUBTYPE = "vdb"; //$NON-NLS-1$
+
+
+ public static interface Operations {
+
+ }
+ }
+
+ public interface Model {
+ public final static String TYPE = "teiid"; //$NON-NLS-1$
+ public final static String SUBTYPE = "model"; //$NON-NLS-1$
+
+
+ public static interface Operations {
+
+ }
+ }
+
public interface Service {
public final static String TYPE = "Resource.Service"; //$NON-NLS-1$
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorComponent.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,129 +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;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.Connector;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.Connector.Operations;
-
-
-/**
- * MetaMatrix Connector component class
- *
- */
-public class ConnectorComponent extends Facet {
-
- private final Log LOG = LogFactory.getLog(ConnectorComponent.class);
-
- /**
- * @see org.teiid.rhq.plugin.Facet#getComponentType()
- * @since 1.0
- */
- @Override
- String getComponentType() {
- return Connector.TYPE;
- }
-
- protected void setOperationArguments(String name, Configuration configuration,
- Map argumentMap) {
-
- if (name.equals(Operations.STOP_CONNECTOR)){
- Boolean stopNow = configuration.getSimple(ConnectionConstants.ComponentType.Operation.Value.STOP_NOW).getBooleanValue();
- argumentMap.put(ConnectionConstants.ComponentType.Operation.Value.STOP_NOW, stopNow);
- }
- //Need identifier for all Connector operations
- String key = ConnectionConstants.IDENTIFIER;
- argumentMap.put(key, getComponentIdentifier());
-
- }
-
- @Override
- public void getValues(MeasurementReport arg0,
- Set<MeasurementScheduleRequest> arg1) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
-// @Override
-// public OperationResult invokeOperation(String name,
-// Configuration configuration) {
-// Map valueMap = new HashMap();
-// Connection conn = null;
-//
-// Set operationDefinitionSet = this.resourceContext.getResourceType()
-// .getOperationDefinitions();
-//
-// ExecutedOperationResult result = initResult(name, operationDefinitionSet);
-//
-// setValueMap(name, configuration, valueMap);
-//
-// execute(conn, result, getComponentType(), name, valueMap);
-//
-// return ((ExecutedOperationResultImpl) result).getOperationResult();
-//
-
-// Connection conn = null;
-// Map valueMap = new HashMap();
-// MMOperationResult result = null;
-//
-// // Add "stop now" value if we are attempting to stop a connector
-// if (name.equals(ComponentType.Operation.STOP_CONNECTOR)) {
-// Boolean stopNow = configuration.getSimple(
-// ConnectionConstants.ComponentType.Operation.Value.STOP_NOW)
-// .getBooleanValue();
-// valueMap.put(
-// ConnectionConstants.ComponentType.Operation.Value.STOP_NOW,
-// stopNow);
-// }
-//
-// valueMap.put(ConnectionConstants.IDENTIFIER, getComponentIdentifier());
-//
-// try {
-// conn = getConnection();
-//
-// if (!conn.isValid()) {
-// return null;
-// }
-// // Object operationReturnObject =
-// conn.executeOperation(result,
-// getComponentType(), name, valueMap);
-//
-//
-// } catch (Exception e) {
-// final String msg = "Failed to invoke operation [" + name + "]. Cause: " + e; //$NON-NLS-1$ //$NON-NLS-2$
-// LOG.error(msg);
-// throw new RuntimeException(msg);
-// } finally {
-// conn.close();
-// }
-//
-// return (OperationResult)result;
-// }
-}
\ No newline at end of file
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorDiscoveryComponent.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/ConnectorDiscoveryComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.rhq.plugin;
-
-import java.util.Collection;
-
-import org.teiid.rhq.comm.Component;
-import org.teiid.rhq.comm.Connection;
-import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionException;
-
-
-/**
- * Discovery component used to discover the monitored connector bindings
- *
- */
-public class ConnectorDiscoveryComponent extends NodeChildrenDiscoveryComponent {
-
- Collection<Component> getComponents(Connection conn, Facet parent) throws ConnectionException {
- return conn.discoverComponents(ConnectionConstants.ComponentType.Runtime.Connector.TYPE, parent.getComponentIdentifier());
- }
-
-
-}
\ No newline at end of file
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -55,11 +55,9 @@
import org.teiid.rhq.admin.utils.SingletonConnectionManager;
import org.teiid.rhq.comm.Component;
import org.teiid.rhq.comm.Connection;
-import org.teiid.rhq.comm.ConnectionConstants;
import org.teiid.rhq.comm.ConnectionException;
import org.teiid.rhq.comm.ExecutedResult;
import org.teiid.rhq.comm.VMComponent;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType;
import org.teiid.rhq.plugin.objects.ExecutedOperationResultImpl;
@@ -112,31 +110,6 @@
*/
public void start(ResourceContext context) {
resourceContext = context;
-
-
- systemKey = resourceContext.getPluginConfiguration()
- .getSimpleProperties().get(Component.SYSTEM_KEY)
- .getStringValue();
- name = resourceContext.getPluginConfiguration().getSimpleProperties()
- .get(Component.NAME).getStringValue();
-
- // because the system may not be up, name and
- // identifier may be null at initial creation
- // and will be updated when the system becomes available.
- if (name == null)
- name = "NotSet"; //$NON-NLS-1$
-
- identifier = resourceContext.getPluginConfiguration()
- .getSimpleProperties().get(Component.IDENTIFIER)
- .getStringValue();
- if (identifier == null)
- identifier = "";//$NON-NLS-1$
- if (resourceContext.getPluginConfiguration().getSimpleProperties().get(
- VMComponent.PORT) != null) {
- port = resourceContext.getPluginConfiguration()
- .getSimpleProperties().get(VMComponent.PORT)
- .getStringValue();
- }
}
/**
@@ -244,31 +217,9 @@
*/
public AvailabilityType getAvailability() {
- if (!connMgr.hasServersDefined()) {
- this.isAvailable = false;
- return AvailabilityType.DOWN;
-
- }
- Connection connection = null;
- try {
-
- LOG.debug("Checking availability of " + identifier); //$NON-NLS-1$
- connection = getConnection();
- if (connection.isAvailable(getComponentType(), identifier)) {
- LOG.info("Availability of " + identifier + " is up"); //$NON-NLS-1$ //$NON-NLS-2$
- this.isAvailable = true;
- return AvailabilityType.UP;
- }
- } catch (InvalidPluginConfigurationException ipce) {
- // dont log anything, already done when getconnection is called
- } catch (Throwable err) {
- LOG.error("Unknown exception occured when checking availability for resource " + identifier, err); //$NON-NLS-1$
- } finally {
- connection.close();
- }
- LOG.error("Availability of " + identifier + " is down"); //$NON-NLS-1$ //$NON-NLS-2$
- this.isAvailable = false;
- return AvailabilityType.DOWN;
+ LOG.debug("Checking availability of " + identifier); //$NON-NLS-1$
+
+ return AvailabilityType.UP;
}
/**
@@ -339,9 +290,9 @@
// start with.
// note that it is empty, so we're assuming there are no required
// configs in the plugin descriptor.
- resourceConfiguration = new Configuration();
+ resourceConfiguration = this.resourceContext.getPluginConfiguration();
}
-
+
Configuration config = resourceConfiguration;
return config;
@@ -438,4 +389,6 @@
*/
public void deleteResource() {
}
+
+
}
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/HostComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/HostComponent.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/HostComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,176 +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;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionException;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.Host;
-
-
-/**
- * Component class for the MetaMatrix Host Controller process.
- *
- */
-public class HostComponent extends Facet {
- private final Log LOG = LogFactory
- .getLog(HostComponent.class);
-
-
- public static final String CONNECTOR_ADDRESS_CONFIG_PROPERTY = "connectorAddress"; //$NON-NLS-1$
-
- public static final String CONNECTION_TYPE = "type"; //$NON-NLS-1$
-
- public static final String PARENT_TYPE = "PARENT"; //$NON-NLS-1$
-
- public static final String INSTALL_DIR = "install.dir"; //$NON-NLS-1$
-
-
- private String install_dir;
- /**
- * @see org.teiid.rhq.plugin.Facet#getComponentType()
- * @since 1.0
- */
- @Override
- String getComponentType() {
- return Host.TYPE;
- }
-
-
-
- String getInstallDirectory() {
-
- if (install_dir != null) {
- return install_dir;
- }
- install_dir = resourceContext.getPluginConfiguration()
- .getSimpleProperties().get(INSTALL_DIR)
- .getStringValue();
-
- return install_dir;
- }
-
-
- /**
- * The plugin container will call this method when your resource component
- * has been scheduled to collect some measurements now. It is within this
- * method that you actually talk to the managed resource and collect the
- * measurement data that is has emitted.
- *
- * @see MeasurementFacet#getValues(MeasurementReport, Set)
- */
- public void getValues(MeasurementReport report,
- Set<MeasurementScheduleRequest> requests) {
- for (MeasurementScheduleRequest request : requests) {
- String name = request.getName();
-
- // TODO: based on the request information, you must collect the
- // requested measurement(s)
- // you can use the name of the measurement to determine what you
- // actually need to collect
- try {
- Number value = new Integer(1); // dummy measurement value -
- // this should come from the
- // managed resource
- report.addData(new MeasurementDataNumeric(request, value
- .doubleValue()));
- } catch (Exception e) {
- LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
- }
- }
-
- return;
- }
-
- protected void setOperationArguments(String name, Configuration configuration,
- Map argumentMap) {
-
- if (name.equals(ConnectionConstants.ComponentType.Operation.GET_PROPERTIES)){
- String key = ConnectionConstants.IDENTIFIER;
- argumentMap.put(key, getComponentIdentifier());
- }
-
- }
-
- /**
- * The plugin container will call this method and it needs to obtain the
- * current configuration of the managed resource. Your plugin will obtain
- * the managed resource's configuration in your own custom way and populate
- * the returned Configuration object with the managed resource's
- * configuration property values.
- *
- * @see ConfigurationFacet#loadResourceConfiguration()
- *
- */
- @Override
- public Configuration loadResourceConfiguration() {
- // here we simulate the loading of the managed resource's configuration
- Configuration config = this.getResourceConfiguration() ;
- if (config == null) {
- // for this example, we will create a simple dummy configuration to
- // start with.
- // note that it is empty, so we're assuming there are no required
- // configs in the plugin descriptor.
- config = new Configuration();
- }
-
- Properties props;
- try {
- props = getConnection().getProperties(this.getComponentType(), this.getComponentIdentifier());
- } catch (ConnectionException e) {
- LOG.error("Failed to obtain host properties for [" + this.getComponentIdentifier() //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
- throw new InvalidPluginConfigurationException(e);
- }
-
- if (props != null && props.size() > 0) {
- Iterator it=props.keySet().iterator();
- while(it.hasNext()) {
- String k = (String)it.next();
-
- config.put(new PropertySimple(k, props.get(k)));
-
- }
-
- }
-
-
- this.setResourceConfiguration(config);
- return this.getResourceConfiguration();
- }
-
-}
\ No newline at end of file
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/HostDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/HostDiscoveryComponent.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/HostDiscoveryComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,55 +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;
-
-import java.util.Collection;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.teiid.rhq.comm.Component;
-import org.teiid.rhq.comm.Connection;
-import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionException;
-
-
-/**
- * Discovery component for the MetaMatrix Host controller process
- *
- */
-public class HostDiscoveryComponent extends NodeChildrenDiscoveryComponent {
-
-
- @Override
- Collection<Component> getComponents(Connection conn, Facet parent) throws ConnectionException {
- return conn.discoverComponents(ConnectionConstants.ComponentType.Runtime.Host.TYPE, "*");
- }
-
- @Override
- protected void addAdditionalProperties(Configuration configuration, Component component) throws InvalidPluginConfigurationException {
- String installdir = component.getProperty(HostComponent.INSTALL_DIR);
- configuration.put(new PropertySimple(HostComponent.INSTALL_DIR,
- installdir));
- }
-
-
-}
\ No newline at end of file
Added: trunk/console/src/main/java/org/teiid/rhq/plugin/ModelComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/ModelComponent.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/ModelComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.teiid.rhq.comm.ConnectionConstants;
+
+
+/**
+ * Component class for the MetaMatrix Host Controller process.
+ *
+ */
+public class ModelComponent extends Facet {
+ private final Log LOG = LogFactory
+ .getLog(ModelComponent.class);
+
+
+ /**
+ * @see org.teiid.rhq.plugin.Facet#getComponentType()
+ * @since 1.0
+ */
+ @Override
+ String getComponentType() {
+ return ConnectionConstants.ComponentType.Resource.Model.TYPE;
+ }
+
+ /**
+ * The plugin container will call this method when your resource component
+ * has been scheduled to collect some measurements now. It is within this
+ * method that you actually talk to the managed resource and collect the
+ * measurement data that is has emitted.
+ *
+ * @see MeasurementFacet#getValues(MeasurementReport, Set)
+ */
+ public void getValues(MeasurementReport report,
+ Set<MeasurementScheduleRequest> requests) {
+ for (MeasurementScheduleRequest request : requests) {
+ String name = request.getName();
+
+ // TODO: based on the request information, you must collect the
+ // requested measurement(s)
+ // you can use the name of the measurement to determine what you
+ // actually need to collect
+ try {
+ Number value = new Integer(1); // dummy measurement value -
+ // this should come from the
+ // managed resource
+ report.addData(new MeasurementDataNumeric(request, value
+ .doubleValue()));
+ } catch (Exception e) {
+ LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
+ + "]. Cause: " + e); //$NON-NLS-1$
+ }
+ }
+
+ return;
+ }
+
+ protected void setOperationArguments(String name, Configuration configuration,
+ Map argumentMap) {
+
+ if (name.equals(ConnectionConstants.ComponentType.Operation.GET_PROPERTIES)){
+ String key = ConnectionConstants.IDENTIFIER;
+ argumentMap.put(key, getComponentIdentifier());
+ }
+
+ }
+
+}
\ No newline at end of file
Added: trunk/console/src/main/java/org/teiid/rhq/plugin/ModelDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/ModelDiscoveryComponent.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/ModelDiscoveryComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.rhq.plugin;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
+
+/**
+ * Discovery component for the MetaMatrix Host controller process
+ *
+ */
+public class ModelDiscoveryComponent implements ResourceDiscoveryComponent {
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ public Set<DiscoveredResourceDetails> discoverResources(
+ ResourceDiscoveryContext discoveryContext)
+ throws InvalidPluginConfigurationException, Exception {
+ Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
+
+ PropertyList list = discoveryContext.getParentResourceContext().getPluginConfiguration().getList("models");
+
+ Iterator<Property> listIter = list.getList().iterator();
+
+ while(listIter.hasNext()){
+ PropertyMap propertyMap = (PropertyMap)listIter.next();
+
+ String modelName = ((PropertySimple)propertyMap.getMap().get("name")).getStringValue();
+
+ ManagedComponent model = ProfileServiceUtil
+ .getManagedComponent(new ComponentType(
+ PluginConstants.ComponentType.Model.TYPE,
+ PluginConstants.ComponentType.Model.SUBTYPE),
+ modelName);
+
+ /**
+ *
+ * A discovered resource must have a unique key, that must stay the same
+ * when the resource is discovered the next time
+ */
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
+ discoveryContext.getResourceType(), // ResourceType
+ modelName, // Resource Key
+ modelName, // Resource Name
+ null, // Version TODO can we get that from discovery ?
+ PluginConstants.ComponentType.Model.DESCRIPTION, // Description
+ discoveryContext.getDefaultPluginConfiguration(), // Plugin Config
+ null // Process info from a process scan
+ );
+
+ // modelURI, connectorBindingNames, source, visible, modelType, visibility, supportsMultiSourceBindings,
+ // name, path, uuid, properties
+ String name = ((SimpleValueSupport)model.getProperty("name").getValue()).getValue().toString();
+ String path = ((SimpleValueSupport)model.getProperty("path").getValue()).getValue().toString();
+ String modelURI = ((SimpleValueSupport)model.getProperty("modelURI").getValue()).getValue().toString();
+ String source = ((SimpleValueSupport)model.getProperty("source").getValue()).getValue().toString();
+ String visible = ((SimpleValueSupport)model.getProperty("visible").getValue()).getValue().toString();
+ String modelType = ((SimpleValueSupport)model.getProperty("modelType").getValue()).getValue().toString();
+ String supportsMultiSourceBindings = ((SimpleValueSupport)model.getProperty("supportsMultiSourceBindings").getValue()).getValue().toString();
+
+ Configuration c = detail.getPluginConfiguration();
+
+ getConnectors(model, c);
+
+ c.put(new PropertySimple("name", name));
+ c.put(new PropertySimple("path", path));
+ c.put(new PropertySimple("modelURI", modelURI));
+ c.put(new PropertySimple("source", source));
+ c.put(new PropertySimple("visible", visible));
+ c.put(new PropertySimple("modelType", modelType));
+ c.put(new PropertySimple("supportsMultiSourceBindings", supportsMultiSourceBindings));
+
+
+ // Add to return values
+ discoveredResources.add(detail);
+ log.info("Discovered Teiid Model: " + modelName);
+ }
+
+ return discoveredResources;
+ }
+
+ /**
+ * @param mcVdb
+ * @param configuration
+ */
+ private void getConnectors(ManagedComponent model, Configuration configuration) {
+ //Get Connector(s) from Model
+ ManagedProperty property = model.getProperty("connectorBindingNames");
+ CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
+ MetaValue[] metaValues = valueSupport.getElements();
+
+ PropertyList connectorsList = new PropertyList("connectors");
+ configuration.put(connectorsList);
+
+ for (MetaValue value : metaValues) {
+ SimpleValueSupport simpleValueSupport = (SimpleValueSupport) value;
+ String connectorName = (String)simpleValueSupport.getValue();
+
+ PropertyMap connector = new PropertyMap("connector", new PropertySimple("name", connectorName));
+ connectorsList.add(connector);
+ }
+ }
+
+}
\ No newline at end of file
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessComponent.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,316 +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;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.event.EventSeverity;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.pluginapi.event.EventContext;
-import org.rhq.core.pluginapi.event.EventPoller;
-import org.rhq.core.pluginapi.event.log.LogFileEventPoller;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.teiid.rhq.comm.Connection;
-import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionException;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.Process;
-import org.teiid.rhq.plugin.log.JBEDSPErrorLogEntryProcessor;
-
-
-/**
- *
- * MetaMatrix server component class. This class represents the node for the
- * MMProcess.
- *
- */
-public class ProcessComponent extends Facet {
- private final Log LOG = LogFactory.getLog(ProcessComponent.class);
-
-
- public static final String PLUGIN_CONFIG_PROP_ERROR_LOG_EVENTS_ENABLED = "enabled"; //$NON-NLS-1$
- public static final String PLUGIN_CONFIG_PROP_ERROR_LOG_MINIMUM_SEVERITY = "minimumSeverity"; //$NON-NLS-1$
- public static final String PLUGIN_CONFIG_PROP_ERROR_LOG_INCLUDES_PATTERN = "errorLogIncludesPattern"; //$NON-NLS-1$
- public static final String PLUGIN_CONFIG_PROP_ERROR_LOG_FILE_PATH = "errorLogFilePath"; //$NON-NLS-1$
- public static final String INSTALL_DIR = "install.dir"; //$NON-NLS-1$
-
- private static final String ERROR_LOG_ENTRY_EVENT_TYPE = "errorLogEntry"; //$NON-NLS-1$
-
-
-
- private EventContext eventContext;
- private File errorLogFile;
-
-
- /**
- * @see org.teiid.rhq.plugin.Facet#start(org.rhq.core.pluginapi.inventory.ResourceContext)
- */
- @Override
- public void start(ResourceContext context) {
- super.start(context);
-
- this.eventContext = resourceContext.getEventContext();
-
- // startEventPollers();
- }
-
- /**
- * @see org.teiid.rhq.plugin.Facet#stop()
- */
- @Override
- public void stop() {
- stopEventPollers();
- super.stop();
-
- }
-
- public AvailabilityType getAvailability() {
-
- return AvailabilityType.UP;
- }
-
- /**
- * @see org.teiid.rhq.plugin.Facet#getComponentType()
- * @since 1.0
- */
- @Override
- String getComponentType() {
- return Process.TYPE;
- }
-
- protected void setOperationArguments(String name, Configuration configuration,
- Map argumentMap) {
-
- if (name.equals(ConnectionConstants.ComponentType.Operation.GET_PROPERTIES)){
- String key = ConnectionConstants.IDENTIFIER;
- argumentMap.put(key, getComponentIdentifier());
- }
-
- }
-
-
- @Override
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
- Connection conn = null;
- Map valueMap = new HashMap();
-
- try{
- conn = getConnection();
- if (!conn.isValid()) {
- return;
- }
- for (MeasurementScheduleRequest request : requests) {
- String name = request.getName();
- LOG.info("Measurement name = " + name); //$NON-NLS-1$
-
- Object metricReturnObject = conn.getMetric(getComponentType(), this.getComponentIdentifier(), name, valueMap);
-
- try {
- if (request.getName().equals(ComponentType.Metric.HIGH_WATER_MARK)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double)metricReturnObject));
- }
- } catch (Exception e) {
- LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
- throw(e);
- }
- }
- }finally{
- conn.close();
- }
-
- }
-
-
- /**
- * The plugin container will call this method and it needs to obtain the
- * current configuration of the managed resource. Your plugin will obtain
- * the managed resource's configuration in your own custom way and populate
- * the returned Configuration object with the managed resource's
- * configuration property values.
- *
- * @see ConfigurationFacet#loadResourceConfiguration()
- *
- */
- @Override
- public Configuration loadResourceConfiguration() {
- // here we simulate the loading of the managed resource's configuration
- Configuration config = this.getResourceConfiguration() ;
- if (config == null) {
- // for this example, we will create a simple dummy configuration to
- // start with.
- // note that it is empty, so we're assuming there are no required
- // configs in the plugin descriptor.
- config = new Configuration();
- }
-
- Properties props;
- try {
- props = getConnection().getProperties(this.getComponentType(), this.getComponentIdentifier());
- } catch (ConnectionException e) {
- LOG.error("Failed to obtain process properties for [" + this.getComponentIdentifier() //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
- throw new InvalidPluginConfigurationException(e);
- }
-
- if (props != null && props.size() > 0) {
- Iterator it=props.keySet().iterator();
- while(it.hasNext()) {
- String k = (String)it.next();
-
- config.put(new PropertySimple(k, props.get(k)));
-
- }
-
- }
-
-
- this.setResourceConfiguration(config);
- return this.getResourceConfiguration();
- }
-
-
- protected static String deriveFileName(final String identifier) {
-
- String startFileName = identifier.substring(0, identifier.indexOf("|")); //$NON-NLS-1$
- String endFileName = identifier.substring(identifier.indexOf("|")+1, identifier.length()); //$NON-NLS-1$
-
- startFileName = replaceAll(startFileName, ".", "_"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String logfilename = startFileName.toLowerCase() + "_" + endFileName + ".log"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- return logfilename;
-
- }
-
- private void startEventPollers() {
- Configuration pluginConfig = resourceContext.getPluginConfiguration();
- Boolean enabled = Boolean.valueOf(pluginConfig.getSimpleValue(
- PLUGIN_CONFIG_PROP_ERROR_LOG_EVENTS_ENABLED, null)); //$NON-NLS-1$
- if (enabled) {
-
- String installdir = pluginConfig.getSimpleValue(
- INSTALL_DIR, null); //$NON-NLS-1$
- if (installdir == null) {
- throw new InvalidPluginConfigurationException(
- "Installation directory could not be determined in order for the process to monitor the log files"); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
-
- String logFileName = deriveFileName(this.getComponentIdentifier());
-
- String relativelogname = pluginConfig.getSimpleValue(
- PLUGIN_CONFIG_PROP_ERROR_LOG_FILE_PATH,
- "/log/" + logFileName); //$NON-NLS-1$
-
- errorLogFile = new File(installdir + "/" + relativelogname); //$NON-NLS-1$
-
- LOG.info("Start event polling on logfile: " + errorLogFile.getAbsolutePath()); //$NON-NLS-1$
-
- JBEDSPErrorLogEntryProcessor processor = new JBEDSPErrorLogEntryProcessor(
- ERROR_LOG_ENTRY_EVENT_TYPE, errorLogFile);
- String includesPatternString = pluginConfig.getSimpleValue(
- PLUGIN_CONFIG_PROP_ERROR_LOG_INCLUDES_PATTERN, null);
- if (includesPatternString != null) {
- try {
- Pattern includesPattern = Pattern
- .compile(includesPatternString);
- processor.setIncludesPattern(includesPattern);
- } catch (PatternSyntaxException e) {
- throw new InvalidPluginConfigurationException(
- "Includes pattern [" + includesPatternString + "] is not a valid regular expression."); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- String minimumSeverityString = pluginConfig.getSimpleValue(
- PLUGIN_CONFIG_PROP_ERROR_LOG_MINIMUM_SEVERITY, null);
- if (minimumSeverityString != null) {
- EventSeverity minimumSeverity = EventSeverity
- .valueOf(minimumSeverityString.toUpperCase());
- processor.setMinimumSeverity(minimumSeverity);
- }
- EventPoller poller = new LogFileEventPoller(this.eventContext,
- ERROR_LOG_ENTRY_EVENT_TYPE, errorLogFile, processor);
- this.eventContext.registerEventPoller(poller, 30, errorLogFile
- .getPath());
- }
- }
-
- private void stopEventPollers() {
-// Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
-// File errorLogFile =
-// resolvePathRelativeToServerRoot(pluginConfig.getSimpleValue(PLUGIN_CONFIG_PROP_ERROR_LOG_FILE_PATH,
-// DEFAULT_ERROR_LOG_PATH));
- this.eventContext.unregisterEventPoller(ERROR_LOG_ENTRY_EVENT_TYPE, errorLogFile.getPath());
- }
-
-
- /*
- * Replace all occurrences of the search string with the replace string
- * in the source string. If any of the strings is null or the search string
- * is zero length, the source string is returned.
- * @param source the source string whose contents will be altered
- * @param search the string to search for in source
- * @param replace the string to substitute for search if present
- * @return source string with *all* occurrences of the search string
- * replaced with the replace string
- */
- private static String replaceAll(String source, String search, String replace) {
- if (source != null && search != null && search.length() > 0 && replace != null) {
- int start = source.indexOf(search);
- if (start > -1) {
- StringBuffer newString = new StringBuffer(source);
- replaceAll(newString, search, replace);
- return newString.toString();
- }
- }
- return source;
- }
-
- private static void replaceAll(StringBuffer source, String search, String replace) {
- if (source != null && search != null && search.length() > 0 && replace != null) {
- int start = source.toString().indexOf(search);
- while (start > -1) {
- int end = start + search.length();
- source.replace(start, end, replace);
- start = source.toString().indexOf(search, start + replace.length());
- }
- }
- }
-
-
-}
\ No newline at end of file
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessDiscoveryComponent.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/ProcessDiscoveryComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,53 +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;
-
-import java.util.Collection;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.teiid.rhq.comm.Component;
-import org.teiid.rhq.comm.Connection;
-import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionException;
-import org.teiid.rhq.comm.VMComponent;
-
-
-
-/**
- *
- * The discovery component class for the MetaMatrix server node
- *
- */
-public class ProcessDiscoveryComponent extends NodeChildrenDiscoveryComponent {
-
-
- Collection<Component> getComponents(Connection conn, Facet parent) throws ConnectionException {
- return conn.discoverComponents(ConnectionConstants.ComponentType.Runtime.Process.TYPE, parent.getComponentIdentifier());
- }
-
- protected void addAdditionalProperties(Configuration configuration, Component component) throws InvalidPluginConfigurationException {
- configuration.put(new PropertySimple(VMComponent.PORT, ((VMComponent)component).getPort()));
-
- }
-}
\ No newline at end of file
Deleted: trunk/console/src/main/java/org/teiid/rhq/plugin/SystemComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/SystemComponent.java 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/SystemComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,169 +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;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.teiid.rhq.comm.Connection;
-import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.Queries.Query;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.System.Metrics;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.System.Operations;
-
-
-/**
- *
- */
-public class SystemComponent extends Facet {
- private final Log LOG = LogFactory.getLog(SystemComponent.class);
-
- /**
- * Property is used to identify an unreachable system
- */
- protected static final String UNREACHABLE_NAME = "UNREACHABLE_SYSTEM"; //$NON-NLS-1$
-
- /**
- * @see org.teiid.rhq.plugin.Facet#getComponentType()
- * @since 4.3
- */
- @Override
- String getComponentType() {
- return ConnectionConstants.ComponentType.Runtime.System.TYPE;
- }
-
- protected void setOperationArguments(String name, Configuration configuration,
- Map valueMap) {
-
- // Parameter logic for System Operations
- if (name.equals(Query.GET_QUERIES) ||
- name.equals(Operations.GET_LONGRUNNINGQUERIES)) {
- Boolean includeSourceQueries = configuration.getSimple(ConnectionConstants.ComponentType.Operation.Value.INCLUDE_SOURCE_QUERIES).getBooleanValue();
- Integer long_running_value = getResourceConfiguration().getSimple(ConnectionConstants.ComponentType.Operation.Value.LONG_RUNNING_QUERY_LIMIT).getIntegerValue();
- valueMap.put(ConnectionConstants.ComponentType.Operation.Value.INCLUDE_SOURCE_QUERIES, includeSourceQueries);
- valueMap.put(ConnectionConstants.ComponentType.Operation.Value.LONG_RUNNING_QUERY_LIMIT, long_running_value);
- }else if (name.equals(Operations.BOUNCE_SYSTEM)) {
- Boolean waitUntilFinished = configuration.getSimple(ConnectionConstants.ComponentType.Operation.Value.WAIT_UNTIL_FINISHED).getBooleanValue();
- valueMap.put(ConnectionConstants.ComponentType.Operation.Value.WAIT_UNTIL_FINISHED, waitUntilFinished);
- }else if (name.equals(ConnectionConstants.ComponentType.Operation.KILL_REQUEST)) {
- String key = ConnectionConstants.ComponentType.Operation.Value.REQUEST_ID;
- valueMap.put(key, configuration.getSimple(key).getStringValue());
- }else if (name.equals(ConnectionConstants.ComponentType.Operation.GET_PROPERTIES) ) {
- String key = ConnectionConstants.IDENTIFIER;
- valueMap.put(key, getComponentIdentifier());
- }
-
- }
-
-
- @Override
- public void getValues(MeasurementReport report,
- Set<MeasurementScheduleRequest> requests) throws Exception {
-
- // because the sytsem object will be created before the use actually connects, checks have to be
- // made not to perform actions that will require a connection before its available
- if (!this.isAvailable()) {
- return;
- }
-
- Connection conn = null;
- Map valueMap = new HashMap();
-
- try {
- conn = getConnection();
- if (!conn.isValid()) {
- return;
- }
- for (MeasurementScheduleRequest request : requests) {
- String name = request.getName();
- LOG.debug("Measurement name = " + name); //$NON-NLS-1$
-
- //Initialize any parameters to be used in the retrieval of metric values
- if (request.getName().equals(Metrics.LONG_RUNNING_QUERIES)) {
- Integer value = getResourceConfiguration().getSimple(ConnectionConstants.ComponentType.Operation.Value.LONG_RUNNING_QUERY_LIMIT).getIntegerValue();
- valueMap.put(ComponentType.Operation.Value.LONG_RUNNING_QUERY_LIMIT, value);
- }
-
- Object metricReturnObject = conn.getMetric(getComponentType(),
- this.getComponentIdentifier(),
- name,
- valueMap);
-
- try {
- if (request.getName().equals(
- Metrics.QUERY_COUNT)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double) metricReturnObject));
- } else {
- if (request.getName().equals(
- Metrics.SESSION_COUNT)) {
- report.addData(new MeasurementDataNumeric(request,
- (Double) metricReturnObject));
- } else {
- if (request.getName().equals(
- Metrics.LONG_RUNNING_QUERIES)) {
- report.addData(new MeasurementDataNumeric(
- request, (Double) metricReturnObject));
- }
- }
- }
-
- } catch (Exception e) {
- LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
- + "]. Cause: " + e); //$NON-NLS-1$
- // throw(e);
- }
- }
- } finally {
- if (conn != null) {
- conn.close();
- }
- }
- }
-
-//
-// @Override
-// public void updateResourceConfiguration(ConfigurationUpdateReport report) {
-//
-// Properties props = System.getProperties();
-//
-// Iterator<PropertySimple> pluginPropIter = report.getConfiguration().getSimpleProperties().values().iterator();
-//
-// while (pluginPropIter.hasNext()){
-// PropertySimple pluginProp = pluginPropIter.next();
-// props.put(pluginProp.getName(), pluginProp.getStringValue());
-// }
-//
-// SingletonConnectionManager.getInstance().initialize(props);
-// super.updateResourceConfiguration(report);
-//
-// }
-
-}
\ No newline at end of file
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java (from rev 1588, trunk/console/src/main/java/org/teiid/rhq/plugin/HostComponent.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,94 @@
+/*
+ * 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;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+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.comm.ConnectionConstants;
+
+
+/**
+ * Component class for a Teiid VDB
+ *
+ */
+public class VDBComponent extends Facet {
+ private final Log LOG = LogFactory
+ .getLog(VDBComponent.class);
+
+ /**
+ * The plugin container will call this method when your resource component
+ * has been scheduled to collect some measurements now. It is within this
+ * method that you actually talk to the managed resource and collect the
+ * measurement data that is has emitted.
+ *
+ * @see MeasurementFacet#getValues(MeasurementReport, Set)
+ */
+ public void getValues(MeasurementReport report,
+ Set<MeasurementScheduleRequest> requests) {
+ for (MeasurementScheduleRequest request : requests) {
+ String name = request.getName();
+
+ // TODO: based on the request information, you must collect the
+ // requested measurement(s)
+ // you can use the name of the measurement to determine what you
+ // actually need to collect
+ try {
+ Number value = new Integer(1); // dummy measurement value -
+ // this should come from the
+ // managed resource
+ report.addData(new MeasurementDataNumeric(request, value
+ .doubleValue()));
+ } catch (Exception e) {
+ LOG.error("Failed to obtain measurement [" + name //$NON-NLS-1$
+ + "]. Cause: " + e); //$NON-NLS-1$
+ }
+ }
+
+ return;
+ }
+
+ protected void setOperationArguments(String name, Configuration configuration,
+ Map argumentMap) {
+
+ if (name.equals(ConnectionConstants.ComponentType.Operation.GET_PROPERTIES)){
+ String key = ConnectionConstants.IDENTIFIER;
+ //argumentMap.put(key, getComponentIdentifier());
+ }
+
+ }
+
+ @Override
+ String getComponentType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
+
Copied: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java (from rev 1588, trunk/console/src/main/java/org/teiid/rhq/plugin/HostDiscoveryComponent.java)
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.rhq.plugin;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
+
+/**
+ * Discovery component for VDs
+ *
+ */
+public class VDBDiscoveryComponent implements ResourceDiscoveryComponent {
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ public Set<DiscoveredResourceDetails> discoverResources(
+ ResourceDiscoveryContext discoveryContext)
+ throws InvalidPluginConfigurationException, Exception {
+ Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
+
+ Set<ManagedComponent> vdbs = ProfileServiceUtil
+ .getManagedComponents(new ComponentType(
+ PluginConstants.ComponentType.VDB.TYPE,
+ PluginConstants.ComponentType.VDB.SUBTYPE));
+
+ for (ManagedComponent mcVdb : vdbs) {
+
+ String vdbName = ((SimpleValueSupport) mcVdb.getProperty("name")
+ .getValue()).getValue().toString();
+ String vdbVersion = ((SimpleValueSupport) mcVdb.getProperty("version")
+ .getValue()).getValue().toString();
+ //TODO: Correct this after deploying proper VDB/Metadata
+ String vdbDescription = "description"; // mcVdb.getProperty("description");
+ String vdbStatus = "active"; // mcVdb.getProperty("status");
+ String vdbURL = "url"; // mcVdb.getProperty("url");
+
+ /**
+ *
+ * A discovered resource must have a unique key, that must stay the
+ * same when the resource is discovered the next time
+ */
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
+ discoveryContext.getResourceType(), // ResourceType
+ vdbName, // Resource Key
+ vdbName, // Resource Name
+ vdbVersion, // Version
+ PluginConstants.ComponentType.VDB.DESCRIPTION, // Description
+ discoveryContext.getDefaultPluginConfiguration(), // Plugin Config
+ null // Process info from a process scan
+ );
+
+ //Get plugin config map for models
+ Configuration configuration = detail.getPluginConfiguration();
+
+ configuration.put(new PropertySimple("name", vdbName));
+ configuration.put(new PropertySimple("version", vdbVersion));
+ configuration.put(new PropertySimple("description", vdbDescription));
+ configuration.put(new PropertySimple("status", vdbStatus));
+ configuration.put(new PropertySimple("url", vdbURL));
+
+ getModels(mcVdb, configuration);
+
+ detail.setPluginConfiguration(configuration);
+
+ // Add to return values
+ discoveredResources.add(detail);
+ log.info("Discovered Teiid VDB: " + vdbName);
+ }
+
+ return discoveredResources;
+ }
+
+ /**
+ * @param mcVdb
+ * @param configuration
+ */
+ private void getModels(ManagedComponent mcVdb, Configuration configuration) {
+ //Get models from VDB
+ ManagedProperty property = mcVdb.getProperty("models");
+ CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
+ MetaValue[] metaValues = valueSupport.getElements();
+
+ PropertyList modelsList = new PropertyList("models");
+ configuration.put(modelsList);
+
+ for (MetaValue value : metaValues) {
+ GenericValueSupport genValueSupport = (GenericValueSupport) value;
+ ManagedObjectImpl managedObject = (ManagedObjectImpl)genValueSupport.getValue();
+ String modelName = managedObject.getName();
+ String type = ((SimpleValueSupport) managedObject.getProperty("modelType").getValue()).getValue().toString();
+ String visibility = ((SimpleValueSupport) managedObject.getProperty("visible").getValue()).getValue().toString();
+ String path = ((SimpleValueSupport) managedObject.getProperty("path").getValue()).getValue().toString();
+
+ PropertyMap model = new PropertyMap("model", new PropertySimple("name", modelName),
+ new PropertySimple("type", type), new PropertySimple("path", path),
+ new PropertySimple("visibility", visibility));
+ modelsList.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-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java 2010-01-20 18:29:36 UTC (rev 1759)
@@ -104,7 +104,8 @@
public interface Connector {
public final static String TYPE = "ConnectionFactory"; //$NON-NLS-1$
- public final static String SUBTYPE = "NoTx"; //$NON-NLS-1$
+ public final static String SUBTYPE_NOTX = "NoTx"; //$NON-NLS-1$
+ public final static String SUBTYPE_TX = "Tx"; //$NON-NLS-1$
public final static String NAME = "Enterprise Connector"; //$NON-NLS-1$
public final static String DESCRIPTION = "JBoss Enterprise Connector Binding"; //$NON-NLS-1$
Modified: trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml 2010-01-20 03:58:44 UTC (rev 1758)
+++ trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml 2010-01-20 18:29:36 UTC (rev 1759)
@@ -1,38 +1,117 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- * 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.
- */-->
+ <!--
+ * 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. */
+ -->
<plugin name="TeiidPlugin" displayName="Teiid Plugin" package="org.teiid.rhq.plugin"
version="2.0.0" description="Supports management and monitoring of JBoss Teiid"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
- <depends plugin="JMX" useClasses="true"/>
+ <depends plugin="JMX" />
+ <depends plugin="JBossAS5" useClasses="true" />
- <server name="Teiid Data Services" description="Teiid Datasources" class="PlatformComponent"
- discovery="PlatformDiscoveryComponent" createDeletePolicy="both">
+ <server name="Data Services" description="JBoss Enterprise Data Services"
+ class="PlatformComponent" discovery="PlatformDiscoveryComponent"
+ createDeletePolicy="both">
+
+
+ <runs-inside>
+ <parent-resource-type name="JBossAS Server"
+ plugin="JBossAS5" />
+ </runs-inside>
+
+ <service name="Virtual Database VDB(s)"
+ description="JBoss Enterprise Data Services Virtual Databases" class="VDBComponent"
+ discovery="VDBDiscoveryComponent" createDeletePolicy="both">
+
+ <resource-configuration>
+ <c:group name="general" displayName="General"
+ hiddenByDefault="false">
+ <c:simple-property name="name" type="string"
+ description="The Virtual Database Name" />
+ <c:simple-property name="version" type="string"
+ description="The Virtual Database Version" />
+ <c:simple-property name="description" type="string"
+ description="The Virtual Database Description" />
+ <c:simple-property name="status" type="string"
+ description="The Virtual Database Status" />
+ <c:simple-property name="url" type="string"
+ description="The Virtual Database URL" />
+ </c:group>
+ <c:group name="models" displayName="Models" hiddenByDefault="false">
+ <c:list-property name="models" description="The 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 model" required="true" />
+ <c:simple-property name="path" displayName="Path"
+ description="Path to the model" required="false" />
+ <c:simple-property name="visibility"
+ displayName="Visible" description="Visbility of the model"
+ required="false" />
+ </c:map-property>
+ </c:list-property>
+ </c:group>
+ </resource-configuration>
+
+ <service name="Models" description="Models that map to a datasource"
+ class="ModelComponent" discovery="ModelDiscoveryComponent"
+ createDeletePolicy="both">
+ <resource-configuration>
+ <c:group name="general" displayName="General"
+ hiddenByDefault="false">
+ <c:simple-property name="name" type="string"
+ description="The model name" readOnly="true" />
+ <c:simple-property name="type" type="string"
+ description="The model type. e.g. Source or Virtual" readOnly="true" />
+ <c:simple-property name="path" type="string"
+ description="The model path" readOnly="true" />
+ <c:simple-property name="modelURI" type="string"
+ description="The model URI" readOnly="true" />
+ <c:simple-property name="source" type="string"
+ description="True if this is a physical source model" readOnly="true" />
+ <c:simple-property name="visible" type="string"
+ description="True if the model is visible" readOnly="true" />
+ <c:simple-property name="modelType" type="string"
+ description="Type for this model" readOnly="true" />
+ <c:simple-property name="supportsMultiSourceBindings"
+ type="string" description="True if this models supports multiple source bindings"
+ readOnly="true" />
+ </c:group>
+ <c:group name="connectors" displayName="Connectors"
+ hiddenByDefault="false">
+ <c:list-property name="connectors"
+ description="The connector(s) for this Model">
+ <c:map-property name="connector">
+ <c:simple-property name="name" displayName="Name"
+ description="Connector for this model" required="true" />
+ </c:map-property>
+ </c:list-property>
+ </c:group>
+ </resource-configuration>
+
+ </service>
+
+ </service>
+
</server>
</plugin>
\ No newline at end of file
14 years, 11 months