Author: rareddy
Date: 2011-09-02 17:01:40 -0400 (Fri, 02 Sep 2011)
New Revision: 3447
Removed:
branches/as7/client/src/main/java/org/teiid/adminapi/Admin.java
branches/as7/client/src/main/java/org/teiid/adminapi/AdminComponentException.java
branches/as7/client/src/main/java/org/teiid/adminapi/AdminException.java
branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java
branches/as7/client/src/main/java/org/teiid/adminapi/AdminObject.java
branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java
branches/as7/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java
branches/as7/client/src/main/java/org/teiid/adminapi/CacheStatistics.java
branches/as7/client/src/main/java/org/teiid/adminapi/DataPolicy.java
branches/as7/client/src/main/java/org/teiid/adminapi/Model.java
branches/as7/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java
branches/as7/client/src/main/java/org/teiid/adminapi/Request.java
branches/as7/client/src/main/java/org/teiid/adminapi/Session.java
branches/as7/client/src/main/java/org/teiid/adminapi/Transaction.java
branches/as7/client/src/main/java/org/teiid/adminapi/Translator.java
branches/as7/client/src/main/java/org/teiid/adminapi/VDB.java
branches/as7/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java
Log:
TEIID-1720: Removing the admin classes from client
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/Admin.java 2011-09-02 20:55:50
UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/Admin.java 2011-09-02 21:01:40
UTC (rev 3447)
@@ -1,298 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-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;
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/AdminComponentException.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/AdminComponentException.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/AdminComponentException.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-
-/**
- * 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);
- }
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/AdminException.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/AdminException.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/AdminException.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,125 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-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);
- }
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,343 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-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
-
- }
- }
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/AdminObject.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/AdminObject.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/AdminObject.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-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);
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/AdminPlugin.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-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$
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-
-/**
- * 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);
- }
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/CacheStatistics.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/CacheStatistics.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/CacheStatistics.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi;
-
-public interface CacheStatistics extends AdminObject {
-
- double getHitRatio();
-
- int getTotalEntries();
-
- int getRequestCount();
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/DataPolicy.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/DataPolicy.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/DataPolicy.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,121 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi;
-
-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();
- }
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/Model.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/Model.java 2011-09-02 20:55:50
UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/Model.java 2011-09-02 21:01:40
UTC (rev 3447)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-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
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,137 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-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();
-
-
-
-}
-
-
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/Request.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/Request.java 2011-09-02 20:55:50
UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/Request.java 2011-09-02 21:01:40
UTC (rev 3447)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-
-
-
-/**
- * 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();
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/Session.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/Session.java 2011-09-02 20:55:50
UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/Session.java 2011-09-02 21:01:40
UTC (rev 3447)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-
-/**
- * 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
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/Transaction.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/Transaction.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/Transaction.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-
-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();
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/Translator.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/Translator.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/Translator.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi;
-
-
-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();
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/VDB.java 2011-09-02 20:55:50 UTC
(rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/VDB.java 2011-09-02 21:01:40 UTC
(rev 3447)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.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();
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi;
-
-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();
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,187 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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;
-
-(a)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;
- }
-
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/CacheStatisticsMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import 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();
- }
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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 ;
- void mergeVDBs(String sourceVDBName, int sourceVDBVersion, String targetVDBName, int
targetVDBVersion) 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;
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,291 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.*;
-
-import org.teiid.adminapi.DataPolicy;
-
-
-(a)XmlAccessorType(XmlAccessType.NONE)
-@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;
- }
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,89 +0,0 @@
-/*
- * 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);
-}
-
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/MetadataMapper.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,1071 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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 = "hitRatio"; //$NON-NLS-1$
- private static final String TOTAL_ENTRIES = "totalEntries"; //$NON-NLS-1$
- private static final String REQUEST_COUNT = "requestCount"; //$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;
- }
-}
-
-
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,321 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.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;
-
-
-(a)XmlAccessorType(XmlAccessType.NONE)
-@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;
- }
- }
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/ModelNodeConstants.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-
-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$
-
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,57 +0,0 @@
-/*
- * 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);
- }
- }
-
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,214 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.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();
- }
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.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>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.NONE)
-@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
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,160 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.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();
- }
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,217 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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;
- }
-
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,85 +0,0 @@
-/*
- * 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;
-
-(a)XmlAccessorType(XmlAccessType.NONE)
-@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
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.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();
- }
-
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2011-09-02
20:55:50 UTC (rev 3446)
+++ branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,343 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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;
-
-
-(a)XmlAccessorType(XmlAccessType.NONE)
-@XmlType(name = "", propOrder = {
- "description",
- "JAXBProperties",
- "models",
- "translators",
- "dataPolicies"
-})
-@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$
- }
-}
Deleted: branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,310 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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;
-
-@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;
- }
- }
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/VDBTranslatorMetaData.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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;
-
-
-(a)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;
- }
-}
Deleted:
branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
===================================================================
---
branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import 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();
- }
-
-}
-
Deleted:
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
===================================================================
---
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.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$
- }
-}
Deleted: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
===================================================================
---
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.teiid.adminapi.Model;
-
-@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());
- }
-}
Deleted:
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java
===================================================================
---
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestRequestMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,134 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import 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;
-@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));
- }
-
-}
Deleted:
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
===================================================================
---
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,137 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.jboss.dmr.ModelNode;
-import org.junit.Test;
-
-@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));
- }
-}
Deleted:
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
===================================================================
---
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import org.jboss.dmr.ModelNode;
-import org.junit.Test;
-
-@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));
- }
-}
Deleted: branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
---
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,232 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import 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;
-
-@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);
- }
-}
Deleted:
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java
===================================================================
---
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java 2011-09-02
20:55:50 UTC (rev 3446)
+++
branches/as7/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetadataParser.java 2011-09-02
21:01:40 UTC (rev 3447)
@@ -1,17 +0,0 @@
-package org.teiid.adminapi.impl;
-
-import java.io.FileInputStream;
-
-import org.junit.Test;
-import org.teiid.core.util.UnitTestUtil;
-
-@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);
- }
-}