[teiid-commits] teiid SVN: r3445 - in branches/as7: admin and 35 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Sep 2 16:49:19 EDT 2011
Author: rareddy
Date: 2011-09-02 16:49:18 -0400 (Fri, 02 Sep 2011)
New Revision: 3445
Added:
branches/as7/admin/
branches/as7/admin/pom.xml
branches/as7/admin/src/
branches/as7/admin/src/main/
branches/as7/admin/src/main/java/
branches/as7/admin/src/main/java/org/
branches/as7/admin/src/main/java/org/teiid/
branches/as7/admin/src/main/java/org/teiid/adminapi/
branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java
branches/as7/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java
branches/as7/admin/src/main/java/org/teiid/adminapi/AdminException.java
branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
branches/as7/admin/src/main/java/org/teiid/adminapi/AdminObject.java
branches/as7/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java
branches/as7/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java
branches/as7/admin/src/main/java/org/teiid/adminapi/CacheStatistics.java
branches/as7/admin/src/main/java/org/teiid/adminapi/DataPolicy.java
branches/as7/admin/src/main/java/org/teiid/adminapi/Model.java
branches/as7/admin/src/main/java/org/teiid/adminapi/PropertyDefinition.java
branches/as7/admin/src/main/java/org/teiid/adminapi/Request.java
branches/as7/admin/src/main/java/org/teiid/adminapi/Session.java
branches/as7/admin/src/main/java/org/teiid/adminapi/Transaction.java
branches/as7/admin/src/main/java/org/teiid/adminapi/Translator.java
branches/as7/admin/src/main/java/org/teiid/adminapi/VDB.java
branches/as7/admin/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
branches/as7/admin/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
branches/as7/admin/src/main/resources/
branches/as7/admin/src/test/
branches/as7/admin/src/test/java/
branches/as7/admin/src/test/java/org/
branches/as7/admin/src/test/java/org/teiid/
branches/as7/admin/src/test/java/org/teiid/adminapi/
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java
branches/as7/admin/src/test/resources/
branches/as7/admin/target/
branches/as7/admin/target/classes/
branches/as7/admin/target/classes/org/
branches/as7/admin/target/classes/org/teiid/
branches/as7/admin/target/classes/org/teiid/adminapi/
branches/as7/admin/target/classes/org/teiid/adminapi/impl/
branches/as7/admin/target/maven-archiver/
branches/as7/admin/target/test-classes/
branches/as7/admin/target/test-classes/org/
branches/as7/admin/target/test-classes/org/teiid/
branches/as7/admin/target/test-classes/org/teiid/adminapi/
branches/as7/admin/target/test-classes/org/teiid/adminapi/impl/
branches/as7/connectors/translator-ws/src/main/java/META-INF/
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java
Modified:
branches/as7/adminshell/pom.xml
branches/as7/api/pom.xml
branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
branches/as7/connectors/pom.xml
branches/as7/engine/pom.xml
branches/as7/jboss-integration/
branches/as7/jboss-integration/pom.xml
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
branches/as7/metadata/pom.xml
branches/as7/pom.xml
branches/as7/runtime/pom.xml
branches/as7/test-integration/pom.xml
Log:
TEIID-1720: Fixed the all the admin calls and resource models for engine and translator
Added: branches/as7/admin/pom.xml
===================================================================
--- branches/as7/admin/pom.xml (rev 0)
+++ branches/as7/admin/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.6.0.Alpha1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-admin</artifactId>
+ <name>admin</name>
+ <description>Admin API for Teiid</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-dmr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-controller-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-cli</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,298 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.Set;
+
+import org.teiid.adminapi.VDB.ConnectionType;
+
+public interface Admin {
+
+ public enum Cache {PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE};
+
+ /**
+ * Assign a {@link Translator} and Data source to a {@link VDB}'s Model
+ *
+ * @param vdbName Name of the VDB
+ * @param vdbVersion Version of the VDB
+ * @param modelName Name of the Model to map Connection Factory
+ * @param sourceName sourceName for the model
+ * @param translatorName
+ * @param dsName data source name that can found in the JNDI map.
+ * @throws AdminException
+ */
+ void assignToModel(String vdbName, int vdbVersion, String modelName, String sourceName, String translatorName, String dsName) throws AdminException;
+
+ /**
+ * Change the {@link ConnectionType} of the {@link VDB}.
+ * @param vdbName Name of the VDB
+ * @param vdbVersion Version of the VDB
+ * @param type
+ * @throws AdminException
+ */
+ void changeVDBConnectionType(String vdbName, int vdbVersion, ConnectionType type) throws AdminException;
+
+ /**
+ * Deploy a {@link VDB} file.
+ * @param name Name of the VDB file to save under
+ * @param VDB VDB.
+ * @throws AdminException
+ *
+ * @return the {@link VDB} representing the current property values and runtime state.
+ */
+ public void deployVDB(String fileName, InputStream vdb) throws AdminException;
+
+
+ /**
+ * Delete the VDB with the given name and version
+ * @param vdbName
+ * @param version
+ * @throws AdminException
+ */
+ void deleteVDB(String vdbName, int vdbVersion) throws AdminException;
+
+ /**
+ * Get the VDBs that currently deployed in the system
+ *
+ * @return Collection of {@link VDB}s. There could be multiple VDBs with the
+ * same name in the Collection but they will differ by VDB version.
+ * @throws AdminException
+ */
+ Set<VDB> getVDBs() throws AdminException;
+
+ /**
+ * Get the VDB
+ * @param vdbName
+ * @param vbdVersion
+ * @throws AdminException
+ * @return
+ */
+ VDB getVDB(String vdbName, int vbdVersion) throws AdminException;
+
+ /**
+ * Get the translators that are available in the configuration
+ *
+ * @return Collection of {@link Translator}
+ * @throws AdminException
+ */
+ Collection<Translator> getTranslators() throws AdminException;
+
+ /**
+ * Get the translator by the given the deployed name.
+ * @param deployedName - name of the deployed translator
+ * @return null if not found
+ * @throws AdminException
+ */
+ Translator getTranslator(String deployedName) throws AdminException;
+
+ /**
+ * Get the Worker Pool statistics in runtime engine.
+ *
+ * @return {@link WorkerPoolStatistics}
+ * @throws AdminException
+ */
+ WorkerPoolStatistics getWorkerPoolStats() throws AdminException;
+
+ /**
+ * Get the Caches that correspond to the specified identifier pattern
+ * @return Collection of {@link String}
+ * @throws AdminException
+ */
+ Collection<String> getCacheTypes() throws AdminException;
+
+ /**
+ * Get all the current Sessions.
+ * @return Collection of {@link Session}
+ * @throws AdminException
+ */
+ Collection<Session> getSessions() throws AdminException;
+
+ /**
+ * Get the all Requests that are currently in process
+ * @return Collection of {@link Request}
+ * @throws AdminException
+ */
+ Collection<Request> getRequests() throws AdminException;
+
+ /**
+ * Get the Requests for the given session
+ * @return Collection of {@link Request}
+ * @throws AdminException
+ */
+ Collection<Request> getRequestsForSession(String sessionId) throws AdminException;
+
+
+ /**
+ * Get all of the available configuration Properties for the specified connector
+ * @param templateName - Name of the connector
+ * @return
+ * @throws AdminException
+ */
+ Collection<PropertyDefinition> getTemplatePropertyDefinitions(String templateName) throws AdminException;
+
+
+ /**
+ * Get all transaction matching the identifier.
+ * @return
+ * @throws AdminException
+ */
+ Collection<Transaction> getTransactions() throws AdminException;
+
+ /**
+ * Clear the cache or caches specified by the cacheIdentifier.
+ * @param cacheType Cache Type
+ * No wild cards currently supported, must be explicit
+ * @throws AdminException
+ */
+ void clearCache(String cacheType) throws AdminException;
+
+ /**
+ * Clear the cache of the given VDB for provided cache type
+ * @param cacheType Cache Type
+ * No wild cards currently supported, must be explicit
+ * @param vdbName - Name of the VDB
+ * @param vdbVersion - VDB version
+ * @throws AdminException
+ */
+ void clearCache(String cacheType, String vdbName, int vdbVersion) throws AdminException;
+
+
+ /**
+ * Get the Cache Statistics for the given type
+ * @param cacheType Cache Type
+ * @return {@link CacheStatistics}
+ * @throws AdminException
+ */
+ CacheStatistics getCacheStats(String cacheType) throws AdminException;
+
+ /**
+ * Terminate the Session
+ *
+ * @param identifier Session Identifier {@link org.teiid.adminapi.Session}.
+ * No wild cards currently supported, must be explicit
+ * @throws AdminException
+ */
+ void terminateSession(String sessionId) throws AdminException;
+
+ /**
+ * Cancel Request
+ *
+ * @param sessionId session Identifier for the request.
+ * @param executionId request Identifier
+ *
+ * @throws AdminException
+ */
+ void cancelRequest(String sessionId, long executionId) throws AdminException;
+
+ /**
+ * Mark the given global transaction as rollback only.
+ * @param transactionId
+ * @throws AdminException
+ */
+ void terminateTransaction(String transactionId) throws AdminException;
+
+ /**
+ * Closes the admin connection
+ */
+ void close();
+
+ /**
+ * Assign a Role name to the Data Role in a given VDB
+ *
+ * @param vdbName
+ * @param vdbVersion
+ * @param dataRole
+ * @param mappedRoleName
+ */
+ void addDataRoleMapping(String vdbName, int vdbVersion, String dataRole, String mappedRoleName) throws AdminException;
+
+ /**
+ * Remove a Role name to the Data Role in a given VDB
+ *
+ * @param vdbName
+ * @param vdbVersion
+ * @param dataRole
+ * @param mappedRoleName
+ */
+ void removeDataRoleMapping(String vdbName, int vdbVersion, String dataRole, String mappedRoleName) throws AdminException;
+
+ /**
+ * Set the any authenticated flag on the Data Role in a given VDB
+ *
+ * @param vdbName
+ * @param vdbVersion
+ * @param dataRole
+ * @param anyAuthenticated
+ */
+ void setAnyAuthenticatedForDataRole(String vdbName, int vdbVersion, String dataRole, boolean anyAuthenticated) throws AdminException;
+
+ /**
+ * Merge the Source VDB into Target VDB. Both Source and Target VDBs must be present for this method to
+ * succeed. The changes will not be persistent between server restarts.
+ * @param sourceVDBName
+ * @param sourceVDBVersion
+ * @param targetVDBName
+ * @param targetVDBVersion
+ */
+ void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int targetVDBVersion) throws AdminException;
+
+
+ /**
+ * Creates a JCA data source
+ * @param deploymentName - name of the source
+ * @param templateName - template of data source
+ * @param properties - properties
+ * @throws AdminException
+ */
+ void createDataSource(String deploymentName, String templateName, Properties properties) throws AdminException;
+
+ /**
+ * Delete data source.
+ * @param deployedName
+ * @throws AdminException
+ */
+ void deleteDataSource(String deployedName) throws AdminException;
+
+ /**
+ * Returns the all names of all the data sources available in the configuration.
+ */
+ Collection<String> getDataSourceNames() throws AdminException;
+
+ /**
+ * Get the Datasource templates available in the configuration.
+ *
+ * @return Set of template names.
+ * @throws AdminException
+ */
+ Set<String> getDataSourceTemplateNames() throws AdminException;
+
+ /**
+ * Tell the engine that the given source is available. Pending dynamic vdb metadata loads will be resumed.
+ * @param jndiName
+ * @throws AdminException
+ */
+ void markDataSourceAvailable(String jndiName) throws AdminException;
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/Admin.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+
+/**
+ * An <code>AdminComponentException</code> is thrown when an error occurs as a
+ * result of an internal component error.
+ *
+ * <p>This exception class is capable of containing multiple exceptions. See
+ * {@link AdminException} for details.
+ */
+public final class AdminComponentException extends AdminException {
+
+ private static final long serialVersionUID = 7117721841515240902L;
+
+
+ public AdminComponentException() {
+ super();
+ }
+
+ /**
+ * Construct with a message.
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminComponentException(String msg) {
+ super(msg);
+ }
+
+ public AdminComponentException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct with an optional error code and a message.
+ * @param code an optional error code
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminComponentException(int code, String msg) {
+ super(code, msg);
+ }
+
+ public AdminComponentException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ public AdminComponentException(int code, String msg, Throwable cause) {
+ super(code, msg, cause);
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminException.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/AdminException.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/AdminException.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.teiid.core.TeiidException;
+
+
+/**
+ * <code>AdminException</code> is the base exception for the admin package. Many *Admin methods throw this
+ * exception. Instances will be one of the concrete subtypes:
+ * {@link AdminComponentException} or {@link AdminProcessingException}</p>
+ *
+ * <p><code>AdminException</code>s may contain multiple child exceptions. An example
+ * of this could be when performing an admin action results in multiple failures. Admin
+ * clients should be aware of this and use the {@link #hasMultiple()} method to
+ * determine if they need to check the child exceptions.</p>
+ */
+public abstract class AdminException extends TeiidException {
+
+ private static final long serialVersionUID = -4446936145500241358L;
+ // List of Admin exceptions in
+ // case of multiple failure
+ private List children;
+
+ /**
+ * No-arg ctor.
+ *
+ * @since 4.3
+ */
+ AdminException() {
+ super();
+ }
+
+ /**
+ * Construct with a message.
+ * @param msg the error message.
+ * @since 4.3
+ */
+ AdminException(String msg) {
+ super(msg);
+ }
+
+ AdminException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+ /**
+ * Construct with an optional error code and a message.
+ * @param code an optional error code
+ * @param msg the error message.
+ * @since 4.3
+ */
+ AdminException(int code, String msg) {
+ super(Integer.toString(code), msg);
+ }
+
+ AdminException(String msg, Throwable cause) {
+ super(cause, msg);
+ }
+
+ AdminException(int code, String msg, Throwable cause) {
+ super(cause, Integer.toString(code),msg);
+ }
+
+ /**
+ * Determine whether this exception is representing
+ * mutliple component failures.
+ * @return <code>true</code> iff this exception contains multiple
+ * component failure exceptions.
+ * @since 4.3
+ */
+ public boolean hasMultiple() {
+ return (children != null && children.size() > 0);
+ }
+
+ /**
+ * Returns a non-null list of failures (<code>AdminException</code>s), one for each
+ * component that failed.
+ *
+ * <p>The list will have members when {@link #hasMultiple()} returns <code>true</code>.</p>
+ * @return The non-null list of failures.
+ * @since 4.3
+ */
+ public List getChildren() {
+ return (children != null ? children : Collections.EMPTY_LIST);
+ }
+
+ /**
+ * Add a child <code>AdminException</code> for a particular failure
+ * if and action resulted in multiple failures.
+ *
+ * @param child a specific failure
+ * @since 4.3
+ */
+ public void addChild(AdminException child) {
+ if ( children == null ) {
+ children = new ArrayList();
+ }
+ children.add(child);
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,343 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.security.auth.callback.*;
+import javax.security.sasl.RealmCallback;
+import javax.security.sasl.RealmChoiceCallback;
+
+import org.jboss.as.cli.Util;
+import org.jboss.as.cli.operation.impl.DefaultOperationRequestAddress;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.teiid.adminapi.VDB.ConnectionType;
+
+
+/**
+ * Singleton factory for class for creating Admin connections to the Teiid
+ */
+public class AdminFactory {
+ private static AdminFactory INSTANCE = new AdminFactory();
+
+ public static AdminFactory getInstance() {
+ return INSTANCE;
+ }
+ /**
+ * Creates a ServerAdmin with the specified connection properties.
+ * @param userName
+ * @param password
+ * @param serverURL
+ * @param applicationName
+ * @return
+ * @throws AdminException
+ */
+ public Admin createAdmin(String host, int port, String userName, char[] password) throws AdminException {
+ if(host == null) {
+ host = "localhost"; //$NON-NLS-1$
+ }
+
+ if(port < 0) {
+ port = 9990;
+ }
+
+ try {
+ CallbackHandler cbh = new AuthenticationCallbackHandler(userName, password);
+ ModelControllerClient newClient = ModelControllerClient.Factory.create(host, port, cbh);
+
+ List<String> nodeTypes = Util.getNodeTypes(newClient, new DefaultOperationRequestAddress());
+ if (!nodeTypes.isEmpty()) {
+ boolean domainMode = nodeTypes.contains("server-group"); //$NON-NLS-1$
+ System.out.println("Connected to " //$NON-NLS-1$
+ + (domainMode ? "domain controller at " : "standalone controller at ") //$NON-NLS-1$ //$NON-NLS-2$
+ + host + ":" + port); //$NON-NLS-1$
+ return new AdminImpl(newClient);
+ }
+ System.out.println("The controller is not available at " + host + ":" + port); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (UnknownHostException e) {
+ System.out.println("Failed to resolve host '" + host + "': " + e.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return null;
+ }
+
+ private class AuthenticationCallbackHandler implements CallbackHandler {
+ private boolean realmShown = false;
+ private String userName = null;
+ private char[] password = null;
+
+ public AuthenticationCallbackHandler(String user, char[] password) {
+ this.userName = user;
+ this.password = password;
+ }
+
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ // Special case for anonymous authentication to avoid prompting user for their name.
+ if (callbacks.length == 1 && callbacks[0] instanceof NameCallback) {
+ ((NameCallback)callbacks[0]).setName("anonymous CLI user"); //$NON-NLS-1$
+ return;
+ }
+
+ for (Callback current : callbacks) {
+ if (current instanceof RealmCallback) {
+ RealmCallback rcb = (RealmCallback) current;
+ String defaultText = rcb.getDefaultText();
+ rcb.setText(defaultText); // For now just use the realm suggested.
+ if (realmShown == false) {
+ realmShown = true;
+ }
+ } else if (current instanceof RealmChoiceCallback) {
+ throw new UnsupportedCallbackException(current, "Realm choice not currently supported."); //$NON-NLS-1$
+ } else if (current instanceof NameCallback) {
+ NameCallback ncb = (NameCallback) current;
+ ncb.setName(userName);
+ } else if (current instanceof PasswordCallback) {
+ PasswordCallback pcb = (PasswordCallback) current;
+ pcb.setPassword(password);
+ } else {
+ throw new UnsupportedCallbackException(current);
+ }
+ }
+ }
+
+ }
+
+ private class AdminImpl implements Admin{
+ public AdminImpl (ModelControllerClient connection) {
+
+ }
+
+ @Override
+ public void addDataRoleMapping(String vdbName, int vdbVersion,
+ String dataRole, String mappedRoleName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void assignToModel(String vdbName, int vdbVersion,
+ String modelName, String sourceName, String translatorName,
+ String dsName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void cancelRequest(String sessionId, long executionId)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void changeVDBConnectionType(String vdbName, int vdbVersion,
+ ConnectionType type) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearCache(String cacheType) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearCache(String cacheType, String vdbName, int vdbVersion)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void close() {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void createDataSource(String deploymentName,
+ String templateName, Properties properties)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteDataSource(String deployedName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteVDB(String vdbName, int vdbVersion)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deployVDB(String fileName, InputStream vdb)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public CacheStatistics getCacheStats(String cacheType)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<String> getCacheTypes() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<String> getDataSourceNames() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<String> getDataSourceTemplateNames() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Request> getRequests() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Request> getRequestsForSession(String sessionId)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Session> getSessions() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<PropertyDefinition> getTemplatePropertyDefinitions(
+ String templateName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Transaction> getTransactions() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Translator getTranslator(String deployedName)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Collection<Translator> getTranslators() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public VDB getVDB(String vdbName, int vbdVersion) throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<VDB> getVDBs() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public WorkerPoolStatistics getWorkerPoolStats() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void markDataSourceAvailable(String jndiName)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mergeVDBs(String sourceVDBName, int sourceVDBVersion,
+ String targetVDBName, int targetVDBVersion)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeDataRoleMapping(String vdbName, int vdbVersion,
+ String dataRole, String mappedRoleName) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAnyAuthenticatedForDataRole(String vdbName,
+ int vdbVersion, String dataRole, boolean anyAuthenticated)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void terminateSession(String sessionId) throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void terminateTransaction(String transactionId)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminObject.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/AdminObject.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/AdminObject.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+/**
+ * Base interface of client side admin objects. Specifies behaviors and properties common to all administrative objects.
+ * <p>
+ * Unique identifiers are available for all <code>AdminObject</code>s and their forms are specific to each object. See
+ * the javadoc on the individual object for its particular identifier pattern required.
+ * </p>
+ * <p>
+ * This interface need not be used directly by clients except when coding to constants.
+ * </p>
+ *
+ * @since 4.3
+ */
+public interface AdminObject extends Serializable {
+
+ /**
+ * The character that delimits the atomic components of the identifier.
+ * @see #DELIMITER
+ */
+ public static final char DELIMITER_CHAR = '|';
+
+ /**
+ * The character (as a <code>String</code>) that delimits the atomic components of the identifier.
+ *
+ * <p>It is <emph>strongly</emph> advisable to write admin client code using this <code>DELIMITER</code>
+ * rather than hard-coding a delimiter character in admin code. Doing this eliminates the possibility
+ * of admin client code breaking if/when the delimiter character must be changed.</p>
+ */
+ public static final String DELIMITER = new String(new char[] {DELIMITER_CHAR});
+
+ /**
+ * The delimiter character as a <code>String</code> escaped.
+ * @see #DELIMITER
+ */
+ public static final String ESCAPED_DELIMITER = "\\" + DELIMITER; //$NON-NLS-1$
+
+ /**
+ * The wildcard character (as a <code>String</code>) that can be used in may identifier patterns
+ * to indicate <i>"anything"</i> or, more specifically, replace <i>"zero or more"</i>
+ * identifier components.
+ *
+ * <p>It is <emph>strongly</emph> advisable to write admin client code using this <code>WILDCARD</code>
+ * rather than hard-coding a wildcard character in admin code. Doing this eliminates the possibility
+ * of admin client code breaking if/when the wildcard character must be changed.</p>
+ */
+ public static final String WILDCARD = "*"; //$NON-NLS-1$
+
+ /**
+ * The wildcard character as a <code>String</code> escaped.
+ * @see #WILDCARD
+ */
+ public static final String ESCAPED_WILDCARD = "\\" + WILDCARD; //$NON-NLS-1$
+
+ /**
+ * Get the name for this AdminObject, usually the last component of the identifier.
+ *
+ * @return String Name
+ * @since 4.3
+ */
+ String getName();
+
+ /**
+ * Get the Configuration Properties that defines this process
+ *
+ * @return Properties
+ * @since 4.3
+ */
+ Properties getProperties();
+
+ /**
+ * Searches for the property with the specified key in this Admin Object. If the key is not found the method returns
+ * <code>null</code>.
+ *
+ * @param name
+ * the property key.
+ * @return the value in this Admin Object with the specified key value.
+ * @since 4.3
+ */
+
+ String getPropertyValue(String name);
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminObject.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.util.ResourceBundle;
+
+import org.teiid.core.BundleUtil;
+
+public class AdminPlugin {
+ public static final String PLUGIN_ID = "org.teiid.adminapi" ; //$NON-NLS-1$
+ public static final BundleUtil Util = new BundleUtil(PLUGIN_ID, PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminPlugin.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+
+/**
+ * An <code>AdminProcessingException</code> indicates that an error occured during processing as a result
+ * of user input. This exception is the result of handling an invalid user
+ * request, not the result of an internal error.</p>
+ *
+ * <p>This exception class is capable of containing multiple exceptions. See
+ * {@link AdminException} for details.
+ */
+public final class AdminProcessingException extends AdminException {
+
+ private static final long serialVersionUID = -878521636838205857L;
+
+ /**
+ * No-arg ctor.
+ *
+ * @since 4.3
+ */
+ public AdminProcessingException() {
+ super();
+ }
+
+ /**
+ * Construct with a message.
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminProcessingException(String msg) {
+ super(msg);
+ }
+
+ public AdminProcessingException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Construct with an optional error code and a message.
+ * @param code an optional error code
+ * @param msg the error message.
+ * @since 4.3
+ */
+ public AdminProcessingException(int code, String msg) {
+ super(code, msg);
+ }
+
+ public AdminProcessingException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ public AdminProcessingException(int code, String msg, Throwable cause) {
+ super(code, msg, cause);
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/CacheStatistics.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/CacheStatistics.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/CacheStatistics.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi;
+
+public interface CacheStatistics extends AdminObject {
+
+ double getHitRatio();
+
+ int getTotalEntries();
+
+ int getRequestCount();
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/CacheStatistics.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/DataPolicy.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/DataPolicy.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/DataPolicy.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi;
+
+import java.util.List;
+
+public interface DataPolicy {
+
+ public enum Context {
+ CREATE,
+ DROP,
+ QUERY,
+ INSERT,
+ UPDATE,
+ DELETE,
+ FUNCTION,
+ ALTER,
+ STORED_PROCEDURE;
+ }
+
+ public enum PermissionType {CREATE, READ, UPDATE, DELETE, ALTER, EXECUTE, DROP};
+
+ /**
+ * Get the Name of the Data Policy
+ * @return
+ */
+ String getName();
+
+ /**
+ * Get the description of the Data Policy
+ * @return
+ */
+ String getDescription();
+
+ /**
+ * Get the List of Permissions for this Data Policy.
+ * @return
+ */
+ List<DataPermission> getPermissions();
+
+ /**
+ * Mapped Container Role names for this Data Policy
+ * @return
+ */
+ List<String> getMappedRoleNames();
+
+ /**
+ * If the policy applies to any authenticated user
+ * @return
+ */
+ boolean isAnyAuthenticated();
+
+ /**
+ * If the policy allows for temporary table usage
+ * @return
+ */
+ Boolean isAllowCreateTemporaryTables();
+
+ interface DataPermission {
+ /**
+ * Get the Resource Name that Data Permission representing
+ * @return
+ */
+ String getResourceName();
+
+ /**
+ * Is "CREATE" allowed?
+ * @return
+ */
+ Boolean getAllowCreate();
+
+ /**
+ * Is "SELECT" allowed?
+ * @return
+ */
+ Boolean getAllowRead();
+
+ /**
+ * Is "INSERT/UPDATE" allowed?
+ * @return
+ */
+ Boolean getAllowUpdate();
+
+ /**
+ * Is "DELETE" allowed?
+ * @return
+ */
+ Boolean getAllowDelete();
+
+ /**
+ * Is "ALTER" allowed?
+ * @return
+ */
+ Boolean getAllowAlter();
+
+ /**
+ * Is "EXECUTE" allowed?
+ * @return
+ */
+ Boolean getAllowExecute();
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/DataPolicy.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/Model.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/Model.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/Model.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.util.List;
+
+
+/**
+ * Represents a metadata model in the Teiid system.
+ *
+ * @since 4.3
+ */
+public interface Model extends AdminObject {
+
+ enum Type {PHYSICAL, VIRTUAL, FUNCTION, OTHER};
+
+ /**
+ * Description about the model
+ * @return
+ */
+ String getDescription();
+
+ /**
+ * Determine if this model is a Source model.
+ *
+ * @return <code>true</code> if it contains physical group(s).
+ */
+ boolean isSource();
+
+ /**
+ * Determine whether this model is exposed for querying.
+ *
+ * @return <code>true</code> if the model is visible
+ * for querying.
+ */
+ boolean isVisible();
+
+ /**
+ * Retrieve the model type.
+ * @return model type
+ */
+ Type getModelType();
+
+ /**
+ * Determine whether this model can support more than one source.
+ *
+ * @return <code>true</code> if this model supports multiple sources
+ */
+ boolean isSupportsMultiSourceBindings();
+
+ /**
+ * Associated Source Names for the Models
+ * @return String
+ */
+ List<String> getSourceNames();
+
+ /**
+ * Get the configured JNDI name for the given source name.
+ * @param sourceName - name of the source
+ * @return null if none configured.
+ */
+ String getSourceConnectionJndiName(String sourceName);
+
+
+ /**
+ * Get the configured translator name for the given source
+ * @param sourceName
+ * @return
+ */
+ String getSourceTranslatorName(String sourceName);
+}
\ No newline at end of file
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/Model.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/PropertyDefinition.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/PropertyDefinition.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/PropertyDefinition.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.util.Collection;
+
+/**
+ * Information about a property of an AdminObject
+ */
+public interface PropertyDefinition extends AdminObject {
+
+ public enum RestartType {
+ NONE,
+ SERVICE,
+ PROCESS,
+ ALL_PROCESSES,
+ CLUSTER
+ }
+ /**
+ * The value of the maximum multiplicity if the multiplicity is considered unbounded.
+ */
+ public static final int UNBOUNDED_VALUE = Integer.MAX_VALUE;
+
+
+ /**
+ * Get the localized display name of this property.
+ * @return the displayable name for this property
+ */
+ String getDisplayName();
+
+ /**
+ * Get the description of this property.
+ * @return the description for this property
+ */
+ String getDescription();
+
+
+ /**
+ * Get the name of the java class that best represents the property type.
+ * @return the name of the java class that best represents the property type.
+ */
+ String getPropertyTypeClassName();
+
+
+ /**
+ * Get the default value for values of this property, or an empty String if
+ * there is no default value.
+ * @return the default value for this property, or an empty String
+ * if there is no default value.
+ */
+ Object getDefaultValue();
+
+ /**
+ * Get the allowed values for this property.
+ * @return the list of allowed values for this property, or an empty
+ * set if the values do not have to conform to a fixed set.
+ */
+ Collection getAllowedValues();
+
+ /**
+ * Get whether this property requires the system to be restarted before it takes effect.
+ * @return true if this property requires the system to be restarted before it takes effect.
+ */
+ public RestartType getRequiresRestart();
+
+ /**
+ * The modifiable flag is used to identify features that may not be changed once
+ * they are set.
+ * @return true if this property is marked with the modifyable
+ * flag, or false otherwise.
+ */
+ boolean isModifiable();
+
+ /**
+ * Return whether the value or values for this property are constrained to be only
+ * those in the AllowedValues list.
+ * @see #getAllowedValues
+ * @return true if this property's value must be with the list of AllowedValues.
+ */
+ boolean isConstrainedToAllowedValues();
+
+ /**
+ * The "expert" flag is used to distinguish between features that are
+ * intended for expert users from those that are intended for normal users.
+ * @return true if this property is to be marked with the expert flag,
+ * or false otherwise.
+ */
+ boolean isAdvanced();
+ /**
+ * The "required" flag is used to identify features that require at least
+ * one value (possibly a default value) by the consumer of the property. Whether
+ * a property definition is required or not can be determined entirely from the
+ * multiplicity: if the multiplicity includes '0', then the property is
+ * not required.
+ * <p>
+ * Whether a property is required by the consumer is unrelated to whether
+ * there is a default value, which only simplifies the task of the property
+ * provider. A property may be required, meaning it must have at least one
+ * value, but that same property definition may or may not have a default.
+ * The combination of required and whether it has a default will determine
+ * whether the user must supply a value.
+ * @return true if this property requires at least one value.
+ */
+ boolean isRequired();
+ /**
+ * The "masked" flag is used to tell whether the value should be masked
+ * when displayed to users.
+ * @return true if this property value is to be masked,
+ * or false otherwise.
+ */
+ boolean isMasked();
+
+
+
+}
+
+
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/PropertyDefinition.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/Request.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/Request.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/Request.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+
+
+
+/**
+ * When a user submits a SQL command to the system for processing, usually that represents
+ * a single request. A single request might have one or more source
+ * requests (the requests that are being processed on the physical data sources) as part
+ * of original request.
+ *
+ * <p>A request is identified by a numbers separated by '|'. usually in they are arranged
+ * in the pattern [session]|[request] or [session]|[request]|[source request] </p>
+ */
+public interface Request extends AdminObject {
+
+ public enum ProcessingState {
+ PROCESSING,
+ DONE,
+ CANCELED
+ }
+
+ public enum ThreadState {
+ RUNNING,
+ QUEUED,
+ IDLE
+ }
+
+ /**
+ * Get the ExecutionId for a Request
+ * @return ExecutionId
+ */
+ public long getExecutionId();
+
+ /**
+ * Get the SessionID for a Request
+ *
+ * @return String SessionID
+ */
+ public String getSessionId();
+
+ /**
+ * Get the SQL Command sent to the Server for a Request
+ *
+ * @return SQL Command
+ */
+ public String getCommand();
+
+ /**
+ * Get when the processing began for this Request
+ * @return Date processing began
+ */
+ public long getStartTime();
+
+ /**
+ * Get the TransactionID of the Request
+ *
+ * @return String of TransactionID if in a transaction
+ */
+ public String getTransactionId();
+
+ /**
+ * @return Returns whether this is a Source Request.
+ */
+ public boolean sourceRequest();
+
+ /**
+ * @return In the case that this is a source request this represents the node id. Otherwise null
+ */
+ public Integer getNodeId();
+
+ /**
+ * @return The request state
+ */
+ ProcessingState getState();
+
+ /**
+ * @return The thread state
+ */
+ ThreadState getThreadState();
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/Request.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/Session.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/Session.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/Session.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+
+/**
+ * A Session represents a single connection between a client and the server.
+ *
+ * A user is allowed to have multiple sessions active simultaneously.
+ */
+public interface Session extends AdminObject {
+
+ /**
+ * Get the Last time Client has check to see if the server is still available
+ *
+ * @return Date of the last ping to the server.
+ */
+ public long getLastPingTime();
+
+
+ /**
+ * Get the Application Name
+ *
+ * @return String of the Application Name
+ */
+ public String getApplicationName();
+
+ /**
+ * Get the unique Teiid session
+ * within a given Teiid System
+ *
+ * @return String of the Session ID
+ */
+ public String getSessionId();
+
+ /**
+ * Get User Name for this Session
+ *
+ * @return String of UserName
+ */
+ public String getUserName();
+
+ /**
+ * Get the VDB Name for this Session
+ *
+ * @return String name of the VDB
+ */
+ public String getVDBName();
+
+ /**
+ * Get the VDB Version for this Session
+ *
+ * @return String name/number of the VDB Version
+ */
+ public int getVDBVersion();
+
+ /**
+ * Get the IPAddress for this Session. Note this value is reported from the client.
+ * @return
+ */
+ public String getIPAddress();
+
+
+ /**
+ * Get the host name of the machine the client is
+ * accessing from. Note this value is reported from the client.
+ * @return
+ */
+ public String getClientHostName();
+
+ /**
+ * Get the client hardware (typically MAC) address. Note this value is reported from the client.
+ * @return the hardware address as a hex string or null if not available.
+ */
+ public String getClientHardwareAddress();
+
+ /**
+ * Get the time the {@link Session} was created.
+ * @return
+ */
+ public long getCreatedTime();
+
+
+ /**
+ * Security Domain user logged into currently
+ * @return
+ */
+ public String getSecurityDomain();
+
+}
\ No newline at end of file
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/Session.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/Transaction.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/Transaction.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/Transaction.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+
+public interface Transaction extends AdminObject {
+
+ /**
+ * Get the session associated with the this transaction.
+ * May be null for an unassociated Global transaction.
+ * @return
+ */
+ String getAssociatedSession();
+
+ /**
+ * Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST
+ * @return
+ */
+ String getScope();
+
+ /**
+ * Returns the Xid string for GLOBAL transactions or the Transaction id string LOCAL/REQUEST.
+ * @return
+ */
+ String getId();
+
+
+ /**
+ * Get the local creation time.
+ * @return
+ */
+ long getCreatedTime();
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/Transaction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/Translator.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/Translator.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/Translator.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi;
+
+
+public interface Translator extends AdminObject{
+ public static final String EXECUTION_FACTORY_CLASS = "execution-factory-class"; //$NON-NLS-1$
+ public static final String TRANSLATOR_PROPERTY = "property"; //$NON-NLS-1$
+
+ /**
+ * Get the Translator type
+ * @return
+ */
+ public String getType();
+
+ /**
+ * Get the Translator description
+ * @return
+ */
+ public String getDescription();
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/Translator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/VDB.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/VDB.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.util.List;
+
+/**
+ * Represents a Virtual Database in the Teiid System.
+ * <br>A VDB has a name and a version.</br>
+ *
+ * <p>The identifier pattern for a VDB is <CODE>"name<{@link #DELIMITER_CHAR}>version"</CODE>,
+ * where the name of the VDB and its version represent its unique identifier in the Teiid system.
+ * There are no spaces allowed in a given VDB name, and VDB name must start with a letter.
+ * A version number is automatically assigned to a VDB when it is deployed into
+ * a system. A VDB is uniquely identified by <CODE>"name<{@link #DELIMITER_CHAR}>version"</CODE>.
+ * For example: <CODE>"Accounts<{@link #DELIMITER_CHAR}>1"</CODE>, <CODE>"UnifiedSales<{@link #DELIMITER_CHAR}>4</CODE>" etc.
+ * </p>
+ *
+ * @since 4.3
+ */
+public interface VDB extends AdminObject {
+
+ public static enum Status{INACTIVE, ACTIVE};
+
+ public enum ConnectionType {NONE, BY_VERSION, ANY}
+
+ /**
+ * @return Collection of Teiid Models
+ */
+ public List<Model> getModels();
+
+ /**
+ * @return the status
+ */
+ public Status getStatus();
+
+ /**
+ * @return the connection status
+ */
+ public ConnectionType getConnectionType();
+
+ /**
+ * @return the VDB version
+ */
+ public int getVersion();
+
+ /**
+ * Get the URL for the VDB
+ * @return
+ */
+ public String getUrl();
+
+ /**
+ * Get the description of the VDB
+ * @return
+ */
+ public String getDescription();
+
+ /**
+ * Shows any validity errors present in the VDB
+ * @return
+ */
+ public List<String> getValidityErrors();
+
+ /**
+ * Shows if VDB is a valid entity
+ * @return
+ */
+ public boolean isValid();
+
+ /**
+ * Get the data roles defined on this VDB
+ * @return
+ */
+ public List<DataPolicy> getDataPolicies();
+
+ /**
+ * Get the list of translators defined in the VDB
+ * @return
+ */
+ public List<Translator> getOverrideTranslators();
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/VDB.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi;
+
+public interface WorkerPoolStatistics extends AdminObject {
+
+ /**
+ * Current active thread count
+ * @return
+ */
+ public int getActiveThreads();
+
+ /**
+ * Highest Active threads recorded so far
+ * @return
+ */
+ public int getHighestActiveThreads();
+
+
+ /**
+ * Queue Name
+ * @return
+ */
+ public String getQueueName();
+
+
+ /**
+ * Max number of active threads allowed
+ * @return
+ */
+ public int getMaxThreads();
+
+ /**
+ * @return Returns the number of requests queued.
+ * @since 4.3
+ */
+ public int getQueued();
+
+ /**
+ * @return The number of completed tasks
+ */
+ long getTotalCompleted();
+
+
+ /**
+ * @return The number of submitted tasks
+ */
+ long getTotalSubmitted();
+
+ /**
+ * @return Returns the highest queue size
+ */
+ public int getHighestQueued();
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.teiid.adminapi.AdminObject;
+
+ at XmlAccessorType(XmlAccessType.NONE)
+public abstract class AdminObjectImpl implements AdminObject, Serializable {
+
+ private static final long serialVersionUID = -6381303538713462682L;
+
+ private String name;
+
+ private ListOverMap<PropertyMetadata> properties = new ListOverMap<PropertyMetadata>(new KeyBuilder<PropertyMetadata>() {
+ private static final long serialVersionUID = 3687928367250819142L;
+
+ @Override
+ public String getKey(PropertyMetadata entry) {
+ return entry.getName();
+ }
+ });
+
+ private transient Map<String, Object> attachments = Collections.synchronizedMap(new HashMap<String, Object>());
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public Properties getProperties() {
+ Properties props = new Properties();
+ for (PropertyMetadata p:this.properties.getMap().values()) {
+ props.setProperty(p.getName(), p.getValue());
+ }
+ return props;
+ }
+
+ public void setProperties(Properties props) {
+ this.properties.clear();
+ if (props != null) {
+ for (String key:props.stringPropertyNames()) {
+ addProperty(key, props.getProperty(key));
+ }
+ }
+ }
+
+ public List<PropertyMetadata> getJAXBProperties(){
+ return properties;
+ }
+
+ public void setJAXBProperties(List<PropertyMetadata> props){
+ this.properties.clear();
+ if (props != null) {
+ for (PropertyMetadata prop:props) {
+ addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+
+ @Override
+ public String getPropertyValue(String name) {
+ PropertyMetadata prop = this.properties.getMap().get(name);
+ if (prop == null) {
+ return null;
+ }
+ return prop.getValue();
+ }
+
+ public void addProperty(String key, String value) {
+ this.properties.getMap().put(key, new PropertyMetadata(key, value));
+ }
+
+ /**
+ * Add attachment
+ *
+ * @param <T> the expected type
+ * @param attachment the attachment
+ * @param type the type
+ * @return any previous attachment
+ * @throws IllegalArgumentException for a null name, attachment or type
+ * @throws UnsupportedOperationException when not supported by the implementation
+ */
+ public <T> T addAttchment(Class<T> type, T attachment) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.put(type.getName(), attachment);
+ if (result == null)
+ return null;
+ return type.cast(result);
+
+ }
+
+ public Object addAttchment(String key, Object attachment) {
+ if (key == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.put(key, attachment);
+ if (result == null)
+ return null;
+ return result;
+ }
+
+ /**
+ * Remove attachment
+ *
+ * @param <T> the expected type
+ * @return the attachment or null if not present
+ * @param type the type
+ * @throws IllegalArgumentException for a null name or type
+ */
+ public <T> T removeAttachment(Class<T> type) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.remove(type.getName());
+ if (result == null)
+ return null;
+ return type.cast(result);
+ }
+
+ public Object removeAttachment(String key) {
+ if (key == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.remove(key);
+ if (result == null)
+ return null;
+ return result;
+ }
+ /**
+ * Get attachment
+ *
+ * @param <T> the expected type
+ * @param type the type
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name or type
+ */
+ public <T> T getAttachment(Class<T> type) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.get(type.getName());
+ if (result == null)
+ return null;
+ return type.cast(result);
+ }
+
+ public Object getAttachment(String key) {
+ if (key == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ Object result = this.attachments.get(key);
+ if (result == null)
+ return null;
+ return result;
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import org.teiid.adminapi.CacheStatistics;
+
+public class CacheStatisticsMetadata extends AdminObjectImpl implements CacheStatistics{
+
+ private static final long serialVersionUID = -3514505497661004560L;
+
+ private double hitRatio;
+ private int totalEntries;
+ private int requestCount;
+
+ @Override
+ public int getRequestCount() {
+ return requestCount;
+ }
+
+ public void setRequestCount(int count) {
+ this.requestCount = count;
+ }
+
+ @Override
+ public double getHitRatio() {
+ return this.hitRatio;
+ }
+
+ @Override
+ public int getTotalEntries() {
+ return this.totalEntries;
+ }
+
+ public void setHitRatio(double value) {
+ this.hitRatio = value;
+ }
+
+ public void setTotalEntries(int value) {
+ this.totalEntries = value;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("hitRatio=").append(hitRatio);//$NON-NLS-1$
+ sb.append("; totalEntries=").append(totalEntries); //$NON-NLS-1$
+ sb.append("; requestCount=").append(requestCount); //$NON-NLS-1$
+ return sb.toString();
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.teiid.adminapi.AdminException;
+
+
+public interface DQPManagement {
+ List<RequestMetadata> getRequestsForSession(String sessionId) ;
+ List<RequestMetadata> getRequests();
+ WorkerPoolStatisticsMetadata getWorkerPoolStatistics();
+ void terminateSession(String terminateeId);
+ boolean cancelRequest(String sessionId, long requestId) throws AdminException;
+ Collection<String> getCacheTypes();
+ void clearCache(String cacheType);
+ void clearCache(String cacheType, String vdbName, int version);
+ Collection<SessionMetadata> getActiveSessions() throws AdminException;
+ int getActiveSessionsCount() throws AdminException;
+ Collection<TransactionMetadata> getTransactions();
+ void terminateTransaction(String xid) throws AdminException ;
+ List<RequestMetadata> getLongRunningRequests();
+ List<RequestMetadata> getRequestsUsingVDB(String vdbName, int vdbVersion) throws AdminException;
+ CacheStatisticsMetadata getCacheStatistics(String cacheType);
+ List<List> executeQuery(String vdbName, int version, String command, long timoutInMilli) throws AdminException;
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,291 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.*;
+
+import org.teiid.adminapi.DataPolicy;
+
+
+ at XmlAccessorType(XmlAccessType.NONE)
+ at XmlType(name = "", propOrder = {
+ "description",
+ "permissions",
+ "mappedRoleNames"
+})
+public class DataPolicyMetadata implements DataPolicy, Serializable {
+ private static final long serialVersionUID = -4119646357275977190L;
+
+ @XmlAttribute(name = "name", required = true)
+ protected String name;
+ @XmlElement(name = "description")
+ protected String description;
+ @XmlAttribute(name = "any-authenticated")
+ protected boolean anyAuthenticated;
+ @XmlAttribute(name = "allow-create-temporary-tables")
+ protected Boolean allowCreateTemporaryTables;
+
+ @XmlElement(name = "permission")
+ protected PermissionMap permissions = new PermissionMap(new KeyBuilder<PermissionMetaData>() {
+ private static final long serialVersionUID = -6992984146431492449L;
+ @Override
+ public String getKey(PermissionMetaData entry) {
+ return entry.getResourceName().toLowerCase();
+ }
+ });
+
+ @XmlElement(name = "mapped-role-name")
+ protected List<String> mappedRoleNames = new ArrayList<String>();
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+ @Override
+ public List<DataPermission> getPermissions() {
+ return new ArrayList<DataPermission>(this.permissions.getMap().values());
+ }
+
+ public void setPermissions(List<DataPermission> permissions) {
+ this.permissions.getMap().clear();
+ for (DataPermission permission:permissions) {
+ this.permissions.add((PermissionMetaData)permission);
+ }
+ }
+
+ public void addPermission(PermissionMetaData... permissions) {
+ for (PermissionMetaData permission:permissions) {
+ this.permissions.add(permission);
+ }
+ }
+
+ @Override
+ public List<String> getMappedRoleNames() {
+ return mappedRoleNames;
+ }
+
+ public void setMappedRoleNames(List<String> names) {
+ this.mappedRoleNames.clear();
+ this.mappedRoleNames.addAll(names);
+ }
+
+ public void addMappedRoleName(String name) {
+ this.mappedRoleNames.add(name);
+ }
+
+ public boolean allows(String resourceName, DataPolicy.PermissionType type) {
+ resourceName = resourceName.toLowerCase();
+ while (resourceName.length() > 0) {
+ PermissionMetaData p = this.permissions.getMap().get(resourceName);
+ if (p != null) {
+ Boolean allowed = p.allows(type);
+ if (allowed != null) {
+ return allowed;
+ }
+ }
+ resourceName = resourceName.substring(0, Math.max(0, resourceName.lastIndexOf('.')));
+ }
+ return false;
+ }
+
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = {
+ "resourceName",
+ "allowCreate",
+ "allowRead",
+ "allowUpdate",
+ "allowDelete",
+ "allowExecute",
+ "allowAlter"
+ })
+ public static class PermissionMetaData implements DataPermission, Serializable {
+ private static final long serialVersionUID = 7034744531663164277L;
+
+ // XML based fields
+ private String resourceName;
+ @XmlElement(name = "allow-create")
+ protected Boolean allowCreate;
+ @XmlElement(name = "allow-read")
+ protected Boolean allowRead;
+ @XmlElement(name = "allow-update")
+ protected Boolean allowUpdate;
+ @XmlElement(name = "allow-delete")
+ protected Boolean allowDelete;
+ @XmlElement(name = "allow-execute")
+ protected Boolean allowExecute;
+ @XmlElement(name = "allow-alter")
+ protected Boolean allowAlter;
+
+ @Override
+ @XmlElement(name = "resource-name", required = true)
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String value) {
+ this.resourceName = value;
+ }
+
+ @Override
+ public Boolean getAllowCreate() {
+ return allowCreate;
+ }
+
+ public void setAllowCreate(Boolean value) {
+ this.allowCreate = value;
+ }
+
+ @Override
+ public Boolean getAllowRead() {
+ return allowRead;
+ }
+
+ public void setAllowRead(Boolean value) {
+ this.allowRead = value;
+ }
+
+ @Override
+ public Boolean getAllowUpdate() {
+ return allowUpdate;
+ }
+
+ public void setAllowUpdate(Boolean value) {
+ this.allowUpdate = value;
+ }
+
+ @Override
+ public Boolean getAllowDelete() {
+ return allowDelete;
+ }
+
+ public void setAllowDelete(Boolean value) {
+ this.allowDelete = value;
+ }
+
+ public String getType() {
+ StringBuilder sb = new StringBuilder();
+ if (Boolean.TRUE.equals(getAllowCreate())) {
+ sb.append("C");//$NON-NLS-1$
+ }
+ if (Boolean.TRUE.equals(getAllowRead())) {
+ sb.append("R");//$NON-NLS-1$
+ }
+ if (Boolean.TRUE.equals(getAllowUpdate())) {
+ sb.append("U");//$NON-NLS-1$
+ }
+ if (Boolean.TRUE.equals(getAllowDelete())) {
+ sb.append("D");//$NON-NLS-1$
+ }
+ if (Boolean.TRUE.equals(getAllowExecute())) {
+ sb.append("E");//$NON-NLS-1$
+ }
+ if (Boolean.TRUE.equals(getAllowAlter())) {
+ sb.append("A");//$NON-NLS-1$
+ }
+ return sb.toString();
+ }
+
+ public Boolean allows(PermissionType type) {
+ switch (type) {
+ case ALTER:
+ return getAllowAlter();
+ case CREATE:
+ return getAllowCreate();
+ case EXECUTE:
+ if (getAllowExecute() != null) {
+ return getAllowExecute();
+ }
+ case READ:
+ return getAllowRead();
+ case UPDATE:
+ return getAllowUpdate();
+ case DELETE:
+ return getAllowDelete();
+ }
+ throw new AssertionError();
+ }
+
+ @Override
+ public Boolean getAllowAlter() {
+ return allowAlter;
+ }
+
+ @Override
+ public Boolean getAllowExecute() {
+ return allowExecute;
+ }
+
+ public void setAllowAlter(Boolean allowAlter) {
+ this.allowAlter = allowAlter;
+ }
+
+ public void setAllowExecute(Boolean allowExecute) {
+ this.allowExecute = allowExecute;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(getResourceName());
+ sb.append("["); //$NON-NLS-1$
+ sb.append(getType());
+ sb.append("]");//$NON-NLS-1$
+ return sb.toString();
+ }
+ }
+
+ public Boolean isAllowCreateTemporaryTables() {
+ return allowCreateTemporaryTables;
+ }
+
+ public void setAllowCreateTemporaryTables(Boolean allowCreateTemporaryTables) {
+ this.allowCreateTemporaryTables = allowCreateTemporaryTables;
+ }
+
+ @Override
+ public boolean isAnyAuthenticated() {
+ return this.anyAuthenticated;
+ }
+
+ public void setAnyAuthenticated(boolean anyAuthenticated) {
+ this.anyAuthenticated = anyAuthenticated;
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+import java.util.AbstractList;
+import java.util.LinkedHashMap;
+import java.util.Set;
+
+class ListOverMap<E> extends AbstractList<E> implements Serializable {
+
+ private static final long serialVersionUID = 5171741731121210240L;
+
+ protected LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
+ protected KeyBuilder<E> builder;
+
+ public ListOverMap(KeyBuilder<E> builder) {
+ this.builder = builder;
+ }
+
+ public LinkedHashMap<String, E> getMap() {
+ return map;
+ }
+
+ @Override
+ public void add(int index, E element) {
+ this.map.put(builder.getKey(element), element);
+ }
+
+ @Override
+ public E remove(int index) {
+ String key = getKey(index);
+ if (key == null) {
+ throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return this.map.remove(key);
+ }
+
+ @Override
+ public E get(int index) {
+ String key = getKey(index);
+ if (key == null) {
+ throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return this.map.get(key);
+ }
+
+ private String getKey(int index) {
+ Set<String> keys = this.map.keySet();
+ int i = 0;
+ for (String key:keys) {
+ if (i == index) {
+ return key;
+ }
+ i++;
+ }
+ return null;
+ }
+
+ @Override
+ public int size() {
+ return this.map.size();
+ }
+}
+
+interface KeyBuilder<E> extends Serializable {
+ String getKey(E entry);
+}
+
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,1071 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.ModelType;
+import org.teiid.adminapi.AdminPlugin;
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
+import org.teiid.adminapi.VDB.ConnectionType;
+import org.teiid.adminapi.VDB.Status;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
+
+
+public class MetadataMapper {
+ private static final String VDBNAME = "vdb-name"; //$NON-NLS-1$
+ private static final String CONNECTIONTYPE = "connection-type"; //$NON-NLS-1$
+ private static final String STATUS = "status"; //$NON-NLS-1$
+ private static final String VERSION = "vdb-version"; //$NON-NLS-1$
+ private static final String URL = "url"; //$NON-NLS-1$
+ private static final String MODELS = "models"; //$NON-NLS-1$
+ private static final String OVERRIDE_TRANSLATORS = "override-translators"; //$NON-NLS-1$
+ private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+ private static final String DYNAMIC = "dynamic"; //$NON-NLS-1$
+ private static final String DATA_POLICIES = "data-policies"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(VDBMetaData vdb, ModelNode node) {
+ if (vdb == null) {
+ return null;
+ }
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(VDBNAME).set(vdb.getName());
+ node.get(CONNECTIONTYPE).set(vdb.getConnectionType().toString());
+ node.get(STATUS).set(vdb.getStatus().toString());
+ node.get(VERSION).set(vdb.getVersion());
+ if (vdb.getUrl() != null) {
+ }
+ if (vdb.getDescription() != null) {
+ node.get(DESCRIPTION).set(vdb.getDescription());
+ }
+ node.get(DYNAMIC).set(vdb.isDynamic());
+
+ //PROPERTIES
+ List<PropertyMetadata> properties = vdb.getJAXBProperties();
+ if (properties!= null && !properties.isEmpty()) {
+ ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
+ for (PropertyMetadata prop:properties) {
+ propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
+ }
+ }
+
+ // MODELS
+ Map<String, ModelMetaData> models = vdb.getModelMetaDatas();
+ if (models != null && !models.isEmpty()) {
+ ModelNode modelNodes = node.get(CHILDREN, MODELS);
+ for(ModelMetaData model:models.values()) {
+ modelNodes.add(ModelMetadataMapper.wrap(model, new ModelNode()));
+ }
+ }
+
+ // OVERRIDE_TRANSLATORS
+ List<Translator> translators = vdb.getOverrideTranslators();
+ if (translators != null && !translators.isEmpty()) {
+ ModelNode translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
+ for (Translator translator:translators) {
+ translatorNodes.add(VDBTranslatorMetaDataMapper.wrap((VDBTranslatorMetaData)translator, new ModelNode()));
+ }
+ }
+
+ // DATA_POLICIES
+ List<DataPolicy> policies = vdb.getDataPolicies();
+ if (policies != null && !policies.isEmpty()) {
+ ModelNode dataPoliciesNodes = node.get(CHILDREN, DATA_POLICIES);
+ for (DataPolicy policy:policies) {
+ dataPoliciesNodes.add(DataPolicyMetadataMapper.wrap((DataPolicyMetadata)policy, new ModelNode()));
+ }
+ }
+ return node;
+ }
+
+ public static VDBMetaData unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ VDBMetaData vdb = new VDBMetaData();
+ if (node.has(VDBNAME)) {
+ vdb.setName(node.get(VDBNAME).asString());
+ }
+ if (node.has(CONNECTIONTYPE)) {
+ vdb.setConnectionType(node.get(CONNECTIONTYPE).asString());
+ }
+ if (node.has(STATUS)) {
+ vdb.setStatus(node.get(STATUS).asString());
+ }
+ if (node.has(VERSION)) {
+ vdb.setVersion(node.get(VERSION).asInt());
+ }
+ if (node.has(URL)) {
+ vdb.setUrl(node.get(URL).asString());
+ }
+ if(node.has(DESCRIPTION)) {
+ vdb.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(DYNAMIC)) {
+ vdb.setDynamic(node.get(DYNAMIC).asBoolean());
+ }
+
+ //PROPERTIES
+ if (node.get(CHILDREN, PROPERTIES).isDefined()) {
+ List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+ for (ModelNode propNode:propNodes) {
+ PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
+ if (prop != null) {
+ vdb.addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+
+ // MODELS
+ if (node.get(CHILDREN, MODELS).isDefined()) {
+ List<ModelNode> modelNodes = node.get(CHILDREN, MODELS).asList();
+ for(ModelNode modelNode:modelNodes) {
+ ModelMetaData model = ModelMetadataMapper.unwrap(modelNode);
+ if (model != null) {
+ vdb.addModel(model);
+ }
+ }
+ }
+
+ // OVERRIDE_TRANSLATORS
+ if (node.get(CHILDREN, OVERRIDE_TRANSLATORS).isDefined()) {
+ List<ModelNode> translatorNodes = node.get(CHILDREN, OVERRIDE_TRANSLATORS).asList();
+ for (ModelNode translatorNode:translatorNodes) {
+ VDBTranslatorMetaData translator = VDBTranslatorMetaDataMapper.unwrap(translatorNode);
+ if (translator != null) {
+ vdb.addOverideTranslator(translator);
+ }
+ }
+ }
+
+ // DATA_POLICIES
+ if (node.get(CHILDREN, DATA_POLICIES).isDefined()) {
+ List<ModelNode> policiesNodes = node.get(CHILDREN, DATA_POLICIES).asList();
+ for (ModelNode policyNode:policiesNodes) {
+ DataPolicyMetadata policy = DataPolicyMetadataMapper.unwrap(policyNode);
+ if (policy != null) {
+ vdb.addDataPolicy(policy);
+ }
+
+ }
+ }
+ return vdb;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, VDBNAME, ModelType.STRING, true);
+
+ ModelNode connectionsAllowed = new ModelNode();
+ connectionsAllowed.add(ConnectionType.NONE.toString());
+ connectionsAllowed.add(ConnectionType.ANY.toString());
+ connectionsAllowed.add(ConnectionType.BY_VERSION.toString());
+ addAttribute(node, CONNECTIONTYPE, ModelType.STRING, false).get(ALLOWED).set(connectionsAllowed);
+
+ ModelNode statusAllowed = new ModelNode();
+ statusAllowed.add(Status.ACTIVE.toString());
+ statusAllowed.add(Status.INACTIVE.toString());
+ addAttribute(node, STATUS, ModelType.STRING, true).get(ALLOWED).set(statusAllowed);
+
+ addAttribute(node, VERSION, ModelType.INT, true);
+ addAttribute(node, URL, ModelType.STRING, false);
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, DYNAMIC, ModelType.BOOLEAN, false);
+
+ ModelNode props = node.get(CHILDREN, PROPERTIES);
+ props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+ PropertyMetaDataMapper.describe(props);
+
+ ModelNode models = node.get(CHILDREN, MODELS);
+ ModelMetadataMapper.describe(models);
+ models.get(DESCRIPTION).set(AdminPlugin.Util.getString(MODELS+DOT_DESC));
+ models.get(MIN_OCCURS).set(1);
+
+ ModelNode translators = node.get(CHILDREN, OVERRIDE_TRANSLATORS);
+ translators.get(DESCRIPTION).set(AdminPlugin.Util.getString(OVERRIDE_TRANSLATORS+DOT_DESC));
+ VDBTranslatorMetaDataMapper.describe(translators);
+
+ ModelNode dataPolicies = node.get(CHILDREN, DATA_POLICIES);
+ dataPolicies.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_POLICIES+DOT_DESC));
+ DataPolicyMetadataMapper.describe(dataPolicies);
+ return node;
+ }
+
+ /**
+ * model metadata mapper
+ */
+ public static class ModelMetadataMapper {
+ private static final String MODEL_NAME = "model-name"; //$NON-NLS-1$
+ private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String VISIBLE = "visible"; //$NON-NLS-1$
+ private static final String MODEL_TYPE = "model-type"; //$NON-NLS-1$
+ private static final String MODELPATH = "model-path"; //$NON-NLS-1$
+ private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+ private static final String SOURCE_MAPPINGS = "source-mappings"; //$NON-NLS-1$
+ private static final String VALIDITY_ERRORS = "validity-errors"; //$NON-NLS-1$
+
+ public static ModelNode wrap(ModelMetaData model, ModelNode node) {
+ if (model == null) {
+ return null;
+ }
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ node.get(MODEL_NAME).set(model.getName());
+ if (model.getDescription() != null) {
+ node.get(DESCRIPTION).set(model.getDescription());
+ }
+ node.get(VISIBLE).set(model.isVisible());
+ node.get(MODEL_TYPE).set(model.getModelType().toString());
+ if (model.getPath() != null) {
+ node.get(MODELPATH).set(model.getPath());
+ }
+
+ List<PropertyMetadata> properties = model.getJAXBProperties();
+ if (properties!= null && !properties.isEmpty()) {
+ ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
+ for (PropertyMetadata prop:properties) {
+ propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
+ }
+ }
+
+ List<SourceMappingMetadata> sources = model.getSourceMappings();
+ if (sources != null && !sources.isEmpty()) {
+ ModelNode sourceMappingNode = node.get(CHILDREN, SOURCE_MAPPINGS);
+ for(SourceMappingMetadata source:sources) {
+ sourceMappingNode.add(SourceMappingMetadataMapper.wrap(source, new ModelNode()));
+ }
+ }
+
+ List<ValidationError> errors = model.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ ModelNode errorsNode = node.get(CHILDREN, VALIDITY_ERRORS);
+ for (ValidationError error:errors) {
+ errorsNode.add(ValidationErrorMapper.wrap(error));
+ }
+ }
+ return node;
+ }
+
+ public static ModelMetaData unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ ModelMetaData model = new ModelMetaData();
+ if (node.has(MODEL_NAME)) {
+ model.setName(node.get(MODEL_NAME).asString());
+ }
+ if (node.has(DESCRIPTION)) {
+ model.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(VISIBLE)) {
+ model.setVisible(node.get(VISIBLE).asBoolean());
+ }
+ if(node.has(MODEL_TYPE)) {
+ model.setModelType(node.get(MODEL_TYPE).asString());
+ }
+ if(node.has(MODELPATH)) {
+ model.setPath(node.get(MODELPATH).asString());
+ }
+
+ if (node.get(CHILDREN, PROPERTIES).isDefined()) {
+ List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+ for (ModelNode propNode:propNodes) {
+ PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
+ if (prop != null) {
+ model.addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+
+ if (node.get(CHILDREN, SOURCE_MAPPINGS).isDefined()) {
+ List<ModelNode> sourceMappingNodes = node.get(CHILDREN, SOURCE_MAPPINGS).asList();
+ for (ModelNode sourceMapping:sourceMappingNodes) {
+ SourceMappingMetadata source = SourceMappingMetadataMapper.unwrap(sourceMapping);
+ if (source != null) {
+ model.addSourceMapping(source);
+ }
+ }
+ }
+
+ if (node.get(CHILDREN, VALIDITY_ERRORS).isDefined()) {
+ List<ModelNode> errorNodes = node.get(CHILDREN, VALIDITY_ERRORS).asList();
+ for(ModelNode errorNode:errorNodes) {
+ ValidationError error = ValidationErrorMapper.unwrap(errorNode);
+ if (error != null) {
+ model.addError(error);
+ }
+ }
+ }
+ return model;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ ModelNode modelTypes = new ModelNode();
+ modelTypes.add(Model.Type.PHYSICAL.toString());
+ modelTypes.add(Model.Type.VIRTUAL.toString());
+ modelTypes.add(Model.Type.FUNCTION.toString());
+ modelTypes.add(Model.Type.OTHER.toString());
+ addAttribute(node, MODEL_NAME, ModelType.STRING, true).get(ALLOWED).set(modelTypes);
+
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, VISIBLE, ModelType.BOOLEAN, false);
+ addAttribute(node, MODEL_TYPE, ModelType.STRING, true);
+ addAttribute(node, MODELPATH, ModelType.STRING, false);
+
+ ModelNode props = node.get(CHILDREN, PROPERTIES);
+ props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+ PropertyMetaDataMapper.describe(props);
+
+ ModelNode source = node.get(CHILDREN, SOURCE_MAPPINGS);
+ source.get(DESCRIPTION).set(AdminPlugin.Util.getString(SOURCE_MAPPINGS+DOT_DESC));
+ SourceMappingMetadataMapper.describe(source);
+
+ ModelNode errors = node.get(CHILDREN, VALIDITY_ERRORS);
+ errors.get(DESCRIPTION).set(AdminPlugin.Util.getString(VALIDITY_ERRORS+DOT_DESC));
+ ValidationErrorMapper.describe(errors);
+
+ return node;
+ }
+ }
+
+ /**
+ * validation error mapper
+ */
+ public static class ValidationErrorMapper {
+ private static final String ERROR_PATH = "error-path"; //$NON-NLS-1$
+ private static final String SEVERITY = "severity"; //$NON-NLS-1$
+ private static final String MESSAGE = "message"; //$NON-NLS-1$
+
+ public static ModelNode wrap(ValidationError error) {
+ if (error == null) {
+ return null;
+ }
+
+ ModelNode node = new ModelNode();
+ node.get(TYPE).set(ModelType.OBJECT);
+ if (error.getPath() != null) {
+ node.get(ERROR_PATH).set(error.getPath());
+ }
+ node.get(SEVERITY).set(error.getSeverity());
+ node.get(MESSAGE).set(error.getValue());
+
+ return node;
+ }
+
+ public static ValidationError unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ ValidationError error = new ValidationError();
+ if (node.has(ERROR_PATH)) {
+ error.setPath(node.get(ERROR_PATH).asString());
+ }
+ if (node.has(SEVERITY)) {
+ error.setSeverity(node.get(SEVERITY).asString());
+ }
+ if(node.has(MESSAGE)) {
+ error.setValue(node.get(MESSAGE).asString());
+ }
+ return error;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, ERROR_PATH, ModelType.STRING, false);
+ addAttribute(node, SEVERITY, ModelType.STRING, true);
+ addAttribute(node, MESSAGE, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ /**
+ * Source Mapping Metadata mapper
+ */
+ public static class SourceMappingMetadataMapper {
+ private static final String SOURCE_NAME = "source-name"; //$NON-NLS-1$
+ private static final String JNDI_NAME = "jndi-name"; //$NON-NLS-1$
+ private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
+
+ public static ModelNode wrap(SourceMappingMetadata source, ModelNode node) {
+ if (source == null) {
+ return null;
+ }
+
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ node.get(SOURCE_NAME).set(source.getName());
+ node.get(JNDI_NAME).set(source.getConnectionJndiName());
+ node.get(TRANSLATOR_NAME).set(source.getTranslatorName());
+ return node;
+ }
+
+ public static SourceMappingMetadata unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+ SourceMappingMetadata source = new SourceMappingMetadata();
+ if (node.has(SOURCE_NAME)) {
+ source.setName(node.get(SOURCE_NAME).asString());
+ }
+ if (node.has(JNDI_NAME)) {
+ source.setConnectionJndiName(node.get(JNDI_NAME).asString());
+ }
+ if (node.has(TRANSLATOR_NAME)) {
+ source.setTranslatorName(node.get(TRANSLATOR_NAME).asString());
+ }
+ return source;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, SOURCE_NAME, ModelType.STRING, true);
+ addAttribute(node, JNDI_NAME, ModelType.STRING, true);
+ addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ /**
+ * Source Mapping Metadata mapper
+ */
+ public static class VDBTranslatorMetaDataMapper {
+ private static final String TRANSLATOR_NAME = "translator-name"; //$NON-NLS-1$
+ private static final String BASETYPE = "base-type"; //$NON-NLS-1$
+ private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String PROPERTIES = "properties"; //$NON-NLS-1$
+ private static final String MODULE_NAME = "module-name"; //$NON-NLS-1$
+
+ public static ModelNode wrap(VDBTranslatorMetaData translator, ModelNode node) {
+ if (translator == null) {
+ return null;
+ }
+ node.get(TYPE).set(ModelType.OBJECT);
+
+ node.get(TRANSLATOR_NAME).set(translator.getName());
+ if (translator.getType() != null) {
+ node.get(BASETYPE).set(translator.getType());
+ }
+ if (translator.getDescription() != null) {
+ node.get(DESCRIPTION).set(translator.getDescription());
+ }
+
+ if (translator.getModuleName() != null) {
+ node.get(MODULE_NAME).set(translator.getModuleName());
+ }
+
+ List<PropertyMetadata> properties = translator.getJAXBProperties();
+ if (properties!= null && !properties.isEmpty()) {
+ ModelNode propsNode = node.get(CHILDREN, PROPERTIES);
+ for (PropertyMetadata prop:properties) {
+ propsNode.add(PropertyMetaDataMapper.wrap(prop, new ModelNode()));
+ }
+ }
+ return node;
+ }
+
+ public static VDBTranslatorMetaData unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+ VDBTranslatorMetaData translator = new VDBTranslatorMetaData();
+ if (node.has(TRANSLATOR_NAME)) {
+ translator.setName(node.get(TRANSLATOR_NAME).asString());
+ }
+ if (node.has(BASETYPE)) {
+ translator.setType(node.get(BASETYPE).asString());
+ }
+ if (node.has(DESCRIPTION)) {
+ translator.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(MODULE_NAME)) {
+ translator.setModuleName(node.get(MODULE_NAME).asString());
+ }
+
+ if (node.get(CHILDREN,PROPERTIES).isDefined()) {
+ List<ModelNode> propNodes = node.get(CHILDREN, PROPERTIES).asList();
+ for (ModelNode propNode:propNodes) {
+ PropertyMetadata prop = PropertyMetaDataMapper.unwrap(propNode);
+ if (prop != null) {
+ translator.addProperty(prop.getName(), prop.getValue());
+ }
+ }
+ }
+ return translator;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, TRANSLATOR_NAME, ModelType.STRING, true);
+ addAttribute(node, BASETYPE, ModelType.STRING, true);
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, MODULE_NAME, ModelType.STRING, false);
+
+ ModelNode props = node.get(CHILDREN, PROPERTIES);
+ props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+ PropertyMetaDataMapper.describe(props);
+ return node;
+ }
+ }
+
+ /**
+ * Property Metadata mapper
+ */
+ public static class PropertyMetaDataMapper {
+ private static final String PROPERTY_NAME = "property-name"; //$NON-NLS-1$
+ private static final String PROPERTY_VALUE = "property-value"; //$NON-NLS-1$
+
+ public static ModelNode wrap(PropertyMetadata property, ModelNode node) {
+ if (property == null) {
+ return null;
+ }
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(PROPERTY_NAME).set(property.getName());
+ node.get(PROPERTY_VALUE).set(property.getValue());
+
+ return node;
+ }
+
+ public static PropertyMetadata unwrap(ModelNode node) {
+ if(node == null) {
+ return null;
+ }
+ PropertyMetadata property = new PropertyMetadata();
+ if (node.has(PROPERTY_NAME)) {
+ property.setName(node.get(PROPERTY_NAME).asString());
+ }
+ if(node.has(PROPERTY_VALUE)) {
+ property.setValue(node.get(PROPERTY_VALUE).asString());
+ }
+ return property;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, PROPERTY_NAME, ModelType.STRING, true);
+ addAttribute(node, PROPERTY_VALUE, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ /**
+ * DataPolicy Metadata mapper
+ */
+ public static class DataPolicyMetadataMapper {
+ private static final String POLICY_NAME = "policy-name"; //$NON-NLS-1$
+ private static final String DATA_PERMISSIONS = "data-permissions"; //$NON-NLS-1$
+ private static final String MAPPED_ROLE_NAMES = "mapped-role-names"; //$NON-NLS-1$
+ private static final String ALLOW_CREATE_TEMP_TABLES = "allow-create-temp-tables"; //$NON-NLS-1$
+ private static final String ANY_AUTHENTICATED = "any-authenticated"; //$NON-NLS-1$
+
+ public static ModelNode wrap(DataPolicyMetadata policy, ModelNode node) {
+ if (policy == null) {
+ return null;
+ }
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(POLICY_NAME).set(policy.getName());
+ if (policy.getDescription() != null) {
+ node.get(DESCRIPTION).set(policy.getDescription());
+ }
+ if (policy.isAllowCreateTemporaryTables() != null) {
+ node.get(ALLOW_CREATE_TEMP_TABLES).set(policy.isAllowCreateTemporaryTables());
+ }
+ node.get(ANY_AUTHENTICATED).set(policy.isAnyAuthenticated());
+
+ //DATA_PERMISSIONS
+ List<DataPolicy.DataPermission> permissions = policy.getPermissions();
+ if (permissions != null && !permissions.isEmpty()) {
+ ModelNode permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS);
+ for (DataPolicy.DataPermission dataPermission:permissions) {
+ permissionNodes.add(PermissionMetaDataMapper.wrap((PermissionMetaData)dataPermission, new ModelNode()));
+ }
+ }
+
+ //MAPPED_ROLE_NAMES
+ if (policy.getMappedRoleNames() != null && !policy.getMappedRoleNames().isEmpty()) {
+ ModelNode mappedRoleNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES);
+ for (String role:policy.getMappedRoleNames()) {
+ mappedRoleNodes.add(role);
+ }
+ }
+ return node;
+ }
+
+ public static DataPolicyMetadata unwrap(ModelNode node) {
+ if(node == null) {
+ return null;
+ }
+ DataPolicyMetadata policy = new DataPolicyMetadata();
+ if (node.has(POLICY_NAME)) {
+ policy.setName(node.get(POLICY_NAME).asString());
+ }
+ if (node.has(DESCRIPTION)) {
+ policy.setDescription(node.get(DESCRIPTION).asString());
+ }
+ if (node.has(ALLOW_CREATE_TEMP_TABLES)) {
+ policy.setAllowCreateTemporaryTables(node.get(ALLOW_CREATE_TEMP_TABLES).asBoolean());
+ }
+ if (node.has(ANY_AUTHENTICATED)) {
+ policy.setAnyAuthenticated(node.get(ANY_AUTHENTICATED).asBoolean());
+ }
+
+ //DATA_PERMISSIONS
+ if (node.get(CHILDREN, DATA_PERMISSIONS).isDefined()) {
+ List<ModelNode> permissionNodes = node.get(CHILDREN, DATA_PERMISSIONS).asList();
+ for (ModelNode permissionNode:permissionNodes) {
+ PermissionMetaData permission = PermissionMetaDataMapper.unwrap(permissionNode);
+ if (permission != null) {
+ policy.addPermission(permission);
+ }
+ }
+ }
+
+ //MAPPED_ROLE_NAMES
+ if (node.get(CHILDREN, MAPPED_ROLE_NAMES).isDefined()) {
+ List<ModelNode> roleNameNodes = node.get(CHILDREN, MAPPED_ROLE_NAMES).asList();
+ for (ModelNode roleNameNode:roleNameNodes) {
+ policy.addMappedRoleName(roleNameNode.asString());
+ }
+ }
+ return policy;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, POLICY_NAME, ModelType.STRING, true);
+ addAttribute(node, DESCRIPTION, ModelType.STRING, false);
+ addAttribute(node, ALLOW_CREATE_TEMP_TABLES, ModelType.BOOLEAN, false);
+ addAttribute(node, ANY_AUTHENTICATED, ModelType.BOOLEAN, false);
+
+ ModelNode permissions = node.get(CHILDREN, DATA_PERMISSIONS);
+ PropertyMetaDataMapper.describe(permissions);
+ permissions.get(DESCRIPTION).set(AdminPlugin.Util.getString(DATA_PERMISSIONS+DOT_DESC));
+ permissions.get(MIN_OCCURS).set(1);
+
+ ModelNode roleNames = node.get(CHILDREN, MAPPED_ROLE_NAMES);
+ roleNames.get(TYPE).set(ModelType.LIST);
+ roleNames.get(DESCRIPTION).set(AdminPlugin.Util.getString(MAPPED_ROLE_NAMES+DOT_DESC));
+ roleNames.get("value-type").set(ModelType.STRING); //$NON-NLS-1$
+ return node;
+ }
+ }
+
+ public static class PermissionMetaDataMapper{
+ private static final String RESOURCE_NAME = "resource-name"; //$NON-NLS-1$
+ private static final String ALLOW_CREATE = "allow-create"; //$NON-NLS-1$
+ private static final String ALLOW_DELETE = "allow-delete"; //$NON-NLS-1$
+ private static final String ALLOW_UPADTE = "allow-update"; //$NON-NLS-1$
+ private static final String ALLOW_READ = "allow-read"; //$NON-NLS-1$
+ private static final String ALLOW_EXECUTE = "allow-execute"; //$NON-NLS-1$
+ private static final String ALLOW_ALTER = "allow-alter"; //$NON-NLS-1$
+
+
+
+ public static ModelNode wrap(PermissionMetaData permission, ModelNode node) {
+ if (permission == null) {
+ return null;
+ }
+
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(RESOURCE_NAME).set(permission.getResourceName());
+ if (permission.getAllowCreate() != null) {
+ node.get(ALLOW_CREATE).set(permission.getAllowCreate().booleanValue());
+ }
+ if (permission.getAllowDelete() != null) {
+ node.get(ALLOW_DELETE).set(permission.getAllowDelete().booleanValue());
+ }
+ if (permission.getAllowUpdate() != null) {
+ node.get(ALLOW_UPADTE).set(permission.getAllowUpdate().booleanValue());
+ }
+ if (permission.getAllowRead() != null) {
+ node.get(ALLOW_READ).set(permission.getAllowRead().booleanValue());
+ }
+ if (permission.getAllowExecute() != null) {
+ node.get(ALLOW_EXECUTE).set(permission.getAllowExecute().booleanValue());
+ }
+ if(permission.getAllowAlter() != null) {
+ node.get(ALLOW_ALTER).set(permission.getAllowAlter().booleanValue());
+ }
+ return node;
+ }
+
+ public static PermissionMetaData unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ PermissionMetaData permission = new PermissionMetaData();
+ if (node.get(RESOURCE_NAME) != null) {
+ permission.setResourceName(node.get(RESOURCE_NAME).asString());
+ }
+ if (node.has(ALLOW_CREATE)) {
+ permission.setAllowCreate(node.get(ALLOW_CREATE).asBoolean());
+ }
+ if (node.has(ALLOW_DELETE)) {
+ permission.setAllowDelete(node.get(ALLOW_DELETE).asBoolean());
+ }
+ if (node.has(ALLOW_UPADTE)) {
+ permission.setAllowUpdate(node.get(ALLOW_UPADTE).asBoolean());
+ }
+ if (node.has(ALLOW_READ)) {
+ permission.setAllowRead(node.get(ALLOW_READ).asBoolean());
+ }
+ if (node.has(ALLOW_EXECUTE)) {
+ permission.setAllowExecute(node.get(ALLOW_EXECUTE).asBoolean());
+ }
+ if (node.has(ALLOW_ALTER)) {
+ permission.setAllowAlter(node.get(ALLOW_ALTER).asBoolean());
+ }
+ return permission;
+ }
+ public static ModelNode describe(ModelNode node) {
+ addAttribute(node, RESOURCE_NAME, ModelType.STRING, true);
+ addAttribute(node, ALLOW_CREATE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_DELETE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_UPADTE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_READ, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_EXECUTE, ModelType.BOOLEAN, false);
+ addAttribute(node, ALLOW_ALTER, ModelType.BOOLEAN, false);
+ return node;
+ }
+ }
+
+ public static class CacheStatisticsMetadataMapper {
+ private static final String HITRATIO = "hit-ratio"; //$NON-NLS-1$
+ private static final String TOTAL_ENTRIES = "total-entries"; //$NON-NLS-1$
+ private static final String REQUEST_COUNT = "request-count"; //$NON-NLS-1$
+
+ public static ModelNode wrap(CacheStatisticsMetadata object, ModelNode node) {
+ if (object == null)
+ return null;
+
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(TOTAL_ENTRIES).set(object.getTotalEntries());
+ node.get(HITRATIO).set(object.getHitRatio());
+ node.get(REQUEST_COUNT).set(object.getRequestCount());
+
+ return node;
+ }
+
+ public static CacheStatisticsMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ CacheStatisticsMetadata cache = new CacheStatisticsMetadata();
+ cache.setTotalEntries(node.get(TOTAL_ENTRIES).asInt());
+ cache.setHitRatio(node.get(HITRATIO).asDouble());
+ cache.setRequestCount(node.get(REQUEST_COUNT).asInt());
+ return cache;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, TOTAL_ENTRIES, ModelType.STRING, true);
+ addAttribute(node, HITRATIO, ModelType.STRING, true);
+ addAttribute(node, REQUEST_COUNT, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ public static class RequestMetadataMapper {
+ private static final String TRANSACTION_ID = "transaction-id"; //$NON-NLS-1$
+ private static final String NODE_ID = "node-id"; //$NON-NLS-1$
+ private static final String SOURCE_REQUEST = "source-request"; //$NON-NLS-1$
+ private static final String COMMAND = "command"; //$NON-NLS-1$
+ private static final String START_TIME = "start-time"; //$NON-NLS-1$
+ private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
+ private static final String EXECUTION_ID = "execution-id"; //$NON-NLS-1$
+ private static final String STATE = "processing-state"; //$NON-NLS-1$
+ private static final String THREAD_STATE = "thread-state"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(RequestMetadata request, ModelNode node) {
+ if (request == null) {
+ return null;
+ }
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(EXECUTION_ID).set(request.getExecutionId());
+ node.get(SESSION_ID).set(request.getSessionId());
+ node.get(START_TIME).set(request.getStartTime());
+ node.get(COMMAND).set(request.getCommand());
+ node.get(SOURCE_REQUEST).set(request.sourceRequest());
+ if (request.getNodeId() != null) {
+ node.get(NODE_ID).set(request.getNodeId());
+ }
+ if (request.getTransactionId() != null) {
+ node.get(TRANSACTION_ID).set(request.getTransactionId());
+ }
+ node.get(STATE).set(request.getState().name());
+ node.get(THREAD_STATE).set(request.getThreadState().name());
+ return node;
+ }
+
+ public static RequestMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ RequestMetadata request = new RequestMetadata();
+ request.setExecutionId(node.get(EXECUTION_ID).asLong());
+ request.setSessionId(node.get(SESSION_ID).asString());
+ request.setStartTime(node.get(START_TIME).asLong());
+ request.setCommand(node.get(COMMAND).asString());
+ request.setSourceRequest(node.get(SOURCE_REQUEST).asBoolean());
+ if (node.has(NODE_ID)) {
+ request.setNodeId(node.get(NODE_ID).asInt());
+ }
+ if (node.has(TRANSACTION_ID)) {
+ request.setTransactionId(node.get(TRANSACTION_ID).asString());
+ }
+ request.setState(ProcessingState.valueOf(node.get(STATE).asString()));
+ request.setThreadState(ThreadState.valueOf(node.get(THREAD_STATE).asString()));
+ return request;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, EXECUTION_ID, ModelType.LONG, true);
+ addAttribute(node, SESSION_ID, ModelType.STRING, true);
+ addAttribute(node, START_TIME, ModelType.LONG, true);
+ addAttribute(node, COMMAND, ModelType.STRING, true);
+ addAttribute(node, SOURCE_REQUEST, ModelType.BOOLEAN, true);
+ addAttribute(node, NODE_ID, ModelType.INT, false);
+ addAttribute(node, TRANSACTION_ID, ModelType.STRING, false);
+ addAttribute(node, STATE, ModelType.STRING, true);
+ addAttribute(node, THREAD_STATE, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ public static class SessionMetadataMapper {
+ private static final String SECURITY_DOMAIN = "security-domain"; //$NON-NLS-1$
+ private static final String VDB_VERSION = "vdb-version"; //$NON-NLS-1$
+ private static final String VDB_NAME = "vdb-name"; //$NON-NLS-1$
+ private static final String USER_NAME = "user-name"; //$NON-NLS-1$
+ private static final String SESSION_ID = "session-id"; //$NON-NLS-1$
+ private static final String LAST_PING_TIME = "last-ping-time"; //$NON-NLS-1$
+ private static final String IP_ADDRESS = "ip-address"; //$NON-NLS-1$
+ private static final String CLIENT_HOST_NAME = "client-host-address"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "created-time"; //$NON-NLS-1$
+ private static final String APPLICATION_NAME = "application-name"; //$NON-NLS-1$
+ private static final String CLIENT_HARDWARE_ADRESS = "client-hardware-address"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(SessionMetadata session, ModelNode node) {
+ if (session == null) {
+ return null;
+ }
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ if (session.getApplicationName() != null) {
+ node.get(APPLICATION_NAME).set(session.getApplicationName());
+ }
+ node.get(CREATED_TIME).set(session.getCreatedTime());
+ node.get(CLIENT_HOST_NAME).set(session.getClientHostName());
+ node.get(IP_ADDRESS).set(session.getIPAddress());
+ node.get(LAST_PING_TIME).set(session.getLastPingTime());
+ node.get(SESSION_ID).set(session.getSessionId());
+ node.get(USER_NAME).set(session.getUserName());
+ node.get(VDB_NAME).set(session.getVDBName());
+ node.get(VDB_VERSION).set(session.getVDBVersion());
+ if (session.getSecurityDomain() != null){
+ node.get(SECURITY_DOMAIN).set(session.getSecurityDomain());
+ }
+ if (session.getClientHardwareAddress() != null) {
+ node.get(CLIENT_HARDWARE_ADRESS).set(session.getClientHardwareAddress());
+ }
+ return node;
+ }
+
+ public static SessionMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ SessionMetadata session = new SessionMetadata();
+ if (node.has(APPLICATION_NAME)) {
+ session.setApplicationName(node.get(APPLICATION_NAME).asString());
+ }
+ session.setCreatedTime(node.get(CREATED_TIME).asLong());
+ session.setClientHostName(node.get(CLIENT_HOST_NAME).asString());
+ session.setIPAddress(node.get(IP_ADDRESS).asString());
+ session.setLastPingTime(node.get(LAST_PING_TIME).asLong());
+ session.setSessionId(node.get(SESSION_ID).asString());
+ session.setUserName(node.get(USER_NAME).asString());
+ session.setVDBName(node.get(VDB_NAME).asString());
+ session.setVDBVersion(node.get(VDB_VERSION).asInt());
+ if (node.has(SECURITY_DOMAIN)) {
+ session.setSecurityDomain(node.get(SECURITY_DOMAIN).asString());
+ }
+ if (node.has(CLIENT_HARDWARE_ADRESS)) {
+ session.setClientHardwareAddress(node.get(CLIENT_HARDWARE_ADRESS).asString());
+ }
+ return session;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, APPLICATION_NAME, ModelType.STRING, false);
+ addAttribute(node, CREATED_TIME, ModelType.LONG, true);
+ addAttribute(node, CLIENT_HOST_NAME, ModelType.LONG, true);
+ addAttribute(node, IP_ADDRESS, ModelType.STRING, true);
+ addAttribute(node, LAST_PING_TIME, ModelType.LONG, true);
+ addAttribute(node, SESSION_ID, ModelType.STRING, true);
+ addAttribute(node, USER_NAME, ModelType.STRING, true);
+ addAttribute(node, VDB_NAME, ModelType.STRING, true);
+ addAttribute(node, VDB_VERSION, ModelType.INT, true);
+ addAttribute(node, SECURITY_DOMAIN, ModelType.STRING, false);
+ return node;
+ }
+ }
+
+ public static class TransactionMetadataMapper {
+ private static final String ID = "txn-id"; //$NON-NLS-1$
+ private static final String SCOPE = "txn-scope"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "txn-created-time"; //$NON-NLS-1$
+ private static final String ASSOCIATED_SESSION = "session-id"; //$NON-NLS-1$
+
+ public static ModelNode wrap(TransactionMetadata object, ModelNode transaction) {
+ if (object == null)
+ return null;
+
+ transaction.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+ transaction.get(ASSOCIATED_SESSION).set(object.getAssociatedSession());
+ transaction.get(CREATED_TIME).set(object.getCreatedTime());
+ transaction.get(SCOPE).set(object.getScope());
+ transaction.get(ID).set(object.getId());
+
+ return transaction;
+ }
+
+ public static TransactionMetadata unwrap(ModelNode node) {
+ if (node == null)
+ return null;
+
+ TransactionMetadata transaction = new TransactionMetadata();
+ transaction.setAssociatedSession(node.get(ASSOCIATED_SESSION).asString());
+ transaction.setCreatedTime(node.get(CREATED_TIME).asLong());
+ transaction.setScope(node.get(SCOPE).asString());
+ transaction.setId(node.get(ID).asString());
+ return transaction;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, ASSOCIATED_SESSION, ModelType.STRING, true);
+ addAttribute(node, CREATED_TIME, ModelType.LONG, true);
+ addAttribute(node, SCOPE, ModelType.LONG, true);
+ addAttribute(node, ID, ModelType.STRING, true);
+ return node;
+ }
+ }
+
+ public static class WorkerPoolStatisticsMetadataMapper {
+ private static final String MAX_THREADS = "max-threads"; //$NON-NLS-1$
+ private static final String HIGHEST_QUEUED = "highest-queued"; //$NON-NLS-1$
+ private static final String QUEUED = "queued"; //$NON-NLS-1$
+ private static final String QUEUE_NAME = "queue-name"; //$NON-NLS-1$
+ private static final String TOTAL_SUBMITTED = "total-submitted"; //$NON-NLS-1$
+ private static final String TOTAL_COMPLETED = "total-completed"; //$NON-NLS-1$
+ private static final String HIGHEST_ACTIVE_THREADS = "highest-active-threads"; //$NON-NLS-1$
+ private static final String ACTIVE_THREADS = "active-threads"; //$NON-NLS-1$
+
+
+ public static ModelNode wrap(WorkerPoolStatisticsMetadata stats, ModelNode node) {
+ if (stats == null)
+ return null;
+ node.get(ModelNodeConstants.TYPE).set(ModelType.OBJECT);
+
+ node.get(ACTIVE_THREADS).set(stats.getActiveThreads());
+ node.get(HIGHEST_ACTIVE_THREADS).set(stats.getHighestActiveThreads());
+ node.get(TOTAL_COMPLETED).set(stats.getTotalCompleted());
+ node.get(TOTAL_SUBMITTED).set(stats.getTotalSubmitted());
+ node.get(QUEUE_NAME).set(stats.getQueueName());
+ node.get(QUEUED).set(stats.getQueued());
+ node.get(HIGHEST_QUEUED).set(stats.getHighestQueued());
+ node.get(MAX_THREADS).set(stats.getMaxThreads());
+
+ return node;
+ }
+
+ public static WorkerPoolStatisticsMetadata unwrapMetaValue(ModelNode node) {
+ if (node == null)
+ return null;
+
+ WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
+ stats.setActiveThreads(node.get(ACTIVE_THREADS).asInt());
+ stats.setHighestActiveThreads(node.get(HIGHEST_ACTIVE_THREADS).asInt());
+ stats.setTotalCompleted(node.get(TOTAL_COMPLETED).asLong());
+ stats.setTotalSubmitted(node.get(TOTAL_SUBMITTED).asLong());
+ stats.setQueueName(node.get(QUEUE_NAME).asString());
+ stats.setQueued(node.get(QUEUED).asInt());
+ stats.setHighestQueued(node.get(HIGHEST_QUEUED).asInt());
+ stats.setMaxThreads(node.get(MAX_THREADS).asInt());
+ return stats;
+ }
+
+ public static ModelNode describe(ModelNode node) {
+ node.get(TYPE).set(ModelType.OBJECT);
+ addAttribute(node, ACTIVE_THREADS, ModelType.INT, true);
+ addAttribute(node, HIGHEST_ACTIVE_THREADS, ModelType.INT, true);
+ addAttribute(node, TOTAL_COMPLETED, ModelType.LONG, true);
+ addAttribute(node, TOTAL_SUBMITTED, ModelType.LONG, true);
+ addAttribute(node, QUEUE_NAME, ModelType.STRING, true);
+ addAttribute(node, QUEUED, ModelType.INT, true);
+ addAttribute(node, HIGHEST_QUEUED, ModelType.INT, true);
+ addAttribute(node, MAX_THREADS, ModelType.INT, true);
+ return node;
+ }
+ }
+
+ private static final String CHILDREN = "children"; //$NON-NLS-1$
+ private static final String ATTRIBUTES = "attributes"; //$NON-NLS-1$
+ private static final String DOT_DESC = ".describe"; //$NON-NLS-1$
+ private static final String TYPE = "type"; //$NON-NLS-1$
+ private static final String MIN_OCCURS = "min-occurs"; //$NON-NLS-1$
+ private static final String REQUIRED = "required"; //$NON-NLS-1$
+ private static final String ALLOWED = "allowed"; //$NON-NLS-1$
+ static ModelNode addAttribute(ModelNode node, String name, ModelType dataType, boolean required) {
+ node.get(ATTRIBUTES, name, TYPE).set(dataType);
+ node.get(ATTRIBUTES, name, DESCRIPTION).set(AdminPlugin.Util.getString(name+DOT_DESC));
+ node.get(ATTRIBUTES, name, REQUIRED).set(required);
+ return node;
+ }
+}
+
+
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,321 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.bind.annotation.*;
+
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError.Severity;
+
+
+ at XmlAccessorType(XmlAccessType.NONE)
+ at XmlType(name = "", propOrder = {
+ "description",
+ "JAXBProperties",
+ "sources",
+ "errors"
+})
+public class ModelMetaData extends AdminObjectImpl implements Model {
+
+ private static final int DEFAULT_ERROR_HISTORY = 10;
+ private static final String SUPPORTS_MULTI_SOURCE_BINDINGS_KEY = "supports-multi-source-bindings"; //$NON-NLS-1$
+ private static final long serialVersionUID = 3714234763056162230L;
+
+ @XmlElement(name = "source")
+ protected ListOverMap<SourceMappingMetadata> sources = new ListOverMap<SourceMappingMetadata>(new KeyBuilder<SourceMappingMetadata>() {
+ private static final long serialVersionUID = 2273673984691112369L;
+
+ @Override
+ public String getKey(SourceMappingMetadata entry) {
+ return entry.getName();
+ }
+ });
+
+ @XmlAttribute(name = "type")
+ protected String modelType = Type.PHYSICAL.name();
+
+ @XmlElement(name = "description")
+ protected String description;
+
+ @XmlAttribute(name = "path")
+ protected String path;
+
+ @XmlAttribute(name = "visible")
+ protected Boolean visible = true;
+
+ @XmlElement(name = "validation-error")
+ protected List<ValidationError> errors;
+
+ @XmlAttribute(name = "name", required = true)
+ public String getName() {
+ return super.getName();
+ }
+
+ // This is needed by JAXB
+ public void setName(String name) {
+ super.setName(name);
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public boolean isSource() {
+ return getModelType() == Model.Type.PHYSICAL;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return this.visible;
+ }
+
+ @Override
+ public Type getModelType() {
+ try {
+ return Type.valueOf(modelType.toUpperCase());
+ } catch(IllegalArgumentException e) {
+ return Type.OTHER;
+ }
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public boolean isSupportsMultiSourceBindings() {
+ String supports = getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY);
+ return Boolean.parseBoolean(supports);
+ }
+
+ @Override
+ @XmlElement(name = "property", type = PropertyMetadata.class)
+ public List<PropertyMetadata> getJAXBProperties(){
+ return super.getJAXBProperties();
+ }
+
+ public void setSupportsMultiSourceBindings(boolean supports) {
+ addProperty(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY, Boolean.toString(supports));
+ }
+
+ public void setModelType(Model.Type modelType) {
+ this.modelType = modelType.name();
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public String toString() {
+ return getName() + this.sources;
+ }
+
+ public void setVisible(Boolean value) {
+ this.visible = value;
+ }
+
+ public List<SourceMappingMetadata> getSourceMappings(){
+ return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
+ }
+
+ public void setSourceMappings(List<SourceMappingMetadata> sources){
+ for (SourceMappingMetadata source: sources) {
+ addSourceMapping(source.getName(), source.getTranslatorName(), source.getConnectionJndiName());
+ }
+ }
+
+ @Override
+ public List<String> getSourceNames() {
+ return new ArrayList<String>(this.sources.getMap().keySet());
+ }
+
+ @Override
+ public String getSourceConnectionJndiName(String sourceName) {
+ SourceMappingMetadata s = this.sources.getMap().get(sourceName);
+ if (s == null) {
+ return null;
+ }
+ return s.getConnectionJndiName();
+ }
+
+ @Override
+ public String getSourceTranslatorName(String sourceName) {
+ SourceMappingMetadata s = this.sources.getMap().get(sourceName);
+ if (s == null) {
+ return null;
+ }
+ return s.getTranslatorName();
+ }
+
+ public void addSourceMapping(String name, String translatorName, String connJndiName) {
+ this.sources.getMap().put(name, new SourceMappingMetadata(name, translatorName, connJndiName));
+ }
+
+ public void addSourceMapping(SourceMappingMetadata source) {
+ this.sources.getMap().put(source.getName(), new SourceMappingMetadata(source.getName(), source.getTranslatorName(), source.getConnectionJndiName()));
+ }
+
+ public List<ValidationError> getErrors(){
+ return getValidationErrors(Severity.ERROR);
+ }
+
+ public void setErrors(List<ValidationError> errors){
+ this.errors = errors;
+ }
+
+ public synchronized List<ValidationError> getValidationErrors(ValidationError.Severity severity){
+ if (this.errors == null) {
+ return Collections.emptyList();
+ }
+ List<ValidationError> list = new ArrayList<ValidationError>();
+ for (ValidationError ve: this.errors) {
+ if (Severity.valueOf(ve.severity) == severity) {
+ list.add(ve);
+ }
+ }
+ return list;
+ }
+
+ public synchronized ValidationError addError(String severity, String message) {
+ if (this.errors == null) {
+ this.errors = new LinkedList<ValidationError>();
+ }
+ ValidationError ve = new ValidationError(severity, message);
+ this.errors.add(ve);
+ if (this.errors.size() > DEFAULT_ERROR_HISTORY) {
+ this.errors.remove(0);
+ }
+ return ve;
+ }
+
+ public synchronized ValidationError addError(ValidationError ve) {
+ if (this.errors == null) {
+ this.errors = new LinkedList<ValidationError>();
+ }
+ this.errors.add(ve);
+ if (this.errors.size() > DEFAULT_ERROR_HISTORY) {
+ this.errors.remove(0);
+ }
+ return ve;
+ }
+
+
+ public synchronized boolean removeError(ValidationError remove) {
+ if (this.errors == null) {
+ return false;
+ }
+ return this.errors.remove(remove);
+ }
+
+ public synchronized void clearErrors() {
+ this.errors.clear();
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = {
+ "value"
+ })
+ public static class ValidationError implements Serializable{
+ private static final long serialVersionUID = 2044197069467559527L;
+
+ public enum Severity {ERROR, WARNING};
+
+ @XmlValue
+ protected String value;
+
+ @XmlAttribute(name = "severity", required = true)
+ protected String severity;
+
+ @XmlAttribute(name = "path")
+ protected String path;
+
+ public ValidationError() {};
+
+ public ValidationError(String severity, String msg) {
+ this.severity = severity;
+ this.value = msg;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getSeverity() {
+ return severity;
+ }
+
+ public void setSeverity(String severity) {
+ this.severity = severity;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ValidationError other = (ValidationError) obj;
+ if (severity == null) {
+ if (other.severity != null)
+ return false;
+ } else if (!severity.equals(other.severity))
+ return false;
+ if (value == null) {
+ if (other.value != null)
+ return false;
+ } else if (!value.equals(other.value))
+ return false;
+ return true;
+ }
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+
+public class ModelNodeConstants {
+ public static final String TYPE = "type";//$NON-NLS-1$
+ public static final String ATTRIBUTES = "attributes"; //$NON-NLS-1$
+ public static final String DESCRIPTION = "description"; //$NON-NLS-1$
+
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+
+public class PermissionMap extends ListOverMap<PermissionMetaData> {
+
+ private static final long serialVersionUID = -1170556665834875267L;
+
+ public PermissionMap(KeyBuilder<PermissionMetaData> builder) {
+ super(builder);
+ }
+
+ @Override
+ public void add(int index, PermissionMetaData element) {
+ PermissionMetaData previous = this.map.get(builder.getKey(element));
+ if (previous != null) {
+ if (element.allowCreate != null) {
+ previous.setAllowCreate(element.allowCreate);
+ }
+ if (element.allowRead != null) {
+ previous.setAllowRead(element.allowRead);
+ }
+ if (element.allowUpdate != null) {
+ previous.setAllowUpdate(element.allowUpdate);
+ }
+ if (element.allowDelete != null) {
+ previous.setAllowDelete(element.allowDelete);
+ }
+ }
+ else {
+ super.add(index, element);
+ }
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.teiid.adminapi.PropertyDefinition;
+
+
+
+public class PropertyDefinitionMetadata extends AdminObjectImpl implements PropertyDefinition {
+ private static final long serialVersionUID = 6612838530524627205L;
+ private Collection allowedValues = new ArrayList();
+ private Object defaultValue = null;
+ private String description = null;
+ private String displayName = null;
+ private String propertyTypeClassName = String.class.getName();
+ private RestartType requiresRestart = RestartType.NONE;
+ private boolean advanced = false;
+ private boolean masked = false;
+ private boolean modifiable = true;
+ private boolean required = false;
+
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append("Display Name:").append(getDisplayName()); //$NON-NLS-1$
+ result.append(" Description:").append(getDescription()); //$NON-NLS-1$
+ result.append(" Property Type Classname:").append(getPropertyTypeClassName()); //$NON-NLS-1$
+ result.append(" Default Value:").append(getDefaultValue()); //$NON-NLS-1$
+ result.append(" Constrained To Allow Values:").append(isConstrainedToAllowedValues()); //$NON-NLS-1$
+ result.append(" Allowed Values:").append(getAllowedValues()); //$NON-NLS-1$
+ result.append(" Required:").append(isRequired()); //$NON-NLS-1$
+ result.append(" Expert:").append(isAdvanced()); //$NON-NLS-1$
+ result.append(" Masked:").append(isMasked()); //$NON-NLS-1$
+ result.append(" Modifiable:").append(isModifiable()); //$NON-NLS-1$
+ result.append(" RequiresRestart:").append(getRequiresRestart()); //$NON-NLS-1$
+ return result.toString();
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#getAllowedValues()
+ */
+ public Collection getAllowedValues() {
+ return allowedValues;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#getDefaultValue()
+ */
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#getDescription()
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#getDisplayName()
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#getPropertyTypeClassName()
+ */
+ public String getPropertyTypeClassName() {
+ return propertyTypeClassName;
+ }
+
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#getRequiresRestart()
+ */
+ public RestartType getRequiresRestart() {
+ return requiresRestart;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#isExpert()
+ * @since 4.3
+ */
+ public boolean isAdvanced() {
+ return advanced;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#isMasked()
+ */
+ public boolean isMasked() {
+ return masked;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#isModifiable()
+ */
+ public boolean isModifiable() {
+ return modifiable;
+ }
+
+ /**
+ * @see org.teiid.adminapi.PropertyDefinition#isRequired()
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * @param allowedValues The allowedValues to set.
+ */
+ public void setAllowedValues(Collection allowedValues) {
+ this.allowedValues = allowedValues;
+ }
+
+ /**
+ * @param defaultValue The defaultValue to set.
+ */
+ public void setDefaultValue(Serializable defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @param description The description to set.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
+ /**
+ * @param displayName The displayName to set.
+ */
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+
+ /**
+ * @param expert The value of expert to set.
+ */
+ public void setAdvanced(boolean expert) {
+ this.advanced = expert;
+ }
+
+ /**
+ * @param masked The value of masked to set.
+ */
+ public void setMasked(boolean masked) {
+ this.masked = masked;
+ }
+ /**
+ * @param modifiable The value of modifiable to set.
+ */
+ public void setModifiable(boolean modifiable) {
+ this.modifiable = modifiable;
+ }
+
+ /**
+ * @param propertyTypeClassName The propertyTypeName to set.
+ */
+ public void setPropertyTypeClassName(String propertyTypeClassName) {
+ this.propertyTypeClassName = propertyTypeClassName;
+ }
+
+
+ /**
+ * @param required The value of required to set.
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ /**
+ * @param requiresRestart The value of requiresRestart to set.
+ */
+ public void setRequiresRestart(RestartType requiresRestart) {
+ this.requiresRestart = requiresRestart;
+ }
+
+ @Override
+ public boolean isConstrainedToAllowedValues() {
+ return allowedValues != null && !allowedValues.isEmpty();
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <pre>
+ * <complexType name="property">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.NONE)
+ at XmlType(name = "property")
+public class PropertyMetadata implements Serializable{
+ private static final long serialVersionUID = -5040224539939758816L;
+
+ @XmlAttribute(name = "name", required = true)
+ protected String name;
+ @XmlAttribute(name = "value", required = true)
+ protected String value;
+
+ public PropertyMetadata() {
+ }
+
+ public PropertyMetadata(String key, String value) {
+ this.name = key;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ return this.name+"="+this.value; //$NON-NLS-1$
+ }
+}
\ No newline at end of file
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.util.Date;
+
+import org.teiid.adminapi.Request;
+import org.teiid.core.util.HashCodeUtil;
+
+
+
+public class RequestMetadata extends AdminObjectImpl implements Request {
+
+ private static final long serialVersionUID = -2779106368517784259L;
+
+ private long executionId;
+ private String sessionId;
+ private String command;
+ private long startTime;
+ private boolean sourceRequest;
+ private Integer nodeID;
+ private String transactionId;
+ private ProcessingState processingState = ProcessingState.PROCESSING;
+ private ThreadState threadState = ThreadState.RUNNING;
+
+ @Override
+ public long getExecutionId() {
+ return executionId;
+ }
+
+ public void setExecutionId(long id) {
+ this.executionId = id;
+ }
+
+ @Override
+ public ProcessingState getState() {
+ return processingState;
+ }
+
+ public void setState(ProcessingState state) {
+ this.processingState = state;
+ }
+
+ @Override
+ public ThreadState getThreadState() {
+ return threadState;
+ }
+
+ public void setThreadState(ThreadState threadState) {
+ this.threadState = threadState;
+ }
+
+ @Override
+ public String getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(String session) {
+ this.sessionId = session;
+ }
+
+ @Override
+ public long getStartTime() {
+ return this.startTime;
+ }
+
+ public void setStartTime(long time) {
+ this.startTime = time;
+ }
+
+ @Override
+ public String getCommand() {
+ return this.command;
+ }
+
+ public void setCommand(String cmd) {
+ this.command = cmd;
+ }
+
+ @Override
+ public boolean sourceRequest() {
+ return sourceRequest;
+ }
+
+ public void setSourceRequest(boolean sourceRequest) {
+ this.sourceRequest = sourceRequest;
+ }
+
+ @Override
+ public Integer getNodeId() {
+ return this.nodeID;
+ }
+
+ public void setNodeId(Integer nodeID) {
+ this.nodeID = nodeID;
+ }
+
+ @Override
+ public String getTransactionId() {
+ return this.transactionId;
+ }
+
+ public void setTransactionId(String id) {
+ this.transactionId = id;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof RequestMetadata)) {
+ return false;
+ }
+ RequestMetadata value = (RequestMetadata)obj;
+ if (!sourceRequest()) {
+ return sessionId == value.sessionId && executionId == value.executionId;
+ }
+ return sessionId == value.sessionId && executionId == value.executionId && nodeID.equals(value.nodeID);
+ }
+
+ public int hashCode() {
+ return HashCodeUtil.hashCode((int)executionId, sessionId);
+ }
+
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("Request: sessionid=").append(sessionId);
+ str.append("; executionId=").append(executionId);
+ if (nodeID != null) {
+ str.append("; nodeId=").append(nodeID);
+ }
+ if (transactionId != null) {
+ str.append("; transactionId=").append(transactionId);
+ }
+ str.append("; sourceRequest=").append(sourceRequest);
+ str.append("; processingTime=").append(new Date(startTime));
+ str.append("; command=").append(command);
+
+ return str.toString();
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,217 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.util.Date;
+
+import javax.security.auth.Subject;
+
+import org.teiid.adminapi.Session;
+import org.teiid.client.security.SessionToken;
+
+
+
+/**
+ * Add and delete properties also in the Mapper class for correct wrapping for profile service.
+ *
+ */
+/* TODO: it would probably be good to let ipAddress denote the connecting address
+ and add clientIpAdress as the client reported value */
+public class SessionMetadata extends AdminObjectImpl implements Session {
+
+ private static final long serialVersionUID = 918638989081830034L;
+ private String applicationName;
+ private long lastPingTime = System.currentTimeMillis();
+ private long createdTime;
+ private String ipAddress;
+ private String clientHostName;
+ private String clientHardwareAddress;
+ private String userName;
+ private String vdbName;
+ private int vdbVersion;
+ private String sessionId;
+ private String securityDomain;
+
+ //server session state
+ private transient VDBMetaData vdb;
+ private transient SessionToken sessionToken;
+ private transient Subject subject;
+ private transient Object securityContext;
+ private transient boolean embedded;
+
+ @Override
+ public String getApplicationName() {
+ return this.applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+ @Override
+ public long getCreatedTime() {
+ return this.createdTime;
+ }
+
+ public void setCreatedTime(long createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Override
+ public String getClientHostName() {
+ return this.clientHostName;
+ }
+
+ public void setClientHostName(String clientHostname) {
+ this.clientHostName = clientHostname;
+ }
+
+ @Override
+ public String getIPAddress() {
+ return this.ipAddress;
+ }
+
+ public void setIPAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ @Override
+ public long getLastPingTime() {
+ return this.lastPingTime;
+ }
+
+ public void setLastPingTime(long lastPingTime) {
+ this.lastPingTime = lastPingTime;
+ }
+
+ @Override
+ public String getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ @Override
+ public String getUserName() {
+ return this.userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Override
+ public String getVDBName() {
+ return this.vdbName;
+ }
+
+ public void setVDBName(String vdbName) {
+ this.vdbName = vdbName;
+ }
+
+ @Override
+ public int getVDBVersion() {
+ return this.vdbVersion;
+ }
+
+ public void setVDBVersion(int vdbVersion) {
+ this.vdbVersion = vdbVersion;
+ }
+
+ @Override
+ public String getSecurityDomain() {
+ return this.securityDomain;
+ }
+
+ public void setSecurityDomain(String domain) {
+ this.securityDomain = domain;
+ }
+
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("session: sessionid=").append(sessionId);
+ str.append("; userName=").append(userName);
+ str.append("; vdbName=").append(vdbName);
+ str.append("; vdbVersion=").append(vdbVersion);
+ str.append("; createdTime=").append(new Date(createdTime));
+ str.append("; applicationName=").append(applicationName);
+ str.append("; clientHostName=").append(clientHostName);
+ str.append("; clientHardwareAddress=").append(clientHardwareAddress);
+ str.append("; IPAddress=").append(ipAddress);
+ str.append("; securityDomain=").append(securityDomain);
+ str.append("; lastPingTime=").append(new Date(lastPingTime));
+ return str.toString();
+ }
+
+ public VDBMetaData getVdb() {
+ return vdb;
+ }
+
+ public void setVdb(VDBMetaData vdb) {
+ this.vdb = vdb;
+ }
+
+ public SessionToken getSessionToken() {
+ return sessionToken;
+ }
+
+ public void setSessionToken(SessionToken sessionToken) {
+ this.sessionToken = sessionToken;
+ }
+
+ public void setSubject(Subject subject) {
+ this.subject = subject;
+ }
+
+ public Object getSecurityContext() {
+ return securityContext;
+ }
+
+ public void setSecurityContext(Object securityContext) {
+ this.securityContext = securityContext;
+ }
+
+ public Subject getSubject() {
+ return this.subject;
+ }
+
+ public void setEmbedded(boolean embedded) {
+ this.embedded = embedded;
+ }
+
+ public boolean isEmbedded() {
+ return embedded;
+ }
+
+ @Override
+ public String getClientHardwareAddress() {
+ return this.clientHardwareAddress;
+ }
+
+ public void setClientHardwareAddress(String clientHardwareAddress) {
+ this.clientHardwareAddress = clientHardwareAddress;
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+ at XmlAccessorType(XmlAccessType.NONE)
+ at XmlType(name = "")
+public class SourceMappingMetadata implements Serializable {
+ private static final long serialVersionUID = -4417878417697685794L;
+
+ @XmlAttribute(name = "name", required = true)
+ private String name;
+
+ @XmlAttribute(name = "connection-jndi-name")
+ private String jndiName;
+
+ @XmlAttribute(name = "translator-name",required = true)
+ private String translatorName;
+
+ public SourceMappingMetadata() {}
+
+ public SourceMappingMetadata(String name, String translatorName, String connJndiName) {
+ this.name = name;
+ this.translatorName = translatorName;
+ this.jndiName = connJndiName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getConnectionJndiName() {
+ // this default could be controlled if needed.
+ if (this.jndiName == null) {
+ return "java:"+name; //$NON-NLS-1$
+ }
+ return jndiName;
+ }
+
+ public void setConnectionJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ public String getTranslatorName() {
+ return translatorName;
+ }
+
+ public void setTranslatorName(String translatorName) {
+ this.translatorName = translatorName;
+ }
+
+ public String toString() {
+ return getName()+"/"+getTranslatorName()+"/"+getConnectionJndiName(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
\ No newline at end of file
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.util.Date;
+
+import org.teiid.adminapi.Transaction;
+
+
+public class TransactionMetadata extends AdminObjectImpl implements Transaction {
+
+ private static final long serialVersionUID = -8588785315218789068L;
+ private String associatedSession;
+ private String scope;
+ private String id;
+ private long createdTime;
+
+ @Override
+ public String getAssociatedSession() {
+ return associatedSession;
+ }
+
+ public void setAssociatedSession(String associatedSession) {
+ this.associatedSession = associatedSession;
+ }
+
+ @Override
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public long getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(long time) {
+ this.createdTime = time;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append("Associated Session:").append(associatedSession); //$NON-NLS-1$
+ result.append("Scope:").append(scope); //$NON-NLS-1$
+ result.append("Id:").append(id); //$NON-NLS-1$
+ result.append("CreatedTime:").append(new Date(createdTime)); //$NON-NLS-1$
+ return result.toString();
+ }
+
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,343 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.net.URL;
+import java.util.*;
+
+import javax.xml.bind.annotation.*;
+
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
+import org.teiid.core.util.StringUtil;
+
+
+ at XmlAccessorType(XmlAccessType.NONE)
+ at XmlType(name = "", propOrder = {
+ "description",
+ "JAXBProperties",
+ "models",
+ "translators",
+ "dataPolicies"
+})
+ at XmlRootElement(name = "vdb")
+public class VDBMetaData extends AdminObjectImpl implements VDB {
+
+ private static final String VERSION_DELIM = "."; //$NON-NLS-1$
+
+ private static final long serialVersionUID = -4723595252013356436L;
+
+ /**
+ * This simulating a list over a map. JAXB requires a list and performance recommends
+ * map and we would like to keep one variable to represent both.
+ */
+ @XmlElement(name = "model", required = true, type = ModelMetaData.class)
+ protected ListOverMap<ModelMetaData> models = new ListOverMap<ModelMetaData>(new KeyBuilder<ModelMetaData>() {
+ private static final long serialVersionUID = 846247100420118961L;
+
+ @Override
+ public String getKey(ModelMetaData entry) {
+ return entry.getName();
+ }
+ });
+
+ @XmlElement(name = "translator", required = true, type = VDBTranslatorMetaData.class)
+ protected ListOverMap<VDBTranslatorMetaData> translators = new ListOverMap<VDBTranslatorMetaData>(new KeyBuilder<VDBTranslatorMetaData>() {
+ private static final long serialVersionUID = 3890502172003653563L;
+
+ @Override
+ public String getKey(VDBTranslatorMetaData entry) {
+ return entry.getName();
+ }
+ });
+
+ @XmlElement(name = "data-role", required = true, type = DataPolicyMetadata.class)
+ protected ListOverMap<DataPolicyMetadata> dataPolicies = new ListOverMap<DataPolicyMetadata>(new KeyBuilder<DataPolicyMetadata>() {
+ private static final long serialVersionUID = 4954591545242715254L;
+
+ @Override
+ public String getKey(DataPolicyMetadata entry) {
+ return entry.getName();
+ }
+ });
+
+ @XmlAttribute(name = "version", required = true)
+ private int version = 1;
+
+ @XmlElement(name = "description")
+ protected String description;
+
+ private String fileUrl = null;
+ private boolean dynamic = false;
+ private VDB.Status status = VDB.Status.INACTIVE;
+ private ConnectionType connectionType = VDB.ConnectionType.BY_VERSION;
+ private boolean removed;
+
+ @XmlAttribute(name = "name", required = true)
+ public String getName() {
+ return super.getName();
+ }
+
+ public String getFullName() {
+ return getName() + VERSION_DELIM + getVersion();
+ }
+
+ // This needed by JAXB marshaling
+ public void setName(String name) {
+ super.setName(name);
+ }
+
+ public boolean isRemoved() {
+ return removed;
+ }
+
+ public void setRemoved(boolean removed) {
+ this.removed = removed;
+ }
+
+ @Override
+ public ConnectionType getConnectionType() {
+ return this.connectionType;
+ }
+
+ public void setConnectionType(ConnectionType allowConnections) {
+ this.connectionType = allowConnections;
+ }
+
+ public void setConnectionType(String allowConnections) {
+ this.connectionType = ConnectionType.valueOf(allowConnections);
+ }
+
+ @Override
+ public Status getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(Status s) {
+ this.status = s;
+ }
+
+ public void setStatus(String s) {
+ this.status = Status.valueOf(s);
+ }
+
+
+ @Override
+ public int getVersion() {
+ return this.version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ @Override
+ public String getUrl() {
+ return this.fileUrl;
+ }
+
+ public void setUrl(String url) {
+ this.fileUrl = url;
+ }
+
+ public void setUrl(URL url) {
+ this.setUrl(url.toExternalForm());
+ String path = url.getPath();
+ if (path.endsWith("/")) { //$NON-NLS-1$
+ path = path.substring(0, path.length() - 1);
+ }
+ String fileName = StringUtil.getLastToken(path, "/"); //$NON-NLS-1$
+ String[] parts = fileName.split("\\."); //$NON-NLS-1$
+ if (parts[0].equalsIgnoreCase(getName()) && parts.length >= 3) {
+ try {
+ int fileVersion = Integer.parseInt(parts[parts.length - 2]);
+ this.setVersion(fileVersion);
+ } catch (NumberFormatException e) {
+
+ }
+ }
+ }
+
+ @Override
+ public List<Model> getModels(){
+ return new ArrayList<Model>(this.models.getMap().values());
+ }
+
+ public Map<String, ModelMetaData> getModelMetaDatas() {
+ return this.models.getMap();
+ }
+
+ /**
+ * This method required to make the JNDI assignment on the model work; if not persistent Management framework
+ * treating "models" as ReadOnly property. The actual assignment is done in the VDBMetaDataClassInstancefactory
+ * @param models
+ */
+ public void setModels(List<Model> models) {
+ for (Model obj : models) {
+ ModelMetaData model = (ModelMetaData) obj;
+ addModel(model);
+ }
+ }
+
+ public void addModel(ModelMetaData m) {
+ this.models.getMap().put(m.getName(), m);
+ }
+
+ @Override
+ public List<Translator> getOverrideTranslators() {
+ return new ArrayList<Translator>(this.translators.getMap().values());
+ }
+
+ public void setOverrideTranslators(List<Translator> translators) {
+ for (Translator t: translators) {
+ this.translators.getMap().put(t.getName(), (VDBTranslatorMetaData)t);
+ }
+ }
+
+ public void addOverideTranslator(VDBTranslatorMetaData t) {
+ this.translators.getMap().put(t.getName(), t);
+ }
+
+ @Override
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ @Override
+ public List<String> getValidityErrors(){
+ List<String> allErrors = new ArrayList<String>();
+ for (ModelMetaData model:this.models.getMap().values()) {
+ List<ValidationError> errors = model.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ValidationError m:errors) {
+ if (ValidationError.Severity.valueOf(m.getSeverity()).equals(ValidationError.Severity.ERROR)) {
+ allErrors.add(m.getValue());
+ }
+ }
+ }
+ }
+ return allErrors;
+ }
+
+ @Override
+ public boolean isValid() {
+ if (!getValidityErrors().isEmpty()) {
+ return false;
+ }
+
+ if (getModels().isEmpty()) {
+ return false;
+ }
+ for(ModelMetaData m: this.models.getMap().values()) {
+ if (m.isSource()) {
+ List<String> resourceNames = m.getSourceNames();
+ if (resourceNames.isEmpty()) {
+ return false;
+ }
+ for (String sourceName:resourceNames) {
+ if (m.getSourceConnectionJndiName(sourceName) == null) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ public String toString() {
+ return getName()+VERSION_DELIM+getVersion()+ models.getMap().values();
+ }
+
+ public boolean isVisible(String modelName) {
+ ModelMetaData model = getModel(modelName);
+ return model == null || model.isVisible();
+ }
+
+ public ModelMetaData getModel(String modelName) {
+ return this.models.getMap().get(modelName);
+ }
+
+ public Set<String> getMultiSourceModelNames(){
+ Set<String> list = new HashSet<String>();
+ for(ModelMetaData m: models.getMap().values()) {
+ if (m.isSupportsMultiSourceBindings()) {
+ list.add(m.getName());
+ }
+ }
+ return list;
+ }
+
+ // This one manages the JAXB binding
+ @Override
+ @XmlElement(name = "property", type = PropertyMetadata.class)
+ public List<PropertyMetadata> getJAXBProperties(){
+ return super.getJAXBProperties();
+ }
+
+ public boolean isDynamic() {
+ return dynamic;
+ }
+
+ public void setDynamic(boolean dynamic) {
+ this.dynamic = dynamic;
+ }
+
+ @Override
+ public List<DataPolicy> getDataPolicies(){
+ return new ArrayList<DataPolicy>(this.dataPolicies.getMap().values());
+ }
+
+ /**
+ * This method is required by the Management framework to write the mappings to the persistent form. The actual assignment is done
+ * in the VDBMetaDataClassInstancefactory
+ * @param policies
+ */
+ public void setDataPolicies(List<DataPolicy> policies){
+ this.dataPolicies.getMap().clear();
+ for (DataPolicy policy:policies) {
+ this.dataPolicies.getMap().put(policy.getName(), (DataPolicyMetadata)policy);
+ }
+ }
+
+ public void addDataPolicy(DataPolicyMetadata policy){
+ this.dataPolicies.getMap().put(policy.getName(), policy);
+ }
+
+ public DataPolicyMetadata getDataPolicy(String policyName) {
+ return this.dataPolicies.getMap().get(policyName);
+ }
+
+ public VDBTranslatorMetaData getTranslator(String name) {
+ return this.translators.getMap().get(name);
+ }
+
+ public boolean isPreview() {
+ return Boolean.valueOf(getPropertyValue("preview")); //$NON-NLS-1$
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,310 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+ at SuppressWarnings("nls")
+public class VDBMetadataParser {
+
+ public static VDBMetaData unmarshell(InputStream content) throws XMLStreamException {
+ XMLInputFactory inputFactory=XMLInputFactory.newInstance();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(content);
+
+ // elements
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case VDB:
+ VDBMetaData vdb = new VDBMetaData();
+ Properties props = getAttributes(reader);
+ vdb.setName(props.getProperty(Element.NAME.getLocalName()));
+ vdb.setVersion(Integer.parseInt(props.getProperty(Element.VERSION.getLocalName())));
+ parseVDB(reader, vdb);
+ return vdb;
+ default:
+ throw new XMLStreamException("Unexpected element '" + reader.getName() + "' encountered", reader.getLocation());
+ }
+ }
+ return null;
+ }
+
+ private static void parseVDB(XMLStreamReader reader, VDBMetaData vdb) throws XMLStreamException {
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case DESCRIPTION:
+ vdb.setDescription(reader.getElementText());
+ break;
+ case PROPERTY:
+ parseProperty(reader, vdb);
+ break;
+ case MODEL:
+ ModelMetaData model = new ModelMetaData();
+ parseModel(reader, model);
+ vdb.addModel(model);
+ break;
+ case TRANSLATOR:
+ VDBTranslatorMetaData translator = new VDBTranslatorMetaData();
+ parseTranslator(reader, translator);
+ vdb.addOverideTranslator(translator);
+ break;
+ case DATA_ROLE:
+ DataPolicyMetadata policy = new DataPolicyMetadata();
+ parseDataRole(reader, policy);
+ vdb.addDataPolicy(policy);
+ break;
+ case ENTRY:
+ // this is designer specific.
+ break;
+ default:
+ throw new XMLStreamException("Unexpected element '" + reader.getName() + "' encountered", reader.getLocation());
+ }
+ }
+ }
+
+ private static void parseProperty(XMLStreamReader reader, AdminObjectImpl anObj)
+ throws XMLStreamException {
+ if (reader.getAttributeCount() > 0) {
+ String key = null;
+ String value = null;
+ for(int i=0; i<reader.getAttributeCount(); i++) {
+ String attrName = reader.getAttributeLocalName(i);
+ String attrValue = reader.getAttributeValue(i);
+ if (attrName.equals(Element.NAME.getLocalName())) {
+ key = attrValue;
+ }
+ if (attrName.equals(Element.VALUE.getLocalName())) {
+ value = attrValue;
+ }
+ }
+ anObj.addProperty(key, value);
+ }
+ while(reader.nextTag() != XMLStreamConstants.END_ELEMENT);
+ }
+
+ private static void parseDataRole(XMLStreamReader reader, DataPolicyMetadata policy) throws XMLStreamException {
+ Properties props = getAttributes(reader);
+ policy.setName(props.getProperty(Element.NAME.getLocalName()));
+ policy.setAnyAuthenticated(Boolean.parseBoolean(props.getProperty(Element.DATA_ROLE_ANY_ATHENTICATED_ATTR.getLocalName())));
+ policy.setAllowCreateTemporaryTables(Boolean.parseBoolean(props.getProperty(Element.DATA_ROLE_ALLOW_TEMP_TABLES_ATTR.getLocalName())));
+
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case DESCRIPTION:
+ policy.setDescription(reader.getElementText());
+ break;
+ case PERMISSION:
+ PermissionMetaData permission = new PermissionMetaData();
+ parsePermission(reader, permission);
+ policy.addPermission(permission);
+ break;
+ case MAPPED_ROLE_NAME:
+ policy.addMappedRoleName(reader.getElementText());
+ break;
+ default:
+ throw new XMLStreamException("Unexpected element '" + reader.getName() + "' encountered", reader.getLocation());
+ }
+ }
+ }
+
+ private static void parsePermission(XMLStreamReader reader, PermissionMetaData permission) throws XMLStreamException {
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case RESOURCE_NAME:
+ permission.setResourceName(reader.getElementText());
+ break;
+ case ALLOW_ALTER:
+ permission.setAllowAlter(Boolean.parseBoolean(reader.getElementText()));
+ break;
+ case ALLOW_CREATE:
+ permission.setAllowCreate(Boolean.parseBoolean(reader.getElementText()));
+ break;
+ case ALLOW_DELETE:
+ permission.setAllowDelete(Boolean.parseBoolean(reader.getElementText()));
+ break;
+ case ALLOW_EXECUTE:
+ permission.setAllowExecute(Boolean.parseBoolean(reader.getElementText()));
+ break;
+ case ALLOW_READ:
+ permission.setAllowRead(Boolean.parseBoolean(reader.getElementText()));
+ break;
+ case ALLOW_UPADTE:
+ permission.setAllowUpdate(Boolean.parseBoolean(reader.getElementText()));
+ break;
+
+ default:
+ throw new XMLStreamException("Unexpected element '" + reader.getName() + "' encountered", reader.getLocation());
+ }
+ }
+ }
+
+ private static void parseTranslator(XMLStreamReader reader, VDBTranslatorMetaData translator) throws XMLStreamException {
+ Properties props = getAttributes(reader);
+ translator.setName(props.getProperty(Element.NAME.getLocalName()));
+ translator.setType(props.getProperty(Element.TYPE.getLocalName()));
+ translator.setDescription(props.getProperty(Element.DESCRIPTION.getLocalName()));
+
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case PROPERTY:
+ parseProperty(reader, translator);
+ break;
+ default:
+ throw new XMLStreamException("Unexpected element '" + reader.getName() + "' encountered", reader.getLocation());
+ }
+ }
+ }
+
+ private static void parseModel(XMLStreamReader reader, ModelMetaData model) throws XMLStreamException {
+ Properties props = getAttributes(reader);
+ model.setName(props.getProperty(Element.NAME.getLocalName()));
+ model.setModelType(Model.Type.valueOf(props.getProperty(Element.TYPE.getLocalName(), "PHYSICAL")));
+ model.setVisible(Boolean.parseBoolean(props.getProperty(Element.VISIBLE.getLocalName(), "true")));
+ model.setPath(props.getProperty(Element.PATH.getLocalName()));
+
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case DESCRIPTION:
+ model.setDescription(reader.getElementText());
+ break;
+ case PROPERTY:
+ parseProperty(reader, model);
+ break;
+ case SOURCE:
+ Properties sourceProps = getAttributes(reader);
+ String name = sourceProps.getProperty(Element.NAME.getLocalName());
+ String translatorName = sourceProps.getProperty(Element.SOURCE_TRANSLATOR_NAME_ATTR.getLocalName());
+ String connectionName = sourceProps.getProperty(Element.SOURCE_CONNECTION_JNDI_NAME_ATTR.getLocalName());
+ model.addSourceMapping(name, translatorName, connectionName);
+ while(reader.nextTag() != XMLStreamConstants.END_ELEMENT);
+ break;
+ case VALIDATION_ERROR:
+ Properties validationProps = getAttributes(reader);
+ String msg = reader.getElementText();
+ String severity = validationProps.getProperty(Element.VALIDATION_SEVERITY_ATTR.getLocalName());
+ String path = validationProps.getProperty(Element.PATH.getLocalName());
+ ValidationError ve = new ValidationError(severity, msg);
+ ve.setPath(path);
+ model.addError(ve);
+ break;
+ default:
+ throw new XMLStreamException("Unexpected element '" + reader.getName() + "' encountered", reader.getLocation());
+ }
+ }
+ }
+
+
+ private static Properties getAttributes(XMLStreamReader reader) {
+ Properties props = new Properties();
+ if (reader.getAttributeCount() > 0) {
+ for(int i=0; i<reader.getAttributeCount(); i++) {
+ String attrName = reader.getAttributeLocalName(i);
+ String attrValue = reader.getAttributeValue(i);
+ props.setProperty(attrName, attrValue);
+ }
+ }
+ return props;
+ }
+
+ enum Element {
+ // must be first
+ UNKNOWN(null),
+ VDB("vdb"),
+ NAME("name"),
+ VERSION("version"),
+ DESCRIPTION("description"),
+ PROPERTY("property"),
+ VALUE("value"),
+ MODEL("model"),
+ TYPE("type"),
+ VISIBLE("visible"),
+ PATH("path"),
+ SOURCE("source"),
+ SOURCE_TRANSLATOR_NAME_ATTR("translator-name"),
+ SOURCE_CONNECTION_JNDI_NAME_ATTR("connection-jndi-name"),
+ VALIDATION_ERROR("validation-error"),
+ VALIDATION_SEVERITY_ATTR("severity"),
+ TRANSLATOR("translator"),
+ DATA_ROLE("data-role"),
+ DATA_ROLE_ANY_ATHENTICATED_ATTR("any-authenticated"),
+ DATA_ROLE_ALLOW_TEMP_TABLES_ATTR("allow-create-temporary-tables"),
+ PERMISSION("permission"),
+ RESOURCE_NAME("resource-name"),
+ ALLOW_CREATE("allow-create"),
+ ALLOW_READ("allow-read"),
+ ALLOW_UPADTE("allow-update"),
+ ALLOW_DELETE("allow-delete"),
+ ALLOW_EXECUTE("allow-execute"),
+ ALLOW_ALTER("allow-alyer"),
+ MAPPED_ROLE_NAME("mapped-role-name"),
+ ENTRY("entry");
+
+ private final String name;
+
+ Element(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName() {
+ return name;
+ }
+
+ private static final Map<String, Element> elements;
+
+ static {
+ final Map<String, Element> map = new HashMap<String, Element>();
+ for (Element element : values()) {
+ final String name = element.getLocalName();
+ if (name != null) map.put(name, element);
+ }
+ elements = map;
+ }
+
+ public static Element forName(String localName) {
+ final Element element = elements.get(localName);
+ return element == null ? UNKNOWN : element;
+ }
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
+import org.teiid.adminapi.Translator;
+
+
+ at XmlAccessorType(XmlAccessType.NONE)
+public class VDBTranslatorMetaData extends AdminObjectImpl implements Translator {
+ private static final long serialVersionUID = -3454161477587996138L;
+ private String type;
+ private Class<?> executionClass;
+ private String description;
+ private String moduleName;
+
+ @Override
+ public String getName() {
+ return super.getName();
+ }
+
+ @XmlAttribute(name = "name", required = true)
+ public void setName(String name) {
+ super.setName(name);
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @XmlAttribute(name = "type",required = true)
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ @XmlElement(name = "property", type = PropertyMetadata.class)
+ public List<PropertyMetadata> getJAXBProperties(){
+ return super.getJAXBProperties();
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ public Class<?> getExecutionFactoryClass() {
+ return this.executionClass;
+ }
+
+ public void setExecutionFactoryClass(Class<?> clazz) {
+ this.executionClass = clazz;
+ addProperty(EXECUTION_FACTORY_CLASS, clazz.getName());
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ @XmlAttribute(name = "description")
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ public String getModuleName() {
+ return this.moduleName;
+ }
+
+ public void setModuleName(String name) {
+ this.moduleName = name;
+ }
+}
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
===================================================================
--- branches/as7/admin/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java (rev 0)
+++ branches/as7/admin/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import org.teiid.adminapi.WorkerPoolStatistics;
+
+/**
+ * This class is a holder for all the statistics gathered about a worker pool.
+ */
+public class WorkerPoolStatisticsMetadata extends AdminObjectImpl implements WorkerPoolStatistics {
+
+ private static final long serialVersionUID = -4917902925523802295L;
+
+ // Current state
+ private int queued;
+ private int highestQueued;
+ private int maxThreads;
+ private int activeThreads;
+ private int highestActiveThreads;
+ private long totalSubmitted;
+ private long totalCompleted;
+
+ @Override
+ public int getActiveThreads() {
+ return activeThreads;
+ }
+
+ @Override
+ public int getHighestActiveThreads() {
+ return highestActiveThreads;
+ }
+
+ @Override
+ public long getTotalCompleted() {
+ return totalCompleted;
+ }
+
+ @Override
+ public long getTotalSubmitted() {
+ return totalSubmitted;
+ }
+
+ @Override
+ public String getQueueName() {
+ return getName();
+ }
+
+ @Override
+ public int getQueued() {
+ return queued;
+ }
+
+ @Override
+ public int getHighestQueued() {
+ return highestQueued;
+ }
+
+ @Override
+ public int getMaxThreads() {
+ return maxThreads;
+ }
+
+ public void setQueued(int queued) {
+ this.queued = queued;
+ }
+
+ public void setHighestQueued(int highestQueued) {
+ this.highestQueued = highestQueued;
+ }
+
+ public void setMaxThreads(int maxThreads) {
+ this.maxThreads = maxThreads;
+ }
+
+ public void setActiveThreads(int activeThreads) {
+ this.activeThreads = activeThreads;
+ }
+
+ public void setHighestActiveThreads(int highestActiveThreads) {
+ this.highestActiveThreads = highestActiveThreads;
+ }
+
+ public void setTotalSubmitted(long totalSubmitted) {
+ this.totalSubmitted = totalSubmitted;
+ }
+
+ public void setTotalCompleted(long totalCompleted) {
+ this.totalCompleted = totalCompleted;
+ }
+
+ public void setQueueName(String name) {
+ setName(name);
+ }
+
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+
+ str.append("WorkerPoolStats:"); //$NON-NLS-1$
+ str.append(" queue-name = " + getName()); //$NON-NLS-1$
+ str.append("; queued = " + queued); //$NON-NLS-1$
+ str.append("; highestQueued = " + highestQueued); //$NON-NLS-1$
+ str.append("; maxThreads = " + maxThreads); //$NON-NLS-1$
+ str.append("; activeThreads = " + activeThreads); //$NON-NLS-1$
+ str.append("; highestActiveThreads = " + highestActiveThreads); //$NON-NLS-1$
+ str.append("; totalSubmitted = " + totalSubmitted); //$NON-NLS-1$
+ str.append("; totalCompleted = " + totalCompleted); //$NON-NLS-1$
+ return str.toString();
+ }
+
+}
+
Property changes on: branches/as7/admin/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java (rev 0)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+import org.teiid.adminapi.DataPolicy.PermissionType;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import static junit.framework.Assert.*;
+
+public class TestDataPolicyMetaData {
+
+ @Test
+ public void testAllowed() {
+ DataPolicyMetadata policy = new DataPolicyMetadata();
+ policy.setName("readOnly"); //$NON-NLS-1$
+ policy.setDescription("Only has read only permissions"); //$NON-NLS-1$
+ policy.setMappedRoleNames(Arrays.asList("jack", "susan")); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ PermissionMetaData perm1 = new PermissionMetaData();
+ perm1.setResourceName("catalog.schema.Table1"); //$NON-NLS-1$
+ perm1.setAllowRead(true);
+
+ PermissionMetaData perm2 = new PermissionMetaData();
+ perm2.setResourceName("catalog.schema.Table2"); //$NON-NLS-1$
+ perm2.setAllowRead(false);
+
+ PermissionMetaData perm3 = new PermissionMetaData();
+ perm3.setResourceName("catalog.schema.Table3"); //$NON-NLS-1$
+ perm3.setAllowRead(true);
+
+ PermissionMetaData perm4 = new PermissionMetaData();
+ perm4.setResourceName("catalog.schema.Table4"); //$NON-NLS-1$
+ perm4.setAllowRead(true);
+
+ PermissionMetaData perm5 = new PermissionMetaData();
+ perm5.setResourceName("catalog.schema.Table5.column1"); //$NON-NLS-1$
+ perm5.setAllowRead(true);
+
+ policy.addPermission(perm1, perm2, perm3, perm4, perm5);
+
+
+ assertTrue(policy.allows("catalog.schema.Table1", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("catalog.schema.Table1", PermissionType.CREATE)); //$NON-NLS-1$
+
+ assertFalse(policy.allows("catalog.schema", PermissionType.READ)); //$NON-NLS-1$
+
+ assertFalse(policy.allows("catalog.schema.Table2.column", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("catalog.schema.Table2", PermissionType.READ)); //$NON-NLS-1$
+
+ assertTrue(policy.allows("catalog.schema.Table3.column", PermissionType.READ)); //$NON-NLS-1$
+ assertTrue(policy.allows("catalog.schema.Table3", PermissionType.READ)); //$NON-NLS-1$
+
+ assertTrue(policy.allows("catalog.schema.Table4.column", PermissionType.READ)); //$NON-NLS-1$
+ assertTrue(policy.allows("catalog.schema.Table4", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("catalog.schema.Table4", PermissionType.DELETE)); //$NON-NLS-1$
+
+ assertTrue(policy.allows("catalog.schema.Table5.column1", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("catalog.schema.Table5.column2", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("catalog.schema.Table5", PermissionType.READ)); //$NON-NLS-1$
+ }
+}
Property changes on: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java (rev 0)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.teiid.adminapi.Model;
+
+ at SuppressWarnings("nls")
+public class TestModelMetaData {
+
+ @Test
+ public void testModelType() {
+
+ ModelMetaData model = new ModelMetaData();
+ model.modelType = "physical";
+
+ assertTrue(model.getModelType() == Model.Type.PHYSICAL);
+ assertTrue(model.isSource());
+
+ model.modelType = "VIRTUAL";
+ assertTrue(model.getModelType() == Model.Type.VIRTUAL);
+
+ model.modelType = "TYPE";
+ assertTrue(model.getModelType() == Model.Type.OTHER);
+ assertTrue(!model.isSource());
+ }
+
+ @Test
+ public void testSupportMultiSource() {
+ ModelMetaData model = new ModelMetaData();
+ assertFalse(model.isSupportsMultiSourceBindings());
+ model.setSupportsMultiSourceBindings(true);
+
+ assertTrue(model.isSupportsMultiSourceBindings());
+
+ assertTrue(!model.getProperties().isEmpty());
+ }
+
+ public void testErrors() {
+ ModelMetaData m = new ModelMetaData();
+ m.addError("ERROR", "I am Error");
+ m.addError("WARNING", "I am warning");
+
+ assertFalse(m.getErrors().isEmpty());
+ assertEquals(1, m.getErrors().size());
+ }
+}
Property changes on: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java (rev 0)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.dmr.ModelNode;
+import org.junit.Test;
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
+ at SuppressWarnings("nls")
+public class TestRequestMetadata {
+
+ @Test public void testMapping() {
+ RequestMetadata request = buildRequest();
+
+ ModelNode node = MetadataMapper.RequestMetadataMapper.wrap(request, new ModelNode());
+
+ RequestMetadata actual = MetadataMapper.RequestMetadataMapper.unwrap(node);
+
+ assertEquals(request, actual);
+ assertEquals(request.getState(), actual.getState());
+ }
+
+ private RequestMetadata buildRequest() {
+ RequestMetadata request = new RequestMetadata();
+ request.setState(ProcessingState.PROCESSING);
+ request.setCommand("select * from foo"); //$NON-NLS-1$
+ request.setExecutionId(1234);
+ request.setName("request-name"); //$NON-NLS-1$
+ request.setSessionId("session-id");//$NON-NLS-1$
+ request.setSourceRequest(false);
+ request.setStartTime(12345L);
+ request.setTransactionId("transaction-id");//$NON-NLS-1$
+ request.setThreadState(ThreadState.RUNNING);
+ //request.setNodeId(1);
+ return request;
+ }
+
+ public static final String desc = "{\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"OBJECT\"\n" +
+ " },\n" +
+ " \"attributes\" : {\n" +
+ " \"execution-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Unique Identifier for Request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"session-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Session Identifier\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"start-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Start time for the request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"command\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Executing Command\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"source-request\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"BOOLEAN\"\n" +
+ " },\n" +
+ " \"description\" : \"Is this Connector level request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"node-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"INT\"\n" +
+ " },\n" +
+ " \"description\" : \"Node Identifier\",\n" +
+ " \"required\" : false\n" +
+ " },\n" +
+ " \"transaction-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Get Transaction XID if transaction involved\",\n" +
+ " \"required\" : false\n" +
+ " },\n" +
+ " \"processing-state\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"State of the Request\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"thread-state\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Thread state\",\n" +
+ " \"required\" : true\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+ @Test public void testDescribe() {
+ assertEquals(desc, MetadataMapper.RequestMetadataMapper.describe(new ModelNode()).toJSONString(false));
+ }
+
+}
Property changes on: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java (rev 0)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.dmr.ModelNode;
+import org.junit.Test;
+
+ at SuppressWarnings("nls")
+public class TestSessionMetadata {
+
+ @Test public void testMapping() {
+ SessionMetadata session = new SessionMetadata();
+ session.setSessionId("test");
+ session.setApplicationName("foo");
+ session.setClientHostName("localhost");
+ session.setCreatedTime(1234);
+ session.setIPAddress("127.0.0.1");
+ session.setVDBName("vdb-name");
+ session.setVDBVersion(2);
+ session.setSecurityContext("auth-domain");
+ session.setUserName("user");
+
+ ModelNode node = MetadataMapper.SessionMetadataMapper.wrap(session, new ModelNode());
+
+ SessionMetadata session1 = MetadataMapper.SessionMetadataMapper.unwrap(node);
+
+ assertEquals(session.getSessionId(), session1.getSessionId());
+ assertEquals(session.getApplicationName(), session1.getApplicationName());
+
+ }
+
+ private static final String describe = "{\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"OBJECT\"\n" +
+ " },\n" +
+ " \"attributes\" : {\n" +
+ " \"application-name\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Application assosiated with Session\",\n" +
+ " \"required\" : false\n" +
+ " },\n" +
+ " \"created-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"When session created\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"client-host-address\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Host name from where the session created\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"ip-address\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"IP address from where session is created\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"last-ping-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Last ping time\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"session-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Session Identifier\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"user-name\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"User name associated with session\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"vdb-name\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"The Virtual Database Name\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"vdb-version\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"INT\"\n" +
+ " },\n" +
+ " \"description\" : \"The Virtual Database Version\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"security-domain\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Security domain that session used for login\",\n" +
+ " \"required\" : false\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+
+ @Test public void testDescribe() {
+ ModelNode n = MetadataMapper.SessionMetadataMapper.describe(new ModelNode());
+ //System.out.println(n.toJSONString(false));
+ assertEquals(describe, n.toJSONString(false));
+ }
+}
Property changes on: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java (rev 0)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.dmr.ModelNode;
+import org.junit.Test;
+
+ at SuppressWarnings("nls")
+public class TestTransactionMetadata {
+
+ @Test public void testMapping() {
+ TransactionMetadata tm = new TransactionMetadata();
+ tm.setAssociatedSession("x");
+ tm.setCreatedTime(1234);
+ tm.setId("tnx-id");
+ tm.setScope("scope");
+
+ ModelNode node = MetadataMapper.TransactionMetadataMapper.wrap(tm, new ModelNode());
+
+ TransactionMetadata tm1 = MetadataMapper.TransactionMetadataMapper.unwrap(node);
+
+ assertEquals(tm.getAssociatedSession(), tm1.getAssociatedSession());
+
+ assertEquals(tm.getCreatedTime(), tm1.getCreatedTime());
+ assertEquals(tm.getId(), tm1.getId());
+ assertEquals(tm.getScope(), tm1.getScope());
+ }
+
+ private static final String describe = "{\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"OBJECT\"\n" +
+ " },\n" +
+ " \"attributes\" : {\n" +
+ " \"session-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Session Identifier\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"txn-created-time\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Transaction created time\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"txn-scope\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"LONG\"\n" +
+ " },\n" +
+ " \"description\" : \"Transaction scope (Request, Local, Global)\",\n" +
+ " \"required\" : true\n" +
+ " },\n" +
+ " \"txn-id\" : {\n" +
+ " \"type\" : {\n" +
+ " \"TYPE_MODEL_VALUE\" : \"STRING\"\n" +
+ " },\n" +
+ " \"description\" : \"Transaction Identifier (XID)\",\n" +
+ " \"required\" : true\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+ @Test
+ public void testDescribe() {
+ ModelNode n = MetadataMapper.TransactionMetadataMapper.describe(new ModelNode());
+ //System.out.println(n.toJSONString(false));
+ assertEquals(describe, n.toJSONString(false));
+ }
+}
Property changes on: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java (rev 0)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,232 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.jboss.dmr.ModelNode;
+import org.junit.Test;
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.Translator;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import org.teiid.core.util.ObjectConverterUtil;
+import org.teiid.core.util.PropertiesUtils;
+import org.teiid.core.util.UnitTestUtil;
+
+ at SuppressWarnings("nls")
+public class TestVDBMetaData {
+
+ @Test
+ public void testMarshellUnmarshell() throws Exception {
+
+ VDBMetaData vdb = buildVDB();
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
+ JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
+ Marshaller marshell = jc.createMarshaller();
+ marshell.setSchema(schema);
+ marshell.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
+
+ StringWriter sw = new StringWriter();
+ marshell.marshal(vdb, sw);
+
+ System.out.println(sw.toString());
+
+ // UnMarshell
+ Unmarshaller un = jc.createUnmarshaller();
+ un.setSchema(schema);
+ vdb = (VDBMetaData)un.unmarshal(new StringReader(sw.toString()));
+
+ validateVDB(vdb);
+ }
+
+ static void validateVDB(VDBMetaData vdb) {
+ ModelMetaData modelOne;
+ ModelMetaData modelTwo;
+ assertEquals("myVDB", vdb.getName()); //$NON-NLS-1$
+ assertEquals("vdb description", vdb.getDescription()); //$NON-NLS-1$
+ assertEquals(1, vdb.getVersion());
+ assertEquals("vdb-value", vdb.getPropertyValue("vdb-property")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ assertNotNull(vdb.getModel("model-one")); //$NON-NLS-1$
+ assertNotNull(vdb.getModel("model-two")); //$NON-NLS-1$
+ assertNull(vdb.getModel("model-unknown")); //$NON-NLS-1$
+
+ modelOne = vdb.getModel("model-one"); //$NON-NLS-1$
+ assertEquals("model-one", modelOne.getName()); //$NON-NLS-1$
+ assertEquals("s1", modelOne.getSourceNames().get(0)); //$NON-NLS-1$
+ assertEquals(Model.Type.PHYSICAL, modelOne.getModelType());
+ assertEquals("model-value-override", modelOne.getPropertyValue("model-prop")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse(modelOne.isVisible());
+ assertEquals("model description", modelOne.getDescription());
+
+ modelTwo = vdb.getModel("model-two"); //$NON-NLS-1$
+ assertEquals("model-two", modelTwo.getName()); //$NON-NLS-1$
+ assertTrue(modelTwo.getSourceNames().contains("s1")); //$NON-NLS-1$
+ assertTrue(modelTwo.getSourceNames().contains("s2")); //$NON-NLS-1$
+ assertEquals(Model.Type.VIRTUAL, modelTwo.getModelType()); // this is not persisted in the XML
+ assertEquals("model-value", modelTwo.getPropertyValue("model-prop")); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ assertTrue(vdb.getValidityErrors().contains("There is an error in VDB")); //$NON-NLS-1$
+
+ List<Translator> translators = vdb.getOverrideTranslators();
+ assertTrue(translators.size() == 1);
+
+ Translator translator = translators.get(0);
+ assertEquals("oracleOverride", translator.getName());
+ assertEquals("oracle", translator.getType());
+ assertEquals("my-value", translator.getPropertyValue("my-property"));
+ assertEquals("hello world", translator.getDescription());
+ List<DataPolicy> roles = vdb.getDataPolicies();
+
+ assertTrue(roles.size() == 1);
+
+ DataPolicyMetadata role = vdb.getDataPolicy("roleOne"); //$NON-NLS-1$
+ assertTrue(role.isAllowCreateTemporaryTables());
+ assertEquals("roleOne described", role.getDescription()); //$NON-NLS-1$
+ assertNotNull(role.getMappedRoleNames());
+ assertTrue(role.getMappedRoleNames().contains("ROLE1")); //$NON-NLS-1$
+ assertTrue(role.getMappedRoleNames().contains("ROLE2")); //$NON-NLS-1$
+
+ List<DataPolicy.DataPermission> permissions = role.getPermissions();
+ assertEquals(2, permissions.size());
+
+ for (DataPolicy.DataPermission p: permissions) {
+ if (p.getResourceName().equalsIgnoreCase("myTable.T1")) { //$NON-NLS-1$
+ assertTrue(p.getAllowRead());
+ assertNull(p.getAllowDelete());
+ }
+ else {
+ assertFalse(p.getAllowRead());
+ assertTrue(p.getAllowDelete());
+ }
+ }
+ }
+
+ private VDBMetaData buildVDB() {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("myVDB"); //$NON-NLS-1$
+ vdb.setDescription("vdb description"); //$NON-NLS-1$
+ vdb.setVersion(1);
+ vdb.addProperty("vdb-property", "vdb-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ vdb.addProperty("vdb-property2", "vdb-value2"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ModelMetaData modelOne = new ModelMetaData();
+ modelOne.setName("model-one"); //$NON-NLS-1$
+ modelOne.addSourceMapping("s1", "translator", "java:mybinding"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.setModelType(Model.Type.PHYSICAL); //$NON-NLS-1$
+ modelOne.addProperty("model-prop", "model-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.addProperty("model-prop", "model-value-override"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.setVisible(false);
+ modelOne.addError("ERROR", "There is an error in VDB"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelOne.setDescription("model description");
+
+ vdb.addModel(modelOne);
+
+ ModelMetaData modelTwo = new ModelMetaData();
+ modelTwo.setName("model-two"); //$NON-NLS-1$
+ modelTwo.addSourceMapping("s1", "translator", "java:binding-one"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelTwo.addSourceMapping("s2", "translator", "java:binding-two"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelTwo.setModelType(Model.Type.VIRTUAL); //$NON-NLS-1$
+ modelTwo.addProperty("model-prop", "model-value"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ vdb.addModel(modelTwo);
+
+ VDBTranslatorMetaData t1 = new VDBTranslatorMetaData();
+ t1.setName("oracleOverride");
+ t1.setType("oracle");
+ t1.setDescription("hello world");
+ t1.addProperty("my-property", "my-value");
+ List<Translator> list = new ArrayList<Translator>();
+ list.add(t1);
+ vdb.setOverrideTranslators(list);
+
+ DataPolicyMetadata roleOne = new DataPolicyMetadata();
+ roleOne.setName("roleOne"); //$NON-NLS-1$
+ roleOne.setDescription("roleOne described"); //$NON-NLS-1$
+ roleOne.setAllowCreateTemporaryTables(true);
+ PermissionMetaData perm1 = new PermissionMetaData();
+ perm1.setResourceName("myTable.T1"); //$NON-NLS-1$
+ perm1.setAllowRead(true);
+ roleOne.addPermission(perm1);
+
+ PermissionMetaData perm2 = new PermissionMetaData();
+ perm2.setResourceName("myTable.T2"); //$NON-NLS-1$
+ perm2.setAllowRead(false);
+ perm2.setAllowDelete(true);
+ roleOne.addPermission(perm2);
+
+ roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ vdb.addDataPolicy(roleOne);
+ return vdb;
+ }
+
+ @Test
+ public void testAdminMOCreation() {
+ VDBMetaData vdb = new VDBMetaData();
+
+ PropertiesUtils.setBeanProperty(vdb, "url", "http://teiid.org/myvdb.vdb");
+
+ assertEquals("http://teiid.org/myvdb.vdb", vdb.getUrl());
+ }
+
+ @Test public void testSetUrlVersion() throws MalformedURLException {
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("foo");
+ vdb.setUrl(new URL("file:///x/foo.2.vdb"));
+ assertEquals(2, vdb.getVersion());
+ }
+
+ @Test public void testVDBMetaDataMapper() {
+ VDBMetaData vdb = buildVDB();
+
+ ModelNode node = MetadataMapper.wrap(vdb, new ModelNode());
+
+ vdb = MetadataMapper.unwrap(node);
+ validateVDB(vdb);
+ }
+
+ @Test
+ public void testVDBMetaDataDescribe() throws Exception {
+ ModelNode node = MetadataMapper.describe(new ModelNode());
+ String actual = node.toJSONString(false);
+ assertEquals(ObjectConverterUtil.convertFileToString(new File(UnitTestUtil.getTestDataPath() + "/vdb-describe.txt")), actual);
+ }
+}
Property changes on: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java
===================================================================
--- branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java (rev 0)
+++ branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,17 @@
+package org.teiid.adminapi.impl;
+
+import java.io.FileInputStream;
+
+import org.junit.Test;
+import org.teiid.core.util.UnitTestUtil;
+
+ at SuppressWarnings("nls")
+public class TestVDBMetadataParser {
+
+ @Test
+ public void testparseVDB() throws Exception {
+ FileInputStream in = new FileInputStream(UnitTestUtil.getTestDataPath() + "/parser-test-vdb.xml");
+ VDBMetaData vdb = VDBMetadataParser.unmarshell(in);
+ TestVDBMetaData.validateVDB(vdb);
+ }
+}
Property changes on: branches/as7/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/adminshell/pom.xml
===================================================================
--- branches/as7/adminshell/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/adminshell/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -25,6 +25,10 @@
<artifactId>teiid-client</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ </dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
Modified: branches/as7/api/pom.xml
===================================================================
--- branches/as7/api/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/api/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -25,6 +25,12 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
<artifactId>teiid-common-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
Modified: branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml
===================================================================
--- branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/build/kits/jboss-as7/modules/org/jboss/teiid/main/module.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -9,6 +9,7 @@
<resource-root path="teiid-metadata-${project.version}.jar" />
<resource-root path="teiid-runtime-${project.version}.jar" />
<resource-root path="teiid-engine-${project.version}.jar" />
+ <resource-root path="teiid-admin-${project.version}.jar" />
<resource-root path="saxonhe-9.2.1.5.jar" />
<resource-root path="json-simple-1.1.jar" />
<resource-root path="conf" />
Modified: branches/as7/connectors/pom.xml
===================================================================
--- branches/as7/connectors/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/connectors/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -44,6 +44,11 @@
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
<artifactId>teiid-engine</artifactId>
<scope>test</scope>
</dependency>
Modified: branches/as7/engine/pom.xml
===================================================================
--- branches/as7/engine/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/engine/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -47,6 +47,12 @@
<artifactId>teiid-client</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
Property changes on: branches/as7/jboss-integration
___________________________________________________________________
Modified: svn:ignore
- .classpath
.project
.settings
target
+ .classpath
.project
.settings
target
transaction.log
Modified: branches/as7/jboss-integration/pom.xml
===================================================================
--- branches/as7/jboss-integration/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -30,6 +30,11 @@
</dependency>
<dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<scope>provided</scope>
Added: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java (rev 0)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.teiid.jboss;
+
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.OperationStepHandler;
+import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.as.controller.registry.ManagementResourceRegistration;
+import org.jboss.dmr.ModelNode;
+
+public abstract class BaseOperationHandler<T> implements DescriptionProvider, OperationStepHandler {
+ private static final String DESCRIBE = ".describe"; //$NON-NLS-1$
+ protected static final String MISSING = ".missing"; //$NON-NLS-1$
+
+ private String operationName;
+
+ protected BaseOperationHandler(String operationName){
+ this.operationName = operationName;
+ }
+
+ public void register(ManagementResourceRegistration subsystem) {
+ subsystem.registerOperationHandler(this.operationName, this, this);
+ }
+
+ public String name() {
+ return this.operationName;
+ }
+
+ public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
+ if (context.getType() == OperationContext.Type.SERVER) {
+ context.addStep(new OperationStepHandler() {
+ public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
+
+ ModelNode model = context.getResult();
+
+ final ModelNode address = operation.require(OP_ADDR);
+ final PathAddress pathAddress = PathAddress.pathAddress(address);
+
+ executeOperation(getService(context, pathAddress), operation, model);
+
+ context.completeStep();
+ }
+
+ }, OperationContext.Stage.RUNTIME);
+ }
+ else {
+ context.getResult().set("no metrics available"); //$NON-NLS-1$
+ }
+ context.completeStep();
+ }
+
+ @SuppressWarnings("unused")
+ protected T getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException{
+ return null;
+ }
+
+ @Override
+ public ModelNode getModelDescription(final Locale locale) {
+ final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
+ final ModelNode operation = new ModelNode();
+ operation.get(OPERATION_NAME).set(this.operationName);
+ operation.get(DESCRIPTION).set(bundle.getString(name()+DESCRIBE));
+ describeParameters(operation, bundle);
+ return operation;
+ }
+
+ protected String getReplyName() {
+ return name()+".reply"+DESCRIBE; //$NON-NLS-1$
+ }
+
+ protected String getParameterDescription(ResourceBundle bundle, String paramName) {
+ return bundle.getString(name()+"."+paramName+DESCRIBE); //$NON-NLS-1$
+ }
+
+ abstract protected void executeOperation(T service, ModelNode operation, ModelNode node) throws OperationFailedException;
+
+ protected void describeParameters(@SuppressWarnings("unused") ModelNode operationNode, @SuppressWarnings("unused")ResourceBundle bundle) {
+ }
+}
Property changes on: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/BaseOperationHandler.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineAdd.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -33,10 +33,7 @@
import javax.resource.spi.work.WorkManager;
import javax.transaction.TransactionManager;
-import org.jboss.as.controller.AbstractBoottimeAddStepHandler;
-import org.jboss.as.controller.OperationContext;
-import org.jboss.as.controller.OperationFailedException;
-import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.*;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.naming.ManagedReferenceFactory;
import org.jboss.as.naming.NamingStore;
@@ -63,7 +60,7 @@
import org.teiid.transport.SSLConfiguration;
import org.teiid.transport.SocketConfiguration;
-class QueryEngineAdd extends AbstractBoottimeAddStepHandler implements DescriptionProvider {
+class QueryEngineAdd extends AbstractAddStepHandler implements DescriptionProvider {
@Override
public ModelNode getModelDescription(Locale locale) {
@@ -80,18 +77,27 @@
@Override
protected void populateModel(ModelNode operation, ModelNode model) {
- populateQueryEngine(operation, model);
+ final ModelNode address = operation.require(OP_ADDR);
+ final PathAddress pathAddress = PathAddress.pathAddress(address);
+ final String engineName = pathAddress.getLastElement().getValue();
+
+ populateQueryEngine(engineName, operation, model);
}
@Override
- protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
+ protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
+ final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
ServiceTarget target = context.getServiceTarget();
final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener();
-
+
+ final ModelNode address = operation.require(OP_ADDR);
+ final PathAddress pathAddress = PathAddress.pathAddress(address);
+ final String engineName = pathAddress.getLastElement().getValue();
+
// now build the engine
- final RuntimeEngineDeployer engine = buildQueryEngine(operation);
+ final RuntimeEngineDeployer engine = buildQueryEngine(engineName, operation);
engine.setSecurityHelper(new JBossSecurityHelper());
engine.setContainerLifeCycleListener(shutdownListener);
// TODO: none of the caching is configured..
@@ -161,8 +167,8 @@
}
- private RuntimeEngineDeployer buildQueryEngine(ModelNode node) {
- RuntimeEngineDeployer engine = new RuntimeEngineDeployer(node.require(Configuration.ENGINE_NAME).asString());
+ private RuntimeEngineDeployer buildQueryEngine(String engineName, ModelNode node) {
+ RuntimeEngineDeployer engine = new RuntimeEngineDeployer(engineName);
if (node.hasDefined(Configuration.MAX_THREADS)) {
engine.setMaxThreads(node.get(Configuration.MAX_THREADS).asInt());
@@ -280,7 +286,6 @@
}
static void describeQueryEngine(ModelNode node, String type, ResourceBundle bundle) {
- addAttribute(node, Configuration.ENGINE_NAME, type, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
addAttribute(node, Configuration.MAX_THREADS, type, bundle.getString(Configuration.MAX_THREADS+DESC), ModelType.INT, false, "64"); //$NON-NLS-1$
addAttribute(node, Configuration.MAX_ACTIVE_PLANS, type, bundle.getString(Configuration.MAX_ACTIVE_PLANS+DESC), ModelType.INT, false, "20"); //$NON-NLS-1$
addAttribute(node, Configuration.USER_REQUEST_SOURCE_CONCURRENCY, type, bundle.getString(Configuration.USER_REQUEST_SOURCE_CONCURRENCY+DESC), ModelType.INT, false, "0"); //$NON-NLS-1$
@@ -343,10 +348,10 @@
addAttribute(node, Configuration.AUTH_MODE, type, bundle.getString(Configuration.AUTH_MODE+DESC), ModelType.STRING, false, "anonymous"); //$NON-NLS-1$
}
- private void populateQueryEngine(ModelNode operation, ModelNode model) {
- model.get(Configuration.ENGINE_NAME).set(operation.require(Configuration.ENGINE_NAME).asString());
+ private void populateQueryEngine(String engineName, ModelNode operation, ModelNode model) {
+ model.get(Configuration.ENGINE_NAME).set(engineName);
- if (operation.hasDefined(Configuration.MAX_THREADS)) {
+ if (operation.hasDefined(Configuration.MAX_THREADS)) {
model.get(Configuration.MAX_THREADS).set(operation.get(Configuration.MAX_THREADS).asInt());
}
if (operation.hasDefined(Configuration.MAX_ACTIVE_PLANS)) {
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineOperationHandler.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -22,73 +22,49 @@
package org.teiid.jboss;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
-import static org.teiid.jboss.Configuration.addAttribute;
import java.util.Collection;
import java.util.List;
-import java.util.Locale;
import java.util.ResourceBundle;
-import org.jboss.as.controller.*;
-import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.as.controller.OperationContext;
+import org.jboss.as.controller.OperationFailedException;
+import org.jboss.as.controller.PathAddress;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.msc.service.ServiceController;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.impl.*;
+import org.teiid.adminapi.impl.MetadataMapper.TransactionMetadataMapper;
import org.teiid.adminapi.impl.MetadataMapper.VDBTranslatorMetaDataMapper;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
-abstract class QueryEngineOperationHandler extends AbstractAddStepHandler implements DescriptionProvider {
- private static final String DESCRIBE = ".describe"; //$NON-NLS-1$
+abstract class QueryEngineOperationHandler extends BaseOperationHandler<RuntimeEngineDeployer> {
- private String operationName;
-
protected QueryEngineOperationHandler(String operationName){
- this.operationName = operationName;
+ super(operationName);
}
@Override
- protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException{
-
+ protected RuntimeEngineDeployer getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+ String serviceName = pathAddress.getLastElement().getValue();
+ ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.engineServiceName(serviceName));
+ return RuntimeEngineDeployer.class.cast(sc.getValue());
}
+}
+
+abstract class TranslatorOperationHandler extends BaseOperationHandler<TranslatorRepository> {
+ protected TranslatorOperationHandler(String operationName){
+ super(operationName);
+ }
+
@Override
- protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
- final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
-
- ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.engineServiceName(operation.require(Configuration.ENGINE_NAME).asString()));
- RuntimeEngineDeployer engine = RuntimeEngineDeployer.class.cast(sc.getValue());
- executeOperation(engine, operation, model);
- }
-
-
- @Override
- public ModelNode getModelDescription(final Locale locale) {
- final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
- final ModelNode operation = new ModelNode();
- operation.get(OPERATION_NAME).set(this.operationName);
- operation.get(DESCRIPTION).set(bundle.getString(getBundleOperationName()+DESCRIBE));
- addAttribute(operation, Configuration.ENGINE_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
- describeParameters(operation, bundle);
- return operation;
- }
-
- protected String getBundleOperationName() {
- return RuntimeEngineDeployer.class.getSimpleName()+"."+this.operationName; //$NON-NLS-1$
- }
-
- protected String getReplyName() {
- return getBundleOperationName()+".reply"+DESCRIBE; //$NON-NLS-1$
- }
-
- protected String getParameterDescription(ResourceBundle bundle, String parmName) {
- return bundle.getString(RuntimeEngineDeployer.class.getSimpleName()+"."+this.operationName+"."+parmName+DESCRIBE); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- abstract protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException;
-
- protected void describeParameters(@SuppressWarnings("unused") ModelNode operationNode, @SuppressWarnings("unused")ResourceBundle bundle) {
+ public TranslatorRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+ ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.TRANSLATOR_REPO);
+ return TranslatorRepository.class.cast(sc.getValue());
}
}
@@ -100,6 +76,10 @@
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
node.set(engine.getRuntimeVersion());
}
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REPLY_PROPERTIES).set(ModelType.STRING);
+ operationNode.get(REPLY_PROPERTIES, DESCRIBE).set(bundle.getString(getReplyName()));
+ }
}
class GetActiveSessionsCount extends QueryEngineOperationHandler{
@@ -114,38 +94,45 @@
// TODO: handle exception in model node terms
}
}
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REPLY_PROPERTIES).set(ModelType.INT);
+ operationNode.get(REPLY_PROPERTIES, DESCRIBE).set(bundle.getString(getReplyName()));
+ }
}
class GetActiveSessions extends QueryEngineOperationHandler{
- protected GetActiveSessions(String operationName) {
- super(operationName);
+ protected GetActiveSessions() {
+ super("active-sessions"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
- node.get(TYPE).set(ModelType.LIST);
-
try {
Collection<SessionMetadata> sessions = engine.getActiveSessions();
for (SessionMetadata session:sessions) {
- node.add(MetadataMapper.SessionMetadataMapper.wrap(session, node.add()));
+ MetadataMapper.SessionMetadataMapper.wrap(session, node.add());
}
} catch (AdminException e) {
// TODO: handle exception in model node terms
}
}
+
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.SessionMetadataMapper.describe(new ModelNode()));
+ }
}
class GetRequestsPerSession extends QueryEngineOperationHandler{
- protected GetRequestsPerSession(String operationName) {
- super(operationName);
+ protected GetRequestsPerSession() {
+ super("requests-per-session"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
- node.get(TYPE).set(ModelType.LIST);
-
+ if (!operation.hasDefined(OperationsConstants.SESSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SESSION+MISSING)));
+ }
List<RequestMetadata> requests = engine.getRequestsForSession(operation.get(OperationsConstants.SESSION).asString());
for (RequestMetadata request:requests) {
- node.add(MetadataMapper.RequestMetadataMapper.wrap(request, node.add()));
+ MetadataMapper.RequestMetadataMapper.wrap(request, node.add());
}
}
@@ -154,27 +141,33 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.SESSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.SESSION));
- //TODO: define response??
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.RequestMetadataMapper.describe(new ModelNode()));
}
}
class GetRequestsPerVDB extends QueryEngineOperationHandler{
- protected GetRequestsPerVDB(String operationName) {
- super(operationName);
+ protected GetRequestsPerVDB() {
+ super("requests-per-vdb"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
- node.get(TYPE).set(ModelType.LIST);
-
try {
+
+ if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME+MISSING)));
+ }
+ if (!operation.hasDefined(OperationsConstants.VDB_VERSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION+MISSING)));
+ }
+
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
List<RequestMetadata> requests = engine.getRequestsUsingVDB(vdbName,vdbVersion);
for (RequestMetadata request:requests) {
- node.add(MetadataMapper.RequestMetadataMapper.wrap(request, node.add()));
+ MetadataMapper.RequestMetadataMapper.wrap(request, node.add());
}
} catch (AdminException e) {
- // TODO: handle exception in model node terms
+ throw new OperationFailedException(e, new ModelNode().set(e.getMessage()));
}
}
@@ -187,31 +180,35 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
- //TODO: define response??
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.RequestMetadataMapper.describe(new ModelNode()));
}
}
class GetLongRunningQueries extends QueryEngineOperationHandler{
- protected GetLongRunningQueries(String operationName) {
- super(operationName);
+ protected GetLongRunningQueries() {
+ super("long-running-queries"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
- node.get(TYPE).set(ModelType.LIST);
-
List<RequestMetadata> requests = engine.getLongRunningRequests();
for (RequestMetadata request:requests) {
- node.add(MetadataMapper.RequestMetadataMapper.wrap(request, node.add()));
+ MetadataMapper.RequestMetadataMapper.wrap(request, node.add());
}
}
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.RequestMetadataMapper.describe(new ModelNode()));
+ }
}
class TerminateSession extends QueryEngineOperationHandler{
- protected TerminateSession(String operationName) {
- super(operationName);
+ protected TerminateSession() {
+ super("terminate-session"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
+ if (!operation.hasDefined(OperationsConstants.SESSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SESSION+MISSING)));
+ }
engine.terminateSession(operation.get(OperationsConstants.SESSION).asString());
}
@@ -223,15 +220,19 @@
}
class CancelQuery extends QueryEngineOperationHandler{
- protected CancelQuery(String operationName) {
- super(operationName);
+ protected CancelQuery() {
+ super("cancel-query"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException{
try {
- engine.cancelRequest(operation.get(OperationsConstants.SESSION).asString(), operation.get(OperationsConstants.EXECUTION_ID).asLong());
+ if (!operation.hasDefined(OperationsConstants.SESSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SESSION+MISSING)));
+ }
+ boolean pass = engine.cancelRequest(operation.get(OperationsConstants.SESSION).asString(), operation.get(OperationsConstants.EXECUTION_ID).asLong());
+ node.set(pass);
} catch (AdminException e) {
- // TODO: handle exception in model node terms
+ throw new OperationFailedException(e, new ModelNode().set(e.getMessage()));
}
}
@@ -243,30 +244,45 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.EXECUTION_ID, TYPE).set(ModelType.LONG);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.EXECUTION_ID, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.EXECUTION_ID, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.EXECUTION_ID));
+
+ operationNode.get(REPLY_PROPERTIES).set(ModelType.BOOLEAN);
+ operationNode.get(REPLY_PROPERTIES, DESCRIBE).set(bundle.getString(getReplyName()));
}
}
class CacheTypes extends QueryEngineOperationHandler{
- protected CacheTypes(String operationName) {
- super(operationName);
+ protected CacheTypes() {
+ super("cache-types"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
- node.get(TYPE).set(ModelType.LIST);
Collection<String> types = engine.getCacheTypes();
for (String type:types) {
node.add(type);
}
}
+
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ ModelNode node = new ModelNode();
+ node.get(OperationsConstants.CACHE_TYPE, TYPE).set(ModelType.STRING);
+ node.get(OperationsConstants.CACHE_TYPE, REQUIRED).set(true);
+ node.get(OperationsConstants.CACHE_TYPE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.CACHE_TYPE));
+ operationNode.get(REPLY_PROPERTIES).add(node);
+ }
}
class ClearCache extends QueryEngineOperationHandler{
- protected ClearCache(String operationName) {
- super(operationName);
+ protected ClearCache() {
+ super("clear-cache"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+
+ if (!operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
+ }
+
String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
if (operation.get(OperationsConstants.VDB_NAME) != null && operation.get(OperationsConstants.VDB_VERSION) != null) {
@@ -297,11 +313,14 @@
class CacheStatistics extends QueryEngineOperationHandler{
- protected CacheStatistics(String operationName) {
- super(operationName);
+ protected CacheStatistics() {
+ super("cache-statistics"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+ if (!operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
+ }
String cacheType = operation.get(OperationsConstants.CACHE_TYPE).asString();
CacheStatisticsMetadata stats = engine.getCacheStatistics(cacheType);
MetadataMapper.CacheStatisticsMetadataMapper.wrap(stats, node);
@@ -311,51 +330,62 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.CACHE_TYPE, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.CACHE_TYPE));
+
+ ModelNode node = new ModelNode();
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.CacheStatisticsMetadataMapper.describe(node));
}
}
class WorkerPoolStatistics extends QueryEngineOperationHandler{
- protected WorkerPoolStatistics(String operationName) {
- super(operationName);
+ protected WorkerPoolStatistics() {
+ super("workerpool-statistics"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
WorkerPoolStatisticsMetadata stats = engine.getWorkerPoolStatistics();
MetadataMapper.WorkerPoolStatisticsMetadataMapper.wrap(stats, node);
}
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.WorkerPoolStatisticsMetadataMapper.describe(new ModelNode()));
+ }
}
class ActiveTransactions extends QueryEngineOperationHandler{
- protected ActiveTransactions(String operationName) {
- super(operationName);
+ protected ActiveTransactions() {
+ super("active-transactions"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
Collection<TransactionMetadata> txns = engine.getTransactions();
-
- node.get(TYPE).set(ModelType.LIST);
-
for (TransactionMetadata txn:txns) {
- node.add(MetadataMapper.TransactionMetadataMapper.wrap(txn, node.add()));
+ MetadataMapper.TransactionMetadataMapper.wrap(txn, node.add());
}
-
}
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ ModelNode node = new ModelNode();
+ operationNode.get(REPLY_PROPERTIES).add(TransactionMetadataMapper.describe(node));
+ }
}
class TerminateTransaction extends QueryEngineOperationHandler{
- protected TerminateTransaction(String operationName) {
- super(operationName);
+ protected TerminateTransaction() {
+ super("terminate-transaction"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+
+ if (!operation.hasDefined(OperationsConstants.XID)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.XID+MISSING)));
+ }
+
String xid = operation.get(OperationsConstants.XID).asString();
try {
engine.terminateTransaction(xid);
} catch (AdminException e) {
- // TODO: Handle exception
+ throw new OperationFailedException(e, new ModelNode().set(e.getMessage()));
}
}
@@ -366,19 +396,40 @@
}
}
-class MergeVDBs extends QueryEngineOperationHandler{
+class MergeVDBs extends BaseOperationHandler<VDBRepository>{
- protected MergeVDBs(String operationName) {
- super(operationName);
+ protected MergeVDBs() {
+ super("merge-vdbs"); //$NON-NLS-1$
}
+
@Override
- protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+ protected VDBRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+ ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_REPO);
+ return VDBRepository.class.cast(sc.getValue());
+ }
+
+ @Override
+ protected void executeOperation(VDBRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+ if (!operation.hasDefined(OperationsConstants.SOURCE_VDBNAME)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SOURCE_VDBNAME+MISSING)));
+ }
+ if (!operation.hasDefined(OperationsConstants.SOURCE_VDBVERSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SOURCE_VDBVERSION+MISSING)));
+ }
+
+ if (!operation.hasDefined(OperationsConstants.TARGET_VDBNAME)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TARGET_VDBNAME+MISSING)));
+ }
+ if (!operation.hasDefined(OperationsConstants.TARGET_VDBVERSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TARGET_VDBVERSION+MISSING)));
+ }
+
String sourceVDBName = operation.get(OperationsConstants.SOURCE_VDBNAME).asString();
int sourceVDBversion = operation.get(OperationsConstants.SOURCE_VDBVERSION).asInt();
String targetVDBName = operation.get(OperationsConstants.TARGET_VDBNAME).asString();
int targetVDBversion = operation.get(OperationsConstants.TARGET_VDBVERSION).asInt();
try {
- engine.mergeVDBs(sourceVDBName, sourceVDBversion, targetVDBName, targetVDBversion);
+ repo.mergeVDBs(sourceVDBName, sourceVDBversion, targetVDBName, targetVDBversion);
} catch (AdminException e) {
throw new OperationFailedException(new ModelNode().set(e.getMessage()));
}
@@ -405,18 +456,30 @@
class ExecuteQuery extends QueryEngineOperationHandler{
- protected ExecuteQuery(String operationName) {
- super(operationName);
+ protected ExecuteQuery() {
+ super("execute-query"); //$NON-NLS-1$
}
@Override
protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+
+ if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME+MISSING)));
+ }
+ if (!operation.hasDefined(OperationsConstants.VDB_VERSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION+MISSING)));
+ }
+ if (!operation.hasDefined(OperationsConstants.SQL_QUERY)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.SQL_QUERY+MISSING)));
+ }
+ if (!operation.hasDefined(OperationsConstants.TIMEOUT_IN_MILLI)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TIMEOUT_IN_MILLI+MISSING)));
+ }
+
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
String sql = operation.get(OperationsConstants.SQL_QUERY).asString();
int timeout = operation.get(OperationsConstants.TIMEOUT_IN_MILLI).asInt();
try {
- node.get(TYPE).set(ModelType.LIST);
-
List<List> results = engine.executeQuery(vdbName, vdbVersion, sql, timeout);
List colNames = results.get(0);
for (int rowNum = 1; rowNum < results.size(); rowNum++) {
@@ -452,20 +515,36 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TIMEOUT_IN_MILLI, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TIMEOUT_IN_MILLI));
+
+ operationNode.get(REPLY_PROPERTIES).set(ModelType.LIST);
}
}
-class GetVDB extends QueryEngineOperationHandler{
+class GetVDB extends BaseOperationHandler<VDBRepository>{
- protected GetVDB(String operationName) {
- super(operationName);
+ protected GetVDB() {
+ super("get-vdb"); //$NON-NLS-1$
}
+
@Override
- protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+ protected VDBRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+ ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_REPO);
+ return VDBRepository.class.cast(sc.getValue());
+ }
+
+ @Override
+ protected void executeOperation(VDBRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+ if (!operation.hasDefined(OperationsConstants.VDB_NAME)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME+MISSING)));
+ }
+ if (!operation.hasDefined(OperationsConstants.VDB_VERSION)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION+MISSING)));
+ }
+
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
- VDBMetaData vdb = engine.getVDB(vdbName, vdbVersion);
+ VDBMetaData vdb = repo.getVDB(vdbName, vdbVersion);
MetadataMapper.wrap(vdb, node);
}
@@ -477,59 +556,71 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.STRING);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
+
+ operationNode.get(REPLY_PROPERTIES).set(MetadataMapper.describe(new ModelNode()));
}
}
-class GetVDBs extends QueryEngineOperationHandler{
+class ListVDBs extends BaseOperationHandler<VDBRepository>{
- protected GetVDBs(String operationName) {
- super(operationName);
+ protected ListVDBs() {
+ super("list-vdbs"); //$NON-NLS-1$
}
+
@Override
- protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
- List<VDBMetaData> vdbs = engine.getVDBs();
- node.get(TYPE).set(ModelType.LIST);
-
+ protected VDBRepository getService(OperationContext context, PathAddress pathAddress) throws OperationFailedException {
+ ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_REPO);
+ return VDBRepository.class.cast(sc.getValue());
+ }
+
+ @Override
+ protected void executeOperation(VDBRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+ List<VDBMetaData> vdbs = repo.getVDBs();
for (VDBMetaData vdb:vdbs) {
node.add(MetadataMapper.wrap(vdb, node.add()));
}
}
-
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.describe(new ModelNode()));
+ }
}
-class GetTranslators extends QueryEngineOperationHandler{
+class GetTranslators extends TranslatorOperationHandler{
- protected GetTranslators(String operationName) {
- super(operationName);
+ protected GetTranslators() {
+ super("list-translators"); //$NON-NLS-1$
}
+
@Override
- protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
- List<VDBTranslatorMetaData> translators = engine.getTranslators();
- node.get(TYPE).set(ModelType.OBJECT);
-
+ protected void executeOperation(TranslatorRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+ List<VDBTranslatorMetaData> translators = repo.getTranslators();
for (VDBTranslatorMetaData t:translators) {
node.add(MetadataMapper.VDBTranslatorMetaDataMapper.wrap(t, node.add()));
}
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
- operationNode.get(REPLY_PROPERTIES, TYPE).set(ModelType.LIST);
- operationNode.get(REPLY_PROPERTIES, VALUE_TYPE).set(ModelType.OBJECT);
operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
+ operationNode.get(REPLY_PROPERTIES).add(MetadataMapper.VDBTranslatorMetaDataMapper.describe(new ModelNode()));
}
}
-class GetTranslator extends QueryEngineOperationHandler{
+class GetTranslator extends TranslatorOperationHandler{
- protected GetTranslator(String operationName) {
- super(operationName);
+ protected GetTranslator() {
+ super("get-translator"); //$NON-NLS-1$
}
@Override
- protected void executeOperation(RuntimeEngineDeployer engine, ModelNode operation, ModelNode node) throws OperationFailedException {
+ protected void executeOperation(TranslatorRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+
+ if (!operation.hasDefined(OperationsConstants.TRANSLATOR_NAME)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TRANSLATOR_NAME+MISSING)));
+ }
+
String translatorName = operation.get(OperationsConstants.TRANSLATOR_NAME).asString();
- VDBTranslatorMetaData translator = engine.getTranslator(translatorName);
+ VDBTranslatorMetaData translator = repo.getTranslatorMetaData(translatorName);
MetadataMapper.VDBTranslatorMetaDataMapper.wrap(translator, node);
}
@@ -538,7 +629,36 @@
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, REQUIRED).set(true);
operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TRANSLATOR_NAME));
- VDBTranslatorMetaDataMapper.describe(operationNode.get(REPLY_PROPERTIES));
+ operationNode.get(REPLY_PROPERTIES).set(VDBTranslatorMetaDataMapper.describe(new ModelNode()));
operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
}
+}
+
+class ListQueryEngines extends TranslatorOperationHandler{
+
+ protected ListQueryEngines() {
+ super("list-engines"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void executeOperation(TranslatorRepository repo, ModelNode operation, ModelNode node) throws OperationFailedException {
+
+ if (!operation.hasDefined(OperationsConstants.TRANSLATOR_NAME)) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.TRANSLATOR_NAME+MISSING)));
+ }
+
+ String translatorName = operation.get(OperationsConstants.TRANSLATOR_NAME).asString();
+
+ VDBTranslatorMetaData translator = repo.getTranslatorMetaData(translatorName);
+ MetadataMapper.VDBTranslatorMetaDataMapper.wrap(translator, node);
+ }
+
+ protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, TYPE).set(ModelType.STRING);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, REQUIRED).set(true);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.TRANSLATOR_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.TRANSLATOR_NAME));
+
+ operationNode.get(REPLY_PROPERTIES).set(VDBTranslatorMetaDataMapper.describe(new ModelNode()));
+ operationNode.get(REPLY_PROPERTIES, DESCRIPTION).set(bundle.getString(getReplyName()));
+ }
}
\ No newline at end of file
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/QueryEngineRemove.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -21,53 +21,59 @@
*/
package org.teiid.jboss;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
-import static org.teiid.jboss.Configuration.addAttribute;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
-import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.AbstractRemoveStepHandler;
import org.jboss.as.controller.OperationContext;
-import org.jboss.as.controller.OperationFailedException;
-import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.descriptions.DescriptionProvider;
+import org.jboss.as.naming.deployment.ContextNames;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceRegistry;
+import org.teiid.transport.LocalServerConnection;
-public class QueryEngineRemove extends AbstractAddStepHandler implements DescriptionProvider {
+public class QueryEngineRemove extends AbstractRemoveStepHandler implements DescriptionProvider {
@Override
+ protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) {
+
+ final ModelNode address = operation.require(OP_ADDR);
+ final PathAddress pathAddress = PathAddress.pathAddress(address);
+
+ String engineName = pathAddress.getLastElement().getValue();
+
+ final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
+ ServiceName serviceName = TeiidServiceNames.engineServiceName(engineName);
+ final ServiceController<?> controller = serviceRegistry.getService(serviceName);
+ if (controller != null) {
+ context.removeService(serviceName);
+ }
+
+ final ServiceName referenceFactoryServiceName = TeiidServiceNames.engineServiceName(engineName).append("reference-factory"); //$NON-NLS-1$
+ final ServiceController<?> referceFactoryController = serviceRegistry.getService(referenceFactoryServiceName);
+ if (referceFactoryController != null) {
+ context.removeService(referenceFactoryServiceName);
+ }
+
+ final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(LocalServerConnection.TEIID_RUNTIME_CONTEXT+engineName);
+ final ServiceController<?> binderController = serviceRegistry.getService(bindInfo.getBinderServiceName());
+ if (binderController != null) {
+ context.removeService(bindInfo.getBinderServiceName());
+ }
+ }
+
+ @Override
public ModelNode getModelDescription(Locale locale) {
final ResourceBundle bundle = IntegrationPlugin.getResourceBundle(locale);
final ModelNode operation = new ModelNode();
operation.get(OPERATION_NAME).set(REMOVE);
- operation.get(DESCRIPTION).set(bundle.getString("engine.remove")); //$NON-NLS-1$
- addAttribute(operation, Configuration.ENGINE_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.ENGINE_NAME+Configuration.DESC), ModelType.STRING, true, null);
+ operation.get(DESCRIPTION).set(bundle.getString(REMOVE+DESCRIBE));
return operation;
}
-
- @Override
- protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException {
- final String name = model.require(Configuration.ENGINE_NAME).asString();
- model.get(Configuration.ENGINE_NAME).set(name);
- }
-
- @Override
- protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
- final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
-
- final String engineName = model.require(Configuration.ENGINE_NAME).asString();
- final ServiceRegistry registry = context.getServiceRegistry(true);
- final ServiceController<?> controller = registry.getService(TeiidServiceNames.translatorServiceName(engineName));
- if (controller != null) {
- controller.setMode(ServiceController.Mode.REMOVE);
- }
- }
+
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidBootServicesAdd.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -117,6 +117,10 @@
}
populateBufferManager(operation, model);
//TODO: add cache model descriptions
+
+ // these are just place holders
+// model.get(Configuration.QUERY_ENGINE);
+// model.get(Configuration.TRANSLATOR);
}
@Override
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -45,22 +45,6 @@
private static final String ACTIVE_SESSION_COUNT = "active-session-count"; //$NON-NLS-1$
private static final String RUNTIME_VERSION = "runtime-version"; //$NON-NLS-1$
- private static final String REQUESTS_PER_SESSION = "requests-per-session"; //$NON-NLS-1$
- private static final String ACTIVE_SESSIONS = "active-sessions"; //$NON-NLS-1$
- private static final String REQUESTS_PER_VDB = "requests-per-vdb"; //$NON-NLS-1$
- private static final String LONG_RUNNING_QUERIES = "long-running-queries"; //$NON-NLS-1$
- private static final String TERMINATE_SESSION = "terminate-session";//$NON-NLS-1$
- private static final String CANCEL_QUERY = "cancel-query";//$NON-NLS-1$
- private static final String CACHE_TYPES = "cache-types";//$NON-NLS-1$
- private static final String CLEAR_CACHE = "clear-cache";//$NON-NLS-1$
- private static final String CACHE_STATISTICS = "cache-statistics";//$NON-NLS-1$
- private static final String WORKERPOOL_STATISTICS = "workerpool-statistics";//$NON-NLS-1$
- private static final String ACTIVE_TRANSACTIONS = "active-transactions";//$NON-NLS-1$
- private static final String TERMINATE_TRANSACTION = "terminate-transaction";//$NON-NLS-1$
- private static final String MERGE_VDBS = "merge-vdbs";//$NON-NLS-1$
- private static final String EXECUTE_QUERY = "execute-query";//$NON-NLS-1$
- private static final String GETVDBS = "getVDBs";//$NON-NLS-1$
- private static final String GETVDB = "getVDB";//$NON-NLS-1$
public static final String TEIID_SUBSYSTEM = "teiid"; //$NON-NLS-1$
private static TeiidSubsystemParser parser = new TeiidSubsystemParser();
@@ -92,10 +76,10 @@
TeiidBootServicesAdd.describeTeiidRoot(bundle, ATTRIBUTES, node);
node.get(CHILDREN, Configuration.QUERY_ENGINE, DESCRIPTION).set(bundle.getString(Configuration.QUERY_ENGINE+Configuration.DESC));
- node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(false);
+ node.get(CHILDREN, Configuration.QUERY_ENGINE, REQUIRED).set(true);
node.get(CHILDREN, Configuration.TRANSLATOR, DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
- node.get(CHILDREN, Configuration.TRANSLATOR, REQUIRED).set(false);
+ node.get(CHILDREN, Configuration.TRANSLATOR, REQUIRED).set(true);
return node;
}
@@ -113,8 +97,6 @@
node.get(DESCRIPTION).set(bundle.getString(Configuration.TRANSLATOR+Configuration.DESC));
node.get(HEAD_COMMENT_ALLOWED).set(true);
node.get(TAIL_COMMENT_ALLOWED).set(true);
-
- addAttribute(node, Configuration.TRANSLATOR_NAME, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
addAttribute(node, Configuration.TRANSLATOR_MODULE, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
return node;
}
@@ -141,57 +123,30 @@
engineSubsystem.registerOperationHandler(REMOVE, ENGINE_REMOVE, ENGINE_REMOVE, false);
- QueryEngineOperationHandler op;
engineSubsystem.registerReadOnlyAttribute(RUNTIME_VERSION, new GetRuntimeVersion(RUNTIME_VERSION), Storage.RUNTIME);
engineSubsystem.registerReadOnlyAttribute(ACTIVE_SESSION_COUNT, new GetActiveSessionsCount(ACTIVE_SESSION_COUNT), Storage.RUNTIME);
- op = new GetActiveSessions(ACTIVE_SESSIONS);
- engineSubsystem.registerOperationHandler(ACTIVE_SESSIONS, op, op);
+ // teiid level admin api operation handlers
+ new GetTranslator().register(teiidSubsystem);
+ new GetTranslators().register(teiidSubsystem);
+ new MergeVDBs().register(teiidSubsystem);
+ new ListVDBs().register(teiidSubsystem);
+ new GetVDB().register(teiidSubsystem);
- op = new GetRequestsPerSession(REQUESTS_PER_SESSION);
- engineSubsystem.registerOperationHandler(REQUESTS_PER_SESSION, op, op);
-
- op = new GetRequestsPerVDB(REQUESTS_PER_VDB);
- engineSubsystem.registerOperationHandler(REQUESTS_PER_VDB, op, op);
-
- op = new GetLongRunningQueries(LONG_RUNNING_QUERIES);
- engineSubsystem.registerOperationHandler(LONG_RUNNING_QUERIES, op, op);
-
- op = new TerminateSession(TERMINATE_SESSION);
- engineSubsystem.registerOperationHandler(TERMINATE_SESSION, op, op);
-
- op = new CancelQuery(CANCEL_QUERY);
- engineSubsystem.registerOperationHandler(CANCEL_QUERY, op, op);
-
- op = new CacheTypes(CACHE_TYPES);
- engineSubsystem.registerOperationHandler(CACHE_TYPES, op, op);
-
- op = new ClearCache(CLEAR_CACHE);
- engineSubsystem.registerOperationHandler(CLEAR_CACHE, op, op);
-
- op = new CacheStatistics(CACHE_STATISTICS);
- engineSubsystem.registerOperationHandler(CACHE_STATISTICS, op, op);
-
- op = new WorkerPoolStatistics(WORKERPOOL_STATISTICS);
- engineSubsystem.registerOperationHandler(WORKERPOOL_STATISTICS, op, op);
-
- op = new ActiveTransactions(ACTIVE_TRANSACTIONS);
- engineSubsystem.registerOperationHandler(ACTIVE_TRANSACTIONS, op, op);
-
- op = new TerminateTransaction(TERMINATE_TRANSACTION);
- engineSubsystem.registerOperationHandler(TERMINATE_TRANSACTION, op, op);
-
- op = new MergeVDBs(MERGE_VDBS);
- engineSubsystem.registerOperationHandler(MERGE_VDBS, op, op);
-
- op = new ExecuteQuery(EXECUTE_QUERY);
- engineSubsystem.registerOperationHandler(EXECUTE_QUERY, op, op);
-
- op = new GetVDBs(GETVDBS);
- engineSubsystem.registerOperationHandler(GETVDBS, op, op);
-
- op = new GetVDB(GETVDB);
- engineSubsystem.registerOperationHandler(GETVDB, op, op);
+ // engine level admin api handlers
+ new GetActiveSessions().register(engineSubsystem);
+ new GetRequestsPerSession().register(engineSubsystem);
+ new GetRequestsPerVDB().register(engineSubsystem);
+ new GetLongRunningQueries().register(engineSubsystem);
+ new TerminateSession().register(engineSubsystem);
+ new CancelQuery().register(engineSubsystem);
+ new CacheTypes().register(engineSubsystem);
+ new ClearCache().register(engineSubsystem);
+ new CacheStatistics().register(engineSubsystem);
+ new WorkerPoolStatistics().register(engineSubsystem);
+ new ActiveTransactions().register(engineSubsystem);
+ new TerminateTransaction().register(engineSubsystem);
+ new ExecuteQuery().register(engineSubsystem);
}
@Override
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -348,11 +348,11 @@
case SECURITY_DOMAIN_ELEMENT:
node.get(reader.getLocalName()).add(reader.getElementText());
break;
-
case JDBC_ELEMENT:
node.get(reader.getLocalName()).set(parseSocketConfiguration(reader));
break;
+
case ODBC_ELEMENT:
node.get(reader.getLocalName()).set(parseSocketConfiguration(reader));
break;
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -55,7 +55,6 @@
operation.get(OPERATION_NAME).set(ADD);
operation.get(DESCRIPTION).set(bundle.getString("translator.add")); //$NON-NLS-1$
- addAttribute(operation, Configuration.TRANSLATOR_NAME, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
addAttribute(operation, Configuration.TRANSLATOR_MODULE, ATTRIBUTES, bundle.getString(Configuration.TRANSLATOR_MODULE+Configuration.DESC), ModelType.STRING, true, null);
return operation;
}
@@ -75,7 +74,11 @@
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
- final String name = operation.require(Configuration.TRANSLATOR_NAME).asString();
+ final ModelNode address = operation.require(OP_ADDR);
+ final PathAddress pathAddress = PathAddress.pathAddress(address);
+
+ final String translatorName = pathAddress.getLastElement().getValue();
+
final String moduleName = operation.require(Configuration.TRANSLATOR_MODULE).asString();
final ServiceTarget target = context.getServiceTarget();
@@ -86,25 +89,32 @@
moduleId = ModuleIdentifier.create(moduleName);
module = Module.getCallerModuleLoader().loadModule(moduleId);
} catch (ModuleLoadException e) {
- throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName, name))); //$NON-NLS-1$
+ throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName, translatorName))); //$NON-NLS-1$
}
+
+ boolean added = false;
final ServiceLoader<ExecutionFactory> serviceLoader = module.loadService(ExecutionFactory.class);
if (serviceLoader != null) {
for (ExecutionFactory ef:serviceLoader) {
VDBTranslatorMetaData metadata = TranslatorUtil.buildTranslatorMetadata(ef, moduleName);
if (metadata == null) {
- throw new OperationFailedException( new ModelNode().set(IntegrationPlugin.Util.getString("error_adding_translator", name))); //$NON-NLS-1$
+ throw new OperationFailedException( new ModelNode().set(IntegrationPlugin.Util.getString("error_adding_translator", translatorName))); //$NON-NLS-1$
}
- if (name.equalsIgnoreCase(metadata.getName())) {
+ if (translatorName.equalsIgnoreCase(metadata.getName())) {
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("translator.added", metadata.getName())); //$NON-NLS-1$
TranslatorService translatorService = new TranslatorService(metadata);
ServiceBuilder<VDBTranslatorMetaData> builder = target.addService(TeiidServiceNames.translatorServiceName(metadata.getName()), translatorService);
builder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, translatorService.repositoryInjector);
builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
+ added = true;
}
}
}
+
+ if (!added) {
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString("translator.failed-to-load", translatorName, moduleName))); //$NON-NLS-1$
+ }
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/TranslatorRemove.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -23,25 +23,24 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_NAME;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
-import static org.teiid.jboss.Configuration.addAttribute;
-import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import org.jboss.as.controller.AbstractAddStepHandler;
+import org.jboss.as.controller.AbstractRemoveStepHandler;
import org.jboss.as.controller.OperationContext;
-import org.jboss.as.controller.OperationFailedException;
-import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceRegistry;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
-public class TranslatorRemove extends AbstractAddStepHandler implements DescriptionProvider {
+public class TranslatorRemove extends AbstractRemoveStepHandler implements DescriptionProvider {
@Override
public ModelNode getModelDescription(Locale locale) {
@@ -49,25 +48,23 @@
final ModelNode operation = new ModelNode();
operation.get(OPERATION_NAME).set(REMOVE);
operation.get(DESCRIPTION).set(bundle.getString("translator.remove")); //$NON-NLS-1$
- addAttribute(operation, Configuration.TRANSLATOR_NAME, REQUEST_PROPERTIES, bundle.getString(Configuration.TRANSLATOR_NAME+Configuration.DESC), ModelType.STRING, true, null);
return operation;
}
@Override
- protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException {
- final String translatorName = model.require(Configuration.TRANSLATOR_NAME).asString();
- model.get(Configuration.TRANSLATOR_NAME).set(translatorName);
- }
-
- @Override
- protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model,
- final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
-
- final String translatorName = model.require(Configuration.TRANSLATOR_NAME).asString();
- final ServiceRegistry registry = context.getServiceRegistry(true);
- final ServiceController<?> controller = registry.getService(TeiidServiceNames.translatorServiceName(translatorName));
+ protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) {
+
+ final ModelNode address = operation.require(OP_ADDR);
+ final PathAddress pathAddress = PathAddress.pathAddress(address);
+
+ String translatorName = pathAddress.getLastElement().getValue();
+
+ final ServiceRegistry registry = context.getServiceRegistry(true);
+ final ServiceName serviceName = TeiidServiceNames.translatorServiceName(translatorName);
+ final ServiceController<?> controller = registry.getService(serviceName);
if (controller != null) {
- controller.setMode(ServiceController.Mode.REMOVE);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("translator.removed", translatorName)); //$NON-NLS-1$
+ context.removeService(serviceName);
}
}
}
Modified: branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2011-09-02 20:49:18 UTC (rev 3445)
@@ -466,12 +466,6 @@
}
@Override
- public void mergeVDBs(String sourceVDBName, int sourceVDBVersion,
- String targetVDBName, int targetVDBVersion) throws AdminException {
- this.vdbRepository.mergeVDBs(sourceVDBName, sourceVDBVersion, targetVDBName, targetVDBVersion);
- }
-
- @Override
public List<List> executeQuery(final String vdbName, final int version, final String command, final long timoutInMilli) throws AdminException {
String user = "JOPR ADMIN"; //$NON-NLS-1$
@@ -773,22 +767,6 @@
this.securityDomainNames.add(domain);
}
- public List<VDBMetaData> getVDBs(){
- return this.vdbRepository.getVDBs();
- }
-
- public VDBMetaData getVDB(String vdbName, int version){
- return this.vdbRepository.getVDB(vdbName, version);
- }
-
- public List<VDBTranslatorMetaData> getTranslators(){
- return getTranslatorRepositoryInjector().getValue().getTranslators();
- }
-
- public VDBTranslatorMetaData getTranslator(String translatorName) {
- return getTranslatorRepositoryInjector().getValue().getTranslatorMetaData(translatorName);
- }
-
private DQPCore.ContextProvider getContextProvider() {
return new DQPCore.ContextProvider() {
@Override
Modified: branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2011-09-02 20:49:18 UTC (rev 3445)
@@ -33,6 +33,7 @@
datasource_not_found=Datasource {0} not found in the configuration.
sourcename_not_found=No source name {0} found in the model: {1}.{2}.{3}
vdb_file_not_found = VDB file {0} not found at the location specified.
+socket_not_enabled=Socket based remote JDBC protocol is not enabled.
no_operation=No operation found with given name = {0}
failed_to_remove=Failed to remove the deployment
@@ -146,43 +147,43 @@
susbsystem.add = Add the Teiid Subsystem
#engine managed operations
-RuntimeEngineDeployer.active-sessions.describe=List of all the current active sessions in the Teiid subsystem.
-RuntimeEngineDeployer.requests-per-session.describe=Current active requests in progress in the query engine for a given session identifier
-RuntimeEngineDeployer.requests-per-session.session.describe=The session Identifier
-RuntimeEngineDeployer.requests-per-vdb.describe=Current active requests in progress in the query engine for a given VDB name and its version.
-RuntimeEngineDeployer.requests-per-vdb.vdb_name.describe=VDB Name
-RuntimeEngineDeployer.requests-per-vdb.vdb_version.describe=VDB Version
-RuntimeEngineDeployer.long-running-queries.describe=Long running queries that exceeded the threshold set by the 'queryThresholdInSecs' configuration property.
-RuntimeEngineDeployer.terminate-session.describe=Terminate the session
-RuntimeEngineDeployer.terminate-session.session.describe=The session Identifier of session to be terminated
-RuntimeEngineDeployer.cancel-query.describe=Cancel the execution of the actively running query
-RuntimeEngineDeployer.cancel-query.session.describe=The session Identifier of the user
-RuntimeEngineDeployer.cancel-query.execution-id.describe=The Execution Identifier of the query
-RuntimeEngineDeployer.cache-types.describe=List the available cache types
+active-sessions.describe=List of all the current active sessions in the Teiid subsystem.
+requests-per-session.describe=Current active requests in progress in the query engine for a given session identifier
+requests-per-session.session.describe=The session Identifier
+requests-per-vdb.describe=Current active requests in progress in the query engine for a given VDB name and its version.
+requests-per-vdb.vdb_name.describe=VDB Name
+requests-per-vdb.vdb_version.describe=VDB Version
+long-running-queries.describe=Long running queries that exceeded the threshold set by the 'queryThresholdInSecs' configuration property.
+terminate-session.describe=Terminate the session
+terminate-session.session.describe=The session Identifier of session to be terminated
+cancel-query.describe=Cancel the execution of the actively running query
+cancel-query.session.describe=The session Identifier of the user
+cancel-query.execution-id.describe=The Execution Identifier of the query
+cache-types.describe=List the available cache types
-RuntimeEngineDeployer.clear-cache.describe=Clear the caches in the system of the given type
-RuntimeEngineDeployer.clear-cache.cache-type.describe=cache type to be cleared. (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
-RuntimeEngineDeployer.clear-cache.vdb-name.describe=VDB name
-RuntimeEngineDeployer.clear-cache.vdb_version.describe=VDB version
-RuntimeEngineDeployer.cache-statistics.describe=Get the cache statistics for the given cache type
-RuntimeEngineDeployer.cache-statistics.cache-type.describe=cache type (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
+clear-cache.describe=Clear the caches in the system of the given type
+clear-cache.cache-type.describe=cache type to be cleared. (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
+clear-cache.vdb-name.describe=VDB name
+clear-cache.vdb_version.describe=VDB version
+cache-statistics.describe=Get the cache statistics for the given cache type
+cache-statistics.cache-type.describe=cache type (PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE)
-RuntimeEngineDeployer.workerpool-statistics.describe=Get thread statistics worker pool
-RuntimeEngineDeployer.active-transactions.describe=Active Transactions in the Query Engine
+workerpool-statistics.describe=Get thread statistics worker pool
+active-transactions.describe=Active Transactions in the Query Engine
-RuntimeEngineDeployer.terminate-transaction.describe=Terminate the XA transaction
-RuntimeEngineDeployer.terminate-transaction.xid.describe=xid identifier of the XA transaction
-RuntimeEngineDeployer.merge-vdbs.describe=Merge Two VDBs
-RuntimeEngineDeployer.merge-vdbs.source-vdb-name.describe=Source VDB name
-RuntimeEngineDeployer.merge-vdbs.source-vdb-version.describe=Source VDB version number
-RuntimeEngineDeployer.merge-vdbs.target-vdb-name.describe=Target VDB name
-RuntimeEngineDeployer.merge-vdbs.target-vdb-version.describe=Target VDB version number
+terminate-transaction.describe=Terminate the XA transaction
+terminate-transaction.xid.describe=xid identifier of the XA transaction
+merge-vdbs.describe=Merge Two VDBs
+merge-vdbs.source-vdb-name.describe=Source VDB name
+merge-vdbs.source-vdb-version.describe=Source VDB version number
+merge-vdbs.target-vdb-name.describe=Target VDB name
+merge-vdbs.target-vdb-version.describe=Target VDB version number
-RuntimeEngineDeployer.execute-query.describe=Execute a sql query
-RuntimeEngineDeployer.execute-query.vdb-name.describe=vdb name
-RuntimeEngineDeployer.execute-query.vdb-version.describe=vdb version
-RuntimeEngineDeployer.execute-query.sql-query.describe=sql query to execute
-RuntimeEngineDeployer.execute-query.timeout-in-milli.describe=timeout
+execute-query.describe=Execute a sql query
+execute-query.vdb-name.describe=vdb name
+execute-query.vdb-version.describe=vdb version
+execute-query.sql-query.describe=sql query to execute
+execute-query.timeout-in-milli.describe=timeout
socket-binding.not_defined=Teiid socket binding not defined for JDBC or ODBC port.
@@ -193,4 +194,41 @@
translator.describe = Teiid Translators
translator.add = Add Teiid translator
translator.remove = Remove Teiid translator
-teiid-boot.add = Teiid boot services
\ No newline at end of file
+teiid-boot.add = Teiid boot serviceshitRatio.describe
+
+total-entries.describe = Total entries in Cache
+hit-ratio.describe = Cache Hit ratio
+request-count.describe=Total request count
+
+cache-types.cache-type.describe=cache type
+get-translators.reply.describe=Returns list of translators registered in the teiid container
+get-translator.reply.describe=Returns translator if found with given name
+active-session-count.reply.describe=Returns the count of active sessions
+runtime-version.reply.describe=Teiid runtime version
+list-vdbs.describe=List the available virtual databases in the system
+cancel-query.reply.describe=True if successful; false otherwise.
+clear-cache.vdb-version.describe=vdb version
+get-vdb.describe=Get the VDB with the given name and version
+get-vdb.vdb-name.describe=name of the vdb
+get-vdb.vdb-version.describe=vdb version
+requests-per-vdb.vdb-name.describe=vdb name
+requests-per-vdb.vdb-version.describe=vdb version
+remove.reply.describe=remove service
+remove.describe=remove service
+
+vdb-name.missing=Parameter "vdb-name" is required
+vdb-version.missing=Parameter "vdb-version" is required
+cache-type.missing=Parameter "cache-type" is required
+session.missing=Parameter "session" is required
+execution-id.missing=Parameter "execution-id" is required
+xid.missing=Parameter "xid" is required
+source-vdb-name.missing=Parameter "source-vdb-name" is required
+source-vdb-version.missing=Parameter "source-vdb-version" is required
+target-vdb-name.missing=Parameter "target-vdb-name" is required
+target-vdb-version.missing=Parameter "target-vdb-version" is required
+sql-query.missing=Parameter "sql-query" is required
+timeout-in-milli.missing=Parameter "timeout-in-milli" is required
+translator-name.missing=Parameter "translator-name" is required
+engine_service_not_found= Query Engine Service with name {0} is not found
+translator.removed = Translator "{0}" removed
+translator.failed-to-load = Translator "{0}" not found in the module "{1}"
\ No newline at end of file
Modified: branches/as7/metadata/pom.xml
===================================================================
--- branches/as7/metadata/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/metadata/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -43,6 +43,12 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
<artifactId>teiid-api</artifactId>
<scope>provided</scope>
</dependency>
Modified: branches/as7/pom.xml
===================================================================
--- branches/as7/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -273,6 +273,11 @@
<artifactId>teiid-client</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client</artifactId>
@@ -532,6 +537,7 @@
<module>jboss-integration</module>
<module>test-integration</module>
<module>client-jdk15</module>
+ <module>admin</module>
</modules>
<distributionManagement>
<repository>
Modified: branches/as7/runtime/pom.xml
===================================================================
--- branches/as7/runtime/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/runtime/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -33,6 +33,11 @@
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
<artifactId>teiid-engine</artifactId>
</dependency>
<dependency>
Modified: branches/as7/test-integration/pom.xml
===================================================================
--- branches/as7/test-integration/pom.xml 2011-09-02 20:37:43 UTC (rev 3444)
+++ branches/as7/test-integration/pom.xml 2011-09-02 20:49:18 UTC (rev 3445)
@@ -47,6 +47,10 @@
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-admin</artifactId>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client</artifactId>
More information about the teiid-commits
mailing list