teiid SVN: r1909 - in trunk/common-core/src: main/java/com/metamatrix/common/protocol and 11 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 14:27:44 -0500 (Thu, 04 Mar 2010)
New Revision: 1909
Added:
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/SymmetricCryptor.java
Removed:
trunk/common-core/src/main/java/com/metamatrix/common/classloader/
trunk/common-core/src/main/java/com/metamatrix/common/jdbc/
trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java
trunk/common-core/src/main/java/com/metamatrix/common/protocol/MetaMatrixURLStreamHandlerFactory.java
trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java
trunk/common-core/src/main/java/com/metamatrix/common/protocol/classpath/
trunk/common-core/src/main/java/com/metamatrix/common/protocol/jar/
trunk/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/
trunk/common-core/src/main/java/com/metamatrix/common/protocol/mmrofile/
trunk/common-core/src/main/java/com/metamatrix/common/util/ByteArrayHelper.java
trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java
trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/CryptoUtil.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Decryptor.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Encryptor.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/PasswordChangeUtility.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/cipher/
trunk/common-core/src/main/java/com/metamatrix/core/io/
trunk/common-core/src/main/java/com/metamatrix/core/util/DateUtil.java
trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtilities.java
trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java
trunk/common-core/src/main/java/com/metamatrix/core/vdb/VDBStatus.java
trunk/common-core/src/test/java/com/metamatrix/common/classloader/
trunk/common-core/src/test/java/com/metamatrix/common/jdbc/
trunk/common-core/src/test/java/com/metamatrix/common/protocol/
trunk/common-core/src/test/java/com/metamatrix/common/util/TestByteArrayHelper.java
trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestPasswordChangeUtility.java
trunk/common-core/src/test/java/com/metamatrix/core/util/TestStringUtilities.java
trunk/common-core/src/test/java/com/metamatrix/core/util/TestZipFileUtil.java
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
trunk/common-core/src/main/java/com/metamatrix/common/util/ApplicationInfo.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java
trunk/common-core/src/main/java/com/metamatrix/core/CoreConstants.java
trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java
trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java
trunk/common-core/src/main/java/com/metamatrix/core/vdb/VdbConstants.java
trunk/common-core/src/test/java/com/metamatrix/api/exception/TestExceptionHolder.java
trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestDhKeyGenerator.java
trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java
Log:
TEIID-833 committing JCA merge
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/protocol/MMURLConnection.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,77 +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 com.metamatrix.common.protocol;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-
-
-/**
- * Base URL Connection Class
- * @since 4.4
- */
-public abstract class MMURLConnection extends URLConnection {
- protected static final String READ = "read"; //$NON-NLS-1$
- protected static final String WRITE = "write"; //$NON-NLS-1$
- protected static final String LIST = "list"; //$NON-NLS-1$
- protected static final String DELETE = "delete"; //$NON-NLS-1$
-
- public static final String FILE_LIST_SORT = "sort"; //$NON-NLS-1$
- public static final String DATE = "date"; //$NON-NLS-1$
- public static final String ALPHA = "alpha"; //$NON-NLS-1$
- public static final String REVERSEALPHA = "reversealpha"; //$NON-NLS-1$
-
-
- protected String action = READ;
- protected Properties props = null;
-
- public MMURLConnection(URL url) {
- super(url);
-
- // If the URL has any query part parse it and handle it.
- String query = url.getQuery();
- if (query != null) {
- StringTokenizer st = new StringTokenizer(query, "&"); //$NON-NLS-1$
- while (st.hasMoreTokens()) {
- String option = st.nextToken();
- int index = option.indexOf('=');
- if (index != -1) {
- String task = option.substring(0, index);
- String value = option.substring(index+1);
- if (task.equals("action")) { //$NON-NLS-1$
- action = value;
- }
- else {
- if (props == null) {
- props = new Properties();
- }
- props.setProperty(task, value);
- }
- }
- }
- }
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/protocol/MetaMatrixURLStreamHandlerFactory.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/protocol/MetaMatrixURLStreamHandlerFactory.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/protocol/MetaMatrixURLStreamHandlerFactory.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,65 +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 com.metamatrix.common.protocol;
-
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-
-import com.metamatrix.common.protocol.classpath.ClasspathURLConnection;
-import com.metamatrix.common.protocol.jar.JarURLConnection;
-import com.metamatrix.common.protocol.mmfile.MMFileURLConnection;
-import com.metamatrix.common.protocol.mmrofile.MMROFileURLConnection;
-
-
-/**
- * A facory class for registering the "classpath:" and "mmfile:" protocol based URL.
- * since we can not register in app servers currently this only used for testing.
- * @since 4.4
- */
-public class MetaMatrixURLStreamHandlerFactory implements URLStreamHandlerFactory {
- private static final String DEFAULT_HANDLER_PKG = "sun.net.www.protocol"; //$NON-NLS-1$
-
- public URLStreamHandler createURLStreamHandler(String protocol) {
- if (protocol.equals(ClasspathURLConnection.PROTOCOL)) {
- return new com.metamatrix.common.protocol.classpath.Handler();
- }
- else if (protocol.equals(MMFileURLConnection.PROTOCOL)) {
- return new com.metamatrix.common.protocol.mmfile.Handler();
- }
- else if (protocol.equals(MMROFileURLConnection.PROTOCOL)) {
- return new com.metamatrix.common.protocol.mmrofile.Handler();
- }
- else if (protocol.equals(JarURLConnection.PROTOCOL)) {
- return new com.metamatrix.common.protocol.jar.Handler();
- }
- else {
- String handlerName = DEFAULT_HANDLER_PKG+"."+protocol+".Handler"; //$NON-NLS-1$ //$NON-NLS-2$
- try {
- Class handlerClass = Class.forName(handlerName);
- return (URLStreamHandler)handlerClass.newInstance();
- } catch (Exception e) {
- // eat it and return null
- }
- }
- return null;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,392 +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 com.metamatrix.common.protocol;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.Authenticator;
-import java.net.MalformedURLException;
-import java.net.PasswordAuthentication;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
-
-import com.metamatrix.common.protocol.classpath.ClasspathURLConnection;
-import com.metamatrix.common.protocol.mmfile.MMFileURLConnection;
-import com.metamatrix.common.protocol.mmrofile.MMROFileURLConnection;
-import com.metamatrix.core.io.FileUrl;
-
-/**
- * Helper class to build the URL objects from the strings. Since as an
- * application we do not know if we are embedded or we are in our own server, we
- * can not install the "URLStreamHandlers" in the VM, as they can be only
- * installed once per VM, as an alternative, the stream handler must be
- * specified at the time URL it is constructed. This class will help us to this
- * code at one place.
- *
- * Here inspect the given string and build the correct type of URL with correct
- * handler.
- *
- * @since 4.4
- */
-public class URLHelper {
- private static final String SEPARATOR = ":"; //$NON-NLS-1$
-
- static {
- // Very important that this property is set, so that loading of
- // custom extension module URLHandlers will work
-
- String propKey = "java.protocol.handler.pkgs"; //$NON-NLS-1$
- String directory = "com.metamatrix.common.protocol"; //$NON-NLS-1$
-
- String value = System.getProperty(propKey);
- if (value == null || value.trim().length() == 0) {
- System.setProperty(propKey, directory);
- } else if (value.indexOf(directory) < 0) {
- value = value + "|" + directory; //$NON-NLS-1$
- System.setProperty(propKey, value);
- }
- }
-
- /**
- * Construct the URL based on the String
- *
- * @param url
- * @return
- * @throws MalformedURLException
- * @since 4.4
- */
- public static URL buildURL(String url) throws MalformedURLException {
-
- if (url == null) {
- throw new MalformedURLException();
- }
-
- url = convertBackSlashes(url);
-
- if (url.startsWith(ClasspathURLConnection.PROTOCOL + SEPARATOR)) {
- String filename = url.substring((ClasspathURLConnection.PROTOCOL + SEPARATOR).length());
- return new URL(ClasspathURLConnection.PROTOCOL,"", -1, filename, new com.metamatrix.common.protocol.classpath.Handler()); //$NON-NLS-1$
- } else if (url.startsWith(MMFileURLConnection.PROTOCOL + SEPARATOR)) {
- String filename = url.substring((MMFileURLConnection.PROTOCOL + SEPARATOR).length());
- return new URL(MMFileURLConnection.PROTOCOL,"", -1, filename, new com.metamatrix.common.protocol.mmfile.Handler()); //$NON-NLS-1$
- } else if (url.startsWith(MMROFileURLConnection.PROTOCOL + SEPARATOR)) {
- String filename = url.substring((MMROFileURLConnection.PROTOCOL + SEPARATOR).length());
- return new URL(MMROFileURLConnection.PROTOCOL,"", -1, filename, new com.metamatrix.common.protocol.mmrofile.Handler()); //$NON-NLS-1$
- }
- else if (isFile(url)) {
- String filename = extractFileName(url);
- return new URL(MMFileURLConnection.PROTOCOL,"", -1, filename, new com.metamatrix.common.protocol.mmfile.Handler()); //$NON-NLS-1$
- }
- return new URL(url);
- }
-
- public static URL buildURL(URL context, String url)
- throws MalformedURLException {
-
- if (url == null) {
- throw new MalformedURLException();
- }
-
- if (context == null) {
- return buildURL(url);
- }
-
- url = convertBackSlashes(url);
-
- if (url.startsWith(ClasspathURLConnection.PROTOCOL + SEPARATOR)) {
- String filename = url.substring((ClasspathURLConnection.PROTOCOL + SEPARATOR).length());
- return new URL(ClasspathURLConnection.PROTOCOL,"", -1, filename, new com.metamatrix.common.protocol.classpath.Handler()); //$NON-NLS-1$
- } else if (url.startsWith(MMFileURLConnection.PROTOCOL + SEPARATOR)) {
- String filename = url.substring((MMFileURLConnection.PROTOCOL + SEPARATOR).length());
- return new URL(MMFileURLConnection.PROTOCOL,"", -1, filename, new com.metamatrix.common.protocol.mmfile.Handler()); //$NON-NLS-1$
- } else if (url.startsWith(MMROFileURLConnection.PROTOCOL + SEPARATOR)) {
- String filename = url.substring((MMROFileURLConnection.PROTOCOL + SEPARATOR).length());
- return new URL(MMROFileURLConnection.PROTOCOL,"", -1, filename, new com.metamatrix.common.protocol.mmrofile.Handler()); //$NON-NLS-1$
- } else if (isFile(url)) {
- String filename = extractFileName(url);
- String contextURL = context.toString();
-
- if (contextURL.startsWith(ClasspathURLConnection.PROTOCOL+ SEPARATOR)) {
- return new URL(context, filename,new com.metamatrix.common.protocol.classpath.Handler());
- } else if (contextURL.startsWith(MMFileURLConnection.PROTOCOL+ SEPARATOR)) {
- return new URL(context, filename,new com.metamatrix.common.protocol.mmfile.Handler());
- } else if (contextURL.startsWith(MMROFileURLConnection.PROTOCOL+ SEPARATOR)) {
- return new URL(URLHelper.buildURL(context.getPath()), filename,new com.metamatrix.common.protocol.mmfile.Handler());
- }
- }
- return new URL(context, url);
-
- }
-
- public static URL buildURL(URL url) {
- try {
- return buildURL(url.toExternalForm());
- } catch (MalformedURLException e) {
- // since it came as url it should not have any issues with this
- }
- return null;
- }
-
- /**
- * Determines whether a URL object resolves to a valid url. This will work
- * for any protocol (file, HTTP, etc.).
- *
- * @param url
- * @param userName
- * @param password
- * @param verifyHostname whether to verify hostname for HTTPS connection
- * @return resolved boolean
- * @throws MalformedURLException, IOException
- * @since 5.1
- */
- public static boolean resolveUrl(final URL url, final String userName, final String password, boolean verifyHostname) throws MalformedURLException, IOException{
- if(userName != null && userName.length() != 0 && password != null) {
- Authenticator.setDefault( new Authenticator() {
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(userName, password.toCharArray());
- }
- });
- }
- return resolveUrl(url, verifyHostname);
- }
-
- /**
- * Determines whether a URL object resolves to a valid url. This will work
- * for any protocol (file, HTTP, etc.).
- *
- * @param url
- * @return resolved boolean
- * @throws MalformedURLException, IOException
- * @since 5.1
- */
- public static boolean resolveUrl(final URL url) throws MalformedURLException, IOException{
- return resolveUrl(url, true);
- }
-
- /**
- * Determines whether a URL object resolves to a valid url. This will work
- * for any protocol (file, HTTP, etc.).
- *
- * @param url
- * @param verifyHostname whether to verify hostname for HTTPS connection
- * @return resolved boolean
- * @throws MalformedURLException, IOException
- * @since 5.5
- */
- public static boolean resolveUrl(final URL url, boolean verifyHostname) throws MalformedURLException, IOException{
- boolean resolved = true;
- if (url==null){
- return resolved;
- }
- String nextLine;
- URLConnection urlConn = null;
- InputStreamReader inStream = null;
- BufferedReader buff = null;
- // Add a time-out here....
- long timeOut = 30000;
-
- long startTime = System.currentTimeMillis();
- long deltaTime = 0;
- try {
- urlConn = url.openConnection();
- if(!verifyHostname && urlConn instanceof HttpsURLConnection) {
- ((HttpsURLConnection)urlConn).setHostnameVerifier(new HostnameVerifier() {
- public boolean verify(String arg, SSLSession session) {
- return true;
- }
- });
- }
- inStream = new InputStreamReader(urlConn.getInputStream());
- buff = new BufferedReader(inStream);
- boolean keepReading = true;
- // Read and print the lines from index.html
- while (keepReading ) {
- nextLine = buff.readLine();
- if (nextLine != null) {
-
- } else {
- break;
- }
- deltaTime = System.currentTimeMillis() - startTime;
- if( deltaTime > timeOut ) {
- keepReading = false;
- resolved = false;
- }
- }
- } finally {
- if (inStream != null){
- inStream.close();
- }
- }
-
- return resolved;
- }
-
- /**
- * Download the content from the given URL and save it into the specified file.
- * @param url URL of the file to be saved
- * @param filePath the full path of the file name
- * @param userName user name if authentication is required
- * @param password password if authentication is required
- * @param verifyHostname whether to verify hostname for HTTPS connection
- * @return the file created
- * @throws MalformedURLException
- * @throws IOException
- * @since 5.5
- */
- public static File createFileFromUrl(final URL url,
- final String filePath, final String userName, final String password, boolean verifyHostname) throws MalformedURLException, IOException{
- if(userName != null && userName.length() != 0 && password != null) {
- Authenticator.setDefault( new Authenticator() {
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(userName, password.toCharArray());
- }
- });
- }
- File file = null;
- String tempDir = System.getProperty("java.io.tmpdir");//$NON-NLS-1$
- if(filePath.indexOf("/") != -1 || filePath.indexOf("\\") != -1 ) {//$NON-NLS-1$//$NON-NLS-2$
-
- int lastPart = filePath.lastIndexOf("/");//$NON-NLS-1$
- if(lastPart == -1) {
- lastPart = filePath.lastIndexOf("\\");//$NON-NLS-1$
- }
- String relativeDir = filePath.substring(0, lastPart);
- File dir = new File(new File(tempDir), relativeDir);
- if(!dir.exists()) {
- dir.mkdirs();
- }
- file = new File(dir, filePath.substring(lastPart + 1));
- }else{
- file = new File(new File(tempDir), filePath);
- }
- return createFileFromUrlInternal(url, new FileUrl(file.toURI()), verifyHostname);
- }
-
- /**
- * Build a {@link java.io.File} from a {@link java.net.URL} object.
- *
- * @param url
- * @param fileNamePrefix
- * @param fileNameSuffix
- * @return File
- * @since 5.1
- */
- public static File createFileFromUrl(final URL url,
- final String fileNamePrefix,
- final String fileNameSuffix) throws MalformedURLException, IOException{
-
- return createFileFromUrlInternal(url, FileUrl.createTempFile(fileNamePrefix,fileNameSuffix), true);
- }
-
- private static File createFileFromUrlInternal(final URL url, final File file, boolean verifyHostname) throws MalformedURLException, IOException{
- String nextLine;
- URLConnection urlConn = null;
- InputStreamReader inStream = null;
- BufferedReader buff = null;
- FileWriter fw = null;
- BufferedWriter bw = null;
- try {
- file.deleteOnExit();
- ((FileUrl)file).setOriginalUrlString(url.toString());
- fw = new FileWriter(file);
- bw = new BufferedWriter(fw);
- urlConn = url.openConnection();
- if(!verifyHostname && urlConn instanceof HttpsURLConnection) {
- ((HttpsURLConnection)urlConn).setHostnameVerifier(new HostnameVerifier() {
- public boolean verify(String arg, SSLSession session) {
- return true;
- }
- });
- }
- inStream = new InputStreamReader(urlConn.getInputStream());
- buff = new BufferedReader(inStream);
-
- // Read and print the lines from index.html
- while (true) {
- nextLine = buff.readLine();
- if (nextLine != null) {
- bw.write(nextLine);
- } else {
- break;
- }
- }
- } finally {
- if (inStream!=null){
- inStream.close();
- }
- if (bw!=null){
- bw.close();
- }
- }
-
- return file;
- }
-
- static boolean isFile(String file) {
- return extractFileName(file) != null;
- }
-
- static String extractFileName(String file) {
-
- if (file.matches("^(\\w){2,}:.*")) { //$NON-NLS-1$
- // Handles URLs - No conversion nessasary
- // http://lib/foo.txt - currently do not support, converts to local
- // host with absolute path
- // file://lib/foo.txt
- // file:///c:/lib/foo.txt
- return null;
- } else if (file.matches("^\\/.*")) { //$NON-NLS-1$
- // Handles absolute paths- it can be file or URL depending upon
- // context Conversion needed
- // /lib/foo.txt
- return file;
- } else if (file.matches("^\\w:[\\\\,\\/].*")) { //$NON-NLS-1$
- // Handles windows absolute path - no conversion needed
- // c:\\lib\\foo.txt
- // c:/lib.foo.txt
- file = file.replaceAll("\\\\", "\\/"); //$NON-NLS-1$ //$NON-NLS-2$
- return "/" + file; //$NON-NLS-1$
- } else if (file.matches("^(\\.)+\\/.*|^\\w+\\/.*|^\\w+.*")) { //$NON-NLS-1$
- // Handles relative paths - these can be urls or files - conversion
- // nessasary
- // ./lib/foo.txt
- // ../lib/foo.txt
- // lib/foo.txt
- return file;
- }
- return null;
- }
-
- static String convertBackSlashes(String str) {
- return str.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -41,6 +41,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -137,6 +138,15 @@
private static Map<Class<?>, ValueCache<?>> valueMaps = new HashMap<Class<?>, ValueCache<?>>(128);
public static final int MAX_STRING_LENGTH = 4000;
+
+ public static final class DataTypeAliases {
+ public static final String VARCHAR = "varchar"; //$NON-NLS-1$
+ public static final String TINYINT = "tinyint"; //$NON-NLS-1$
+ public static final String SMALLINT = "smallint"; //$NON-NLS-1$
+ public static final String BIGINT = "bigint"; //$NON-NLS-1$
+ public static final String REAL = "real"; //$NON-NLS-1$
+ public static final String DECIMAL = "decimal"; //$NON-NLS-1$
+ }
public static final class DefaultDataTypes {
public static final String STRING = "string"; //$NON-NLS-1$
@@ -216,7 +226,7 @@
/** Base data type names and classes, Type class --> Type name */
private static Map<Class, String> dataTypeClasses = new LinkedHashMap<Class, String>(128);
- private static Set<String> DATA_TYPE_NAMES = Collections.unmodifiableSet(dataTypeNames.keySet());
+ private static Set<String> DATA_TYPE_NAMES;
private static Set<Class> DATA_TYPE_CLASSES = Collections.unmodifiableSet(dataTypeClasses.keySet());
@@ -490,6 +500,13 @@
DataTypeManager.addDataType(DefaultDataTypes.OBJECT, DefaultDataClasses.OBJECT);
DataTypeManager.addDataType(DefaultDataTypes.NULL, DefaultDataClasses.NULL);
DataTypeManager.addDataType(DefaultDataTypes.BLOB, DefaultDataClasses.BLOB);
+ DATA_TYPE_NAMES = Collections.unmodifiableSet(new LinkedHashSet<String>(dataTypeNames.keySet()));
+ dataTypeNames.put(DataTypeAliases.BIGINT, DefaultDataClasses.LONG);
+ dataTypeNames.put(DataTypeAliases.DECIMAL, DefaultDataClasses.BIG_DECIMAL);
+ dataTypeNames.put(DataTypeAliases.REAL, DefaultDataClasses.FLOAT);
+ dataTypeNames.put(DataTypeAliases.SMALLINT, DefaultDataClasses.SHORT);
+ dataTypeNames.put(DataTypeAliases.TINYINT, DefaultDataClasses.BYTE);
+ dataTypeNames.put(DataTypeAliases.VARCHAR, DefaultDataClasses.STRING);
if (USE_VALUE_CACHE) {
valueMaps.put(DefaultDataClasses.BOOLEAN, new ValueCache<Boolean>() {
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/ApplicationInfo.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/ApplicationInfo.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/ApplicationInfo.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -27,7 +27,9 @@
import java.io.InputStream;
import java.io.Serializable;
import java.net.URL;
+import java.text.DateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
@@ -37,7 +39,7 @@
import java.util.StringTokenizer;
import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.DateUtil;
+import com.metamatrix.core.util.ObjectConverterUtil;
public final class ApplicationInfo implements Serializable {
@@ -123,7 +125,7 @@
String classPath = getClassPath();
StringBuffer sb = new StringBuffer();
- sb.append("\nDate: " + DateUtil.getCurrentDateAsString());//$NON-NLS-1$
+ sb.append("\nDate: " + DateFormat.getDateInstance().format(new Date()));//$NON-NLS-1$
sb.append( LINE_SEPARATOR );
Map pathResults = new HashMap();
@@ -187,7 +189,7 @@
sb.append("Patch " + url.getFile() + ":"); //$NON-NLS-1$ //$NON-NLS-2$
sb.append( LINE_SEPARATOR );
InputStream is = url.openStream();
- byte[] data = ByteArrayHelper.toByteArray(is);
+ byte[] data = ObjectConverterUtil.convertToByteArray(is);
sb.append(new String(data));
sb.append("-------------------------------------");//$NON-NLS-1$
sb.append( LINE_SEPARATOR );
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/ByteArrayHelper.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/ByteArrayHelper.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/ByteArrayHelper.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,179 +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 com.metamatrix.common.util;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class ByteArrayHelper {
-
- /**
- * <p>The default size of each temporary byte array that is instantiated
- * to buffer data from an InputStream, in the
- * {@link #toByteArray(InputStream)}method.</p>
- *
- * <p>Ideally, this number
- * should be big enough that only one byte array is needed, but
- * small enough that wasted memory isn't allocated. If the first
- * temp array is filled, then a second one of this size will be
- * created, and so on until all of the stream is read.</p>
- */
- public static final int CHUNK_SIZE = 32000;
-
- /**
- * <p>Reads data from the file and returns it as a
- * byte array. The returned byte array is exactly filled with the data from the
- * InputStream, with no space left over.</p>
- *
- * @param file data to be converted to a byte array
- * @return byte array exactly filled with data; no leftover space
- * @throws IOException if there is an Exception reading from the InputStream
- */
- public static byte[] toByteArray(File file) throws IOException {
-
- FileInputStream fis = null;
- try {
- fis = new FileInputStream(file);
- return ByteArrayHelper.toByteArray(fis);
- } finally {
- if (fis != null) {
- fis.close();
- }
- }
- }
- /**
- * <p>Reads binary data from the InputStream and returns it as a
- * byte array. The InputStream is not closed in this method.
- * The returned byte array is exactly filled with the data from the
- * InputStream, with no space left over.</p>
- *
- * <p>If the amount of data in the input stream is known, use
- * {@link #toByteArray(InputStream, int) toByteArray(InputStream, int)}.
- * </p>
- * @param stream data to be converted to a byte array
- * @return byte array exactly filled with data; no leftover space
- * @throws IOException if there is an Exception reading from the InputStream
- */
- public static byte[] toByteArray(InputStream stream) throws IOException {
- return toByteArray(stream, CHUNK_SIZE);
- }
-
- /**
- * <p>Reads binary data from the InputStream and returns it as a
- * byte array. The InputStream is not closed in this method.
- * The returned byte array is exactly filled with the data from the
- * InputStream, with no space left over.</p>
- *
- * <p>The chunkSize parameter controls the size of intermediate
- * byte array(s) that are used to buffer the stream data.
- * Ideally, this number
- * should be big enough that only one byte array is needed, but
- * small enough that wasted memory isn't allocated. If the first
- * temp array is filled, then a second one of this size will be
- * created, and so on until all of the stream is read. Then, data
- * will be copied into the final, correctly-size byte array which is
- * returned form this method.</p>
- *
- * <p>If the size of the input stream is known beforehand (for example,
- * if the size of a file represented by a FileInputStream is known), then
- * that size <i>plus one</i> should be passed in as the chunkSize.</p>
- *
- * <p>Implementation notes: If more than one intermediate byte array
- * is needed, an ArrayList is instantiated to hold the intermediate byte
- * arrays until all data is read from the stream. Afterward, the
- * ArrayList is iterated through; the intermediate array(s) are
- * copied using System.arrayCopy into the final byte array.</p>
- *
- * @param stream data to be converted to a byte array
- * @param chunkSize size of intermediate byte array(s) to buffer data
- * @return byte array exactly filled with data; no leftover space
- * @throws IOException if there is an Exception reading from the InputStream
- */
- public static byte[] toByteArray(InputStream stream, int chunkSize) throws IOException {
-
- byte[] data = null;
- ArrayList dataArrays = null;
-
- //intermediate byte array(s) reference
- data= new byte[chunkSize];
-
- int pos= 0;
- int finalSize = 0;
- while (stream.available() > 0 ) {
- int n= stream.read(data, pos, data.length - pos);
- if (n>=0){ //n could equal -1 for some streams, indicating EOF
- pos += n;
- }
-
- if (data.length - pos == 0 ){
- if ( dataArrays == null){
- dataArrays = new ArrayList();
- }
- dataArrays.add(data);
- data= new byte[chunkSize];
- pos = 0;
- finalSize = finalSize + chunkSize;
- }
-
- }
-
- finalSize = finalSize + pos;
- //final, correctly-sized byte array
- byte[] result = new byte[finalSize];
- int offSet = 0;
-
- if (dataArrays != null){
- Iterator i = dataArrays.iterator();
- byte[] tempArray = null;
- for (; i.hasNext(); offSet=offSet+chunkSize){
- tempArray = (byte[])i.next();
- System.arraycopy(tempArray,0,result,offSet,chunkSize);
- }
- }
-
- System.arraycopy(data,0,result,offSet,pos);
-
- return result;
- }
-
-
- /**
- * converts the byte array to an input stream
- */
- public static InputStream toInputStream(byte[] data) throws Exception {
- ByteArrayInputStream bais = new ByteArrayInputStream(data);
- InputStream isContent = new BufferedInputStream(bais);
-
- return isContent;
-
-
-
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/JMXUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,86 +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 com.metamatrix.common.util;
-
-import java.lang.management.ManagementFactory;
-
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.NotCompliantMBeanException;
-import javax.management.ObjectName;
-
-import com.metamatrix.core.MetaMatrixCoreException;
-
-public class JMXUtil {
- public enum MBeanType {SERVICE, SERVER, UTIL, ADMINAPI};
-
- String processName;
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-
- public JMXUtil(String processName) {
- this.processName = processName;
- }
-
- public ObjectName buildName(MBeanType type, String name) throws FailedToRegisterException {
- try {
- return new ObjectName("Teiid["+processName+"]:type="+type+",name="+name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } catch (MalformedObjectNameException e) {
- throw new FailedToRegisterException(e);
- }
- }
-
- public void register(MBeanType type, String name, Object anObj) throws FailedToRegisterException {
- try {
- mbs.registerMBean(anObj, buildName(type, name));
- } catch (InstanceAlreadyExistsException e) {
- throw new FailedToRegisterException(e);
- } catch (MBeanRegistrationException e) {
- throw new FailedToRegisterException(e);
- } catch (NotCompliantMBeanException e) {
- throw new FailedToRegisterException(e);
- }
- }
-
- public void unregister(MBeanType type, String name) throws FailedToRegisterException {
- try {
- mbs.unregisterMBean(buildName(type, name));
- } catch (InstanceNotFoundException e) {
- throw new FailedToRegisterException(e);
- } catch (MBeanRegistrationException e) {
- throw new FailedToRegisterException(e);
- }
- }
-
- public MBeanServer getMBeanServer() {
- return mbs;
- }
-
- public static class FailedToRegisterException extends MetaMatrixCoreException{
- public FailedToRegisterException(Throwable e) {
- super(e);
- }
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,225 +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 com.metamatrix.common.util;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Constants pertaining to WSDL servlet execution.
- *
- * @since 4.2
- */
-
-public class WSDLServletUtil {
-
- /**
- * General keys
- */
- public static final String SERVER_URL_KEY = "ServerURL"; //$NON-NLS-1$
-
- public static final String SECURE_PROTOCOL = "Secure"; //$NON-NLS-1$
-
- public static final String VDB_NAME_KEY = "VDBName"; //$NON-NLS-1$
-
- public static final String VDB_VERSION_KEY = "VDBVersion"; //$NON-NLS-1$
-
- public static final String ADD_PROPS = "AdditionalProperties"; //$NON-NLS-1$
-
- public static final String TXN_AUTO_WRAP = "txnAutoWrap"; //$NON-NLS-1$
-
- public static final String ADD_EXEC_PROPS = "AddExecProperties"; //$NON-NLS-1$
-
- public static final String MM_WEBSERVICE_QUERY_TIMEOUT = "com.metamatrix.webservice.querytimeout"; //$NON-NLS-1$
-
- public static final String DISCOVERED_WSDL = "discovered_wsdl"; //$NON-NLS-1$
-
- /*
- * This is the parameter that will tell this servlet when the web service endpoint as defined in WSDL served up by this
- * servlet will use the HTTP vs HTTPS protocol.
- */
- public static final String HTTP_TYPE_PARAMETER_KEY = "httptype"; //$NON-NLS-1$
-
- /*
- * This is the value of the httptype URL request param that will indicate that the returned WSDL should have an http endpoint
- * instead of an https endpoint.
- */
- public static final String HTTP_PARAMETER_VALUE = "http"; //$NON-NLS-1$
-
- /*
- * Static contant representing the standard http protocol.
- */
- public static final String HTTP = "http"; //$NON-NLS-1$
-
- /**
- * Static contant representing the secure http protocol.
- */
- public static final String HTTPS = "https"; //$NON-NLS-1$
-
- /**
- * Default content type for the VDBResourceServlet
- */
- public static final String DEFAULT_CONTENT_TYPE = "text/html"; //$NON-NLS-1$
-
- /**
- * XML content type for the VDBResourceServlet
- */
- public static final String XML_CONTENT_TYPE = "text/xml"; //$NON-NLS-1$
-
- /**
- * WSDL URL Generator keys
- */
- public static final String MMSERVER_HOST_PORT_KEY = "MMServerHostAndPort"; //$NON-NLS-1$
-
- public static final String TARGET_HOST_KEY = "TargetHost"; //$NON-NLS-1$
-
- public static final String TARGET_PORT_KEY = "TargetPort"; //$NON-NLS-1$
-
- public static final String SERVLET_PATH = "/servlet/ArtifactDocumentService"; //$NON-NLS-1$
-
- public static final String SQLQUERYWEBSERVICE_WSDL_PATH = "/services/SqlQueryWebService?wsdl"; //$NON-NLS-1$
-
- public static final String GENERATED_WSDL_NAME = "MetaMatrixDataServices"; //$NON-NLS-1$
-
- public static final String GENERATED_WSDL_FILENAME = GENERATED_WSDL_NAME + ".wsdl"; //$NON-NLS-1$
-
- public static final String COLON = ":"; //$NON-NLS-1$
-
- public static final String SLASH = "/"; //$NON-NLS-1$
-
- public static final String DOUBLE_SLASH = "//"; //$NON-NLS-1$
-
- public static final String AMP = "&"; //$NON-NLS-1$
-
- public static final String QUESTION_MARK = "?"; //$NON-NLS-1$
-
- public static final String EQUALS = "="; //$NON-NLS-1$
-
- public static final String COMMA = ","; //$NON-NLS-1$
-
- private static final String SQLQUERYWEBSERVICE_URL_FORMAT = "{0}://{1}:{2}/{3}"; //$NON-NLS-1$
-
- /*
- * this default value is based on Tomcat's default value in its server.xml file. This value can be overridden by setting the
- * com.metamatrix.webservice.dataservice.httpsport System property for the VM that this servlet is running in.
- */
- private static final String DEFAULT_HTTPS_PORT = "8443"; //$NON-NLS-1$
-
- private static final String DEFAULT_HTTP_PORT = "8080"; //$NON-NLS-1$
-
- private static final String HTTPS_PORT_PROPERTY_KEY = "com.metamatrix.webservice.dataservice.httpsport"; //$NON-NLS-1$
-
- private static final String HTTP_PORT_PROPERTY_KEY = "com.metamatrix.webservice.dataservice.httpport"; //$NON-NLS-1$
-
- /**
- * Returns the formatted url from the supplied info
- *
- * @param scheme the server scheme
- * @param host the server host name
- * @param port the server port
- * @param appContext the context of this application to use in the WSDL url
- * @param serverURLs the list of server url info, first url is full url including protocol. Subsequent items are just the
- * host:port strings.
- * @param vdbName the vdb name
- * @param vdbVersion the vdb version number
- */
- public static String formatURL( String scheme,
- String host,
- String port,
- String appContext,
- List serverURLs,
- String vdbName,
- String vdbVersion ) {
-
- StringBuffer result = new StringBuffer();
- try {
- boolean hasPort = true;
- boolean hasVDBVersion = true;
-
- if (port == null || port.length() == 0) {
- hasPort = false;
- }
-
- if (vdbVersion == null || vdbVersion.trim().length() == 0) {
- hasVDBVersion = false;
- }
-
- result.append(scheme).append(COLON).append(DOUBLE_SLASH).append(host);
-
- if (hasPort) {
- result.append(COLON).append(port);
- }
-
- result.append(appContext).append(SERVLET_PATH).append(SLASH).append(GENERATED_WSDL_FILENAME);
- result.append(QUESTION_MARK).append(SERVER_URL_KEY).append(EQUALS);
- // Append comma-delimited server urls
- Iterator iter = serverURLs.iterator();
- while (iter.hasNext()) {
- String serverURL = (String)iter.next();
- result.append(serverURL);
- // If there is another url coming, add an encoded comma
- if (iter.hasNext()) {
- result.append(URLEncoder.encode(COMMA, "UTF-8")); //$NON-NLS-1$
- }
- }
- result.append(AMP).append(VDB_NAME_KEY).append(EQUALS).append(vdbName);
- if (hasVDBVersion) {
- result.append(AMP).append(VDB_VERSION_KEY).append(EQUALS).append(vdbVersion);
- }
-
- } catch (UnsupportedEncodingException err) {
- // ignore
- }
-
- return result.toString();
- }
-
- /**
- * Returns the formatted wsdl url for the SqlQueryWebService
- *
- * @param server - server name
- * @param appContext the context of this application to use in the WSDL url
- * @param secure - secure ssl (true) or non-secure (false)
- * @return wsdlUrl - String
- * @since 4.3
- */
- public static String getSqlQueryWebServiceUrl( final String server,
- String appContext,
- final boolean secure ) {
-
- appContext=appContext.replace("/",""); //$NON-NLS-1$ //$NON-NLS-2$
- return MessageFormat.format(SQLQUERYWEBSERVICE_URL_FORMAT, new Object[] {secure ? HTTPS : HTTP, server,
- secure ? getHttpsPort() : getHttpPort(), appContext+SQLQUERYWEBSERVICE_WSDL_PATH});
- }
-
- public static final String getHttpsPort() {
- return System.getProperty(HTTPS_PORT_PROPERTY_KEY, DEFAULT_HTTPS_PORT);
- }
-
- public static final String getHttpPort() {
- return System.getProperty(HTTP_PORT_PROPERTY_KEY, DEFAULT_HTTP_PORT);
- }
-}
Copied: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java (from rev 1900, branches/JCA/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java)
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/BasicCryptor.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -0,0 +1,220 @@
+/*
+ * 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 com.metamatrix.common.util.crypto;
+
+import java.io.Serializable;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.Cipher;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.SealedObject;
+
+import com.metamatrix.core.CorePlugin;
+import com.metamatrix.core.ErrorMessageKeys;
+import com.metamatrix.core.util.Base64;
+
+/**
+ * <p>Public methods in this class throw only <code>CryptoException</code>s. </p>
+ */
+public class BasicCryptor implements Cryptor {
+
+ /** The key to be used for decryption. */
+ protected Key decryptKey;
+ /** The <code>Cipher</code> to use for decryption. */
+ private Cipher decryptCipher;
+ /** The key to be used for encryption. */
+ private Key encryptKey;
+ /** The <code>Cipher</code> to use for encryption. */
+ protected Cipher encryptCipher;
+ protected String cipherAlgorithm;
+ public static final String OLD_ENCRYPT_PREFIX = "{mm-encrypt}"; //$NON-NLS-1$
+ public static final String ENCRYPT_PREFIX = "{teiid-encrypt}"; //$NON-NLS-1$
+
+ public BasicCryptor( Key encryptKey, Key decryptKey, String algorithm) throws CryptoException {
+ this.encryptKey = encryptKey;
+ this.cipherAlgorithm = algorithm;
+ this.decryptKey = decryptKey;
+
+ initEncryptCipher();
+ initDecryptCipher();
+ }
+
+ /**
+ * Decrypt the ciphertext to yield the original cleartext.
+ * @param ciphertext The text to be encrypted, in byte form
+ * @param The decrypted cleartext, in byte form
+ */
+ public synchronized byte[] decrypt( byte[] ciphertext ) throws CryptoException {
+ try {
+ return decryptCipher.doFinal(ciphertext);
+ } catch ( Exception e ) {
+ try {
+ initDecryptCipher();
+ } catch (CryptoException err) {
+ //shouldn't happen
+ }
+ throw new CryptoException( ErrorMessageKeys.CM_UTIL_ERR_0071, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0071, e.getClass().getName(), e.getMessage()));
+ }
+ }
+
+ public String decrypt( String ciphertext ) throws CryptoException {
+ if ( ciphertext == null ) {
+ throw new CryptoException( ErrorMessageKeys.CM_UTIL_ERR_0074, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0074));
+ }
+
+ ciphertext = stripEncryptionPrefix(ciphertext);
+
+ // Decode the previously encoded text into bytes...
+ byte[] cipherBytes = null;
+ try {
+ cipherBytes = Base64.decode(ciphertext);
+ } catch ( IllegalArgumentException e ) {
+ throw new CryptoException( ErrorMessageKeys.CM_UTIL_ERR_0075, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0075, e.getMessage()));
+ }
+ // Perform standard decryption
+ byte[] cleartext = decrypt( cipherBytes );
+ // Perform "standard" Java encoding and return the result
+ return new String(cleartext);
+ }
+
+ public static String stripEncryptionPrefix(String ciphertext) {
+ if (ciphertext.startsWith(BasicCryptor.ENCRYPT_PREFIX)) {
+ ciphertext = ciphertext.substring(BasicCryptor.ENCRYPT_PREFIX.length());
+ } else if (ciphertext.startsWith(BasicCryptor.OLD_ENCRYPT_PREFIX)) {
+ ciphertext = ciphertext.substring(BasicCryptor.OLD_ENCRYPT_PREFIX.length());
+ }
+ return ciphertext;
+ }
+
+ /**
+ * Initialize the ciphers used for encryption and decryption. The ciphers
+ * define the algorithms to be used. They are initialized with the
+ * appropriate key to be used in the encryption or decryption operation.
+ */
+ protected void initDecryptCipher() throws CryptoException {
+
+ // Create and initialize decryption cipher
+ try {
+ decryptCipher = Cipher.getInstance( cipherAlgorithm);
+ decryptCipher.init( Cipher.DECRYPT_MODE, decryptKey );
+ } catch ( NoSuchAlgorithmException e ) {
+ throw new CryptoException( e, ErrorMessageKeys.CM_UTIL_ERR_0076, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0076, cipherAlgorithm ));
+ } catch ( NoSuchPaddingException e ) {
+ throw new CryptoException( ErrorMessageKeys.CM_UTIL_ERR_0077, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0077, cipherAlgorithm, e.getClass().getName(), e.getMessage() ));
+ } catch ( InvalidKeyException e ) {
+ throw new CryptoException( e, ErrorMessageKeys.CM_UTIL_ERR_0079, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0079, e.getClass().getName(), e.getMessage()) );
+ }
+ }
+
+ public synchronized Serializable unsealObject(Serializable object) throws CryptoException {
+
+ if (!(object instanceof SealedObject)) {
+ return object;
+ }
+
+ SealedObject so = (SealedObject)object;
+
+ try {
+ return (Serializable)so.getObject(decryptCipher);
+ } catch ( Exception e ) {
+ try {
+ initDecryptCipher();
+ } catch (CryptoException err) {
+ //shouldn't happen
+ }
+ throw new CryptoException( ErrorMessageKeys.CM_UTIL_ERR_0071, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0071, e.getClass().getName(), e.getMessage()));
+ }
+ }
+
+ /**
+ * Encrypt the cleartext in byte array format.
+ * @param cleartext The text to be encrypted, in byte form
+ * @param The encrypted ciphertext, in byte form
+ */
+ public synchronized byte[] encrypt( byte[] cleartext ) throws CryptoException {
+ try {
+ return encryptCipher.doFinal(cleartext);
+ } catch ( Exception e ) {
+ try {
+ initEncryptCipher();
+ } catch (CryptoException err) {
+ //shouldn't happen
+ }
+ throw new CryptoException(ErrorMessageKeys.CM_UTIL_ERR_0081, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0081, e.getMessage()));
+ }
+ }
+
+ public String encrypt( String cleartext ) throws CryptoException {
+ if ( cleartext == null ) {
+ throw new CryptoException( ErrorMessageKeys.CM_UTIL_ERR_0072, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0072));
+ }
+ String clearString = new String(cleartext);
+ if ( clearString.trim().length() == 0 && clearString.length() == 0 ) {
+ throw new CryptoException( ErrorMessageKeys.CM_UTIL_ERR_0073, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0073));
+ }
+ // Turn char array into string and get its bytes using "standard" encoding
+ byte[] clearBytes = clearString.getBytes();
+ // Perform standard encryption
+ byte[] cipherBytes = encrypt( clearBytes );
+ // Perform specialized encoding now, and return result
+
+ String encoded = Base64.encodeBytes( cipherBytes );
+ return BasicCryptor.ENCRYPT_PREFIX + encoded;
+ }
+
+ /**
+ * Initialize the cipher used for encryption. The cipher defines the
+ * algorithm to be used. It is initialized with the appropriate key to
+ * be used in the encryption operation.
+ */
+ protected void initEncryptCipher() throws CryptoException {
+
+ // Create and initialize encryption cipher
+ try {
+ encryptCipher = Cipher.getInstance( cipherAlgorithm );
+ encryptCipher.init( Cipher.ENCRYPT_MODE, encryptKey );
+ } catch ( NoSuchAlgorithmException e ) {
+ throw new CryptoException( e, ErrorMessageKeys.CM_UTIL_ERR_0076, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0076, cipherAlgorithm ));
+ } catch ( NoSuchPaddingException e ) {
+ throw new CryptoException(e, ErrorMessageKeys.CM_UTIL_ERR_0072, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0077, cipherAlgorithm , e.getMessage() ));
+ } catch ( InvalidKeyException e ) {
+ throw new CryptoException( e, ErrorMessageKeys.CM_UTIL_ERR_0078, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0078, e.getMessage() ));
+ }
+ }
+
+ public synchronized Serializable sealObject(Serializable object) throws CryptoException {
+ try {
+ return new SealedObject(object, encryptCipher);
+ } catch ( Exception e ) {
+ try {
+ initEncryptCipher();
+ } catch (CryptoException err) {
+ //shouldn't happen
+ }
+ throw new CryptoException(ErrorMessageKeys.CM_UTIL_ERR_0081, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0081, e.getMessage()));
+ }
+ }
+
+} // END CLASS
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/CryptoUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/CryptoUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/CryptoUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,419 +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 com.metamatrix.common.util.crypto;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.common.util.crypto.cipher.BasicCryptor;
-import com.metamatrix.common.util.crypto.cipher.SymmetricCryptor;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-import com.metamatrix.core.util.Base64;
-
-/**
- * Collection of Crypto utilities and helpers for use by the server and installers.
- *
- */
-public class CryptoUtil {
- /**
- * This property indicates the encryption provider, if set to none encryption is disabled.
- */
- public static final String ENCRYPTION_ENABLED = "teiid.encryption.enabled"; //$NON-NLS-1$
-
- /** The name of the key. */
- public static final String KEY_NAME = "teiid.keystore"; //$NON-NLS-1$
- public static final URL KEY = CryptoUtil.class.getResource("/" + KEY_NAME); //$NON-NLS-1$
- public static final String OLD_ENCRYPT_PREFIX = "{mm-encrypt}"; //$NON-NLS-1$
- public static final String ENCRYPT_PREFIX = "{teiid-encrypt}"; //$NON-NLS-1$
- // Empty provider means encryption should be disabled
- public static final String NONE = "none"; //$NON-NLS-1$
-
- private static boolean encryptionEnabled = PropertiesUtils.getBooleanProperty(System.getProperties(), ENCRYPTION_ENABLED, true);
-
- private static Cryptor CRYPTOR;
-
- public static boolean isEncryptionEnabled() {
- return encryptionEnabled;
- }
-
- /**
- * Encrypts given set of property values based on occurrence of the property name in
- * the <code>match</code> collection.
- * @param match A Set of property names that, if found in <code>props</code>
- * property names, will modify the associated value in <code>props</code>. <strong>
- * Note</strong>: This is a <i><b>case insensitive</b></i> match.
- * @param props The properties whose values are to be modified in place.
- * @returns A copy of the <code>props</code> with values modified.
- * @throws CryptoException if there's an error with the <code>Cryptor</code>.
- */
- public static Properties propertyEncrypt(String match, Properties props)
- throws CryptoException {
- Cryptor theCryptor = CryptoUtil.getCryptor();
- Properties modifiedProps = new Properties();
-
- Enumeration propEnum = props.propertyNames();
-
- while (propEnum.hasMoreElements()) {
- String propName = (String) propEnum.nextElement();
- if (match.equalsIgnoreCase(propName)) {
- String propVal = props.getProperty(propName);
- if (propVal != null) {
- if (propVal.trim().length() > 0) {
- String cryptValue = theCryptor.encrypt(propVal);
- modifiedProps.setProperty(propName, cryptValue);
- } else {
- modifiedProps.setProperty(propName, propVal);
- }
- }
- } else {
- modifiedProps.setProperty(propName, props.getProperty(propName));
- }
- }
- return modifiedProps;
- }
-
- /**
- * Decrypts given set of property values based on occurrence of the property name in
- * the <code>match</code> collection.
- * @param match A Set of property names that, if found in <code>props</code>
- * property names, will modify the associated value in <code>props</code>. <strong>
- * Note</strong>: This is a <i><b>case insensitive</b></i> match.
- * @param props The properties whose values are to be modified in place.
- * @returns A copy of the <code>props</code> with values modified.
- * @throws CryptoException if there's an error with the <code>Cryptor</code>.
- */
- public static Properties propertyDecrypt(String match, Properties props)
- throws CryptoException {
- Cryptor theCryptor = CryptoUtil.getCryptor();
- Properties modifiedProps = new Properties();
-
- Enumeration propEnum = props.propertyNames();
-
- while (propEnum.hasMoreElements()) {
- String propName = (String) propEnum.nextElement();
- if (match.equalsIgnoreCase(propName)) {
- String propVal = props.getProperty(propName);
- if (propVal != null) {
- if (propVal.trim().length() > 0 && CryptoUtil.isValueEncrypted(propVal)) {
- String cryptValue = theCryptor.decrypt(propVal);
- modifiedProps.setProperty(propName, cryptValue);
-
- } else {
- modifiedProps.setProperty(propName, propVal);
- }
- }
-
- } else {
- modifiedProps.setProperty(propName, props.getProperty(propName));
- }
- }
- return modifiedProps;
- }
-
- /**
- * Encrypts given set of property values based on occurrence of the property name ending
- * in with the given pattern, using the server-side encryptor.
- * This method requires that the server keystore is available.
- * @param pattern A pattern that, if found at the end of a <code>props</code>
- * property name, will modify the associated value in <code>props</code>. <strong>
- * Note</strong>: This is a <i><b>case insensitive</b></i> match.
- * @param props The properties whose values are to be modified.
- * @returns A copy of the <code>props</code> with values modified.
- * @throws CryptoException if there's an error with the <code>Cryptor</code>.
- */
- public static Properties propertyEncryptEndsWith(String pattern, Properties props)
- throws CryptoException {
-
- return propertyEncryptEndsWith(CryptoUtil.getCryptor(), pattern, props);
- }
-
-
- /**
- * Encrypts given set of property values based on occurance of the property name ending
- * in with the given pattern, using the specified encryptor.
- * @param encryptor Encryptor to use.
- * @param pattern A pattern that, if found at the end of a <code>props</code>
- * property name, will modify the associated value in <code>props</code>. <strong>
- * Note</strong>: This is a <i><b>case insensitive</b></i> match.
- * @param props The properties whose values are to be modified.
- * @returns A copy of the <code>props</code> with values modified.
- * @throws CryptoException if there's an error with the <code>Cryptor</code>.
- */
- public static Properties propertyEncryptEndsWith(Encryptor encryptor, String pattern, Properties props)
- throws CryptoException {
- Properties modifiedProps = new Properties();
-
- Enumeration propEnum = props.propertyNames();
- pattern = pattern.toUpperCase();
- while (propEnum.hasMoreElements()) {
- String propName = (String) propEnum.nextElement();
- if (propName.toUpperCase().endsWith(pattern)) {
- String propVal = props.getProperty(propName);
- if (propVal != null) {
- if (propVal.trim().length() > 0) {
- String cryptValue = encryptor.encrypt(propVal);
- modifiedProps.setProperty(propName, cryptValue);
- } else {
- modifiedProps.setProperty(propName, propVal);
- }
- }
- } else {
- modifiedProps.setProperty(propName, props.getProperty(propName));
- }
- }
- return modifiedProps;
- }
-
- /**
- * Decrypts given set of property values based on occurance of the property name ending
- * in with the given pattern.
- * @param pattern A pattern that, if found at the end of a <code>props</code>
- * property name, will modify the associated value in <code>props</code>. <strong>
- * Note</strong>: This is a <i><b>case insensitive</b></i> match.
- * @param props The properties whose values are to be modified.
- * @returns A copy of the <code>props</code> with values modified.
- * @throws CryptoException if there's an error with the <code>Cryptor</code>.
- */
- public static Properties propertyDecryptEndsWith(String pattern, Properties props)
- throws CryptoException {
- Cryptor theCryptor = CryptoUtil.getCryptor();
- Properties modifiedProps = new Properties();
-
- Enumeration propEnum = props.propertyNames();
- pattern = pattern.toUpperCase();
- while (propEnum.hasMoreElements()) {
- String propName = (String) propEnum.nextElement();
- if (propName.toUpperCase().endsWith(pattern)) {
- String propVal = props.getProperty(propName);
- // don't try to decrypt a value that doesn't have length
- // an encrypted password would have some content
- if (propVal != null) {
- if (propVal.trim().length() > 0 && CryptoUtil.isValueEncrypted(propVal)) {
- String cryptValue = theCryptor.decrypt(propVal);
- modifiedProps.setProperty(propName, cryptValue);
- } else {
- modifiedProps.setProperty(propName, propVal);
- }
- }
- } else {
- modifiedProps.setProperty(propName, props.getProperty(propName));
- }
- }
- return modifiedProps;
- }
-
- public static boolean isValueEncrypted(String value) {
- if (value == null) {
- return false;
- }
- try {
- if (value.trim().length() == 0) {
- return false;
- }
- String strippedValue = BasicCryptor.stripEncryptionPrefix(value);
- if (strippedValue.length() != value.length()) {
- try {
- Base64.decode(strippedValue);
- } catch (IllegalArgumentException e) {
- return false;
- }
- //if we have the encrypt prefix and the rest of the string is base64 encoded, then
- //we'll assume that it's properly encrypted
- return true;
- }
- CryptoUtil.getDecryptor().decrypt(value);
- return true;
- } catch (CryptoException err) {
- return false;
- }
- }
-
- /**
- * <p>Initialize this factory, bound to a specific keystore and key
- * entry in that store.
- * <br>The keystore file name is well-known and must be in the applicaition's classpath.
- * The key entry name is well-known.
- * The keystore password is found in configuration.<\br></p>
- */
- private static synchronized void init()
- throws CryptoException {
-
- init(KEY);
- }
-
- /**
- * <p>Initialize this factory, bound to the given keystore and keystore password.
- * <br>This method <strong>will</strong> initialize the cryptor with the given
- * keystore and <strong>will not</strong> use the application classpath to find
- * the keystore to use.
- * The key entry name is well-known.
- * </br> </p>
- * @param storeFilename url to the keystore file.
- * @param storePass The password used to unlock the keystore.
- */
- public static synchronized void init(URL keyResource)
- throws CryptoException {
-
- if (CRYPTOR == null) {
- // If encryption is not enabled then do nothing.
- if (!isEncryptionEnabled() || keyResource == null) {
- CRYPTOR = new NullCryptor();
- return;
- }
-
- try {
- // Init given path to keystore, keystore pwd, name of the encrypt key
- // and flag stating NOT to retrieve keystore from classpath
- CRYPTOR = SymmetricCryptor.getSymmectricCryptor(keyResource);
- } catch ( FileNotFoundException e ) {
- throw new CryptoException(e, ErrorMessageKeys.CM_UTIL_ERR_0068, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0068, e.getMessage()));
- } catch ( IOException e ) {
- throw new CryptoException(e, ErrorMessageKeys.CM_UTIL_ERR_0068, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0068, e.getMessage()));
- }
- }
- }
-
- /**
- * Construct and return a utility that can be used for either encryption
- * or decryption.
- *
- * @return A utility that implements the <code>Cryptor</code> interface
- *
- * @throws CryptoException If there was a problem getting the keys
- * required to initialize the cipher, or if there was a
- * problem initializing the cipher utility
- */
- public static Cryptor getCryptor() throws CryptoException {
- init();
- return CRYPTOR;
- }
-
- /**
- * Construct and return a utility that can be used for only encryption.
- *
- * @return A utility that implements the <code>Encryptor</code> interface
- *
- * @throws CryptoException If there was a problem getting the key
- * required to initialize the cipher, or if there was a
- * problem initializing the cipher utility
- */
- public static Encryptor getEncryptor() throws CryptoException {
- return getCryptor();
- }
-
- /**
- * Construct and return a utility that can be used for only decryption.
- *
- * @return A utility that implements the <code>Decryptor</code> interface
- *
- * @throws CryptoException If there was a problem getting the key
- * required to initialize the cipher, or if there was a
- * problem initializing the cipher utility
- */
- public static Decryptor getDecryptor() throws CryptoException {
- return getCryptor();
- }
-
- public static String stringEncrypt(String clearText) throws CryptoException {
- return getCryptor().encrypt(clearText);
- }
-
- public static String stringDecrypt(String cipherText) throws CryptoException {
- return getCryptor().decrypt(cipherText);
- }
-
- public static boolean canDecrypt(String cipherText) {
- try {
- CryptoUtil.getDecryptor().decrypt(cipherText);
- } catch (CryptoException err) {
- return false;
- }
- return true;
- }
-
- /**
- * Allows tests to reinit if necessary
- */
- public static synchronized void reinit() {
- CRYPTOR = null;
- }
-
- public static synchronized boolean isInitialized() {
- return CRYPTOR == null;
- }
-
- public static void main(String[] args) throws Exception {
- if (args.length < 1) {
- printUsage();
- }
-
- int i = 0;
- if (args.length == 2 && args[i].equals("-genkey")) { //$NON-NLS-1$
- String keyName = args[++i];
- if (keyName == null) {
- printUsage();
- }
- SymmetricCryptor.generateAndSaveKey(keyName);
- return;
- }
- else if (args.length == 4 && args[i].equals("-key")) { //$NON-NLS-1$
- String keyFile = args[++i];
- if (keyFile == null) {
- printUsage();
- }
-
- File key = new File(keyFile);
- if (!key.exists()) {
- System.out.println("Key file does not exist at "+keyFile); //$NON-NLS-1$
- }
- else {
- CryptoUtil.init(key.toURI().toURL());
- }
-
- ++i;
- if (args[i].equals("-encrypt")) { //$NON-NLS-1$
- String clearText = args[++i];
- if (clearText == null) {
- printUsage();
- }
- System.out.println("Encypted Text:"+stringEncrypt(clearText)); //$NON-NLS-1$
- return;
- }
- }
- printUsage();
- }
-
- private static void printUsage() {
- System.out.println("java CryptoUtil <option>"); //$NON-NLS-1$
- System.out.println("options:"); //$NON-NLS-1$
- System.out.println("\t-genkey <filename> # Generates password key file"); //$NON-NLS-1$
- System.out.println("\t-key <keyfile> -encrypt <cleartext> # Encrypts the given clear text string"); //$NON-NLS-1$
- System.exit(0);
- }
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Cryptor.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -22,10 +22,45 @@
package com.metamatrix.common.util.crypto;
+import java.io.Serializable;
+
/**
* Interface defining a utility that can perform both encryption and decryption.
- * @see Encryptor
- * @see Decryptor
*/
-public interface Cryptor extends Encryptor, Decryptor {
+public interface Cryptor {
+
+ /**
+ * Encrypt the cleartext in byte array format.
+ * @param cleartext The text to be encrypted, in byte form
+ * @param The encrypted ciphertext, in byte form
+ */
+ byte[] encrypt( byte[] cleartext ) throws CryptoException;
+
+ /**
+ * Encrypt the cleartext
+ * @param cleartext The text to be encrypted
+ * @param The encrypted ciphertext
+ */
+ String encrypt( String cleartext ) throws CryptoException;
+
+ Serializable sealObject(Serializable object) throws CryptoException;
+
+ /**
+ * Decrypt the ciphertext in byte array format to yield the original
+ * cleartext.
+ * @param ciphertext The text to be encrypted, in byte form
+ * @param The decrypted cleartext, in byte form
+ */
+ byte[] decrypt( byte[] ciphertext ) throws CryptoException;
+
+ /**
+ * Decrypt the ciphertext to yield the original
+ * cleartext.
+ * @param ciphertext The text to be encrypted
+ * @param The decrypted cleartext
+ */
+ String decrypt( String ciphertext ) throws CryptoException;
+
+ Serializable unsealObject(Serializable object) throws CryptoException;
+
}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Decryptor.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Decryptor.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Decryptor.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,51 +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 com.metamatrix.common.util.crypto;
-
-import java.io.Serializable;
-
-/**
- * Interface defining a utility that can perform decryption of ciphertext to
- * yield the original cleartext.
- */
-public interface Decryptor {
-
- /**
- * Decrypt the ciphertext in byte array format to yield the original
- * cleartext.
- * @param ciphertext The text to be encrypted, in byte form
- * @param The decrypted cleartext, in byte form
- */
- byte[] decrypt( byte[] ciphertext ) throws CryptoException;
-
- /**
- * Decrypt the ciphertext to yield the original
- * cleartext.
- * @param ciphertext The text to be encrypted
- * @param The decrypted cleartext
- */
- String decrypt( String ciphertext ) throws CryptoException;
-
- Serializable unsealObject(Serializable object) throws CryptoException;
-}
-
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -42,7 +42,6 @@
import javax.crypto.KeyAgreement;
import javax.crypto.spec.DHParameterSpec;
-import com.metamatrix.common.util.crypto.cipher.SymmetricCryptor;
import com.metamatrix.core.MetaMatrixRuntimeException;
/**
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Encryptor.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Encryptor.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/Encryptor.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -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 com.metamatrix.common.util.crypto;
-
-import java.io.Serializable;
-
-/**
- * Interface defining a utility that can perform encryption of cleartext.
- */
-public interface Encryptor {
-
- /**
- * Encrypt the cleartext in byte array format.
- * @param cleartext The text to be encrypted, in byte form
- * @param The encrypted ciphertext, in byte form
- */
- byte[] encrypt( byte[] cleartext ) throws CryptoException;
-
- /**
- * Encrypt the cleartext
- * @param cleartext The text to be encrypted
- * @param The encrypted ciphertext
- */
- String encrypt( String cleartext ) throws CryptoException;
-
- Serializable sealObject(Serializable object) throws CryptoException;
-}
-
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/NullCryptor.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -24,7 +24,7 @@
import java.io.Serializable;
-public class NullCryptor implements Cryptor, Serializable {
+public class NullCryptor implements Cryptor {
public byte[] encrypt(byte[] cleartext) throws CryptoException {
return cleartext;
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/PasswordChangeUtility.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/PasswordChangeUtility.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/PasswordChangeUtility.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,274 +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 com.metamatrix.common.util.crypto;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import com.metamatrix.common.util.crypto.cipher.SymmetricCryptor;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-/**
- * <p>Utility that allows ciphertext that was encrypted with one key
- * to be decrypted with the old key and re-encrypted with a new key</p>
- * <p><i>This utility assumes that the keys have been created and verified to work
- * correctly.</i></p>
- */
-public class PasswordChangeUtility {
-
- /** The name of the old key file name. */
- private String oldkeyName;
-
- /** The name of the new key file name. */
- private String newkeyName;
-
- /** Initailization state. */
- protected boolean initialized;
-
- /** The Cryptor to use for decrypting the old passwords. */
- protected Cryptor oldCryptor;
-
- /** The Cryptor to use for encrypting the new passwords. */
- protected Cryptor newCryptor;
-
- /**
- * Construct a <code>PasswordChangeUtility</code> with information for two different
- * keys.
- * @param oldkeyFileName The absolute path to the key with which you would like
- * to decrypt the old passwords.
- * @param newkeyFileName The absolute path to the key with which you would like
- * to encrypt the new passwords.
- * @throws IllegaArgumentException if any arguments are <code>null</code> or empty.
- */
- public PasswordChangeUtility(String oldkeyFileName,
- String newkeyFileName) {
- if (oldkeyFileName == null || oldkeyFileName.length() == 0) {
- throw new IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0062));
- }
- if (newkeyFileName == null || newkeyFileName.length() == 0) {
- throw new IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0064));
- }
-
- this.oldkeyName = oldkeyFileName;
- this.newkeyName = newkeyFileName;
- }
-
- // =========================================================================
- // I N I T I A L I Z A T I O N
- // =========================================================================
-
- /**
- * <p>Initialize this factory, bound to a specific key and key
- * entry in that store. </p>
- */
- public synchronized void init() throws CryptoException {
-
- if ( initialized == false ) {
-
- // Init and get the Cryptor for old passwords.
- try {
- this.oldCryptor = SymmetricCryptor.getSymmectricCryptor(new File(oldkeyName).toURL());
- } catch ( FileNotFoundException e ) {
- throw new CryptoException(e, ErrorMessageKeys.CM_UTIL_ERR_0066, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0066, e.getMessage()));
- } catch ( IOException e ) {
- throw new CryptoException(e, ErrorMessageKeys.CM_UTIL_ERR_0066, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0066, e.getMessage()));
- }
-
- // Init and get the Cryptor for new passwords.
- try {
- this.newCryptor = SymmetricCryptor.getSymmectricCryptor(new File(newkeyName).toURL());
- } catch ( FileNotFoundException e ) {
- throw new CryptoException(e, ErrorMessageKeys.CM_UTIL_ERR_0066, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0067, e.getMessage()));
- } catch ( IOException e ) {
- throw new CryptoException(e, ErrorMessageKeys.CM_UTIL_ERR_0066, CorePlugin.Util.getString(ErrorMessageKeys.CM_UTIL_ERR_0067, e.getMessage()));
- }
-
- initialized = true;
- }
- }
-
- // =========================================================================
- // U T I L I T Y M E T H O D S
- // =========================================================================
-
- /**
- * Use old Cryptor to encrypt a char[].
- * @param cleartext The cleartext that you want encrypted with the
- * old Cryptor.
- * @return The encrypted ciphertext chars.
- * @throws CryptoException If an error occurs durring initialization
- * of the Cryptor or during encryption.
- */
- public String oldEncrypt( String cleartext ) throws CryptoException {
- init();
- return oldCryptor.encrypt( cleartext );
- }
-
-
- /**
- * Use old Cryptor to encrypt properties.
- * Encrypts any properties that end with <code>match</code>
- * @param match
- * @param props
- * @return Encrypted properties
- * @throws CryptoException
- * @since 4.3
- */
- public Properties oldEncrypt(String match, Properties props)
- throws CryptoException {
- init();
- return doCrypt(oldCryptor, true, match, props);
- }
-
-
-
- /**
- * Use old Cryptor to decrypt a char[].
- * @param ciphertext The ciphertext that you want decrypted with the
- * old Cryptor.
- * @return The decrypted cleartext chars.
- * @throws CryptoException If an error occurs durring initialization
- * of the Cryptor or during decryption.
- */
- public String oldDecrypt( String ciphertext ) throws CryptoException {
- init();
- return oldCryptor.decrypt( ciphertext );
- }
-
- /**
- * Use old Cryptor to decrypt properties.
- * Decrypts any properties that end with <code>match</code>
- * @param match
- * @param props
- * @return decrypted properties
- * @throws CryptoException
- * @since 4.3
- */
- public Properties oldDecrypt(String match, Properties props)
- throws CryptoException {
- init();
- return doCrypt(oldCryptor, false, match, props);
- }
-
-
- /**
- * Use new Cryptor to encrypt a char[].
- * @param cleartext The cleartext that you want encrypted with the
- * new Cryptor.
- * @return The encrypted ciphertext chars.
- * @throws CryptoException If an error occurs durring initialization
- * of the Cryptor or during encryption.
- */
- public String newEncrypt(String cleartext ) throws CryptoException {
- init();
- return newCryptor.encrypt( cleartext );
- }
-
- /**
- * Use new Cryptor to encrypt properties.
- * Encrypts any properties that end with <code>match</code>
- * @param match
- * @param props
- * @return encrypted properties
- * @throws CryptoException
- * @since 4.3
- */
- public Properties newEncrypt(String match, Properties props)
- throws CryptoException {
- init();
- return doCrypt(newCryptor, true, match, props);
- }
-
-
- /**
- * Use new Cryptor to decrypt a char[].
- * @param ciphertext The ciphertext that you want decrypted with the
- * new Cryptor.
- * @return The decrypted cleartext chars.
- * @throws CryptoException If an error occurs durring initialization
- * of the Cryptor or during decryption.
- */
- public String newDecrypt( String ciphertext ) throws CryptoException {
- init();
- return newCryptor.decrypt( ciphertext );
- }
-
- /**
- * Use new Cryptor to decrypt properties.
- * Decrypts any properties that end with <code>match</code>
- * @param match
- * @param props
- * @return decrypted properties
- * @throws CryptoException
- * @since 4.3
- */
- public Properties newDecrypt(String match, Properties props)
- throws CryptoException {
- init();
- return doCrypt(newCryptor, false, match, props);
- }
-
- /**
- * Encrypt or decrypt properties using the specified encryptor.
- * Operates on any properties that end with <code>match</code>
- * @param cryptor
- * @param encrypt If true, encrypt. If false, decrypt.
- * @param match
- * @param props
- * @return
- * @throws CryptoException
- * @since 4.3
- */
- private Properties doCrypt(Cryptor cryptor, boolean encrypt, String match, Properties props)
- throws CryptoException {
- Properties modifiedProps = new Properties();
-
- Enumeration propEnum = props.propertyNames();
-
- String matchUpper = match.toUpperCase();
- while (propEnum.hasMoreElements()) {
- String propName = (String) propEnum.nextElement();
- if (propName.toUpperCase().endsWith(matchUpper)) {
- String propVal = props.getProperty(propName);
- if (propVal != null && propVal.length() > 0) {
- String cryptValue;
- if (encrypt) {
- cryptValue = cryptor.encrypt(propVal);
- } else {
- cryptValue = cryptor.decrypt(propVal);
- }
- modifiedProps.setProperty(propName, cryptValue);
- }
- } else {
- modifiedProps.setProperty(propName, props.getProperty(propName));
- }
- }
- return modifiedProps;
- }
-
-} // END CLASS
-
Copied: trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/SymmetricCryptor.java (from rev 1900, branches/JCA/common-core/src/main/java/com/metamatrix/common/util/crypto/SymmetricCryptor.java)
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/SymmetricCryptor.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/SymmetricCryptor.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -0,0 +1,148 @@
+/*
+ * 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 com.metamatrix.common.util.crypto;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.security.Key;
+import java.security.KeyStore;
+
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+import com.metamatrix.core.util.ArgCheck;
+
+/**
+ * Provides a symmetric cryptor using AES
+ */
+public class SymmetricCryptor extends BasicCryptor {
+
+ public static final String DEFAULT_SYM_KEY_ALGORITHM = "AES"; //$NON-NLS-1$
+ public static final String DEFAULT_SYM_ALGORITHM = "AES/ECB/PKCS5Padding"; //$NON-NLS-1$
+ public static final int DEFAULT_KEY_BITS = 128;
+ public static final String DEFAULT_STORE_PASSWORD = "changeit"; //$NON-NLS-1$
+ public static final String DEFAULT_ALIAS = "cluster_key"; //$NON-NLS-1$
+
+ private static KeyGenerator keyGen;
+
+ /**
+ * Creates a new SymmetricCryptor with a new symmetric key
+ *
+ * @return a new SymmetricCryptor
+ * @throws CryptoException
+ */
+ public static SymmetricCryptor getSymmectricCryptor() throws CryptoException {
+ Key key = generateKey();
+
+ return new SymmetricCryptor(key);
+ }
+
+ private static SecretKey generateKey() throws CryptoException {
+ try {
+ synchronized(SymmetricCryptor.class) {
+ if (keyGen == null) {
+ keyGen = KeyGenerator.getInstance(DEFAULT_SYM_KEY_ALGORITHM);
+ }
+ keyGen.init(DEFAULT_KEY_BITS);
+ return keyGen.generateKey();
+ }
+ } catch (GeneralSecurityException e) {
+ throw new CryptoException(e);
+ }
+ }
+
+ /**
+ * Creates a SymmetricCryptor using the supplied URL contents as the key
+ *
+ * @param key
+ * @return a new SymmetricCryptor
+ * @throws CryptoException
+ * @throws IOException
+ */
+ public static SymmetricCryptor getSymmectricCryptor(URL keyResource) throws CryptoException, IOException {
+ ArgCheck.isNotNull(keyResource);
+ InputStream stream = keyResource.openStream();
+ try {
+ KeyStore store = KeyStore.getInstance("JCEKS"); //$NON-NLS-1$
+ store.load(stream, DEFAULT_STORE_PASSWORD.toCharArray());
+ Key key = store.getKey(DEFAULT_ALIAS, DEFAULT_STORE_PASSWORD.toCharArray());
+ return new SymmetricCryptor(key);
+ } catch (GeneralSecurityException e) {
+ throw new CryptoException(e);
+ } finally {
+ stream.close();
+ }
+ }
+
+ /**
+ * Creates a SymmetricCryptor using the supplied byte array as the key
+ *
+ * @param key
+ * @return a new SymmetricCryptor
+ * @throws CryptoException
+ */
+ public static SymmetricCryptor getSymmectricCryptor(byte[] key) throws CryptoException {
+ Key secretKey = new SecretKeySpec(key, DEFAULT_SYM_KEY_ALGORITHM);
+ return new SymmetricCryptor(secretKey);
+ }
+
+ public static void generateAndSaveKey(String file) throws CryptoException, IOException {
+ SecretKey key = generateKey();
+ saveKey(file, key);
+ }
+
+ private static void saveKey(String file, SecretKey key) throws CryptoException, IOException {
+ ArgCheck.isNotNull(file);
+ FileOutputStream fos = new FileOutputStream(file);
+ try {
+ KeyStore store = KeyStore.getInstance("JCEKS"); //$NON-NLS-1$
+ store.load(null,null);
+ store.setKeyEntry(DEFAULT_ALIAS, key, DEFAULT_STORE_PASSWORD.toCharArray(),null);
+ store.store(fos, DEFAULT_STORE_PASSWORD.toCharArray());
+ } catch (GeneralSecurityException e) {
+ throw new CryptoException(e);
+ } finally {
+ fos.close();
+ }
+ }
+
+ SymmetricCryptor(Key key) throws CryptoException {
+ super(key, key, DEFAULT_SYM_ALGORITHM);
+ }
+
+ public byte[] getEncodedKey() {
+ return this.decryptKey.getEncoded();
+ }
+
+ public static void main(String[] args) throws Exception {
+ if (args.length != 1) {
+ System.out.println("The file to create must be supplied as the only argument."); //$NON-NLS-1$
+ System.exit(-1);
+ }
+ SymmetricCryptor.generateAndSaveKey(args[0]);
+ }
+}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/CoreConstants.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/CoreConstants.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/CoreConstants.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -51,17 +51,10 @@
String PROXIES = "proxies"; //$NON-NLS-1$
}
- public static final String SYSTEM_MODEL = "System"; //$NON-NLS-1$
+ public static final String SYSTEM_MODEL = "SYS"; //$NON-NLS-1$
public static final String SYSTEM_VDB = "System.vdb"; //$NON-NLS-1$
- public static final String SYSTEM_PHYSICAL_MODEL_NAME = "SystemPhysical"; //$NON-NLS-1$
-
- public static final String SYSTEM_ADMIN_MODEL_NAME = "SystemAdmin"; //$NON-NLS-1$
-
- public static final String SYSTEM_ADMIN_PHYSICAL_MODEL_NAME = "SystemAdminPhysical"; //$NON-NLS-1$
-
-
public static final String EXPORTED_VDB_FILE_EXTENSION = VdbConstants.VDB_DEF_FILE_EXTENSION;
public static final String VDB_ARCHIVE_EXTENSION = VdbConstants.VDB_ARCHIVE_EXTENSION;
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/util/DateUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/DateUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/DateUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,174 +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 com.metamatrix.core.util;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import com.metamatrix.core.CorePlugin;
-
-public final class DateUtil {
-
- public static final String COMPLETE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS-ZZ:zz"; //$NON-NLS-1$
- public static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS"; //$NON-NLS-1$
- // String indexes (useful for the logic in 'convertStringToDate')
- // Example "2001-08-07T20:44:22.911-06:00"
- // "yyyy-MM-ddTHH:mm:ss.SSS-ZZ:zz"
- // 01234567890123456789012345678
- // 1 2
-
- private static final ThreadLocal<DateFormat> DATE_FORMATTER = new ThreadLocal<DateFormat>() {
- @Override
- protected DateFormat initialValue() {
- DateFormat df = new SimpleDateFormat(TIMESTAMP_FORMAT);
- df.setLenient(false);
- return df;
- }
- };
-
- /**
- * Method to convert a string in the standard MetaMatrix pattern into a Date object.
- * The pattern is <i>yyyy-MM-dd'T'HH:mm:ss.SSS-ZZ:zz<i> where
- * <blockquote>
- * <pre>
- * Symbol Meaning Presentation Example
- * ------ ------- ------------ -------
- * y year (Number) 1996
- * M month in year (Number) 07
- * d day in month (Number) 10
- * h hour in am/pm (1~12) (Number) 12
- * H hour in day (0~23) (Number) 0
- * m minute in hour (Number) 30
- * s second in minute (Number) 55
- * S millisecond (Number) 978
- * Z zone offset hours (Number) 6
- * z zone offset minutes (Number) 30
- * ' escape for text (Delimiter)
- * '' single quote (Literal) '
- * </pre>
- * </blockquote>
- * The milliseconds, zone hour, and zone minutes are not required for parsing.
- * @param dateString the stringified date in the format described above
- * @return the Date instance
- * @throws ParseException if the string is not of the expected format
- */
- public static final Date convertStringToDate(String dateString) throws ParseException {
- ArgCheck.isNotEmpty(dateString);
- int badIndex=0;
- int millis = 0;
- try {
- // Find the year ...
- int year = Integer.parseInt( dateString.substring(0,4) );
- badIndex=5;
- int month = Integer.parseInt( dateString.substring(5,7) );
- badIndex=8;
- int day = Integer.parseInt( dateString.substring(8,10) );
- badIndex=11;
- int hours = Integer.parseInt( dateString.substring(11,13) );
- badIndex=14;
- int minutes = Integer.parseInt( dateString.substring(14,16) );
- badIndex=17;
- int seconds = Integer.parseInt( dateString.substring(17,19) );
- int len = dateString.length();
- if ( len > 19 ) {
- badIndex=20;
- millis = Integer.parseInt( dateString.substring(20,23) );
- }
- if ( len > 23 ) {
- badIndex=24;
- Integer.parseInt( dateString.substring(24,26) );
- }
- if ( len > 26 ) {
- badIndex=27;
- Integer.parseInt( dateString.substring(27,29) );
- }
-
- // Note the month is zero-based!!!!
- GregorianCalendar calendar = new GregorianCalendar(year,month-1,day,hours,minutes,seconds);
- calendar.add(Calendar.MILLISECOND,millis);
- // TODO: Unable to support different time zones!!!!
- //calendar.add(Calendar.ZONE_OFFSET,millis); throws IllegalArgument
- return calendar.getTime();
-
- // Use a java.sql.Timestamp since java.util.Date doesn't have a way to set millis!!!
- //return new Timestamp(year,month,day,hours,minutes,seconds,millis*1000);
- } catch ( IndexOutOfBoundsException ioobe ) {
- final Object[] params = new Object[]{dateString, COMPLETE_FORMAT};
- throw new ParseException(CorePlugin.Util.getString("DateUtil.The_string_is_not_of_the_expected_format_1",params),badIndex); //$NON-NLS-1$
- } catch ( NumberFormatException nfe ) {
- final Object[] params = new Object[]{dateString, COMPLETE_FORMAT};
- throw new ParseException(CorePlugin.Util.getString("DateUtil.The_string_is_not_of_the_expected_format_2",params),badIndex); //$NON-NLS-1$
- }
- }
-
- public static final String getDateAsString( Date timestamp ) {
- return formatString(timestamp);
- }
-
- public static final String getDateAsString( long timestamp ) {
- return formatString(new Date(timestamp));
- }
-
- public static final Date getDate( long timestamp ) {
- return new Date(timestamp);
- }
-
- public static final String getCurrentDateAsString() {
- return formatString(new Date());
- }
-
- public static final Date getCurrentDate() {
- return new Date();
- }
-
- private static final String formatString( Date timestamp ) {
- StringBuffer sb = new StringBuffer( DATE_FORMATTER.get().format(timestamp) );
- long offsetMillis = Calendar.getInstance().get( Calendar.ZONE_OFFSET );
- if ( offsetMillis == 0 ) {
- sb.append("+00:00"); //$NON-NLS-1$
- } else if ( offsetMillis > 0 ) {
- sb.append('+');
- } else {
- sb.append('-');
- }
- int seconds = (int)(Math.abs(offsetMillis) / 1000);
- int minutes = seconds / 60;
- int hours = minutes / 60;
- minutes = minutes % 60;
- if ( hours < 10 ) {
- sb.append('0');
- }
- sb.append( hours );
- sb.append(':');
- if ( minutes < 10 ) {
- sb.append('0');
- }
- sb.append( minutes );
- return sb.toString();
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -25,10 +25,10 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -66,36 +66,22 @@
* @param coll reference to a Collection. Can be null.
* @throws IOException
*/
- public static void writeCollection(ObjectOutput out, Collection coll) throws IOException {
+ public static void writeCollection(ObjectOutput out, Collection<?> coll) throws IOException {
if (coll == null) {
out.writeInt(0);
} else {
final int size = coll.size();
if (size > 0) {
out.writeInt(coll.size());
- for (Iterator i = coll.iterator(); i.hasNext();) {
- out.writeObject(i.next());
+ for (Object object : coll) {
+ out.writeObject(object);
}
}
}
}
- /**
- * Writes a List to the output using its indexes.
- * @param out the output instance
- * @param list reference to a List. Can be null.
- * @throws IOException
- */
- public static void writeList(ObjectOutput out, List list) throws IOException {
- if (list == null) {
- out.writeInt(0);
- } else {
- final int size = list.size();
- out.writeInt(size);
- for (int i = 0; i < size; i++) {
- out.writeObject(list.get(i));
- }
- }
+ public static void writeList(ObjectOutput out, List<?> coll) throws IOException {
+ writeCollection(out, coll);
}
/**
@@ -104,14 +90,12 @@
* @param list reference to a Map. Can be null.
* @throws IOException
*/
- public static void writeMap(ObjectOutput out, Map map) throws IOException {
+ public static void writeMap(ObjectOutput out, Map<?, ?> map) throws IOException {
if (map == null) {
out.writeInt(0);
} else {
out.writeInt(map.size());
- Map.Entry entry = null;
- for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
- entry = (Map.Entry)i.next();
+ for (Map.Entry<?, ?> entry : map.entrySet()) {
out.writeObject(entry.getKey());
out.writeObject(entry.getValue());
}
@@ -119,21 +103,26 @@
}
/**
- * Reads an array of String that was written to the ouput by this utility class
+ * Reads an array of String that was written to the output by this utility class
* @param in
* @return a non-null String[]
* @throws IOException
* @throws ClassNotFoundException
*/
- public static String[] readStringArray(ObjectInput in) throws IOException, ClassNotFoundException {
+ @SuppressWarnings("unchecked")
+ public static <T> T[] readArray(ObjectInput in, Class<T> type) throws IOException, ClassNotFoundException {
final int length = in.readInt();
- String[] strings = new String[length];
+ T[] result = (T[])Array.newInstance(type, length);
for (int i = 0; i < length; i++) {
- strings[i] = (String)in.readObject();
+ result[i] = type.cast(in.readObject());
}
- return strings;
+ return result;
}
+ public static String[] readStringArray(ObjectInput in) throws IOException, ClassNotFoundException {
+ return readArray(in, String.class);
+ }
+
/**
* Reads a List that was written by this utility class.
* @param in
@@ -141,15 +130,14 @@
* @throws IOException
* @throws ClassNotFoundException
*/
- public static List readList(ObjectInput in) throws IOException, ClassNotFoundException {
- final int size = in.readInt();
- Object [] array = new Object[size];
- for (int i = 0; i < size; i++) {
- array[i] = in.readObject();
- }
- return Arrays.asList(array);
+ public static <T> List<T> readList(ObjectInput in, Class<T> type) throws IOException, ClassNotFoundException {
+ return Arrays.asList(readArray(in, type));
}
+ public static List<?> readList(ObjectInput in) throws IOException, ClassNotFoundException {
+ return readList(in, Object.class);
+ }
+
/**
* Reads a Map that was written by this utility class
* @param in
@@ -157,11 +145,12 @@
* @throws IOException
* @throws ClassNotFoundException
*/
- public static Map readMap(ObjectInput in) throws IOException, ClassNotFoundException {
+ @SuppressWarnings("unchecked")
+ public static <K, V> Map<K, V> readMap(ObjectInput in) throws IOException, ClassNotFoundException {
final int size = in.readInt();
- HashMap map = new HashMap(size + 1, 1);
+ HashMap<K, V> map = new HashMap<K, V>(size);
for (int i = 0; i < size; i++) {
- map.put(in.readObject(), in.readObject());
+ map.put((K)in.readObject(), (V)in.readObject());
}
return map;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/ObjectConverterUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -28,7 +28,6 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -123,25 +122,29 @@
return convertToInputStream(new String(data));
}
- public static void write(final InputStream is, final String fileName) throws Exception {
+ public static void write(final InputStream is, final String fileName) throws IOException {
File f = new File(fileName);
f.delete();
+ write(is, f);
+ }
+
+ public static void write(final InputStream is, final File f) throws IOException {
FileOutputStream fio = new FileOutputStream(f);
BufferedOutputStream bos = new BufferedOutputStream(fio);
-
- byte[] buff = new byte[2048];
- int bytesRead;
-
- // Simple read/write loop.
- while (-1 != (bytesRead = is.read(buff, 0, buff.length))) {
- bos.write(buff, 0, bytesRead);
+ try {
+ byte[] buff = new byte[2048];
+ int bytesRead;
+
+ // Simple read/write loop.
+ while (-1 != (bytesRead = is.read(buff, 0, buff.length))) {
+ bos.write(buff, 0, bytesRead);
+ }
+ } finally {
+ bos.close();
}
-
- bos.flush();
- bos.close();
}
-
+
public static void write(byte[] data, final String fileName) throws Exception {
InputStream is = ObjectConverterUtil.convertToInputStream(data);
ObjectConverterUtil.write(is, fileName);
@@ -154,16 +157,6 @@
is.close();
}
- public static InputStream convertToInputStream(final File file) {
- try {
- FileInputStream fis = new FileInputStream(file);
- InputStream isContent = new BufferedInputStream(fis);
- return isContent;
- } catch (FileNotFoundException fie) {
- final Object[] params = new Object[]{file.getName()};
- throw new IllegalArgumentException(CorePlugin.Util.getString("ObjectConverterUtil.File_is_not_found_4",params)); //$NON-NLS-1$
- }
- }
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -12,8 +12,11 @@
package com.metamatrix.core.util;
+import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.io.StringReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
@@ -26,6 +29,7 @@
import java.util.regex.Pattern;
import com.metamatrix.core.CorePlugin;
+import com.metamatrix.core.MetaMatrixRuntimeException;
/**
* This is a common place to put String utility methods.
@@ -880,6 +884,9 @@
public static boolean isLetterOrDigit(char c) {
return isBasicLatinLetter(c) || isBasicLatinDigit(c) || Character.isLetterOrDigit(c);
}
+ public static boolean isValid(String str) {
+ return (!(str == null || str.trim().length() == 0));
+ }
public static String toUpperCase(String str) {
String newStr = convertBasicLatinToUpper(str);
@@ -1040,4 +1047,20 @@
throw new IllegalArgumentException("Conversion from String to "+ type.getName() + " is not supported"); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ public static String[] getLines(final String value) {
+ StringReader stringReader = new StringReader(value);
+ BufferedReader reader = new BufferedReader(stringReader);
+ ArrayList result = new ArrayList();
+ try {
+ String line = reader.readLine();
+ while (line != null) {
+ result.add(line);
+ line = reader.readLine();
+ }
+ } catch (IOException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+ return (String[]) result.toArray(new String[result.size()]);
+ }
}
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtilities.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtilities.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtilities.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,262 +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 com.metamatrix.core.util;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-
-import com.metamatrix.core.MetaMatrixRuntimeException;
-
-/**
- * This class contains static utilities that return strings that are the result of manipulating other strings or objects.
- * @since 3.1
- * @version 3.1
- * @author <a href="mailto:jverhaeg@metamatrix.com">John P. A. Verhaeg</a>
- */
-public class StringUtilities {
- /**
- * The String "\n"
- */
- public static final String NEW_LINE = "\n"; //$NON-NLS-1$
-
- /**
- * The name of the System property that specifies the string that should be used to separate
- * lines. This property is a standard environment property that is usually set automatically.
- */
- public static final String LINE_SEPARATOR_PROPERTY_NAME = "line.separator"; //$NON-NLS-1$
-
- /**
- * The String that should be used to separate lines; defaults to
- * {@link #NEW_LINE}
- */
- public static final String LINE_SEPARATOR = System.getProperty(LINE_SEPARATOR_PROPERTY_NAME, NEW_LINE);
-
- //############################################################################################################################
- //# Static Methods #
- //############################################################################################################################
-
- public static String getLineSeparator() {
- return LINE_SEPARATOR;
- }
-
- /**
- * Returns the path representing the concatenation of the specified path prefix and suffix. The resulting path is guaranteed
- * to have exactly one file separator between the prefix and suffix.
- * @param prefix The path prefix
- * @param suffix The path suffix
- * @return The concatenated path prefix and suffix
- * @since 3.1
- */
- public static String buildPath(final String prefix, final String suffix) {
- final StringBuffer path = new StringBuffer(prefix);
- if (!prefix.endsWith(File.separator)) {
- path.append(File.separator);
- }
- if (suffix.startsWith(File.separator)) {
- path.append(suffix.substring(File.separator.length()));
- } else {
- path.append(suffix);
- }
- return path.toString();
- }
-
- /**
- * Returns a new string that lowercases the first character in the passed in
- * value String
- * @param value
- * @return String
- */
- public static String lowerCaseFirstChar(final String value){
- if(value == null){
- return null;
- }
-
- //Lower case the first char and try to look-up the SF
- String firstChar = new Character(value.charAt(0) ).toString();
- firstChar = firstChar.toLowerCase();
- return (firstChar + value.substring(1) );
- }
-
- /**
- * Returns a new string that uppercases the first character in the passed in
- * value String
- * @param value
- * @return String
- */
- public static String upperCaseFirstChar(final String value){
- if(value == null){
- return null;
- }
-
- //Lower case the first char and try to look-up the SF
- String firstChar = new Character(value.charAt(0) ).toString();
- firstChar = firstChar.toUpperCase();
- return (firstChar + value.substring(1) );
- }
-
- /**
- * Returns a new string that represents the last fragment of the original
- * string that begins with an uppercase char. Ex: "getSuperTypes" would
- * return "Types".
- * @param value
- * @param lastToken - the last token tried... if not null will look
- * backwards from the last token instead of the end of the value param
- * @return String
- */
- public static String getLastUpperCharToken(final String value, final String lastToken){
- if(value == null || lastToken == null){
- return value;
- }
-
- int index = value.lastIndexOf(lastToken);
- if(index == -1){
- return null;
- }
-
- StringBuffer result = new StringBuffer();
- for(int i = index - 1; i >= 0 ; i--){
- result.insert(0,value.charAt(i) );
- if(Character.isUpperCase(value.charAt(i) ) ){
- return result.toString() + lastToken;
- }
- }
-
- return result.toString() + lastToken;
- }
-
- /**
- * Returns a new string that represents the last fragment of the original
- * string that begins with an uppercase char. Ex: "getSuperTypes" would
- * return "Types".
- * @param value
- * @return String
- */
- public static String getLastUpperCharToken(final String value){
- if(value == null){
- return null;
- }
-
- StringBuffer result = new StringBuffer();
- for(int i = value.length() - 1; i >= 0; i--){
- result.insert(0, value.charAt(i) );
- if(Character.isUpperCase(value.charAt(i) ) ){
- return result.toString();
- }
- }
-
- return result.toString();
- }
-
- public static String[] getLines(final String value) {
- StringReader stringReader = new StringReader(value);
- BufferedReader reader = new BufferedReader(stringReader);
- ArrayList result = new ArrayList();
- try {
- String line = reader.readLine();
- while (line != null) {
- result.add(line);
- line = reader.readLine();
- }
- } catch (IOException e) {
- throw new MetaMatrixRuntimeException(e);
- }
- return (String[]) result.toArray(new String[result.size()]);
- }
-
- public static String removeChars(final String value, final char[] chars) {
- final StringBuffer result = new StringBuffer();
- if (value != null && chars != null && chars.length > 0) {
- final String removeChars = String.valueOf(chars);
- for (int i = 0; i < value.length(); i++) {
- final String character = value.substring(i, i + 1);
- if (removeChars.indexOf(character) == -1) {
- result.append(character);
- }
- }
- } else {
- result.append(value);
- }
- return result.toString();
- }
-
- /** Replaces all "whitespace" characters from the specified string with space
- * characters, where whitespace includes \r\t\n and other characters
- * @param value the string to work with
- * @param stripExtras if true, replace multiple whitespace characters with a single character.
- * @see java.util.regex.Pattern
- */
- public static String replaceWhitespace(String value, boolean stripExtras) {
- return replaceWhitespace(value, " ", stripExtras); //$NON-NLS-1$
- }
-
- /** Replaces all "whitespace" characters from the specified string with space
- * characters, where whitespace includes \r\t\n and other characters
- * @param value the string to work with
- * @param replaceWith the character to replace with
- * @param stripExtras if true, replace multiple whitespace characters with a single character.
- * @see java.util.regex.Pattern
- */
- public static String replaceWhitespace(String value, String replaceWith, boolean stripExtras) {
- String rv = value.replaceAll("\\s+", replaceWith); //$NON-NLS-1$
-
- if (stripExtras) {
- rv = removeExtraWhitespace(rv);
- } // endif
-
- return rv;
- }
-
- /** Replaces multiple sequential "whitespace" characters from the specified string with
- * a single space character, where whitespace includes \r\t\n and other characters
- * @param value the string to work with
- * @see java.util.regex.Pattern
- */
- public static String removeExtraWhitespace(String value) {
- return value.replaceAll("\\s\\s+", " "); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- /**
- *
- * @param originalString
- * @param maxLength
- * @param endLength
- * @param middleString
- * @return
- * @since 5.0
- */
- public static String condenseToLength(String originalString, int maxLength, int endLength, String middleString) {
- if( originalString.length() <= maxLength) {
- return originalString;
- }
- int originalLength = originalString.length();
- StringBuffer sb = new StringBuffer(maxLength);
- sb.append(originalString.substring(0, maxLength - endLength - middleString.length()));
- sb.append(middleString);
- sb.append(originalString.substring(originalLength - endLength, originalLength));
-
- return sb.toString();
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/ZipFileUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,822 +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 com.metamatrix.core.util;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import com.metamatrix.core.CorePlugin;
-
-/**
- * This class provides utilities to manipulate Zip files.
- */
-public final class ZipFileUtil {
-
- // ===========================================================================================================================
- // Constants
-
- // specify buffer size for extraction
- static final int BUFFER = 16384;
-
- static final String TMP_PFX = "ZipFileUtil"; //$NON-NLS-1$
- static final String TMP_SFX = ".zip"; //$NON-NLS-1$
-
- // ===========================================================================================================================
- // Static Controller Methods
-
- /**
- * Adds the file with the specified name to the zip file with the specified name.
- *
- * @param zipFileName
- * The name of the zip file to which the file with the specified name will be added.
- * @param fileName
- * The name of the file to be added.
- * @return True if the file with the specified name was successfully added to the zip file with the specified name.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- public static boolean add(final String zipFileName,
- final String fileName) throws IOException {
- ArgCheck.isNotEmpty(zipFileName);
- ArgCheck.isNotEmpty(fileName);
-
- List fileNames = new ArrayList();
- fileNames.add(fileName);
- return addAll(new File(zipFileName), fileNames, fileNames);
- }
-
- /**
- * Adds the file with the specified name to the zip file with the specified name.
- *
- * @param zipFileName
- * The name of the zip file to which the file with the specified name will be added.
- * @param entryName
- * The name to call the entry in the zip file.
- * @param fileName
- * The name of the file to be added.
- * @return True if the file with the specified name was successfully added to the zip file with the specified name.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- public static boolean add(final String zipFileName,
- final String entryName,
- final String fileName) throws IOException {
- ArgCheck.isNotEmpty(zipFileName);
- ArgCheck.isNotEmpty(entryName);
- ArgCheck.isNotEmpty(fileName);
-
- List fileNames = new ArrayList();
- fileNames.add(fileName);
- List entryNames = new ArrayList();
- entryNames.add(entryName);
- return addAll(new File(zipFileName), entryNames, fileNames);
- }
-
- /**
- * Adds the file with the specified name to the specified zip file.
- *
- * @param zipFile
- * The zip file to which the file with the specified name will be added.
- * @param fileName
- * The name of the file to be added.
- * @return True if the file with the specified name was successfully added to the specified zip file.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- public static boolean add(final File zipFile,
- final String fileName) throws IOException {
- ArgCheck.isNotNull(zipFile);
- ArgCheck.isNotEmpty(fileName);
-
- List fileNames = new ArrayList();
- fileNames.add(fileName);
- return addAll(zipFile, fileNames, fileNames);
- }
-
-
-
- /**
- * Adds all of the files in the specified directory to the specified zip file.
- *
- * @param zipFile
- * The zip file to which the file with the specified name will be added.
- * @param dirName
- * The name of the directory which contains the files to be added.
- * @return True if the files wes successfully added to the specified zip file.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @since 4.3
- */
- public static boolean addAll(final File zipFile,
- final String dirName) throws IOException {
- return addAll(zipFile, dirName, ""); //$NON-NLS-1$
- }
-
- /**
- * Adds all of the files in the specified directory to the specified zip file.
- *
- * @param zipFile
- * The zip file to which the file with the specified name will be added.
- * @param dirName
- * The name of the directory which contains the files to be added.
- * @param pathInZip
- * Path in which the files should be added in the zip.
- * @return True if the files wes successfully added to the specified zip file.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @since 4.3
- */
- public static boolean addAll(final File zipFile,
- final String dirName,
- String pathInZip) throws IOException {
- ArgCheck.isNotNull(zipFile);
- ArgCheck.isNotEmpty(dirName);
-
-
- File dir = new File(dirName);
- //get the entrynames (relative path)
- if (pathInZip.length() > 0) {
- pathInZip = pathInZip + File.separator;
- }
- List entryNames = listRecursively(dir, pathInZip);
- //get the filenames (full path)
- List fileNames = listRecursively(dir, dir.getAbsolutePath() + File.separator);
-
- return addAll(zipFile, entryNames, fileNames);
- }
-
-
- /**
- * List recursively from the <code>sourceDirectory</code> all its contents.
- * @param sourceDirectory
- * @param pathSoFar Path tp append to the beginning of each result.
- * @return List of Strings, the filenames of the contents of the directory.
- * @since 4.3
- */
- private static List listRecursively(File sourceDirectory, String pathSoFar) throws FileNotFoundException {
-
- if (!sourceDirectory.exists()) {
- throw new FileNotFoundException(CorePlugin.Util.getString("FileUtils.File_does_not_exist._1", sourceDirectory)); //$NON-NLS-1$
- }
- if (!sourceDirectory.isDirectory()) {
- throw new FileNotFoundException(CorePlugin.Util.getString("FileUtils.Not_a_directory", sourceDirectory)); //$NON-NLS-1$
- }
-
- return listRecursivelySub(sourceDirectory, pathSoFar);
- }
-
- private static List listRecursivelySub(File sourceDirectory, String pathSoFar) {
- List results = new ArrayList();
-
- File[] sourceFiles = sourceDirectory.listFiles();
- for (int i = 0; i < sourceFiles.length; i++) {
- File srcFile = sourceFiles[i];
- String newPathSoFar = pathSoFar + srcFile.getName();
- if (srcFile.isDirectory()) {
- results.addAll(listRecursivelySub(srcFile, newPathSoFar + File.separator));
- } else {
- results.add(newPathSoFar);
- }
- }
- return results;
- }
-
-
-
-
- /**
- * Adds the files with the specified names to the specified zip file.
- *
- * @param zipFile
- * The zip file to which the file with the specified name will be added.
- * @param entryNames
- * List of Strings. The names to call the entries in the zip file. Must be in the same order as <code>fileNames</code>.
- * @param fileNames
- * List of Files. The names of the file to be added. Must be in the same order as <code>entryNames</code>.
- * @return True if the file with the specified name was successfully added to the specified zip file.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- private static boolean addAll(final File zipFile,
- final List entryNames,
- final List fileNames) throws IOException {
- FileOutputStream fos = null;
- ZipOutputStream out = null;
- File tmpFile = File.createTempFile(TMP_PFX, TMP_SFX);
- try {
- // Create temp zip file
- fos = new FileOutputStream(tmpFile);
- out = new ZipOutputStream(fos);
- // Create buffer to use to write data to temp zip file
- final byte[] buf = new byte[BUFFER];
- // Copy specified zip file to temp zip file
- if (zipFile.exists()) {
- ZipFile zipFileZip = null;
- FileInputStream fis = null;
- ZipInputStream in = null;
- try {
- zipFileZip = new ZipFile(zipFile);
- fis = new FileInputStream(zipFile);
- in = new ZipInputStream(fis);
- for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in.getNextEntry()) {
- writeEntry(entry, zipFileZip.getInputStream(entry), out, buf);
- }
- } catch (final ZipException ignored) {
- // Happens when zip file empty or contains no entries
- } finally {
- // Close input streams so we can later replace specified file with temp file
- if (zipFileZip != null) {
- zipFileZip.close();
- }
- cleanup(in);
- cleanup(fis);
- }
- }
-
- // Add specified entries to temp zip file
- Iterator entryNamesIter = entryNames.iterator();
- Iterator fileNamesIter = fileNames.iterator();
- while (entryNamesIter.hasNext() && fileNamesIter.hasNext()) {
- String entryName = (String) entryNamesIter.next();
- String fileName = (String) fileNamesIter.next();
- long modified = new File(fileName).lastModified();
-
- FileInputStream fis = new FileInputStream(fileName);
- ZipEntry entry = new ZipEntry(entryName);
- entry.setTime(modified);
- writeEntry(entry, fis, out, buf);
- // Close output stream so we can replace specified file with temp file
- // (Also set variable to null so we don't close again in finally block)
- cleanup(fis);
- }
-
-
- out.close();
- out = null;
- fos.close();
- fos = null;
- // Replace specified file with temp file
- FileUtils.rename(tmpFile.getAbsolutePath(), zipFile.getAbsolutePath(), true);
-
-
- return true;
- } finally {
- cleanup(out);
- cleanup(fos);
- if (tmpFile != null && tmpFile.exists() && !tmpFile.delete()) {
- Logger.getLogger("org.teiid.common-core").log(Level.INFO, "Could not delete temp file " + tmpFile.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
- /**
- * Extract the given zip file to the given destination directory base.
- *
- * @param zipFileName
- * The full path and file name of the Zip file to extract.
- * @param destinationDirectory
- * The root directory to extract to.
- * @throws IOException
- */
- public static void extract(final String zipFileName,
- final String destinationDirectory) throws IOException {
- try {
- File sourceZipFile = new File(zipFileName);
- File unzipDestinationDirectory = new File(destinationDirectory);
-
- // Open Zip file for reading
- ZipFile zipFile = new ZipFile(sourceZipFile, ZipFile.OPEN_READ);
-
- // Create an enumeration of the entries in the zip file
- Enumeration zipFileEntries = zipFile.entries();
-
- // Process each entry
- while (zipFileEntries.hasMoreElements()) {
- // grab a zip file entry
- ZipEntry entry = (ZipEntry)zipFileEntries.nextElement();
-
- String currentEntry = entry.getName();
-
- File destFile = new File(unzipDestinationDirectory, currentEntry);
-
- // grab file's parent directory structure
- File destinationParent = destFile.getParentFile();
-
- // create the parent directory structure if needed
- destinationParent.mkdirs();
-
- // extract file if not a directory
- if (!entry.isDirectory()) {
- BufferedInputStream is = new BufferedInputStream(zipFile.getInputStream(entry));
- int currentByte;
- // establish buffer for writing file
- byte data[] = new byte[BUFFER];
-
- // write the current file to disk
- FileOutputStream fos = new FileOutputStream(destFile);
- BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER);
-
- // read and write until last byte is encountered
- while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
- dest.write(data, 0, currentByte);
- }
- dest.flush();
- dest.close();
- fos.close();
- is.close();
- }
- }
- zipFile.close();
- } catch (IOException ioe) {
- throw ioe;
- }
- }
-
- /**
- * Removes the file with the specified name from the zip file with the specified name.
- *
- * @param zipFileName
- * The name of the zip file from which the file with the specified name will be removed.
- * @param fileName
- * The name of the file to be removed.
- * @param ignoreCase
- * Indicates whether the case of the filename should be ignored when finding the match.
- * @return True if the file with the specified name was successfully removed from the zip file with the specified name.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- public static boolean remove(final String zipFileName,
- final String fileName,
- boolean ignoreCase) throws IOException {
- ArgCheck.isNotEmpty(zipFileName);
- return remove(new File(zipFileName), fileName, ignoreCase);
- }
-
- /**
- * Removes the file with the specified name from the zip file with the specified name.
- *
- * @param zipFileName
- * The name of the zip file from which the file with the specified name will be removed.
- * @param fileName
- * The name of the file to be removed.
- * @return True if the file with the specified name was successfully removed from the zip file with the specified name.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- public static boolean remove(final String zipFileName,
- final String fileName) throws IOException {
- ArgCheck.isNotEmpty(zipFileName);
- return remove(new File(zipFileName), fileName, false);
- }
-
- /**
- * Removes the file with the specified name to the specified zip file.
- *
- * @param zipFile
- * The zip file from which the file with the specified name will be removed.
- * @param fileName
- * The name of the file to be removed.
- * @return True if the file with the specified name was successfully removed from the specified zip file.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- public static boolean remove(final File zipFile,
- final String fileName) throws IOException {
- ArgCheck.isNotNull(zipFile);
- ArgCheck.isNotEmpty(fileName);
-
- return remove(zipFile, fileName, false);
- }
-
- /**
- * Removes the file with the specified name to the specified zip file.
- *
- * @param zipFile
- * The zip file from which the file with the specified name will be removed.
- * @param fileName
- * The name of the file to be removed.
- * @param ignoreCase
- * Indicates whether the case of the filename should be ignored when finding the match.
- * @return True if the file with the specified name was successfully removed from the specified zip file.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testAddRemove()}
- * @since 4.3
- */
- public static boolean remove(final File zipFile,
- final String fileName,
- boolean ignoreCase) throws IOException {
- ArgCheck.isNotNull(zipFile);
- ArgCheck.isNotEmpty(fileName);
- FileOutputStream fos = null;
- ZipOutputStream out = null;
- File tmpFile = File.createTempFile(TMP_PFX, TMP_SFX);
- try {
- // Create temp zip file
- fos = new FileOutputStream(tmpFile);
- out = new ZipOutputStream(fos);
- // Create buffer to use to write data to temp zip file
- final byte[] buf = new byte[BUFFER];
- // Copy specified zip file to temp zip file, skipping entry with specified file name
- final ZipFile zipFileZip = new ZipFile(zipFile);
- FileInputStream fis = null;
- ZipInputStream in = null;
- try {
- fis = new FileInputStream(zipFile);
- in = new ZipInputStream(fis);
- for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in.getNextEntry()) {
- if (ignoreCase) {
- if (!entry.getName().equalsIgnoreCase(fileName)) {
- writeEntry(entry, zipFileZip.getInputStream(entry), out, buf);
- }
- } else {
- if (!entry.getName().equals(fileName)) {
- writeEntry(entry, zipFileZip.getInputStream(entry), out, buf);
- }
-
- }
- }
- } finally {
- // Close input streams so we can later replace specified file with temp file
- zipFileZip.close();
- cleanup(in);
- cleanup(fis);
- }
- // Close output stream so we can replace specified file with temp file
- // (Also set variable to null so we don't close again in finally block)
- out.close();
- out = null;
- fos.close();
- fos = null;
- // Replace specified file with temp file
- FileUtils.rename(tmpFile.getAbsolutePath(), zipFile.getAbsolutePath(), true);
- return true;
-
- } finally {
- cleanup(out);
- cleanup(fos);
- }
- }
-
-
- public static boolean replace (final File zipFile, final String replaceName, InputStream replaceStream) throws IOException {
- ArgCheck.isNotNull(zipFile);
- ArgCheck.isNotEmpty(replaceName);
-
- FileOutputStream fos = null;
- ZipOutputStream out = null;
- File tmpFile = File.createTempFile(TMP_PFX, TMP_SFX);
-
- try {
- // Create temp zip file
- fos = new FileOutputStream(tmpFile);
- out = new ZipOutputStream(fos);
-
- // Create buffer to use to write data to temp zip file
- final byte[] buf = new byte[BUFFER];
-
- // Copy specified zip file to temp zip file, skipping entry with
- // specified file name
- final ZipFile zipFileZip = new ZipFile(zipFile);
- FileInputStream fis = null;
- ZipInputStream in = null;
- boolean replaced = false;
-
- try {
- fis = new FileInputStream(zipFile);
- in = new ZipInputStream(fis);
- for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in.getNextEntry()) {
- boolean replace = entry.getName().equals(replaceName);
- if (replace) {
- writeEntry(new ZipEntry(entry.getName()), replaceStream, out, buf);
- replaced = true;
- } else {
- writeEntry(new ZipEntry(entry.getName()), zipFileZip.getInputStream(entry),out, buf);
- }
- }
- } finally {
- // Close input streams so we can later replace specified file
- // with temp file
- zipFileZip.close();
- cleanup(in);
- cleanup(fis);
- }
-
- // if the original was not there then add a new entry
- if (!replaced) {
- ZipEntry entry = new ZipEntry(replaceName);
- writeEntry(entry, replaceStream, out, buf);
- }
-
- // Close output stream so we can replace specified file with temp
- // file
- // (Also set variable to null so we don't close again in finally
- // block)
- out.close();
- out = null;
- fos.close();
- fos = null;
-
- // Replace specified file with temp file
- try {
- FileUtils.rename(tmpFile.getAbsolutePath(), zipFile.getAbsolutePath(), true);
- } catch (Exception e) {
- IOException ex = new IOException();
- ex.initCause(e);
- throw ex;
- }
- return true;
-
- } finally {
- cleanup(out);
- cleanup(fos);
- }
- }
-
- /**
- * Returns the file with the specified name to the specified zip file.
- *
- * @param zipFile
- * The zip file from which the file with the specified name will be retrieved from.
- * @param fileName
- * The name of the file to be returned.
- * @param ignoreCase
- * Indicates whether the case of the filename should be ignored when finding the match.
- * @return True if the file with the specified name was successfully removed from the specified zip file.
- * @throws IOException
- * If an I/O error occurs updating the zip file.
- * @test {@link TestZipFileUtil#testGet()}
- * @since 4.3
- */
- public static InputStream get(final File zipFile,
- final String fileName,
- boolean ignoreCase) throws IOException {
- ArgCheck.isNotNull(zipFile);
- ArgCheck.isNotEmpty(fileName);
- ByteArrayOutputStream out = null;
- try {
-
- out = new ByteArrayOutputStream();
- // Create temp zip file
- // Create buffer to use to write data to temp zip file
- final byte[] buf = new byte[BUFFER];
- // Copy specified zip file to temp zip file, skipping entry with specified file name
- final ZipFile zipFileZip = new ZipFile(zipFile);
- FileInputStream fis = null;
- ZipInputStream in = null;
- try {
- fis = new FileInputStream(zipFile);
- in = new ZipInputStream(fis);
- boolean match = false;
- for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in.getNextEntry()) {
- if (ignoreCase) {
- if (entry.getName().equalsIgnoreCase(fileName)) {
- match = true;
- }
- } else {
- if (entry.getName().equals(fileName)) {
- match = true;
- }
- }
-
- if (match) {
- copyEntry(zipFileZip.getInputStream(entry), out, buf );
-
- byte[] data = out.toByteArray();
-
- out.close();
-
- return new ByteArrayInputStream(data);
-
- }
- }
- } finally {
- // Close input streams so we can later replace specified file with temp file
- zipFileZip.close();
- cleanup(in);
- cleanup(fis);
- }
-
- } finally {
- cleanup(out);
-
- }
-
- return null;
- }
-
- /**
- * Will find all entries in the jar based on the expression specified and based on
- * if case is ignored.
- *
- * @param zipFile
- * The zip file from which the find will be performed.
- * @param regexExpression
- * The regex expression supported by {@link java.util.regex}
- * @param ignoreCase
- * Indicates whether the case of an entry in the jar file should be ignored when finding the match.
- * @return List of entry names that were found to match the regex expression
- * @throws IOException
- * If an I/O error occurs reading the zip file.
- * @test {@link TestZipFileUtil#testFind()}
- * @test {@link TestZipFileUtil#testFindIgnoreCase()}
- * @test {@link TestZipFileUtil#testNotFind()}
- * @since 6.0
- */
- public static List<String> find(final File zipFile,
- final String regexExpression,
- boolean ignoreCase) throws IOException {
- ArgCheck.isNotNull(zipFile);
- ArgCheck.isNotNull(regexExpression);
-
- Pattern pattern = null;
- if (ignoreCase) {
- pattern = Pattern.compile(regexExpression, Pattern.CASE_INSENSITIVE);
- } else {
- pattern = Pattern.compile(regexExpression);
- }
- List<String> finds = new ArrayList();
- final ZipFile zipFileZip = new ZipFile(zipFile);
- FileInputStream fis = null;
- ZipInputStream in = null;
- try {
- fis = new FileInputStream(zipFile);
- in = new ZipInputStream(fis);
- for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in.getNextEntry()) {
- Matcher matcher = pattern.matcher(entry.getName());
- if (matcher.find()) {
- finds.add(entry.getName());
- }
-
- }
- } finally {
- // Close input streams so we can later replace specified file with temp file
- zipFileZip.close();
- cleanup(in);
- cleanup(fis);
- }
- return finds;
- }
-
- /**
- * Attempts to obtain the manifest file from the specified file, which
- * must be either a .jar or .zip file.
- *
- * @param path
- * @param VENDOR
- * @return Manifest, if one exist, other returns null
- */
-
- public static Manifest getManifest(File jarfile){
- JarFile jfile = null;
- String path = jarfile.getAbsolutePath();
- if(!jarfile.isDirectory()){
- if((path.indexOf(".jar")>0) || ((path.indexOf(".zip")>0))){ //$NON-NLS-1$ //$NON-NLS-2$
- //This is a jar file so look for it's Manifest information
- try{
- jfile = new JarFile(jarfile);
- Manifest manifest = jfile.getManifest();
- if(manifest != null){
- return manifest;
- }
- } catch(IOException io){
- // ignore
- }
- }
- }
- return null;
- }
-
-
- /**
- * Writes the specified entry (including its contents) to the specified output stream.
- *
- * @param entry
- * The zip entry to be added.
- * @param in
- * The inputstream from which the zip entry's contents wil be read.
- * @param out
- * The zip output stream to which the specified zip entry will be written.
- * @param buffer
- * The buffer used to transfer data from the specified zip entry to the specified zip output stream.
- * @throws IOException
- * If an I/O error occurs writing to the specified zip output stream.
- * @since 4.3
- */
- private static void writeEntry(final ZipEntry entry,
- final InputStream in,
- final ZipOutputStream out,
- final byte[] buffer) throws IOException {
- // Add specified entry to stream
- out.putNextEntry(entry);
- // Write contents of entry to stream
- final BufferedInputStream zipEntryIn = new BufferedInputStream(in);
- for (int count = zipEntryIn.read(buffer); count >= 0; count = zipEntryIn.read(buffer)) {
- out.write(buffer, 0, count);
- }
- zipEntryIn.close();
- }
-
- private static void copyEntry(final InputStream in,
- final OutputStream out,
- final byte[] buffer) throws IOException {
- BufferedInputStream zipEntryIn = null;
- try {
- // Write contents of entry to stream
- zipEntryIn = new BufferedInputStream(in);
- for (int count = zipEntryIn.read(buffer); count >= 0; count = zipEntryIn.read(buffer)) {
- out.write(buffer, 0, count);
- }
- } finally {
- zipEntryIn.close();
- }
-
- }
-
-
- private static void cleanup(InputStream stream) {
- if (stream != null) {
- try {
- stream.close();
- } catch (Exception e) {
- }
- }
- }
- private static void cleanup(OutputStream stream) {
- if (stream != null) {
- try {
- stream.close();
- } catch (Exception e) {
- }
- }
- }
-
-
- // ===========================================================================================================================
- // Constructors
-
- /**
- * Prevent initialization
- */
- private ZipFileUtil() {
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/core/vdb/VDBStatus.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/vdb/VDBStatus.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/vdb/VDBStatus.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,39 +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 com.metamatrix.core.vdb;
-
-
-public interface VDBStatus {
- public static final short INCOMPLETE = 1;
- public static final short INACTIVE = 2;
- public static final short ACTIVE = 3;
- public static final short DELETED = 4;
- public static final short ACTIVE_DEFAULT = 5;
-
- final static String[] VDB_STATUS_NAMES = {
- "Incomplete", //$NON-NLS-1$
- "Inactive", //$NON-NLS-1$
- "Active", //$NON-NLS-1$
- "Deleted", //$NON-NLS-1$
- "Active-Default"}; //$NON-NLS-1$
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/vdb/VdbConstants.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/vdb/VdbConstants.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/main/java/com/metamatrix/core/vdb/VdbConstants.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -40,17 +40,8 @@
public final static String INDEX_EXT = ".INDEX"; //$NON-NLS-1$
public final static String SEARCH_INDEX_EXT = ".SEARCH_INDEX"; //$NON-NLS-1$
public final static String MODEL_EXT = ".xmi"; //$NON-NLS-1$
+ public final static String UDF_FILE_NAME = "FunctionDefinitions.xmi"; //$NON-NLS-1$
- /**
- * These are virtual database status.
- */
- final public static class VDB_STATUS {
- public static final short INCOMPLETE = 1;
- public static final short INACTIVE = 2;
- public static final short ACTIVE = 3;
- public static final short DELETED = 4;
- }
-
public static final String VDB = ".vdb"; //$NON-NLS-1$
public static final String DEF = ".def"; //$NON-NLS-1$
Modified: trunk/common-core/src/test/java/com/metamatrix/api/exception/TestExceptionHolder.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/api/exception/TestExceptionHolder.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/test/java/com/metamatrix/api/exception/TestExceptionHolder.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -5,6 +5,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.URL;
+import java.net.URLClassLoader;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -12,7 +13,6 @@
import org.junit.Test;
-import com.metamatrix.common.classloader.PostDelegatingClassLoader;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.ReflectionHelper;
import com.metamatrix.core.util.UnitTestUtil;
@@ -30,7 +30,7 @@
}
@Test public void testDeserializationUnknownException() throws Exception {
- ClassLoader cl = new PostDelegatingClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
+ ClassLoader cl = new URLClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
Object obj = ReflectionHelper.create("test.Test", null, cl); //$NON-NLS-1$
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -56,7 +56,7 @@
}
@Test public void testDeserializationUnknownChildException() throws Exception {
- ClassLoader cl = new PostDelegatingClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
+ ClassLoader cl = new URLClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
Exception obj = (Exception)ReflectionHelper.create("test.UnknownException", null, cl); //$NON-NLS-1$
obj.initCause(new SQLException("something bad happended")); //$NON-NLS-1$
@@ -78,7 +78,7 @@
}
@Test public void testDeserializationUnknownChildException2() throws Exception {
- ClassLoader cl = new PostDelegatingClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
+ ClassLoader cl = new URLClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
ArrayList<String> args = new ArrayList<String>();
args.add("Unknown Exception"); //$NON-NLS-1$
Exception obj = (Exception)ReflectionHelper.create("test.UnknownException", args, cl); //$NON-NLS-1$
Deleted: trunk/common-core/src/test/java/com/metamatrix/common/util/TestByteArrayHelper.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/TestByteArrayHelper.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/TestByteArrayHelper.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,95 +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 com.metamatrix.common.util;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-
-public class TestByteArrayHelper extends TestCase {
-
- private static final byte[] TEST_ARRAY = (new String("TEST 1 2 3 4 5 TEST")).getBytes(); //$NON-NLS-1$
-
- // ################################## FRAMEWORK ################################
-
- public TestByteArrayHelper(String name) {
- super(name);
- }
-
- //===================================================================
- //ACTUAL TESTS
- //===================================================================
-
- public void testToByteArrayExactChunkSize(){
- int chunkSize = TEST_ARRAY.length+1;
- InputStream is = new ByteArrayInputStream(TEST_ARRAY);
- checkByteArrayWithChunkSize(TEST_ARRAY,chunkSize, is);
- }
-
- public void testToByteArrayBiggerChunkSize(){
- int chunkSize = 2*TEST_ARRAY.length;
- InputStream is = new ByteArrayInputStream(TEST_ARRAY);
- checkByteArrayWithChunkSize(TEST_ARRAY,chunkSize, is);
- }
-
- public void testToByteArraySmallerChunkSize(){
- int chunkSize = TEST_ARRAY.length/7;
- InputStream is = new ByteArrayInputStream(TEST_ARRAY);
- checkByteArrayWithChunkSize(TEST_ARRAY,chunkSize, is);
- }
-
- public void testToByteArrayBufferedInputStream(){
- int chunkSize = TEST_ARRAY.length+1;
- InputStream is = new ByteArrayInputStream(TEST_ARRAY);
- is = new BufferedInputStream(is);
- checkByteArrayWithChunkSize(TEST_ARRAY,chunkSize, is);
- }
-
- public void testToByteArrayFakeInputStream(){
- int chunkSize = TEST_ARRAY.length+5;
- InputStream is = new FakeInputStream(TEST_ARRAY);
- checkByteArrayWithChunkSize(TEST_ARRAY,chunkSize, is);
- }
-
-
- //===================================================================
- //TESTS HELPERS
- //===================================================================
-
- private void checkByteArrayWithChunkSize(byte[] controlData, int chunkSize, InputStream is){
- byte[] testData = null;
- try{
- testData = ByteArrayHelper.toByteArray(is, chunkSize);
- assertNotNull(testData);
- } catch (IOException e){
- fail(e.getMessage());
- }
-
- assertTrue("byte arrays are NOT same size", controlData.length == testData.length); //$NON-NLS-1$
- assertTrue("byte arrays are NOT identical", Arrays.equals(controlData, testData)); //$NON-NLS-1$
- }
-}
Modified: trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestDhKeyGenerator.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestDhKeyGenerator.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestDhKeyGenerator.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -24,7 +24,6 @@
import junit.framework.TestCase;
-import com.metamatrix.common.util.crypto.cipher.SymmetricCryptor;
public class TestDhKeyGenerator extends TestCase {
@@ -42,7 +41,7 @@
String cleartext2 = clientCryptor.decrypt(ciphertext);
assertEquals(cleartext, cleartext2);
- assertTrue(CryptoUtil.isValueEncrypted(new String(ciphertext)));
+ assertTrue(!ciphertext.equals(cleartext));
}
}
Modified: trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestEncryptDecrypt.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -22,24 +22,26 @@
package com.metamatrix.common.util.crypto;
+import static org.junit.Assert.*;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
-import junit.framework.TestCase;
+import org.junit.BeforeClass;
+import org.junit.Test;
-import com.metamatrix.common.util.crypto.cipher.BasicCryptor;
-import com.metamatrix.common.util.crypto.cipher.SymmetricCryptor;
/**
* <p>Test cases for {@link CryptoFactory} and carious <code>Encryptor</code>
* and <code>Decryptor</code> implementations. </p>
*/
-public class TestEncryptDecrypt extends TestCase {
+public class TestEncryptDecrypt {
// Some strings for testing...
private static final String ALPHA_U = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //$NON-NLS-1$
@@ -49,14 +51,11 @@
/** String to encrypt and decrypt. */
private static final String CLEARTEXT = ALPHA_U + ALPHA_L + NUMBERS + MISC_CHAR;
-
- // =========================================================================
- // T E S T C O N T R O L
- // =========================================================================
-
- /** Construct test case. */
- public TestEncryptDecrypt( String name ) {
- super( name );
+
+ private static Cryptor cryptor;
+
+ @BeforeClass public static void oneTimeSetup() throws CryptoException, IOException {
+ cryptor = SymmetricCryptor.getSymmectricCryptor(TestEncryptDecrypt.class.getResource("/teiid.keystore")); //$NON-NLS-1$
}
// =========================================================================
@@ -67,17 +66,11 @@
* Test encryption (and decryption) for specified string.
*/
public void helpTestEncryptDecrypt( String cleartext ) throws CryptoException {
- // Get a utility that can be used for encryption
- Encryptor encryptor = CryptoUtil.getEncryptor();
-
- // Get a utility that can be used for decryption
- Decryptor decryptor = CryptoUtil.getDecryptor();
-
// Encrypt the cleartext into ciphertext
- String ciphertext = encryptor.encrypt( cleartext );
- String cleartext2 = decryptor.decrypt( ciphertext );
+ String ciphertext = cryptor.encrypt( cleartext );
+ String cleartext2 = cryptor.decrypt( ciphertext );
- assertTrue(CryptoUtil.isValueEncrypted(ciphertext));
+ assertTrue(ciphertext.startsWith(BasicCryptor.ENCRYPT_PREFIX));
assertEquals(cleartext, cleartext2);
}
@@ -87,26 +80,26 @@
// =========================================================================
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
* @throws CryptoException
*/
- public void testPos_EncryptDecryptLongString() throws CryptoException {
+ @Test public void testPos_EncryptDecryptLongString() throws CryptoException {
helpTestEncryptDecrypt( CLEARTEXT );
}
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
* @throws CryptoException
*/
- public void testPos_EncryptDecryptHalfLongString() throws CryptoException {
+ @Test public void testPos_EncryptDecryptHalfLongString() throws CryptoException {
helpTestEncryptDecrypt( CLEARTEXT.substring(0,CLEARTEXT.length()/2) );
}
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
* @throws CryptoException
*/
- public void testPos_EncryptDecryptStringsOfVariousLengths() throws CryptoException {
+ @Test public void testPos_EncryptDecryptStringsOfVariousLengths() throws CryptoException {
for ( int k = 1; k < CLEARTEXT.length()/4; k++ ) {
// Use substring starting at index k, and 'k' characters long
String cleartext = CLEARTEXT.substring(k,k+k);
@@ -115,10 +108,10 @@
}
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
* @throws CryptoException
*/
- public void testPos_EncryptDecryptStringsOfBlanks() throws CryptoException {
+ @Test public void testPos_EncryptDecryptStringsOfBlanks() throws CryptoException {
String BLANKS = " "; //$NON-NLS-1$
for ( int k = 1; k < BLANKS.length(); k++ ) {
// Use substring starting at index 0, and 'k' characters long
@@ -128,32 +121,26 @@
}
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
* @throws CryptoException
*/
- public void testNeg_DecryptNonEncryptedStringLen10() throws CryptoException {
+ @Test public void testNeg_DecryptNonEncryptedStringLen10() throws CryptoException {
String ciphertext = "abcdefghij"; // Will not decode //$NON-NLS-1$
- // Get a utility that can be used for decryption
- Decryptor decryptor = CryptoUtil.getDecryptor();
-
try {
- decryptor.decrypt( ciphertext );
+ cryptor.decrypt( ciphertext );
fail("expected exception"); //$NON-NLS-1$
} catch ( CryptoException e ) {
}
}
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
*/
- public void testNeg_DecryptNullString() throws Exception {
- // Get a utility that can be used for decryption
- Decryptor decryptor = CryptoUtil.getDecryptor();
-
+ @Test public void testNeg_DecryptNullString() throws Exception {
// Decrypt the Base64 encoded ciphertext back to the original cleartext
try {
- decryptor.decrypt( (String)null );
+ cryptor.decrypt( (String)null );
fail("expected exception"); //$NON-NLS-1$
} catch ( CryptoException e ) {
//expected
@@ -162,16 +149,13 @@
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
* @throws CryptoException
*/
- public void testNeg_EncryptZeroLengthString() throws CryptoException {
- // Get a utility that can be used for encryption
- Encryptor encryptor = CryptoUtil.getEncryptor();
-
+ @Test public void testNeg_EncryptZeroLengthString() throws CryptoException {
// Encrypt the cleartext and leave ciphertext in Base64 encoded char array
try {
- encryptor.encrypt( "" ); //$NON-NLS-1$
+ cryptor.encrypt( "" ); //$NON-NLS-1$
fail("expected exception"); //$NON-NLS-1$
} catch ( CryptoException e ) {
assertEquals("Error Code:ERR.003.030.0073 Message:Attempt to encrypt zero-length cleartext.", e.getMessage()); //$NON-NLS-1$
@@ -179,16 +163,13 @@
}
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
* @throws CryptoException
*/
- public void testNeg_EncryptNullCharArray() throws CryptoException {
- // Get a utility that can be used for encryption
- Encryptor encryptor = CryptoUtil.getEncryptor();
-
+ @Test public void testNeg_EncryptNullCharArray() throws CryptoException {
// Encrypt the cleartext and leave ciphertext in Base64 encoded char array
try {
- encryptor.encrypt( (String)null );
+ cryptor.encrypt( (String)null );
fail("expected exception"); //$NON-NLS-1$
} catch ( CryptoException e ) {
assertEquals("Error Code:ERR.003.030.0072 Message:Attempt to encrypt null cleartext.", e.getMessage()); //$NON-NLS-1$
@@ -196,31 +177,28 @@
}
/**
- * Test the {@link BasicCryptor#encrypt} method.
+ * Test the {@link Cryptor#encrypt} method.
*/
- public void testPos_EncryptAfterException() throws Exception {
- // Get a utility that can be used for encryption
- Encryptor encryptor = CryptoUtil.getEncryptor();
-
+ @Test public void testPos_EncryptAfterException() throws Exception {
try {
- encryptor.encrypt( "" );
+ cryptor.encrypt( "" );
} catch ( CryptoException e ) {
// This valid test case should work after a failure!
helpTestEncryptDecrypt( CLEARTEXT );
}
}
- public void testLongEncryption() throws Exception {
+ @Test public void testLongEncryption() throws Exception {
helpTestEncryptDecrypt(CLEARTEXT + CLEARTEXT + CLEARTEXT);
}
- public void testSymmetricEncryptionWithRandomKey() throws Exception {
+ @Test public void testSymmetricEncryptionWithRandomKey() throws Exception {
- SymmetricCryptor cryptor = SymmetricCryptor.getSymmectricCryptor();
+ SymmetricCryptor randomSymCryptor = SymmetricCryptor.getSymmectricCryptor();
ArrayList test = new ArrayList(Arrays.asList(new String[] {ALPHA_L, ALPHA_U, CLEARTEXT, NUMBERS}));
- Serializable result = cryptor.sealObject(test);
+ Serializable result = randomSymCryptor.sealObject(test);
//ensure that we can serialize
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -231,21 +209,16 @@
ObjectInputStream ois = new ObjectInputStream(bais);
result = (Serializable)ois.readObject();
- ArrayList clearObject = (ArrayList)cryptor.unsealObject(result);
+ ArrayList clearObject = (ArrayList)randomSymCryptor.unsealObject(result);
assertEquals(test, clearObject);
- SymmetricCryptor cryptor1 = SymmetricCryptor.getSymmectricCryptor(cryptor.getEncodedKey());
+ SymmetricCryptor cryptor1 = SymmetricCryptor.getSymmectricCryptor(randomSymCryptor.getEncodedKey());
clearObject = (ArrayList)cryptor1.unsealObject(result);
assertEquals(test, clearObject);
}
- public void testIsEncryptedFails() {
- assertFalse(CryptoUtil.isValueEncrypted(ALPHA_U));
- assertFalse(CryptoUtil.isValueEncrypted(CryptoUtil.ENCRYPT_PREFIX + "xyz")); //$NON-NLS-1$
- }
-
}
Deleted: trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestPasswordChangeUtility.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestPasswordChangeUtility.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/crypto/TestPasswordChangeUtility.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -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 com.metamatrix.common.util.crypto;
-
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-/**
- * <p>Test cases for PasswordChangeUtility
- */
-public class TestPasswordChangeUtility extends TestCase {
-
- private static final String PASSWORD = "PASSWORD"; //$NON-NLS-1$
-
- private static final String KEY1 = "key1"; //$NON-NLS-1$
- private static final String KEY2 = "password"; //$NON-NLS-1$
- private static final String KEY3 = "a.paSSword"; //$NON-NLS-1$
- private static final String KEY4 = "password.b"; //$NON-NLS-1$
-
- private static final String VALUE1 = "value1"; //$NON-NLS-1$
- private static final String VALUE2 = "value2"; //$NON-NLS-1$
- private static final String VALUE3 = "value3"; //$NON-NLS-1$
- private static final String VALUE4 = "value4"; //$NON-NLS-1$
-
-
- public static final String FAKE_DECRYPTED_OLD = "fake-decrypted-old"; //$NON-NLS-1$
- public static final String FAKE_ENCRYPTED_OLD = "fake-encrypted-old"; //$NON-NLS-1$
- public static final String FAKE_DECRYPTED_NEW = "fake-decrypted-new"; //$NON-NLS-1$
- public static final String FAKE_ENCRYPTED_NEW = "fake-encrypted-new"; //$NON-NLS-1$
-
-
-
-
- private PasswordChangeUtility utility;
- private Properties properties;
-
- /** Construct test case. */
- public TestPasswordChangeUtility(String name) {
- super(name);
- }
-
- public void setUp() {
- utility = new FakePasswordChangeUtility();
-
- properties = new Properties();
- properties.put(KEY1, VALUE1);
- properties.put(KEY2, VALUE2);
- properties.put(KEY3, VALUE3);
- properties.put(KEY4, VALUE4);
- }
-
- /**Test PasswordChangeUtility.oldEncrypt()*/
- public void testOldEncryptProperties() throws Exception {
- properties = utility.oldEncrypt(PASSWORD, properties);
-
- assertEquals(VALUE1, properties.get(KEY1));
- assertEquals(FAKE_ENCRYPTED_OLD, properties.get(KEY2));
- assertEquals(FAKE_ENCRYPTED_OLD, properties.get(KEY3));
- assertEquals(VALUE4, properties.get(KEY4));
- }
-
- /**Test PasswordChangeUtility.newEncrypt()*/
- public void testNewEncryptProperties() throws Exception {
- properties = utility.newEncrypt(PASSWORD, properties);
-
- assertEquals(VALUE1, properties.get(KEY1));
- assertEquals(FAKE_ENCRYPTED_NEW, properties.get(KEY2));
- assertEquals(FAKE_ENCRYPTED_NEW, properties.get(KEY3));
- assertEquals(VALUE4, properties.get(KEY4));
- }
-
- /**Test PasswordChangeUtility.oldDecrypt()*/
- public void testOldDecryptProperties() throws Exception {
- properties = utility.oldDecrypt(PASSWORD, properties);
-
- assertEquals(VALUE1, properties.get(KEY1));
- assertEquals(FAKE_DECRYPTED_OLD, properties.get(KEY2));
- assertEquals(FAKE_DECRYPTED_OLD, properties.get(KEY3));
- assertEquals(VALUE4, properties.get(KEY4));
- }
-
- /**Test PasswordChangeUtility.newDecrypt()*/
- public void testNewDecryptProperties() throws Exception {
- properties = utility.newDecrypt(PASSWORD, properties);
-
- assertEquals(VALUE1, properties.get(KEY1));
- assertEquals(FAKE_DECRYPTED_NEW, properties.get(KEY2));
- assertEquals(FAKE_DECRYPTED_NEW, properties.get(KEY3));
- assertEquals(VALUE4, properties.get(KEY4));
- }
-
-
-
- /**
- * Subclass of PasswordChangeUtility, extended to use fake cryptors.
- * @since 4.3
- */
- public static class FakePasswordChangeUtility extends PasswordChangeUtility {
- public FakePasswordChangeUtility() {
- super("fake", "fake"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- }
-
- public void init() throws CryptoException {
- this.oldCryptor = new FakeCryptor(FAKE_ENCRYPTED_OLD, FAKE_DECRYPTED_OLD);
- this.newCryptor = new FakeCryptor(FAKE_ENCRYPTED_NEW, FAKE_DECRYPTED_NEW);
- this.initialized = true;
- }
- }
-}
-
Deleted: trunk/common-core/src/test/java/com/metamatrix/core/util/TestStringUtilities.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/core/util/TestStringUtilities.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/test/java/com/metamatrix/core/util/TestStringUtilities.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,75 +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 com.metamatrix.core.util;
-
-import junit.framework.TestCase;
-
-/**
- * @author Lance Phillips
- *
- * @since 3.1
- */
-public class TestStringUtilities extends TestCase {
-
- /**
- * Constructor for TestStringUtilities.
- * @param name
- */
- public TestStringUtilities(String name) {
- super(name);
- }
-
- /**
- * Constructor for TestStringUtilities.
- * @param name
- */
- public TestStringUtilities() {
- this("TestStringUtilities"); //$NON-NLS-1$
- }
-
- public void testGetLastUpperCharToken(){
- String testString = "getSuperDuperTypes"; //$NON-NLS-1$
- String result = StringUtilities.getLastUpperCharToken(testString);
-
- if(!result.equals("Types") ){ //$NON-NLS-1$
- fail("Expected \"Types\" but got " + result); //$NON-NLS-1$
- }
- }
-
- public void testGetLastUpperCharTokenComplex(){
- String testString = "getSuperDuperTypes"; //$NON-NLS-1$
- String result = StringUtilities.getLastUpperCharToken(testString);
-
- result = StringUtilities.getLastUpperCharToken(testString, result);
- if(!result.equals("DuperTypes") ){ //$NON-NLS-1$
- fail("Expected \"DuperTypes\" but got " + result); //$NON-NLS-1$
- }
-
- result = StringUtilities.getLastUpperCharToken(testString, result);
- if(!result.equals("SuperDuperTypes") ){ //$NON-NLS-1$
- fail("Expected \"SuperDuperTypes\" but got " + result); //$NON-NLS-1$
- }
- }
-
-}
Deleted: trunk/common-core/src/test/java/com/metamatrix/core/util/TestZipFileUtil.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/core/util/TestZipFileUtil.java 2010-03-04 18:36:57 UTC (rev 1908)
+++ trunk/common-core/src/test/java/com/metamatrix/core/util/TestZipFileUtil.java 2010-03-04 19:27:44 UTC (rev 1909)
@@ -1,264 +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 com.metamatrix.core.util;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.jar.Manifest;
-
-import junit.framework.TestCase;
-
-/**
- * @since 4.3
- */
-public final class TestZipFileUtil extends TestCase {
-
- // ===========================================================================================================================
- // Constants
-
- private static final String PATH = UnitTestUtil.getTestDataPath();
- private static final String EMPTIED_ZIP_FILE_NAME = PATH + "/testEmptiedZipFile.zip"; //$NON-NLS-1$
- private static final String EMPTY_ZIP_FILE_NAME = PATH + "/testEmptyZipFile.zip"; //$NON-NLS-1$
- private static final String NEW_ZIP_FILE_NAME = UnitTestUtil.getTestScratchPath() + "/testNewZipFile.zip"; //$NON-NLS-1$
- private static final String ZIP_ENTRY_NAME = PATH + "/fakeFile"; //$NON-NLS-1$
- private static final String ZIP_FILE_NAME = PATH + "/testZipFile.zip"; //$NON-NLS-1$
-
-
- public void setUp() {
- try {
- new File(NEW_ZIP_FILE_NAME).delete();
- } catch (Exception e) {
- }
- }
-
- // ===========================================================================================================================
- // Static Controller Methods
-
- /**
- * Adds a file to the specified zip file, verifies the results,
- * removes the file, verifies the results,
- * then deletes the zip file.
- *
- * @param file
- * The zip file on which to perform the add and remove test.
- * @since 4.3
- */
- private void addRemove(final File file) throws Exception {
- final long oldSize = file.length();
- try {
- //add
- assertTrue(ZipFileUtil.add(file, ZIP_ENTRY_NAME));
- assertTrue(file.exists());
- assertTrue(file.length() > oldSize);
-
- //remove
- assertTrue(ZipFileUtil.remove(file, ZIP_ENTRY_NAME));
- assertTrue(file.exists());
- assertEquals(oldSize, file.length());
-
- } finally {
- if (file.exists()) {
- file.delete();
- }
- }
- }
-
-
-
-
-
-
- /**
- * Adds a file to the specified zip file, verifies the results, then deletes the zip file.
- *
- * @param file
- * The zip file on which to perform the add and remove test.
- * @since 4.3
- */
- private void add(final File file) throws Exception {
- final long oldSize = file.length();
- try {
- assertTrue(ZipFileUtil.add(file, ZIP_ENTRY_NAME));
- assertTrue(file.exists());
- assertTrue(file.length() > oldSize);
-
- } finally {
- if (file.exists()) {
- file.delete();
- }
- }
- }
-
- /**
- * Creates a copy of the specified file.
- *
- * @param file
- * The file to copy.
- * @return
- * @throws IOException
- * @since 4.3
- */
- private static File copy(final String file) throws IOException {
- final File copy = File.createTempFile(ZipFileUtil.TMP_PFX, ZipFileUtil.TMP_SFX);
- final byte[] buf = new byte[ZipFileUtil.BUFFER];
- BufferedInputStream in = null;
- BufferedOutputStream out = null;
- try {
- in = new BufferedInputStream(new FileInputStream(file));
- out = new BufferedOutputStream(new FileOutputStream(copy));
- for (int count = in.read(buf); count >= 0; count = in.read(buf)) {
- out.write(buf, 0, count);
- }
- } finally {
- if (in != null) {
- in.close();
- }
- if (out != null) {
- out.close();
- }
- }
- return copy;
- }
-
- // ===========================================================================================================================
- // Test Methods
-
- /**
- * @tests {@link ZipFileUtil#add(String, String)}, {@link ZipFileUtil#add(File, String)},
- * {@link ZipFileUtil#remove(String, String)}, {@link ZipFileUtil#remove(File, String)}
- * @since 4.3
- */
- public void testAddRemove() throws Exception {
- final File file = new File(NEW_ZIP_FILE_NAME);
- assertTrue(!file.exists());
- add(file);
- addRemove(copy(ZIP_FILE_NAME));
- add(copy(EMPTIED_ZIP_FILE_NAME));
- add(copy(EMPTY_ZIP_FILE_NAME));
- }
-
-
- /**
- * Tests ZipFileUtil.addAll()
- * @since 4.3
- */
- public void testAddAll() throws Exception {
- final File file = new File(NEW_ZIP_FILE_NAME);
-
- assertEquals(0, file.length());
- assertTrue(ZipFileUtil.addAll(file, PATH));
- assertTrue(file.length() > 0);
-
- }
-
- /**
- * Tests ZipFileUtil.addAll()
- * @since 4.3
- */
- public void testAddAllPrefix() throws Exception {
- final File file = new File(NEW_ZIP_FILE_NAME);
-
- assertEquals(0, file.length());
- assertTrue(ZipFileUtil.addAll(file, PATH, "my/zip/path")); //$NON-NLS-1$
- assertTrue(file.length() > 0);
- }
-
- public void testGet() throws Exception {
- final File file = new File(ZIP_FILE_NAME);
- assertTrue(file.exists());
-
-
- InputStream is = ZipFileUtil.get(file, "META-INF/MANIFEST.MF", false); //$NON-NLS-1$
-
- assertNotNull(is);
-
- byte[] data = ObjectConverterUtil.convertToByteArray(is);
-
- assertNotNull(data);
-
-
- if (data.length == 0) {
- fail("No manifest file returned"); //$NON-NLS-1$
- }
-
- }
-
- public void testGetManifest() throws Exception {
- final File file = new File(ZIP_FILE_NAME);
- assertTrue(file.exists());
-
-
- Manifest m = ZipFileUtil.getManifest(file);
-
- assertNotNull(m);
-
-
- }
-
-
- public void testFind() throws Exception {
- String jarname = PATH + "/extensionmodule/testjar.jar";
- final File file = new File(jarname);
- assertTrue(file.exists());
-
-
- List<String> found = ZipFileUtil.find(file, "Class.class$", false);
- assertNotNull(found);
- assertTrue(!found.isEmpty());
-
-
- }
-
- public void testFindIgnoreCase() throws Exception {
- String jarname = PATH + "/extensionmodule/testjar.jar";
- final File file = new File(jarname);
- assertTrue(file.exists());
-
-
- List<String> found = ZipFileUtil.find(file, "class.class$", true);
- assertNotNull(found);
- assertTrue(!found.isEmpty());
-
-
- }
-
- public void testNotFind() throws Exception {
- String jarname = PATH + "/extensionmodule/testjar.jar";
- final File file = new File(jarname);
- assertTrue(file.exists());
-
-
- List<String> found = ZipFileUtil.find(file, "^Class.class", false);
- assertNotNull(found);
- assertTrue(found.isEmpty());
-
-
- }
-
-}
14 years, 2 months
teiid SVN: r1908 - in trunk/client/src/test/java: org and 7 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 13:36:57 -0500 (Thu, 04 Mar 2010)
New Revision: 1908
Added:
trunk/client/src/test/java/org/
trunk/client/src/test/java/org/teiid/
trunk/client/src/test/java/org/teiid/adminapi/
trunk/client/src/test/java/org/teiid/adminapi/impl/
trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
trunk/client/src/test/java/org/teiid/netty/
trunk/client/src/test/java/org/teiid/netty/handler/
trunk/client/src/test/java/org/teiid/netty/handler/codec/
trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/
trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java
Log:
TEIID-833 resolving merge conflict
Added: trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java (rev 0)
+++ trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2010-03-04 18:36:57 UTC (rev 1908)
@@ -0,0 +1,115 @@
+/*
+ * 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.StringReader;
+import java.io.StringWriter;
+
+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.junit.Test;
+import org.teiid.adminapi.Model;
+
+
+public class TestVDBMetaData {
+
+ @Test
+ public void testMarshellUnmarshell() throws Exception {
+
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("myVDB");
+ vdb.setDescription("vdb description");
+ vdb.setVersion(1);
+ vdb.addProperty("vdb-property", "vdb-value");
+
+ ModelMetaData modelOne = new ModelMetaData();
+ modelOne.setName("model-one");
+ modelOne.addSourceMapping("s1", "java:mybinding");
+ modelOne.setModelType("PHYSICAL");
+ modelOne.addProperty("model-prop", "model-value");
+ modelOne.addProperty("model-prop", "model-value-override");
+ modelOne.setVisible(false);
+ modelOne.addError("ERROR", "There is an error in VDB");
+
+ vdb.addModel(modelOne);
+
+ ModelMetaData modelTwo = new ModelMetaData();
+ modelTwo.setName("model-two");
+ modelTwo.addSourceMapping("s1", "java:binding-one");
+ modelTwo.addSourceMapping("s2", "java:binding-two");
+ modelTwo.setModelType("VIRTUAL");
+ modelTwo.addProperty("model-prop", "model-value");
+
+ vdb.addModel(modelTwo);
+
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd"));
+ 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();
+ vdb = (VDBMetaData)un.unmarshal(new StringReader(sw.toString()));
+
+ assertEquals("myVDB", vdb.getName());
+ assertEquals("vdb description", vdb.getDescription());
+ assertEquals(1, vdb.getVersion());
+ assertEquals("vdb-value", vdb.getPropertyValue("vdb-property"));
+
+ assertNotNull(vdb.getModel("model-one"));
+ assertNotNull(vdb.getModel("model-two"));
+ assertNull(vdb.getModel("model-unknown"));
+
+ modelOne = vdb.getModel("model-one");
+ assertEquals("model-one", modelOne.getName());
+ assertEquals("s1", modelOne.getSourceNames().get(0));
+ assertEquals(Model.Type.PHYSICAL, modelOne.getModelType());
+ assertEquals("model-value-override", modelOne.getPropertyValue("model-prop"));
+ assertFalse(modelOne.isVisible());
+
+
+ modelTwo = vdb.getModel("model-two");
+ assertEquals("model-two", modelTwo.getName());
+ assertTrue(modelTwo.getSourceNames().contains("s1"));
+ assertTrue(modelTwo.getSourceNames().contains("s2"));
+ assertEquals(Model.Type.VIRTUAL, modelTwo.getModelType()); // this is not persisted in the XML
+ assertEquals("model-value", modelTwo.getPropertyValue("model-prop"));
+
+
+ assertTrue(vdb.getValidityErrors().contains("There is an error in VDB"));
+ }
+}
Property changes on: trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java
===================================================================
--- trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java (rev 0)
+++ trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java 2010-03-04 18:36:57 UTC (rev 1908)
@@ -0,0 +1,79 @@
+/*
+ * 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.netty.handler.codec.serialization;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.SocketTimeoutException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class TestObjectDecoderInputStream {
+
+ @Test public void testTimeoutException() throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectEncoderOutputStream oeos = new ObjectEncoderOutputStream(new DataOutputStream(baos), 512);
+ List<Integer> obj = Arrays.asList(1, 2, 3);
+ oeos.writeObject(obj);
+ oeos.close();
+ final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ InputStream is = new InputStream() {
+ int count;
+ @Override
+ public int read() throws IOException {
+ if (count++%2==0) {
+ throw new SocketTimeoutException();
+ }
+ return bais.read();
+ }
+ };
+ ObjectDecoderInputStream odis = new ObjectDecoderInputStream(new DataInputStream(is), Thread.currentThread().getContextClassLoader(), 1024);
+ Object result = null;
+ do {
+ try {
+ result = odis.readObject();
+ } catch (IOException e) {
+
+ }
+ } while (result == null);
+ assertEquals(obj, result);
+ }
+
+ @Test public void testLargeIntConversion() throws Exception {
+ int testValue = 204503404;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+ dos.writeInt(testValue);
+ dos.close();
+ assertEquals(testValue, ObjectDecoderInputStream.getIntFromBytes(baos.toByteArray()));
+ }
+
+}
Property changes on: trunk/client/src/test/java/org/teiid/netty/handler/codec/serialization/TestObjectDecoderInputStream.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 2 months
teiid SVN: r1907 - trunk/client/src/test/java.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 13:35:29 -0500 (Thu, 04 Mar 2010)
New Revision: 1907
Removed:
trunk/client/src/test/java/org/
Log:
TEIID-833 resolving merge conflict
14 years, 2 months
teiid SVN: r1906 - branches/JCA/client/src/test/java/org/teiid/adminapi/impl.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 13:30:10 -0500 (Thu, 04 Mar 2010)
New Revision: 1906
Modified:
branches/JCA/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
Log:
TEIID-833 committing JCA merge
Modified: branches/JCA/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- branches/JCA/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2010-03-04 18:28:17 UTC (rev 1905)
+++ branches/JCA/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2010-03-04 18:30:10 UTC (rev 1906)
@@ -35,7 +35,6 @@
import org.junit.Test;
import org.teiid.adminapi.Model;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
public class TestVDBMetaData {
Property changes on: branches/JCA/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 2 months
teiid SVN: r1905 - in trunk/client/src: test/java and 4 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 13:28:17 -0500 (Thu, 04 Mar 2010)
New Revision: 1905
Added:
trunk/client/src/test/java/org/
trunk/client/src/test/java/org/teiid/
trunk/client/src/test/java/org/teiid/adminapi/
trunk/client/src/test/java/org/teiid/netty/
trunk/client/src/test/java/org/teiid/netty/handler/
trunk/client/src/test/java/org/teiid/netty/handler/codec/
Removed:
trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java
trunk/client/src/main/java/org/teiid/adminapi/Cache.java
trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java
trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java
trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java
trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java
trunk/client/src/main/java/org/teiid/adminapi/Group.java
trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java
trunk/client/src/main/java/org/teiid/adminapi/Role.java
trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java
Log:
TEIID-833 committing JCA merge
Deleted: trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminOptions.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,195 +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 com.metamatrix.admin.AdminPlugin;
-
-
-/**
- * Creates, collects and stores option values for evaluation when
- * executing methods where decisions should be made based on user preferences.
- * <p>
- * Method of use is to create with an option and use the method {@link #addOption(int)}
- * when more than one option is wished or required.</p>
- * <p>
- * <b>Example:</b>
- * <pre>
- * AdminOptions options = new AdminOptions(AdminOptions.OnConflict.OVERWRITE);
- * options.addOption(BINDINGS_IGNORE_DECRYPT_ERROR);
- * </pre></p>
- * @since 4.3
- */
-public class AdminOptions implements Serializable {
-
- // *************************************************************************
- // When adding an option to this interface, don't forget to
- // add the corresponding string to the toString() method
- // and to the ALLOWABLE_OPTIONS bitmask below.
- // *************************************************************************
- private static final long serialVersionUID = 2809137776857876224L;
-
- /**
- * In the case when adding resource to the system, if the resource already
- * exists in the system, these modes define how to handle the situation.
- */
- public interface OnConflict {
-
- /**
- * Add all bindings in this file and overwrite any
- * bindings that already exist in the system.
- * <p><b>NOTE</b>: This will result in a {@link VDB} with
- * a status of {@link VDB#INACTIVE} or
- * {@link VDB#ACTIVE}.</p>
- */
- public static final int OVERWRITE= 1;
-
- /**
- * Don't add any existing bindings contained in this file
- * (don't update/replace ones that already exist). This
- * will <i>not</i> keep any new bindings specified from being
- * added.
- * <p><b>NOTE</b>: This will result in a {@link VDB} with
- * a status of {@link VDB#INACTIVE} or
- * {@link VDB#ACTIVE}.</p>
- */
- public static final int IGNORE = 2;
-
- /**
- * If there is conflict in the bindings then return with
- * an exception
- * <p><b>NOTE</b>: This will result in a {@link VDB} with
- * a status of {@link VDB#INCOMPLETE} if all models in
- * the VDB are not bound.</p>
- */
- public static final int EXCEPTION = 4;
- }
-
- /**
- * Connector bindings have encrypted passwords as connection
- * properties. If the password property cannot be decrypted,
- * the connector binding will not start until the connector
- * binding password property is changed.
- * <p>Adding a VDB with this option allows the VDB and its
- * connector bindings to be added and persisted to the system
- * configuration, even if the connector binding properties
- * cannot be decrypted. Users should set the password property
- * on all connectors added after using this option.</p>
- * <p><b>NOTE</b>: This will result in a {@link VDB} with
- * a status of {@link VDB#INACTIVE}.</p>
- */
- public static final int BINDINGS_IGNORE_DECRYPT_ERROR = 8;
-
-// =======================================================================================
-// End Options Interface
-// =======================================================================================
-
- private static final int ALLOWABLEOPTIONS = OnConflict.OVERWRITE |
- OnConflict.IGNORE |
- OnConflict.EXCEPTION |
- BINDINGS_IGNORE_DECRYPT_ERROR;
-
- // A bitmask for multiple options
- private int optionsMask;
-
- /**
- * Construct with an option. For available options, see
- * {@link AdminOptions}.
- * <p>
- * <b>Note</b>: A RutimeException is thrown for any option given
- * that is not found in the interface.</p>
- *
- * @param option One of the available options in {@link AdminOptions}.
- * @throws RuntimeException for any option given that is not
- * found in the interface.
- * @since 4.3
- */
- public AdminOptions(int option) throws RuntimeException {
- super();
-
- addOption(option);
- }
-
- /**
- * Add an option to this object if multiple options are required.
- * <p>
- * <b>Note</b>: A RutimeException is thrown for any option given
- * that is not found in the interface.</p>
- *
- * @param anOption the option to add.
- * @throws RuntimeException for any option given that is not
- * found in the interface.
- * @since 4.3
- */
- public void addOption(int anOption) {
- if (anOption != 0 && (ALLOWABLEOPTIONS & anOption) == anOption) {
- this.optionsMask |= anOption;
- } else {
- throw new RuntimeException(AdminPlugin.Util.getString("AdminOptions.Unknown_option", new Object[] {"" + anOption})); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Check if the given option was specified.
- *
- * @param anOption the option to check.
- * @return <code>true</true> iff this opject contains the
- * geven option.
- * @since 4.3
- */
- public boolean containsOption(int anOption) {
- return (this.optionsMask & anOption) == anOption;
- }
-
- /**
- * @see java.lang.Object#toString()
- * @since 4.3
- */
- public String toString() {
- StringBuffer optionString = new StringBuffer("["); //$NON-NLS-1$
-
- if ( (optionsMask & OnConflict.OVERWRITE) == OnConflict.OVERWRITE ) {
- optionString.append("OnConflict_OVERWRITE, "); //$NON-NLS-1$
- }
- if ( (optionsMask & OnConflict.IGNORE) == OnConflict.IGNORE ) {
- optionString.append("OnConflict_IGNORE, "); //$NON-NLS-1$
- }
- if ( (optionsMask & OnConflict.EXCEPTION) == OnConflict.EXCEPTION ) {
- optionString.append("OnConflict_EXCEPTION, "); //$NON-NLS-1$
- }
- if ( (optionsMask & BINDINGS_IGNORE_DECRYPT_ERROR) == BINDINGS_IGNORE_DECRYPT_ERROR ) {
- optionString.append("BINDINGS_IGNORE_DECRYPT_ERROR, "); //$NON-NLS-1$
- }
-
- if ( optionString.length() == 1 ) {
- optionString.append("UNKNOWN"); //$NON-NLS-1$
- } else if (optionString.length() > 2 && optionString.charAt(optionString.length() - 2) == ',' ) {
- optionString.setLength(optionString.length() - 2);
- }
-
- optionString.append(']');
- return optionString.toString();
- }
-
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/Cache.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Cache.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/Cache.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -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;
-
-
-/**
- * Represents a cache in the MetaMatrix system.
- *
- * <p>An idetiifer for cache is specifically represented by a name. All the
- * different kinds of available cache are listed as enumerations on this interface.
- * </p>
- * @since 4.3
- */
-public interface Cache extends
- AdminObject {
-
- /**
- *
- */
- public static final String CODE_TABLE_CACHE = "CodeTableCache"; //$NON-NLS-1$
- /**
- *
- */
- public static final String PREPARED_PLAN_CACHE = "PreparedPlanCache"; //$NON-NLS-1$
- /**
- *
- */
- public static final String QUERY_SERVICE_RESULT_SET_CACHE = "QueryServiceResultSetCache"; //$NON-NLS-1$
- /**
- *
- */
- public static final String CONNECTOR_RESULT_SET_CACHE = "ConnectorResultSetCache"; //$NON-NLS-1$
-
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConfigurationAdmin.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,360 +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.Properties;
-
-import com.metamatrix.admin.RolesAllowed;
-
-
-/**
- * This interface describes the methods to configure Teiid.
- *
- * @since 4.3
- */
-(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
-public interface ConfigurationAdmin {
-
- /**
- * Assign a {@link ConnectorBinding} to a {@link VDB}'s Model
- *
- * @param connectorBindingName
- * Name of the ConnectorBinding
- * @param vdbName
- * Name of the VDB
- * @param vdbVersion
- * Version of the VDB
- * @param modelName
- * Name of the Model to map Connector Binding
- * @throws AdminException
- * if there's a system error or if there's a user input error.
- * @since 4.3
- */
- void assignBindingToModel(String connectorBindingName,
- String vdbName,
- String vdbVersion,
- String modelName) throws AdminException;
-
- void assignBindingsToModel(String[] connectorBindingName,
- String vdbName,
- String vdbVersion,
- String modelName) throws AdminException;
-
- /**
- * Set/update the property for the Connector Binding identified by the given deployed name.
- * @param deployedName
- * @param propertyName
- * @param propertyValue
- * @throws AdminException
- */
- void setConnectorBindingProperty(String deployedName, String propertyName, String propertyValue) throws AdminException;
-
- /**
- * Add Connector Type, will import Connector Type from a file
- *
- * @param name
- * of the Connector Type to add
- * @param cdkFile
- * contents of File from Client
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- void addConnectorType(String name, char[] cdkFile) throws AdminException;
-
- /**
- * Add Connector Type and all the required extension modules required by the
- * this connector type into the system from the given file byte stream which is
- * encoded inthe Connector Archive format.
- *
- * @param archiveContents contents of File
- * @param options resolution option in case of conflict in the connector type
- * @throws AdminException if there's a system error.
- * @since 4.3.2
- */
- void addConnectorArchive(byte[] archiveContents, AdminOptions options ) throws AdminException;
-
- /**
- * Delete Connector Type from Next Configuration
- *
- * @param name String name of the Connector Type to delete
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- void deleteConnectorType(String name) throws AdminException;
-
- /**
- * Deploy a {@link ConnectorBinding} to Configuration
- *
- * @param name
- * is the Connector Binding name that will be added to Configuration
- * @param connectorTypeIdentifier
- * Name of the Connector Type
- * @param properties
- * Name & Value pair need to deploy the Connector Binding
- * @param options The perferred options when executing this method. There are choices about
- * what to do when a connector binding with the given identifier already exists in the system.
- * See the interface {@link AdminOptions.OnConflict} for details.
- * <p>
- * Another option is to ignore a binding connection password decrypt error, when adding a connector
- * binding whose password was encrypted with a different keystore, so that the new password property
- * can be set after the connector binding has been added.</p>
- * @throws AdminException
- * if there's a system error.
- * @return the {@link ConnectorBinding} representing the current property values and runtime state.
- * Note that if this is a system with multiple Processes, this method may actually create multiple deployed
- * Connector Bindings (one for each process). This method will return one of them, arbitrarily.
- * @since 4.3
- */
- ConnectorBinding addConnectorBinding(String name,
- String connectorTypeIdentifier,
- Properties properties, AdminOptions options) throws AdminException;
-
- /**
- * Import a {@link ConnectorBinding} into the Configuration.
- *
- * @param name
- * is the Connector Binding name that will be added to Configuration
- * @param xmlFile
- * contents of XML file that will be sent to the server.
- * @param options The perferred options when executing this method. There are choices about
- * what to do when a connector binding with the given identifier already exists in the system.
- * See the interface {@link AdminOptions.OnConflict} for details.
- * <p>
- * Another option is to ignore a binding connection password decrypt error, when adding a connector
- * binding whose password was encrypted with a different keystore, so that the new password property
- * can be set after the connector binding has been added.</p>
- * @throws AdminException
- * if there's a system error.
- * @return the {@link ConnectorBinding} representing the current property values and runtime state.
- * Note that if this is a system with multiple Processes, this method may actually create multiple deployed
- * Connector Bindings (one for each process). This method will return one of them, arbitrarily.
- * @since 4.3
- */
- ConnectorBinding addConnectorBinding(String name,
- char[] xmlFile, AdminOptions options) throws AdminException;
-
- /**
- * Delete the {@link ConnectorBinding} from the Configuration
- *
- * @param connectorBindingIdentifier
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- void deleteConnectorBinding(String connectorBindingIdentifier) throws AdminException;
-
- /**
- * Import a {@link VDB} file.
- * <br>A VDB file with internal definitions. Thise is the default VDB export configuration
- * begining with MetaMatrix version 4.3.</br>
- *
- * @param name
- * VDB Name
- * @param vdbFile
- * byte array of the VDB Archive
- * @param options The perferred options when executing this method. There are choices about
- * what to do when a connector binding with the given identifier already exists in the system.
- * @throws AdminException
- * if there's a system error.
- * @return the {@link VDB} representing the current property values and runtime state.
- * @since 4.3
- */
- VDB addVDB(String name,
- byte[] vdbFile, AdminOptions options) throws AdminException;
-
-
- /**
- * Delete the VDB with the given name and version
- * @param vdbName
- * @param version
- * @throws AdminException
- */
- void deleteVDB(String vdbName, String version) throws AdminException;
-
- /**
- * Get the {@link LogConfiguration}
- *
- * @return LogConfiguration object
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
- LogConfiguration getLogConfiguration() throws AdminException;
-
- /**
- * Set the {@link LogConfiguration} in the MetaMatrix Server
- *
- * @param config
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- void setLogConfiguration(LogConfiguration config) throws AdminException;
-
-
- /**
- * Set the log listener to install into MM Query. This log listener will receive all log messages
- * written by the MM Query at it's current log level and log contexts.
- *
- * Note: Logging changes are not persistent. This will be fixed in future versions.
- *
- * @param listener The listener component
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- void setLogListener(EmbeddedLogger listener) throws AdminException;
-
- /**
- * Adds an {@link ExtensionModule} to the end of the list of modules.
- * <br><i>All caches (of Class objects) are cleared.</i></br>
- *
- * @param type
- * one of the known types of extension file
- * @param sourceName
- * name (e.g. filename) of extension module
- * @param source
- * actual contents of module
- * @param description
- * (optional) description of the extension module - may be null
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- void addExtensionModule(String type,
- String sourceName,
- byte[] source,
- String description) throws AdminException;
-
- /**
- * Deletes an {@link ExtensionModule} from the list of modules.
- * <br><i>All caches (of Class objects) are cleared.</i></br>
- *
- * @param sourceName
- * name (e.g. filename) of extension module
- * @throws AdminException
- * if there's a system error.
- */
- void deleteExtensionModule(String sourceName) throws AdminException;
-
- /**
- * Export an {@link ExtensionModule} to byte array
- *
- * @param sourceName unique identifier for the {@link ExtensionModule}.
- * @return byte array of the extension module
- * @throws AdminException
- * @since 4.3
- */
- byte[] exportExtensionModule(String sourceName) throws AdminException;
-
- /**
- * Export Configuration to character Array in XML format
- *
- * @return character array of Configuration
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- char[] exportConfiguration() throws AdminException;
-
- /**
- * Export a {@link ConnectorBinding} to character Array in XML format
- *
- * @param connectorBindingIdentifier the unique identifier for a {@link ConnectorBinding}.
- * @return character Array in XML format
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- char[] exportConnectorBinding(String connectorBindingIdentifier) throws AdminException;
-
- /**
- * Export Connector Type to character array
- *
- * @param connectorTypeIdentifier the unique identifier for for a {@link ConnectorType}
- * @return character Array in XML format
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- char[] exportConnectorType(String connectorTypeIdentifier) throws AdminException;
-
- /**
- * Export Connector Archive, which is bundled connector type with its xml
- * properties file and all the extension modules required by the this connector type
- *
- * @param connectorTypeIdentifier the unique identifier for for a {@link ConnectorType}
- * @return byte array of the connector archive.
- * @throws AdminException if there's a system error.
- * @since 4.3.2
- */
- byte[] exportConnectorArchive(String connectorTypeIdentifier) throws AdminException;
-
- /**
- * Export VDB to byte array
- *
- * @param name identifier of the {@link VDB}
- * @param version {@link VDB} version
- * @return byte array of the MetaMatrix VDB Archive
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- byte[] exportVDB(String name, String version) throws AdminException;
-
-
- /**
- * Add User Defined Function model to the system. If one is already deployed before this
- * will replace the previous, otherwise add this as the new UDF model. Once the UDF is added
- * the new UDF model is loaded.
- * @param modelFileContents - UDF contents
- * @param classpath - classpath for the UDF
- * @throws AdminException
- */
- void addUDF(byte[] modelFileContents, String classpath) throws AdminException;
-
- /**
- * Delete the User Defined Function model. Note that this will not delete any supporting
- * extension jar files added, those need to be deleted separately.
- * @throws AdminException
- */
- void deleteUDF() throws AdminException;
-
- /**
- * Indicates that an extension module has changed
- * @throws AdminException
- * @since 6.1.0
- */
- void extensionModuleModified(String name) throws AdminException;
-
-
- /**
- * Set a process level property.
- * @param processIdentifier - identifier for the process where the property needs to be set
- * @param propertyName - name of the property
- * @param propertyValue - value of the property
- */
- void setProcessProperty(String processIdentifier, String propertyName, String propertyValue) throws AdminException;
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectionPool.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -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;
-
-import java.io.Serializable;
-
-
-/**
- * This object holds the statistics for a ConnectionPool that is being utilized by a Connector.
- * As per how many available connections
- * processed etc.
- * <p>An identifier for ConnectionPool, is nothing but the modules it self, like "DQP",
- * "QueryService" or Connector Binding names etc.</p>
- *
- * @since 4.3
- */
-public interface ConnectionPool extends Serializable {
- /**
- * @return Returns total number of current connections in the Connection Pool
- */
- int getTotalConnections();
-
- /**
- * @return Returns the number of connections waiting for use in the connection pool.
- */
- int getConnectionsWaiting();
-
- /**
- * @return Returns the number of Connections currently in use by clients.
- */
- int getConnectionsInuse();
-
- /**
- * @return Returns the number of Connections created since the Connection Pool was created.
- */
- long getConnectionsCreated();
-
- /**
- * @return The number of Connections destroyed since the Connection Pool was created.
- */
- long getConnectionsDestroyed();
-
- /**
- * @return true if this represents an XA connection pool
- */
- boolean isXAPoolType();
-
- /**
- * @return the identifier of the connector binding this pool is used with
- */
- String getConnectorBindingIdentifier();
-
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectorType.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -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;
-
-
-/**
- * Represents a connector type in the MetaMatrix system.
- *
- * <p>{@link ConnectorBinding}s are instances of a connector type.</p>
- *
- * <p>The identifier pattern for a connector type is simply the name
- * of the connector type. Usally name consistes of multiple words with spaces in between
- * for example: "Loopback Connector"
- * </p>
- *
- * @since 4.3
- */
-public interface ConnectorType extends AdminObject {
-
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/EmbeddedLogger.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,44 +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;
-
-
-/**
- * Custom logging interface that provides a hook for custom implementations to log messages
- * produced by MM Query.
- * @since 4.3
- */
-public interface EmbeddedLogger {
-
- /**
- * Logs the given message if the current logging level is >= the logLevel parameter.
- * @param logLevel logging level for this message
- * @param timestamp timestamp at which this log message was generated
- * @param componentName name of the component that generated this message
- * @param threadName name of the thread that generated this message
- * @param message message body. May be null.
- * @param throwable exception thrown. May be null.
- * @since 4.3
- */
- void log(int logLevel, long timestamp, String componentName, String threadName, String message, Throwable throwable);
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/ExtensionModule.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,103 +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 extension module is a library (usually in jar format) that extends
- * the MetaMatrix system in some way. Classes of a custom connector can
- * be added as an extension module.
- *
- * <p> The unique identifier pattern for the extension module is generally
- * the name of the jar file since it applies system wide. Example: <code>MJjdbc.jar</code>
- * @since 4.3
- */
-public interface ExtensionModule extends AdminObject {
-
- /**
- * The name of the JAR file type of extension
- * module - this is the only type of
- * extension module that can be searched
- * for Class objects
- */
- public static final String JAR_FILE_TYPE = "JAR File"; //$NON-NLS-1$
-
- /**
- * The name of the Metadata Keyword type of
- * extension module.
- */
- public static final String METADATA_KEYWORD_TYPE = "Metadata Keyword"; //$NON-NLS-1$
-
- /**
- * The name of the Metamodel Extension type of
- * extension module.
- */
- public static final String METAMODEL_EXTENSION_TYPE = "Metamodel Extension"; //$NON-NLS-1$
-
- /**
- * The name of the Function Definition type of
- * extension module.
- */
- public static final String FUNCTION_DEFINITION_TYPE = "Function Definition"; //$NON-NLS-1$
-
- /**
- * The name of the Configuration Model type of
- * extension module.
- */
- public static final String CONFIGURATION_MODEL_TYPE = "Configuration Model"; //$NON-NLS-1$
-
- /**
- * The name of the VDB File type of extension module.
- */
- public static final String VDB_FILE_TYPE = "VDB File"; //$NON-NLS-1$
-
- /**
- * The name of the Keystore File of extension module.
- */
- public static final String KEYSTORE_FILE_TYPE = "Keystore File"; //$NON-NLS-1$
-
- /**
- * The name of the Miscellaneous File type of extension module.
- */
- public static final String MISC_FILE_TYPE = "Miscellaneous Type"; //$NON-NLS-1$
-
-
- /**
- * @return description
- */
- public String getDescription();
-
- /**
- * @return byte array of file contents
- */
- public byte[] getFileContents();
-
- /**
- * @return String of the Module Type for this Extension Module
- */
- public String getModuleType();
-
-
-
-
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/Group.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Group.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/Group.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,35 +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;
-
-
-/**
- * This interface is used to represent a group of principals.
- */
-public interface Group extends AdminObject {
-
- /**
- * Optional property for a group; group description
- */
- static final String DESCRIPTION = "description"; //$NON-NLS-1$
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/MonitoringAdmin.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,238 +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;
-
-import com.metamatrix.admin.RolesAllowed;
-
-
-/**
- * Used to access the monitorable components of the Teiid system.
- *
- * <p>See the particular admin object in question for an example of
- * allowed identifier patterns.</p>
- *
- * @since 4.3
- */
-(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_READONLY)
-public interface MonitoringAdmin {
-
- /**
- * Get the Connector Types that correspond to the specified identifier pattern.
- *
- * @param connectorTypeIdentifier the unique identifier for for a {@link ConnectorType}
- * <ul>
- * <li> <code>"*"</code> - for all connector types in the system
- * <li> <code>"name*"</code> - for all the connector types that begin with given name
- * <li> <code>"name"</code> - for the single connector type identified by name
- * </ul>
- * @return Collection of {@link ConnectorType}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<ConnectorType> getConnectorTypes(String connectorTypeIdentifier) throws AdminException;
-
- /**
- * Get the VDBs that correspond to the specified identifier pattern.
- *
- * @param vdbIdentifier the unique identifier for for a {@link VDB} in the system
- * <ul>
- * <li> <code>"*"</code> - for all VDBs in the system
- * <li> <code>"name"</code> or <code>"name*"</code> - for all the VDBs that begin with given name
- * <li><code>"name<{@link AdminObject#DELIMITER_CHAR}>version"</code> - for single VDB
- * </ul>
- * @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 if there's a system error.
- * @since 4.3
- */
- @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
- Collection<VDB> getVDBs(String vdbIdentifier) throws AdminException;
-
- /**
- * Get the Connector Bindings that correspond to the specified identifier pattern.
- *
- * @param connectorBindingIdentifier the unique identifier pattern of {@link ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector bindings in the system
- * <li> <code>"name*"</code> - for all connector bindings that begin with given name
- * <li><code>"name"</code> - for single connector binding by the given name
- * </ul>
- * @return Collection of {@link ConnectorBinding}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<ConnectorBinding> getConnectorBindings(String connectorBindingIdentifier) throws AdminException;
-
- /**
- * Get all the Connector Bindings for the given VDB identifier pattern
- * @param vdbName - Name of the VDB
- * @param vdbVersion - version of the VDB
- * @return Collection of {@link ConnectorBinding}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, String vdbVersion) throws AdminException;
-
- /**
- * Get the Extension Modules that correspond to the specified identifier pattern
- * @param extensionModuleIdentifier - the unique identifier for {@link ExtensionModule}
- * <ul>
- * <li> <code>"*"</code> - for all extension modules in the system
- * <li> <code>"name*"</code> - for all the extension modules in that begin with given name
- * <li><code>"name"</code> - for a single extension module identified by given name
- * </ul>
- * @return Collection of {@link ExtensionModule}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<ExtensionModule> getExtensionModules(String extensionModuleIdentifier) throws AdminException;
-
- /**
- * Get the Queue Worker Pools that correspond to the specified identifier pattern.
- *
- * @param identifier - an identfier for the queues {@link QueueWorkerPool}
- * <ul>
- * <li> <code>"*"</code> - for all Queue workers in the system
- * <li> <code>"name*"</code> - for all the Queue workers in that begin with given name
- * <li><code>"name"</code> - for a single queue in the system
- * </ul>
- * for example, In MM Query - "dqp" will return the Stats for MM Query Worker Pool. Also any Connector Binding
- * name will return the stats for that connector binding.
- * @return Collection of {@link QueueWorkerPool}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<QueueWorkerPool> getQueueWorkerPools(String identifier) throws AdminException;
-
-
- /**
- * Get the Connection Pool Stats that correspond to the specified identifier pattern.
- * If the {@link ConnectionPool ConnectionPool} represents an XA connection, there
- * will be 2 {@link ConnectionPool ConnectionPool}s.
- *
- * @param identifier - an identfier that corresponds to the ConnectorBinding that is
- * running in a process {@link ConnectionPool}
- * <ul>
- * <li> <code>"*"</code> - for all Connection Pools in the system
- * <li> <code>"name*"</code> - for all the Connection Pools that begin with given name
- * <li><code>"name"</code> - for a single Connection Pool in the system
- * </ul>
- * @return Collection of {@link ConnectionPool}
- * @throws AdminException if there's a system error.
- * @since 6.1
- */
- Collection<? extends ConnectionPool> getConnectionPoolStats(String identifier) throws AdminException;
-
-
- /**
- * Get the Caches that correspond to the specified identifier pattern
- * @param identifier - an identifier for the cache in {@link Cache}
- * <ul>
- * <li> <code>"*"</code> - for all different caches in the system
- * <li> <code>"name*"</code> - for all the caches that begin with given name
- * <li><code>"name"</code> - for a single cache in the system
- * </ul>
- * @return Collection of {@link Cache}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<Cache> getCaches(String identifier) throws AdminException;
-
- /**
- * Get the Sessions that correspond to the specified identifier pattern
- * @param identifier - an unique identifier for {@link Session}
- * <ul>
- * <li> <code>"*"</code> - for all current sessions of the system
- * <li> <code>"number*"</code> - for all the sessions that begin with given number
- * <li><code>"number"</code> - for a single current session in the system
- * </ul>
- * @return Collection of {@link Session}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<Session> getSessions(String identifier) throws AdminException;
-
- /**
- * Get the Requests that correspond to the specified identifier pattern
- * @param identifier - An Identifier for {@link Request}
- * <ul>
- * <li> <code>"*"</code> - for all current in process requests of the system
- * <li> <code>"number* or number<{@link AdminObject#DELIMITER_CHAR}>*"</code> - for all the sessions
- * that begin with given number, or all the requests for particular session etc.
- * <li><code>"number<{@link AdminObject#DELIMITER_CHAR}>number"</code> - for a single request in the system
- * </ul>
- * @return Collection of {@link Request}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-
- Collection<Request> getRequests(String identifier) throws AdminException;
-
- /**
- * Get the Source Request that correspond to the specified identifier pattern
- * @param identifier An Identifier for {@link Request}
- * <ul>
- * <li> <code>"*"</code> - for all current in process requests of the system
- * <li> <code>"number* or number<{@link AdminObject#DELIMITER_CHAR}>* or number.number.*"</code> - for all the sessions
- * that begin with given number, or all the requests for particular session etc.
- * <li><code>"number<{@link AdminObject#DELIMITER_CHAR}>number<{@link AdminObject#DELIMITER_CHAR}>number"</code> - for a single source request in the system
- * </ul>
- * @return Collection of {@link Request}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- Collection<Request> getSourceRequests(String identifier) throws AdminException;
-
-
- /**
- * Get all of the available Configuration Properties for the specified AdminObject, and details about them.
- * @param connectorTypeIdentifier
- * @return
- * @throws AdminException
- */
- Collection<PropertyDefinition> getConnectorTypePropertyDefinitions(String connectorTypeIdentifier) throws AdminException;
-
-
- /**
- * Get all transaction matching the identifier.
- * @return
- * @throws AdminException
- */
- Collection<Transaction> getTransactions() throws AdminException;
-
- /**
- * Get the processes that correspond to the specified identifier pattern.
- *
- * @param processIdentifier the unique identifier for for a {@link org.teiid.adminapi.ProcessObject ProcessObject}
- * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
- * if all Processes are desired.
- * @return Collection of {@link org.teiid.adminapi.ProcessObject ProcessObject}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- @RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
- Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException;
-
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/QueueWorkerPool.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,88 +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;
-
-
-/**
- * All server modules use queue based processing inside them. This
- * object holds the statistics of those queues, as per how many of them queued, dequeued,
- * processed etc.
- * <p>An identifier for QueueWorkerPool, is nothing but the modules it self, like "DQP",
- * "QueryService" or Connector Binding names etc.</p>
- *
- * @since 4.3
- */
-public interface QueueWorkerPool extends AdminObject {
- /**
- * @return Returns the number of requests queued.
- * @since 4.3
- */
- public int getQueued();
-
- /**
- * @return Returns the number of threads.
- * @since 4.3
- */
- public int getThreads();
-
- /**
- * @return Returns the highest number of active threads
- */
- public int getHighestThreads();
-
- /**
- * @return Returns the number of totalDequeues.
- * @since 4.3
- * @deprecated see {@link #getTotalCompleted()}
- */
- public long getTotalDequeues();
-
- /**
- * @return The number of completed tasks
- */
- long getTotalCompleted();
-
- /**
- * @return Returns the number of totalEnqueues.
- * @since 4.3
- * @deprecated see {@link #getTotalSubmitted()}
- */
- public long getTotalEnqueues();
-
- /**
- * @return The number of submitted tasks
- */
- long getTotalSubmitted();
-
- /**
- * @return Returns the totalHighwaterMark.
- * @since 4.3
- * @deprecated see {@link #getHighestQueued()}
- */
- public int getTotalHighwaterMark();
-
- /**
- * @return Returns the highest queue size
- */
- public int getHighestQueued();
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/Role.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Role.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/Role.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,39 +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;
-
-
-
-/**
- * @since 4.3
- */
-public interface Role extends AdminObject {
-
- /** System admin role name */
- public static final String ADMIN_SYSTEM = AdminRoles.RoleName.ADMIN_SYSTEM;
- /** Product admin role name */
- public static final String ADMIN_PRODUCT = AdminRoles.RoleName.ADMIN_PRODUCT;
- /** Read-only admin role name */
- public static final String ADMIN_READONLY = AdminRoles.RoleName.ADMIN_READONLY;
-
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/RuntimeStateAdmin.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,153 +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 javax.transaction.xa.Xid;
-
-import com.metamatrix.admin.RolesAllowed;
-
-
-/**
- * This interface defines the methods to interact with the Teiid system
- * during runtime.
- *
- * @since 4.3
- */
-(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_PRODUCT)
-public interface RuntimeStateAdmin {
-
- /**
- * Start Connector Binding
- *
- * @param connectorBindingIdentifier identifier for {@link org.teiid.adminapi.ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector bindings in the system
- * <li> <code>"name*"</code> - for all connector bindings that begin with given name
- * <li><code>"name"</code> - for single connector binding by the given name
- * </ul>
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- void startConnectorBinding(String connectorBindingIdentifier) throws AdminException;
-
- /**
- * Stop Connector Binding
- *
- * @param connectorBindingIdentifier identifier for {@link org.teiid.adminapi.ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector bindings in the system
- * <li> <code>"name*"</code> - for all connector bindings that begin with given name
- * <li><code>"name"</code> - for single connector binding by the given name
- * </ul>
- * @param stopNow If true, stop the process forcefully. If false, wait until any pending work is done.
- * @throws AdminException - if there's a system error.
- * @since 4.3
- */
- void stopConnectorBinding(String connectorBindingIdentifier,
- boolean stopNow) throws AdminException;
-
- /**
- * Clear the cache or caches specified by the cacheIdentifier.
- * @param cacheIdentifier Cache name identifier {@link org.teiid.adminapi.Cache}.
- * No wild cards currently supported, must be explicit
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- @RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
- void clearCache(String cacheIdentifier) throws AdminException;
-
- /**
- * Terminate the Session
- *
- * @param identifier Session Identifier {@link org.teiid.adminapi.Session}.
- * No wild cards currently supported, must be explicit
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- void terminateSession(String identifier) throws AdminException;
-
- /**
- * Cancel Request
- *
- * @param identifier The request identifier defined by {@link org.teiid.adminapi.Request}
- * No wild cards currently supported, must be explicit
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- void cancelRequest(String identifier) throws AdminException;
-
- /**
- * Cancel Source Request
- *
- * @param identifier The request identifier defined by {@link org.teiid.adminapi.Request}
- * No wild cards currently supported, must be explicit
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- void cancelSourceRequest(String identifier) throws AdminException;
-
- /**
- * Change the status of a Deployed VDB
- *
- * @param name Name of the Virtual Database
- * @param version Version of the Virtual Database
- * @param status Active, InActive, Delete
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- public void changeVDBStatus(String name, String version, int status)
- throws AdminException;
-
- /**
- * Mark the given global transaction as rollback only.
- * @param transactionId
- * @throws AdminException
- */
- void terminateTransaction(Xid transactionId) throws AdminException;
-
- /**
- * Mark the given transaction as rollback only.
- * @param identifier
- * The exact identifier of the transaction. Wild card is not supported.
- * @param the session the transaction is associated with.
- * @throws AdminException
- */
- void terminateTransaction(String transactionId, String sessionId) throws AdminException;
-
-
- /**
- * Stop the MM Query. If millisToWait is >0, then close to incoming queries, wait the time period
- * for work to stop, then stop the MM Query. Otherwise, stop immediately, aborting all running queries.
- * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
- * @throws AdminException
- * @since 4.3
- */
- void shutdown(int millisToWait) throws AdminException;
-
- /**
- * Restart System
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
- void restart() throws AdminException;
-}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java 2010-03-04 18:25:21 UTC (rev 1904)
+++ trunk/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java 2010-03-04 18:28:17 UTC (rev 1905)
@@ -1,159 +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.Collection;
-import java.util.List;
-
-import com.metamatrix.admin.RolesAllowed;
-
-
-/**
- * This interface defines the methods available for security administration
- * in the Teiid system.
- *
- * @since 4.3
- */
-(a)RolesAllowed(value=AdminRoles.RoleName.ADMIN_SYSTEM)
-public interface SecurityAdmin {
- /**
- * Get the Collection of administrative role names possessed by the given group, if any.
- *
- * @param groupIdentifier The unique identifier for the {@link Group}. This is group name.
- * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @return The Collection of {@link Role}s.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- Collection<Role> getRolesForGroup(String groupIdentifier) throws AdminException;
-
- /**
- * Get the group memberships for the given user.
- *
- * @param userIdentifier
- * The unique identifier for the user. This is generally a user name.
- * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @return The collection of groups in which the given user has membership.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- Collection<Group> getGroupsForUser(String userIdentifier) throws AdminException;
-
-
- /**
- * Get the group denoted by the given <code>groupIdentifier</code>.
- *
- * @param groupIdentifier
- * The unique identifier for the {@link Group}. This is generally a group name.
- * Note that by supplying the {@link AdminObject#WILDCARD WILDCARD} identifier, all all groups in the system will
- * retrieved.</br>
- * @return The Collection of groups.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- Collection<Group> getGroups(String groupIdentifier) throws AdminException;
-
- /**
- * Assign to the given {@link Group} the given Administrative Role.
- *
- * @param roleIdentifier
- * one of {@link AdminRoles}.
- * @param groupIdentifier
- * the unique identifier for the Group. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- void assignRoleToGroup(String roleIdentifier,
- String groupIdentifier) throws AdminException;
-
- /**
- * Remove an administrative role from the given {@link Group}.
- *
- * @param roleIdentifier
- * one of {@link AdminRoles}
- * @param groupIdentifier
- * the unique identifier for the group. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
- void removeRoleFromGroup(String roleIdentifier,
- String groupIdentifier) throws AdminException;
-
- /**
- * Import the data Roles for given vdb and version into the connected server
- * @param vdbName - target name of the VDB, the roles to be imported under
- * @param vdbVersion - target version of the vdb, the roles to be imported under
- * @param data - character data array containing the XML file which defines the roles
- * @param options - options to overwrite in case the matching roles already exist.
- * @return a report of the import
- * @throws AdminException
- */
- String importDataRoles(String vdbName, String vdbVersion, char[] data, AdminOptions options)
- throws AdminException;
-
- /**
- * Export the data roles defined for the given vdb from the current system
- * @param vdbName - Name of the vdb
- * @param vdbVersion - version of the vdb
- * @return - char[] stream containing the XML contents of the roles.
- * @throws AdminException
- */
- char[] exportDataRoles(String vdbName, String vdbVersion) throws AdminException;
-
- /**
- * Authenticate a user with the specified user name and credentials
- * for use with the specified application. The application name may also
- * be used by the Membership Service to determine the appropriate authentication
- * mechanism.
- * @param username the user name that is to be authenticated
- * @param credential
- * @param trustePayload
- * @param applicationName the name of the application for which the user
- * is authenticating
- * @return true if the authentication is successful
- * @throws AdminException
- */
- boolean authenticateUser(String username, char[] credentials, Serializable trustePayload, String applicationName) throws AdminException;
-
- /**
- * Returns the active authorization provider domain names, in authentication order.
- * @return List<String>
- * @throws AdminException
- */
- List<String> getDomainNames( ) throws AdminException;
-
- /**
- * Return the {@link Group}s for a given domain. The domain name must be an specified
- * exactly. See {@link #getActiveDomainNames()} for possible domain names.
- * @param domainName
- * @return
- * @throws AdminException
- */
- Collection<Group> getGroupsForDomain(String domainName) throws AdminException;
-}
14 years, 2 months
teiid SVN: r1904 - in trunk/client: src/main/java/com/metamatrix/admin and 27 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 13:25:21 -0500 (Thu, 04 Mar 2010)
New Revision: 1904
Added:
trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java
trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java
trunk/client/src/main/java/org/teiid/adminapi/AdminFactory.java
trunk/client/src/main/java/org/teiid/adminapi/ConnectionPoolStatistics.java
trunk/client/src/main/java/org/teiid/adminapi/Logger.java
trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java
trunk/client/src/main/java/org/teiid/adminapi/impl/
trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
trunk/client/src/main/java/org/teiid/transport/
trunk/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java
trunk/client/src/main/java/org/teiid/transport/LocalServerConnection.java
trunk/client/src/main/resources/vdb-deployer.xsd
Removed:
trunk/client/src/main/java/com/metamatrix/admin/RolesAllowed.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java
trunk/client/src/main/java/com/metamatrix/dqp/message/RequestID.java
trunk/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java
trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
trunk/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java
trunk/client/src/main/java/org/teiid/transport/LocalServerConnection.java
trunk/client/src/test/java/com/metamatrix/admin/api/objects/
trunk/client/src/test/java/com/metamatrix/common/comm/platform/client/
trunk/client/src/test/java/org/
Modified:
trunk/client/pom.xml
trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java
trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java
trunk/client/src/main/java/com/metamatrix/common/batch/BatchSerializer.java
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/xa/MMXid.java
trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java
trunk/client/src/main/java/com/metamatrix/dqp/client/ResultsFuture.java
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java
trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java
trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java
trunk/client/src/main/java/org/teiid/adminapi/Model.java
trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java
trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java
trunk/client/src/main/java/org/teiid/adminapi/Request.java
trunk/client/src/main/java/org/teiid/adminapi/Session.java
trunk/client/src/main/java/org/teiid/adminapi/Transaction.java
trunk/client/src/main/java/org/teiid/adminapi/VDB.java
trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties
trunk/client/src/main/resources/com/metamatrix/common/comm/i18n.properties
trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
trunk/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java
trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
Log:
TEIID-833 committing JCA merge
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/pom.xml 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,5 +22,10 @@
<artifactId>teiid-common-core</artifactId>
<type>test-jar</type>
</dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Deleted: trunk/client/src/main/java/com/metamatrix/admin/RolesAllowed.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/RolesAllowed.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/RolesAllowed.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,36 +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 com.metamatrix.admin;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Documented
-(a)Retention(value=RetentionPolicy.RUNTIME)
-(a)Target(value={ElementType.TYPE,ElementType.METHOD})
-public @interface RolesAllowed {
- String[] value();
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectionPool.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,115 +0,0 @@
-package com.metamatrix.admin.objects;
-
-import org.teiid.adminapi.ConnectionPool;
-
-public class MMConnectionPool implements ConnectionPool {
-
- /**
- * @since 6.1
- */
- private static final long serialVersionUID = -2341549955193216875L;
-
- private boolean xa;
- /**
- * Number of connections currently in use by a client
- */
- private int connectionInUse;
- /**
- * Number of connections waiting for use by a client
- */
- private int connectionsWaiting;
- /**
- * Total number of connections currently in the pool
- */
- private int totalConnections;
-
- /**
- * Total number of connections that have been destroyed since the inception of the pool
- */
- private long connectionsDestroyed;
- /**
- * Total number of connections that have been created since the inception of the pool
- */
- private long connectionsCreated;
-
- private String connectorBindingIdentifier;
-
- public boolean isXAPoolType() {
- return xa;
- }
-
- public void setXa(boolean xa) {
- this.xa = xa;
- }
-
- @Override
- public String getConnectorBindingIdentifier() {
- return connectorBindingIdentifier;
- }
-
- public void setConnectorBindingIdentifier(String connectorBindingIdentifier) {
- this.connectorBindingIdentifier = connectorBindingIdentifier;
- }
-
- public int getConnectionsInuse() {
- return this.connectionInUse;
- }
-
- public int getConnectionsWaiting() {
- return this.connectionsWaiting;
- }
-
- public long getConnectionsCreated() {
- return this.connectionsCreated;
- }
-
- public long getConnectionsDestroyed() {
- return this.connectionsDestroyed;
- }
-
- public int getTotalConnections() {
- return this.totalConnections;
- }
-
- public void setConnectionsInUse(int inUseConnections) {
- this.connectionInUse = inUseConnections;
- }
-
- public void setConnectionsWaiting(int waitingConnections) {
- this.connectionsWaiting = waitingConnections;
- }
-
- public void setTotalConnections(int totalConnections) {
- this.totalConnections = totalConnections;
- }
-
- public void setConnectionsDestroyed(long connectionsDestroyed) {
- this.connectionsDestroyed = connectionsDestroyed;
- }
-
- public void setConnectionsCreated(long connectionsCreated) {
- this.connectionsCreated = connectionsCreated;
- }
-
-
- @Override
- /**
- * Get string for display purposes
- * @see java.lang.Object#toString()
- * @since 6.1
- */
- public String toString() {
- StringBuffer str = new StringBuffer();
-
- str.append(this.connectorBindingIdentifier + " ConnectionPoolStats:\n"); //$NON-NLS-1$
- str.append("\tisXAPoolType = " + isXAPoolType()); //$NON-NLS-1$
- str.append("\ttotalConnections = " + this.totalConnections); //$NON-NLS-1$
- str.append("\tinUseConnections = " + this.connectionInUse); //$NON-NLS-1$
- str.append("\twaitingConnections = " + connectionsWaiting); //$NON-NLS-1$
- str.append("\tconnectionsCreated = " + connectionsCreated); //$NON-NLS-1$
- str.append("\tconnectionsDestroyed = " + connectionsDestroyed); //$NON-NLS-1$
- return str.toString();
- }
-
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorBinding.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,231 +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 com.metamatrix.admin.objects;
-
-import java.util.Date;
-
-import org.teiid.adminapi.ConnectorBinding;
-
-import com.metamatrix.admin.AdminPlugin;
-
-
-/**
- * A Connector Binding is a Connector Type with properties that have been
- * bond to a Connector.
- *
- * May are may not be assigned to a VDB
- */
-public class MMConnectorBinding extends MMAdminObject implements ConnectorBinding {
-
- private static final long serialVersionUID = 6919562861762280546L;
- private String routingUUID = ""; //$NON-NLS-1$
- private String description = ""; //$NON-NLS-1$
- private String connectorTypeName = ""; //$NON-NLS-1$
- private int currentState;
- private Date stateChangedTime;
- private long serviceID = -1;
-
-
- /**
- * Constructor.
- * @param identifierParts
- * @since 4.3
- */
- public MMConnectorBinding(String[] identifierParts) {
- super(identifierParts);
- }
-
-
-
-
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.MMConnectorBinding")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.Description")).append(description); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.Created")).append(getCreatedDate()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.Created_By")).append(getCreatedBy()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.Updated")).append(getLastChangedDate()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.Updated_By")).append(getLastChangedBy()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.State")).append(getState()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.State_Changed")).append(getStateChangedTime()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.IsRegistered")).append(isRegistered()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorBinding.Properties")).append(getPropertiesAsString()); //$NON-NLS-1$
- return result.toString();
- }
-
-
-
- /**
- * Returns the description
- * @return description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Set the description
- * @param description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
-
-
- /**
- * Returns the String globally unique routing UUID for this
- * Connector Binding
- * @return Returns the routingUUID.
- * @since 4.3
- */
- public String getRoutingUUID() {
- return this.routingUUID;
- }
-
- /**
- * @param routingUUID The routingUUID to set.
- * @since 4.3
- */
- public void setRoutingUUID(String routingUUID) {
- this.routingUUID = routingUUID;
- }
-
- /**
- * @return the current state of this connector binding.
- */
- public int getState() {
- return this.currentState;
- }
-
- /**
- * @return Returns the currentState as String.
- * @since 4.3
- */
- public String getStateAsString() {
- switch (currentState) {
- case STATE_OPEN:
- return AdminPlugin.Util.getString("MMConnectorBinding.open"); //$NON-NLS-1$
- case STATE_CLOSED:
- return AdminPlugin.Util.getString("MMConnectorBinding.closed"); //$NON-NLS-1$
- case STATE_FAILED:
- return AdminPlugin.Util.getString("MMConnectorBinding.failed"); //$NON-NLS-1$
- case STATE_INIT_FAILED:
- return AdminPlugin.Util.getString("MMConnectorBinding.initializationFailed"); //$NON-NLS-1$
- case STATE_NOT_INITIALIZED:
- return AdminPlugin.Util.getString("MMConnectorBinding.notInitialized"); //$NON-NLS-1$
- case STATE_NOT_REGISTERED:
- return AdminPlugin.Util.getString("MMConnectorBinding.notRegistered"); //$NON-NLS-1$
- case STATE_DATA_SOURCE_UNAVAILABLE:
- return AdminPlugin.Util.getString("MMConnectorBinding.dataSourceUnavailable"); //$NON-NLS-1$
- default:
- return AdminPlugin.Util.getString("MMConnectorBinding.unknown"); //$NON-NLS-1$
- }
- }
-
- /**
- * Set the state
- * @param state
- * @since 4.3
- */
- public void setState(int state) {
- this.currentState = state;
-
- //check on what states mean "registered"
- setRegistered(currentState==STATE_OPEN || currentState==STATE_FAILED || currentState==STATE_DATA_SOURCE_UNAVAILABLE);
- }
-
-
- /**
- * @return Returns time of last state change.
- * @since 4.3
- */
- public Date getStateChangedTime() {
- return stateChangedTime;
- }
-
- /**
- * Set the state changed time
- * @param stateChangedTime
- * @since 4.3
- */
- public void setStateChangedTime(Date stateChangedTime) {
- this.stateChangedTime = stateChangedTime;
- }
-
-
- /**
- * @return Returns the serviceID.
- * @since 4.3
- */
- public long getServiceID() {
- return this.serviceID;
- }
-
- /**
- * @param serviceID The serviceID to set.
- * @since 4.3
- */
- public void setServiceID(long serviceID) {
- this.serviceID = serviceID;
- }
-
-
- /**
- * @return Returns the processID.
- * @since 4.3
- */
- public String getProcessName() {
- return identifierParts[1];
- }
-
-
- /**
- * @return Returns the hostName.
- * @since 4.3
- */
- public String getHostName() {
- return identifierParts[0];
- }
-
-
- /**
- * @param connectorTypeName the identifier for a connector type
- * @since 4.3
- */
- public void setConnectorTypeName(String connectorTypeName) {
- this.connectorTypeName = connectorTypeName;
- }
-
- /**
- * @see org.teiid.adminapi.ConnectorBinding#getConnectorTypeName()
- * @since 4.3
- */
- public String getConnectorTypeName() {
- return this.connectorTypeName;
- }
-}
\ No newline at end of file
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMConnectorType.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,58 +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 com.metamatrix.admin.objects;
-
-import org.teiid.adminapi.ConnectorType;
-
-import com.metamatrix.admin.AdminPlugin;
-
-/**
- * Dataholder for a connector type.
- */
-public class MMConnectorType extends MMAdminObject implements ConnectorType {
- private static final long serialVersionUID = -3029541826277765764L;
-
- /**
- * Constructor
- * @param identifierParts of the Conenctor Type
- */
- public MMConnectorType(String[] identifierParts) {
- super(identifierParts);
- }
-
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMConnectorType.MMConnectorType")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorType.Created")).append(getCreatedDate()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorType.Created_By")).append(getCreatedBy()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorType.Updated")).append(getLastChangedDate()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMConnectorType.Updated_By")).append(getLastChangedBy()); //$NON-NLS-1$
- return result.toString();
- }
-
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMExtensionModule.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,109 +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 com.metamatrix.admin.objects;
-
-import org.teiid.adminapi.ExtensionModule;
-
-import com.metamatrix.admin.AdminPlugin;
-
-/**
- * A simple Extension Modules for the Admin API
- */
-public final class MMExtensionModule extends MMAdminObject implements ExtensionModule {
- private static final long serialVersionUID = -3250813293338474584L;
- private String description;
- private byte[] fileContents;
- private String moduleType;
-
-
-
- /**
- * Create a new MMExtensionModule
- * @param identifierParts
- * @since 4.3
- */
- public MMExtensionModule(String[] identifierParts) {
- super(identifierParts);
- }
-
-
-
- /**
- * @return description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return byte array of file contents
- */
- public byte[] getFileContents() {
- return fileContents;
- }
-
- /**
- * @param contents
- */
- public void setFileContents(byte[] contents) {
- this.fileContents = contents;
- }
-
- /**
- * @return String of the Module Type for this Extension Module
- */
- public String getModuleType() {
- return moduleType;
- }
-
- /**
- * @param type
- */
- public void setModuleType(String type) {
- this.moduleType = type;
- }
-
-
-
- /**
- * @return a String of this object for display.
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMExtensionModule.MMExtensionModule")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMExtensionModule.moduleType")).append(getModuleType()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMExtensionModule.description")).append(getDescription()); //$NON-NLS-1$
- return result.toString();
- }
-
-
-
-
-}
\ No newline at end of file
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMGroup.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,51 +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 com.metamatrix.admin.objects;
-
-import org.teiid.adminapi.Group;
-
-
-/**
- * @since 4.3
- */
-public class MMGroup extends MMAdminObject implements Group {
- private static final long serialVersionUID = 1102507655851078982L;
-
- /**
- * @param groupName
- * @since 4.3
- */
- public MMGroup(String[] groupName) {
- super(groupName);
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("[Name=\""); //$NON-NLS-1$
- sb.append(this.getName());
- sb.append("\"]"); //$NON-NLS-1$
- return sb.toString();
- }
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,191 +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 com.metamatrix.admin.objects;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.adminapi.Model;
-
-import com.metamatrix.admin.AdminPlugin;
-
-/**
- */
-public class MMModel extends MMAdminObject implements Model {
-
- private static final long serialVersionUID = 3714234763056162230L;
- private List connectorBindingNames = new ArrayList();
- private String modelType = ""; //$NON-NLS-1$
- private String modelURI = ""; //$NON-NLS-1$
- private boolean isMaterialization = false;
- private boolean isPhysical = false;
- private boolean isVisible = false;
- private boolean supportsMultiSourceBindings = false;
-
-
-
- /**
- * Construct a new MMModel
- * @param identifierParts
- */
- public MMModel(String[] identifierParts) {
- super(identifierParts);
- }
-
-
- /**
- * @see java.lang.Object#toString()
- * @return String for display purposes
- */
- public String toString() {
-
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMModel.MMModel")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.type")).append(getModelType()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.physical")).append(isPhysical); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.visible")).append(isVisible); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.connector_bindings")).append(getConnectorBindingNames()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.modelURI")).append(getModelURI()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.properties")).append(getPropertiesAsString()); //$NON-NLS-1$
- return result.toString();
- }
-
- /**
- * @see org.teiid.adminapi.Model#getConnectorBindingNames()
- * @since 4.3
- */
- public List getConnectorBindingNames() {
- return connectorBindingNames;
- }
-
- /**
- * @see org.teiid.adminapi.Model#isPhysical()
- * @since 4.3
- */
- public boolean isPhysical() {
- return isPhysical;
- }
-
- /**
- * @see org.teiid.adminapi.Model#isVisible()
- * @since 4.3
- */
- public boolean isVisible() {
- return isVisible;
- }
-
- /**
- * @see org.teiid.adminapi.Model#getModelType()
- * @since 4.3
- */
- public String getModelType() {
- return modelType;
- }
-
- /**
- * @see org.teiid.adminapi.Model#getModelURI()
- * @since 4.3
- */
- public String getModelURI() {
- return modelURI;
- }
-
- /**
- * @see org.teiid.adminapi.Model#supportsMultiSourceBindings()
- * @since 4.3
- */
- public boolean supportsMultiSourceBindings() {
- return this.supportsMultiSourceBindings;
- }
-
- /**
- * @param bindings
- */
- public void setConnectorBindingNames(List bindings) {
- connectorBindingNames = bindings;
- }
-
- /**
- * @param supports
- * @since 4.3
- */
- public void setSupportsMultiSourceBindings(boolean supports) {
- this.supportsMultiSourceBindings = supports;
- }
-
-
-
- /**
- * @param isPhysical Whether this model is visible.
- * @since 4.3
- */
- public void setPhysical(boolean isPhysical) {
- this.isPhysical = isPhysical;
- }
-
-
- /**
- * @param isVisible Whether this model is visible.
- * @since 4.3
- */
- public void setVisible(boolean isVisible) {
- this.isVisible = isVisible;
- }
-
-
- /**
- * @param modelType The modelType to set.
- * @since 4.3
- */
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
-
- /**
- * @param modelURI The modelURI to set.
- * @since 4.3
- */
- public void setModelURI(String modelURI) {
- this.modelURI = modelURI;
- }
-
-
- /**
- * @return Returns whether the model is a materialization.
- * @since 4.3
- */
- public boolean isMaterialization() {
- return this.isMaterialization;
- }
-
-
- /**
- * @param isMaterialization whether the model is a materialization..
- * @since 4.3
- */
- public void setMaterialization(boolean isMaterialization) {
- this.isMaterialization = isMaterialization;
- }
-
-}
Modified: trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMProcess.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -27,7 +27,7 @@
import org.teiid.adminapi.AdminObject;
import org.teiid.adminapi.ProcessObject;
-import org.teiid.adminapi.QueueWorkerPool;
+import org.teiid.adminapi.WorkerPoolStatistics;
import com.metamatrix.admin.AdminPlugin;
@@ -52,7 +52,7 @@
private long objectsWritten = 0;
private Date startTime;
- private QueueWorkerPool queueWorkerPool = null;
+ private WorkerPoolStatistics queueWorkerPool = null;
/**
@@ -296,14 +296,14 @@
* @return Returns the queueWorkerPool.
* @since 4.3
*/
- public QueueWorkerPool getQueueWorkerPool() {
+ public WorkerPoolStatistics getQueueWorkerPool() {
return this.queueWorkerPool;
}
/**
* @param queueWorkerPool The queueWorkerPool to set.
* @since 4.3
*/
- public void setQueueWorkerPool(QueueWorkerPool queueWorkerPool) {
+ public void setQueueWorkerPool(WorkerPoolStatistics queueWorkerPool) {
this.queueWorkerPool = queueWorkerPool;
}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMPropertyDefinition.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,296 +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 com.metamatrix.admin.objects;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.teiid.adminapi.PropertyDefinition;
-
-import com.metamatrix.admin.AdminPlugin;
-
-
-/**
- * @since 4.3
- */
-public class MMPropertyDefinition extends MMAdminObject implements PropertyDefinition {
- private static final long serialVersionUID = 6612838530524627205L;
- private String value = null;
- private Collection allowedValues = new ArrayList();
- private Object defaultValue = null;
- private String description = null;
- private String displayName = null;
- private String propertyType = "String"; //$NON-NLS-1$
- private String propertyTypeClassName = String.class.getName();
- private RestartType requiresRestart = RestartType.NONE;
- private boolean expert = 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(AdminPlugin.Util.getString("MMPropertyDefinition.MMPropertyDefinition")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Display_name")).append(getDisplayName()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Description")).append(getDescription()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Value")).append(getValue()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Property_type")).append(getPropertyType()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Property_type_class_name")).append(getPropertyTypeClassName()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Default_value")).append(getDefaultValue()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Constrained_to_allow_values")).append(isConstrainedToAllowedValues()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Allowed_values")).append(getAllowedValues()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Required")).append(isRequired()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Expert")).append(isExpert()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Masked")).append(isMasked()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Modifiable")).append(isModifiable()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.RequiresRestart")).append(getRequiresRestart()); //$NON-NLS-1$
- return result.toString();
- }
-
-
-
-
- /**
- * Constructor.
- * @param identifierParts
- * @since 4.3
- */
- public MMPropertyDefinition(String[] identifierParts) {
- super(identifierParts);
- }
-
-
-
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getValue()
- * @since 4.3
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getAllowedValues()
- * @since 4.3
- */
- public Collection getAllowedValues() {
- return allowedValues;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getDefaultValue()
- * @since 4.3
- */
- public Object getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getDescription()
- * @since 4.3
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getDisplayName()
- * @since 4.3
- */
- public String getDisplayName() {
- return displayName;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getPropertyType()
- * @since 4.3
- */
- public String getPropertyType() {
- return propertyType;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getPropertyTypeClassName()
- * @since 4.3
- */
- public String getPropertyTypeClassName() {
- return propertyTypeClassName;
- }
-
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#getRequiresRestart()
- * @since 4.3
- */
- public RestartType getRequiresRestart() {
- return requiresRestart;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isExpert()
- * @since 4.3
- */
- public boolean isExpert() {
- return expert;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isMasked()
- * @since 4.3
- */
- public boolean isMasked() {
- return masked;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isModifiable()
- * @since 4.3
- */
- public boolean isModifiable() {
- return modifiable;
- }
-
- /**
- * @see org.teiid.adminapi.PropertyDefinition#isRequired()
- * @since 4.3
- */
- public boolean isRequired() {
- return required;
- }
-
-
-
-
-
-
- /**
- * @param allowedValues The allowedValues to set.
- * @since 4.3
- */
- public void setAllowedValues(Collection allowedValues) {
- this.allowedValues = allowedValues;
- }
-
- /**
- * @param defaultValue The defaultValue to set.
- * @since 4.3
- */
- public void setDefaultValue(Object defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- /**
- * @param description The description to set.
- * @since 4.3
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
-
- /**
- * @param displayName The displayName to set.
- * @since 4.3
- */
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
-
-
- /**
- * @param expert The value of expert to set.
- * @since 4.3
- */
- public void setExpert(boolean expert) {
- this.expert = expert;
- }
-
- /**
- * @param masked The value of masked to set.
- * @since 4.3
- */
- public void setMasked(boolean masked) {
- this.masked = masked;
- }
- /**
- * @param modifiable The value of modifiable to set.
- * @since 4.3
- */
- public void setModifiable(boolean modifiable) {
- this.modifiable = modifiable;
- }
-
- /**
- * @param propertyTypeAsString The propertyTypeAsString to set.
- * @since 4.3
- */
- public void setPropertyType(String propertyTypeAsString) {
- this.propertyType = propertyTypeAsString;
- }
-
- /**
- * @param propertyTypeClassName The propertyTypeName to set.
- * @since 4.3
- */
- public void setPropertyTypeClassName(String propertyTypeClassName) {
- this.propertyTypeClassName = propertyTypeClassName;
- }
-
-
- /**
- * @param required The value of required to set.
- * @since 4.3
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- /**
- * @param requiresRestart The value of requiresRestart to set.
- * @since 4.3
- */
- public void setRequiresRestart(RestartType requiresRestart) {
- this.requiresRestart = requiresRestart;
- }
-
- /**
- * @param value The value to set.
- * @since 4.3
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- @Override
- public boolean isConstrainedToAllowedValues() {
- return allowedValues != null && !allowedValues.isEmpty();
- }
-
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMQueueWorkerPool.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,155 +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 com.metamatrix.admin.objects;
-
-import org.teiid.adminapi.QueueWorkerPool;
-
-import com.metamatrix.admin.AdminPlugin;
-
-/**
- * Dataholder for all the statistics gathered about a worker pool.
- */
-public class MMQueueWorkerPool extends MMAdminObject implements QueueWorkerPool {
- private static final long serialVersionUID = 454595217325824487L;
- // Current state
- private int queued = 0;
- private int threads = 0;
-
- // Total counts, never reset
- private int highestThreads;
- private int highestQueued = 0;
- private long totalSubmitted = 0;
- private long totalCompleted = 0;
-
- /**
- * Construct a new MMQueueWorkerPool
- * @param identifierParts
- * @since 4.3
- */
- public MMQueueWorkerPool(String[] identifierParts) {
- super(identifierParts);
- }
-
- /**
- * Get string for display purposes
- * @see java.lang.Object#toString()
- * @since 4.3
- */
- public String toString() {
- StringBuffer str = new StringBuffer();
-
- str.append(AdminPlugin.Util.getString("MMQueueWorkerPool.MMQueueWorkerPool") + getIdentifier()); //$NON-NLS-1$
- str.append(AdminPlugin.Util.getString("MMQueueWorkerPool.queued") + queued); //$NON-NLS-1$
- str.append(AdminPlugin.Util.getString("MMQueueWorkerPool.highestQueued") + highestQueued); //$NON-NLS-1$
- str.append(AdminPlugin.Util.getString("MMQueueWorkerPool.totalSubmitted") + totalSubmitted); //$NON-NLS-1$
- str.append(AdminPlugin.Util.getString("MMQueueWorkerPool.totalCompleted") + totalCompleted); //$NON-NLS-1$
- str.append(AdminPlugin.Util.getString("MMQueueWorkerPool.threads") + threads); //$NON-NLS-1$
- str.append(AdminPlugin.Util.getString("MMQueueWorkerPool.highestThreads") + highestThreads); //$NON-NLS-1$
-
- return str.toString();
- }
-
- /**
- * @return Returns the number of requests queued.
- * @since 4.3
- */
- public int getQueued() {
- return this.queued;
- }
- /**
- * @param queued The number of requests queued.
- * @since 4.3
- */
- public void setQueued(int queued) {
- this.queued = queued;
- }
- /**
- * @return Returns the number of threads.
- * @since 4.3
- */
- public int getThreads() {
- return this.threads;
- }
- /**
- * @param threads The number of threads to set.
- * @since 4.3
- */
- public void setThreads(int threads) {
- this.threads = threads;
- }
- /**
- * @return Returns the number of totalDequeues.
- * @since 4.3
- */
- public long getTotalDequeues() {
- return getTotalCompleted();
- }
- /**
- * @return Returns the number of totalEnqueues.
- * @since 4.3
- */
- public long getTotalEnqueues() {
- return getTotalSubmitted();
- }
- /**
- * @return Returns the totalHighwaterMark.
- * @since 4.3
- */
- public int getTotalHighwaterMark() {
- return getHighestQueued();
- }
-
- public int getHighestThreads() {
- return highestThreads;
- }
-
- public void setHighestThreads(int highestThreads) {
- this.highestThreads = highestThreads;
- }
-
- public int getHighestQueued() {
- return highestQueued;
- }
-
- public void setHighestQueued(int highestQueued) {
- this.highestQueued = highestQueued;
- }
-
- public long getTotalSubmitted() {
- return totalSubmitted;
- }
-
- public void setTotalSubmitted(long totalSubmitted) {
- this.totalSubmitted = totalSubmitted;
- }
-
- public void setTotalCompleted(long totalCompleted) {
- this.totalCompleted = totalCompleted;
- }
-
- public long getTotalCompleted() {
- return totalCompleted;
- }
-
-}
-
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMRequest.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,274 +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 com.metamatrix.admin.objects;
-
-import java.util.Date;
-
-import org.teiid.adminapi.Request;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.core.util.DateUtil;
-
-/**
- * Dataholder for information about Requests.
- */
-public class MMRequest extends MMAdminObject implements Request{
-
- private static final long serialVersionUID = -6271863624581160147L;
- String userName = ""; //$NON-NLS-1$;
- String sessionID;
- String requestID;
- Date created;
- Date processingDate;
- String transactionID = ""; //$NON-NLS-1$;
- String sqlCommand = ""; //$NON-NLS-1$;
- String connectorBindingName= ""; //$NON-NLS-1$;
- String nodeID=""; //$NON-NLS-1$
- boolean sourceRequest = false;
-
- /**
- * Construct a new MMRequest
- * @param identifierParts
- * @since 4.3
- */
- public MMRequest(String[] identifierParts) {
- super(identifierParts);
-
- this.sessionID = identifierParts[0];
- this.requestID = identifierParts[1];
- if (identifierParts.length >= 3) {
- this.nodeID = identifierParts[2];
- this.sourceRequest = true;
- }
- this.name = requestID;
- }
-
-
-
-
- /**
- * @return Date the request was created
- * @since 4.3
- */
- public Date getCreated() {
- return created;
- }
-
-
- /**
- * @return Date the request was created, as a String
- * @since 4.3
- */
- public String getCreatedString() {
- String result = ""; //$NON-NLS-1$;
- if( created != null ) {
- result = DateUtil.getDateAsString(created);
- }
- return result;
- }
-
-
-
- /**
- * Get the RequestID for a Request
- * @return RequestID
- */
- public String getRequestID() {
- return requestID;
- }
-
- /**
- * Get the SessionID for a Request
- *
- * @return long SessionID
- */
- public String getSessionID() {
- return sessionID;
- }
-
- /**
- * Get the SQL Command sent to the Server for a Request
- *
- * @return MetaMatrix SQL Command
- */
- public String getSqlCommand() {
- return sqlCommand;
- }
-
- /**
- * Get the Date processing began for the Request
- * @return Date processing began for the request
- */
- public Date getProcessingDate() {
- return processingDate;
- }
-
- /**
- * Get the Date processing began for the Request, as a String
- * @return Date processing began for the request
- */
- public String getProcessingDateString() {
- String result = ""; //$NON-NLS-1$;
- if (processingDate != null) {
- result = DateUtil.getDateAsString(processingDate);
- }
- return result;
- }
-
-
- /**
- * Get the TransactionID of the Request
- *
- * @return String of TransactionID if in a transaction
- */
- public String getTransactionID() {
- return transactionID;
- }
-
- /**
- * Get the UserName of the Request
- *
- * @return String username for the Request
- */
- public String getUserName() {
- return userName;
- }
-
-
-
-
-
- /**
- * @param created The date created.
- * @since 4.3
- */
- public void setCreated(Date created) {
- this.created = created;
- }
- /**
- * @param sessionID The sessionID to set.
- * @since 4.3
- */
- public void setSessionID(String sessionID) {
- this.sessionID = sessionID;
- }
- /**
- * @param sqlCommand The sqlCommand to set.
- * @since 4.3
- */
- public void setSqlCommand(String sqlCommand) {
- this.sqlCommand = sqlCommand;
- }
- /**
- * @param processingDate The date processing began.
- * @since 4.3
- */
- public void setProcessingDate(Date processingDate) {
- this.processingDate = processingDate;
- }
- /**
- * @param transactionID The transactionID to set.
- * @since 4.3
- */
- public void setTransactionID(String transactionID) {
- this.transactionID = transactionID;
- }
- /**
- * @param userName The userName to set.
- * @since 4.3
- */
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- /**
- * @return Returns the connectorBindingName.
- * @since 4.3
- */
- public String getConnectorBindingName() {
- return this.connectorBindingName;
- }
- /**
- * @param connectorBindingName The connectorBindingName to set.
- * @since 4.3
- */
- public void setConnectorBindingName(String connectorBindingName) {
- this.connectorBindingName = connectorBindingName;
- }
-
- /**
- * @return Returns whether this is a Source Request.
- * @since 4.3
- */
- public boolean isSource() {
- return sourceRequest;
- }
-
- /**
- * Set if the request is source request
- * @param value
- * @since 4.3
- */
- public void setSource(boolean value) {
- sourceRequest = value;
- }
-
- /**
- * If this is a source request then this represents the node id
- * @return Returns the nodeID.
- * @since 4.3
- */
- public String getNodeID() {
- return this.nodeID;
- }
-
- /**
- * If this is a source request then this represents the node id
- * @param nodeID The nodeID to set.
- * @since 4.3
- */
- public void setNodeID(String nodeID) {
- this.nodeID = nodeID;
- }
-
-
- /**
- * @see java.lang.Object#toString()
- * @return String for display purposes
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMRequest.MMRequest")).append(getIdentifier()); //$NON-NLS-1$
- if (isSource()) {
- result.append(AdminPlugin.Util.getString("MMRequest.nodeID")).append(getNodeID()); //$NON-NLS-1$
- }
- result.append(AdminPlugin.Util.getString("MMRequest.requestID")).append(getRequestID()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMRequest.userName")).append(userName); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMRequest.sessionID")).append(sessionID); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMRequest.created")).append(getCreatedString()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMRequest.processing")).append(getProcessingDateString()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMRequest.transactionID")).append(transactionID); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMRequest.command")).append(sqlCommand); //$NON-NLS-1$
- return result.toString();
- }
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMRole.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,100 +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 com.metamatrix.admin.objects;
-
-import java.util.Properties;
-
-import org.teiid.adminapi.Role;
-
-
-
-/**
- * @since 4.3
- */
-public class MMRole extends MMAdminObject implements Role {
-
- private static final long serialVersionUID = -768301010301417417L;
-
- /**
- * Ctor
- * @param identifier the role identifier should contain the whole
- * dotted notation in one field of the identifier so that the name
- * contains all components.
- * @since 4.3
- */
- public MMRole(String[] identifier) {
- super(identifier);
- }
-
- /**
- * Get the names of all administrative roles in the system.
- * @return the array of all role names suitable for adding to Principals.
- * @since 4.3
- */
- public static String[] getAvailableRoles() {
- return new String[] {Role.ADMIN_PRODUCT, Role.ADMIN_SYSTEM, Role.ADMIN_READONLY};
- }
-
- /**
- * @see org.teiid.adminapi.AdminObject#getIdentifier()
- * @since 4.3
- */
- public String getIdentifier() {
- return super.getIdentifier();
- }
-
- /**
- * @see org.teiid.adminapi.AdminObject#getName()
- * @since 4.3
- */
- public String getName() {
- // A Role name should not be broken into components
- // Role name should have have complete, dotted notation.
- return super.getIdentifier();
- }
-
- /**
- * @see org.teiid.adminapi.AdminObject#getProperties()
- * @since 4.3
- */
- public Properties getProperties() {
- return null;
- }
-
- /**
- * @see org.teiid.adminapi.AdminObject#getPropertyValue(java.lang.String)
- * @since 4.3
- */
- public String getPropertyValue(String name) {
- return null;
- }
-
- /**
- * @see com.metamatrix.admin.objects.MMAdminObject#toString()
- * @since 4.3
- */
- public String toString() {
- return super.getIdentifier();
- }
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMSession.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,273 +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 com.metamatrix.admin.objects;
-
-import java.util.Date;
-
-import org.teiid.adminapi.Session;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.core.util.DateUtil;
-
-/**
- * MetaMatrix Session
- *
- */
-public class MMSession extends MMAdminObject implements Session {
-
- private static final long serialVersionUID = 4939105946380675244L;
- private String userName = ""; //$NON-NLS-1$;
- private String applicationName = ""; //$NON-NLS-1$
- private String sessionID;
- private String vdbName = ""; //$NON-NLS-1$
- private String vdbVersion = ""; //$NON-NLS-1$
- private String ipAddress = ""; //$NON-NLS-1$
- private String hostName = ""; //$NON-NLS-1$
- private long lastPingTime;
- private int sessionState;
-
-
-
- /**
- * constructor
- * @param identifierParts
- */
- public MMSession(String[] identifierParts) {
- super(identifierParts);
- this.sessionID = getIdentifier();
- }
-
-
- /**
- * Convert a Session to a String
- *
- * @see java.lang.Object#toString()
- * @since 4.3
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMSession.MMSession")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.User_Name")).append(userName); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.Application")).append(applicationName); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.ID")).append(sessionID); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.VDB_Name")).append(vdbName); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.VDB_Version")).append(vdbVersion); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.Last_Ping_Time")).append(getLastPingTimeString()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.State")).append(getStateAsString()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.IPAddress")).append(ipAddress); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMSession.HostName")).append(hostName); //$NON-NLS-1$
-
- return result.toString();
- }
-
- /**
- * Get the Last time Client has checked to see if the server is still available
- *
- * @return Date of the last ping to the server.
- */
- public Date getLastPingTime() {
- return new Date(lastPingTime);
- }
-
-
- /**
- * Get the Time the User logged into the System as a String
- *
- * @return String
- */
- public String getLastPingTimeString() {
- return DateUtil.getDateAsString(getLastPingTime());
- }
-
- /**
- * Set the Last time Client has checked to see if the server is still available
- * @param lastPingTime
- */
- public void setLastPingTime(long lastPingTime) {
- this.lastPingTime = lastPingTime;
- }
-
-
-
- /**
- * Get the SessionState
- *
- * @return String with the SessionState
- */
- public String getStateAsString() {
- String result = ""; //$NON-NLS-1$
- switch (sessionState) {
- case STATE_EXPIRED :
- result = EXPIRED_STATE_DESC;
- break;
- case STATE_ACTIVE :
- result = ACTIVE_STATE_DESC;
- break;
- case STATE_CLOSED :
- result = CLOSED_STATE_DESC;
- break;
- case STATE_TERMINATED :
- result = TERMINATED_STATE_DESC;
- break;
- case STATE_PASSIVATED :
- result = PASSIVATED_STATE_DESC;
- break;
- default :
- result = UNKNOWN_STATE_DESC;
- }
- return result;
- }
-
-
- /**
- * Set the SessionState
- * @param state
- */
- public void setSessionState(int state) {
- this.sessionState = state;
- }
-
- /**
- * Get the Application Name
- *
- * @return String of the Application Name
- */
- public String getApplicationName() {
- return applicationName;
- }
-
- /**
- * Set the ApplicationName
- * @param name
- */
- public void setApplicationName(String name) {
- this.applicationName = name;
- }
-
- /**
- * Get the unique MetaMatrix session
- * within a given MetaMatrix System
- *
- * @return Strings of the Session ID
- */
- public String getSessionID() {
- return sessionID;
- }
-
- /**
- * Get the State of the Session
- *
- * @return int of the Session's state
- */
- public int getState() {
- return sessionState;
- }
-
- /**
- * Get User Name for this Session
- *
- * @return String of UserName
- */
- public String getUserName() {
- return userName;
- }
-
- /**
- * Set User Name for this Session
- * @param userName
- */
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- /**
- * Get the VDB Name for this Session
- *
- * @return String name of the VDB
- */
- public String getVDBName() {
- return vdbName;
- }
-
- /**
- * Set VDBName for this Session
- * @param vdbName
- */
- public void setVDBName(String vdbName) {
- this.vdbName = vdbName;
- }
-
- /**
- * Get the VDB Version for this Session
- *
- * @return String name/number of the VDB Version
- */
- public String getVDBVersion() {
- return vdbVersion;
- }
-
- /**
- * Set VDBVersion for this Session
- * @param vdbVersion
- */
- public void setVDBVersion(String vdbVersion) {
- this.vdbVersion = vdbVersion;
- }
-
- /**
- * Set IPAddress for this Session
- * @param ipAddress
- */
- public void setIPAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- }
-
-
- /**
- * Get the IPAddress for this Session
- * @return IPAddress
- */
- public String getIPAddress() {
- return this.ipAddress;
- }
-
- /**
- * Set information defined by the client at runtime
- * @param clientMachineName
- */
- public void setHostName(String clientMachineName) {
- this.hostName = clientMachineName;
- }
-
-
- /**
- * Get the host name of the machine the client is
- * accessing from
- * @return IPAddress
- */
- public String getHostName() {
- return this.hostName;
- }
-
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,289 +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 com.metamatrix.admin.objects;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-
-import org.teiid.adminapi.VDB;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.core.util.HashCodeUtil;
-
-/**
- * Dataholder object for information about a VDB (Virtual Database)
- */
-public final class MMVDB extends MMAdminObject implements VDB, Comparable {
-
- private static final long serialVersionUID = -3755957080991586389L;
- /**VDB is registered but incomplete*/
- public static final int STATUS_INCOMPLETE = 1;
- /**VDB is deployed but inactive*/
- public static final int STATUS_INACTIVE = 2;
- /**VDB is deployed and active*/
- public static final int STATUS_ACTIVE = 3;
- /**VDB has been deleted*/
- public static final int STATUS_DELETED = 4;
-
- final static String[] VDB_STATUS_NAMES = {"Incomplete", //$NON-NLS-1$
- "Inactive", //$NON-NLS-1$
- "Active", //$NON-NLS-1$
- "Deleted"}; //$NON-NLS-1$
-
-
-
- private Collection models = new ArrayList();
- private short status;
- private Date versionedDate;
- private String versionedBy;
- private long uid;
- private boolean hasMaterializedViews;
- private int cachedHashcode;
- private boolean hasWSDL;
-
-
-
- /**
- * VDBs are identified by name and version.
- * @param identifierParts the VDB name and version parts
- */
- public MMVDB(String[] identifierParts) {
- super(identifierParts);
- this.cachedHashcode = HashCodeUtil.hashCode(13, getIdentifier());
- }
-
- /**
- * @see java.lang.Object#toString()
- * @since 4.3
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMVDB.MMVDB")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.status")).append(getState()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.versionedDate")).append(versionedDate); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.versionedBy")).append(versionedBy); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.properties")).append(getPropertiesAsString()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMVDB.models")).append(models); //$NON-NLS-1$
- return result.toString();
- }
-
- /**
- * Add an MMModel
- * @param mmModel
- * @since 4.3
- */
- public void addModel(MMModel mmModel) {
- models.add(mmModel);
- }
-
- /**
- * @return date the VDB was versioned
- */
- public Date getVersionedDate() {
- return versionedDate;
- }
-
- /**
- * @return user that versioned the VDB
- */
- public String getVersionedBy() {
- return versionedBy;
- }
-
- /**
- * @return Collection of MMModels
- */
- public Collection getModels() {
- return models;
- }
-
- /**
- * @return the status
- */
- public int getState() {
- return status;
- }
-
- /**
- * @return the status
- */
- public String getStateAsString() {
- return VDB_STATUS_NAMES[this.status - 1];
- }
-
- /**
- * Must be overridden since, unlike other admin objects, the
- * name component of a VDB is the first component of the
- * identifier. VDB version is the second component.
- * @see com.metamatrix.admin.objects.MMAdminObject#getName()
- * @return The Name of the VDB
- * @since 4.3
- */
- public String getName() {
- return identifierParts[0];
- }
-
- /**
- * @return the VDB version
- */
- public String getVDBVersion() {
- return identifierParts[1];
- }
-
-
- /**
- * @param bound The date the VDB was bound.
- * @since 4.3
- */
- public void setVersionedDate(Date bound) {
- this.versionedDate = bound;
- }
-
-
- /**
- * @param boundBy The user that bound the VDB.
- * @since 4.3
- */
- public void setVersionedBy(String boundBy) {
- this.versionedBy = boundBy;
- }
-
-
- /**
- * @param models Collection of MMModels to set.
- * @since 4.3
- */
- public void setModels(Collection models) {
- this.models = models;
- }
-
-
- /**
- * @param status The status to set.
- * @since 4.3
- */
- public void setStatus(short status) {
- this.status = status;
-
- //TODO: are these correct?
- setEnabled(status == STATUS_ACTIVE);
- setRegistered(status == STATUS_ACTIVE || status == STATUS_INACTIVE || status == STATUS_INCOMPLETE);
- }
-
-
- /**
- * @return Returns the uid.
- * @since 4.3
- */
- public long getUID() {
- return this.uid;
- }
-
-
- /**
- * @param uid The uid to set.
- * @since 4.3
- */
- public void setUID(long uid) {
- this.uid = uid;
- }
-
- /**
- * @see org.teiid.adminapi.VDB#hasMaterializedViews()
- * @since 4.3
- */
- public boolean hasMaterializedViews() {
- return hasMaterializedViews;
- }
-
-
- /**
- * @param hasMaterializedViews The hasMaterializedViews to set.
- * @since 4.3
- */
- public void setMaterializedViews(boolean hasMaterializedViews) {
- this.hasMaterializedViews = hasMaterializedViews;
- }
-
-
-
-
- /**
- * @return Returns the hasWSDL.
- * @since 5.5.3
- */
- public boolean hasWSDL() {
- return this.hasWSDL;
- }
-
-
- /**
- * @param hasWSDL The hasWSDL to set.
- * @since 5.5.3
- */
- public void setHasWSDL(boolean hasWSDL) {
- this.hasWSDL = hasWSDL;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- * @since 4.3
- */
- public boolean equals(Object obj) {
- if ( ! (obj instanceof MMVDB) ) {
- return false;
- }
-
- MMVDB other = (MMVDB)obj;
- if ( ! identifier.equals(other.identifier) ) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- * @since 4.3
- */
- public int hashCode() {
- return this.cachedHashcode;
- }
-
- /**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- * @since 4.3
- */
- public int compareTo(Object obj) {
- if ( ! (obj instanceof MMVDB) ) {
- return -1;
- }
-
- MMVDB other = (MMVDB)obj;
- return identifier.compareTo(other.identifier);
- }
-
-
-
-}
Deleted: trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,87 +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 com.metamatrix.admin.objects;
-
-import javax.transaction.xa.Xid;
-
-import org.teiid.adminapi.Transaction;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.common.xa.MMXid;
-
-public class TransactionImpl extends MMAdminObject implements Transaction {
-
- private static final long serialVersionUID = -8588785315218789068L;
- private String associatedSession;
- private String scope;
- private MMXid xid;
- private String status;
-
- public TransactionImpl(String ... id) {
- super(id);
- }
-
- public String getAssociatedSession() {
- return associatedSession;
- }
-
- public void setAssociatedSession(String associatedSession) {
- this.associatedSession = associatedSession;
- }
-
- public String getScope() {
- return scope;
- }
-
- public void setScope(String scope) {
- this.scope = scope;
- }
-
- public Xid getXid() {
- return xid;
- }
-
- public void setXid(MMXid xid) {
- this.xid = xid;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- @Override
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("TransactionImpl.identifier")).append(getIdentifier()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("TransactionImpl.associatedSession")).append(associatedSession); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("TransactionImpl.scope")).append(scope); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("TransactionImpl.status")).append(status); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("TransactionImpl.xid")).append(xid); //$NON-NLS-1$
- return result.toString();
- }
-
-}
Modified: trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/api/MMURL.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -45,8 +45,6 @@
public static final String VDB_VERSION = "VirtualDatabaseVersion"; //$NON-NLS-1$
// constant for vdb version part of serverURL
public static final String VERSION = "version"; //$NON-NLS-1$
-
- public static final String CREDENTIALS = "credentials"; //$NON-NLS-1$
}
public static interface CONNECTION {
@@ -63,11 +61,6 @@
*/
public static final String DISCOVERY_STRATEGY = "discoveryStategy"; //$NON-NLS-1$
- /**
- * if "true" in the embedded mode if there is a active instance that instance will be shutdown.
- */
- public static final String SHUTDOWN = "shutdown"; //$NON-NLS-1$
-
public static final String SERVER_URL = "serverURL"; //$NON-NLS-1$
/**
* Non-secure MetaMatrix Protocol.
@@ -83,7 +76,8 @@
public static final String USER_NAME = "user"; //$NON-NLS-1$
// constant for password part of url
public static final String PASSWORD = "password"; //$NON-NLS-1$
- public static final String CLIENT_TOKEN_PROP = "clientToken"; //$NON-NLS-1$
+
+ public static final String ADMIN = "admin"; //$NON-NLS-1$
}
public static final String DOT_DELIMITER = "."; //$NON-NLS-1$
Modified: trunk/client/src/main/java/com/metamatrix/common/batch/BatchSerializer.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/batch/BatchSerializer.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/batch/BatchSerializer.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -45,24 +45,21 @@
private BatchSerializer() {} // Uninstantiable
- private static final Map serializers = new HashMap(18, 1.0f);
+ private static ColumnSerializer defaultSerializer = new ColumnSerializer();
+
+ private static final Map<String, ColumnSerializer> serializers = new HashMap<String, ColumnSerializer>();
static {
serializers.put(DataTypeManager.DefaultDataTypes.BIG_DECIMAL, new BigDecimalColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.BIG_INTEGER, new BigIntegerColumnSerializer());
- serializers.put(DataTypeManager.DefaultDataTypes.BLOB, new ObjectColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.BOOLEAN, new BooleanColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.BYTE, new ByteColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.CHAR, new CharColumnSerializer());
- serializers.put(DataTypeManager.DefaultDataTypes.CLOB, new ObjectColumnSerializer());
- serializers.put(DataTypeManager.DefaultDataTypes.XML, new ObjectColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.DATE, new DateColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.DOUBLE, new DoubleColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.FLOAT, new FloatColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.INTEGER, new IntColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.LONG, new LongColumnSerializer());
- serializers.put(DataTypeManager.DefaultDataTypes.OBJECT, new ObjectColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.SHORT, new ShortColumnSerializer());
- serializers.put(DataTypeManager.DefaultDataTypes.STRING, new StringColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.TIME, new TimeColumnSerializer());
serializers.put(DataTypeManager.DefaultDataTypes.TIMESTAMP, new TimestampColumnSerializer());
}
@@ -123,19 +120,10 @@
}
/**
- * An interface representing a stateless serializer of a batch column
- * @since 4.2
- */
- private static interface ColumnSerializer {
- void writeColumn(ObjectOutput out, int col, List[] results) throws IOException;
- void readColumn(ObjectInput in, int col, List[] batch, byte[] isNullNuffer) throws IOException, ClassNotFoundException;
- }
-
- /**
* An abstract serializer for native types
* @since 4.2
*/
- private static abstract class AbstractNativeColumnSerializer implements ColumnSerializer {
+ private static class ColumnSerializer {
public void writeColumn(ObjectOutput out, int col, List[] batch) throws IOException {
writeIsNullData(out, col, batch);
Object obj = null;
@@ -156,11 +144,15 @@
}
}
- protected abstract void writeObject(ObjectOutput out, Object obj) throws IOException;
- protected abstract Object readObject(ObjectInput in) throws IOException;
+ protected void writeObject(ObjectOutput out, Object obj) throws IOException {
+ out.writeObject(obj);
+ }
+ protected Object readObject(ObjectInput in) throws IOException, ClassNotFoundException {
+ return in.readObject();
+ }
}
- private static class IntColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class IntColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeInt(((Integer)obj).intValue());
}
@@ -169,7 +161,7 @@
}
}
- private static class LongColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class LongColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeLong(((Long)obj).longValue());
}
@@ -178,7 +170,7 @@
}
}
- private static class FloatColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class FloatColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeFloat(((Float)obj).floatValue());
}
@@ -187,7 +179,7 @@
}
}
- private static class DoubleColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class DoubleColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeDouble(((Double)obj).doubleValue());
}
@@ -196,7 +188,7 @@
}
}
- private static class ShortColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class ShortColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeShort(((Short)obj).shortValue());
}
@@ -205,7 +197,7 @@
}
}
- private static class BooleanColumnSerializer implements ColumnSerializer {
+ private static class BooleanColumnSerializer extends ColumnSerializer {
/* This implementation compacts the isNull and boolean data for non-null values into a byte[]
* by using a 8 bit mask that is bit-shifted to mask each value.
*/
@@ -270,7 +262,7 @@
}
}
- private static class ByteColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class ByteColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeByte(((Byte)obj).byteValue());
}
@@ -279,7 +271,7 @@
}
}
- private static class CharColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class CharColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeChar(((Character)obj).charValue());
}
@@ -288,61 +280,8 @@
}
}
- private static class StringColumnSerializer extends AbstractNativeColumnSerializer {
- /*
- * This implementation writes single-byte chars until it reaches a non-ascii char in the string,
- * at which point it starts writing two-byte characters. This implementation never writes more
- * than two bytes per char.
- */
+ private static class BigIntegerColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
- String val = (String)obj;
- int length = val.length();
- out.writeInt(length);
- boolean writingShort = true;
- char c;
- for (int i = 0 ; i < length; i++) {
- if (writingShort) {
- /* charAt() simply gets the char out of the underlying array. The assumption is that this would be quicker
- * calling getChars() which makes a copy of the underlying char[].
- */
- c = val.charAt(i);
- if (c < 0x80) {
- out.write(c);
- } else {
- out.write(0x80);
- writingShort = false;
- out.writeChar(c);
- }
- } else {
- out.writeChar(val.charAt(i));
- }
- }
- }
- protected Object readObject(ObjectInput in) throws IOException {
- int b;
- boolean readingShort;
- int length = in.readInt();
- char[] chars = new char[length];
- readingShort = true;
- for (int i = 0; i < length; i++) {
- if (readingShort) {
- b = in.read();
- if (b == 0x80) {
- readingShort = false;
- chars[i] = in.readChar();
- } else {
- chars[i] = ((char)b);
- }
- } else {
- chars[i] = in.readChar();
- }
- }
- return new String(chars);
- }
- }
-
- private static class BigIntegerColumnSerializer extends AbstractNativeColumnSerializer {
- protected void writeObject(ObjectOutput out, Object obj) throws IOException {
BigInteger val = (BigInteger)obj;
byte[] bytes = val.toByteArray();
out.writeInt(bytes.length);
@@ -356,7 +295,7 @@
}
}
- private static class BigDecimalColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class BigDecimalColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
BigDecimal val = (BigDecimal)obj;
out.writeInt(val.scale());
@@ -374,7 +313,7 @@
}
}
- private static class DateColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class DateColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeLong(((java.sql.Date)obj).getTime());
}
@@ -383,7 +322,7 @@
}
}
- private static class TimeColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class TimeColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
out.writeLong(((Time)obj).getTime());
}
@@ -392,7 +331,7 @@
}
}
- private static class TimestampColumnSerializer extends AbstractNativeColumnSerializer {
+ private static class TimestampColumnSerializer extends ColumnSerializer {
protected void writeObject(ObjectOutput out, Object obj) throws IOException {
Timestamp ts = (Timestamp)obj;
out.writeLong(ts.getTime());
@@ -404,24 +343,12 @@
return ts;
}
}
-
- private static class ObjectColumnSerializer implements ColumnSerializer {
- public void writeColumn(ObjectOutput out, int col, List[] results) throws IOException {
- for (int i = 0; i < results.length; i++) {
- out.writeObject(results[i].get(col));
- }
- }
- public void readColumn(ObjectInput in, int col, List[] batch, byte[] isNull) throws IOException, ClassNotFoundException {
- for (int i = 0; i < batch.length; i++) {
- batch[i].set(col, in.readObject());
- }
- }
- }
-
private static ColumnSerializer getSerializer(String type) {
- ColumnSerializer cs = (ColumnSerializer)serializers.get((type == null) ? DataTypeManager.DefaultDataTypes.OBJECT : type);
- assert cs != null;
+ ColumnSerializer cs = serializers.get((type == null) ? DataTypeManager.DefaultDataTypes.OBJECT : type);
+ if (cs == null) {
+ return defaultSerializer;
+ }
return cs;
}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -28,10 +28,11 @@
public interface ServerConnection {
public static final int PING_INTERVAL = 120000;
+ public static final String LOCAL_CONNECTION = "localConnection";
<T> T getService(Class<T> iface);
- void shutdown();
+ void close();
boolean isOpen();
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -26,12 +26,9 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.core.MetaMatrixCoreException;
public interface ServerConnectionFactory {
- void initialize(Properties info) throws MetaMatrixCoreException;
-
/**
* Establish a connection to the server.
* @param connProps The properties used by the transport to find a connection. These
@@ -41,18 +38,5 @@
* @throws CommunicationException If an error occurs in connecting, typically due to
* problems with the connection properties (bad user name, bad password, bad host name, etc)
*/
- ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException;
-
-
- /**
- * Shutdown the connection factory, including the DQP and all its existing connections
- */
- void shutdown(boolean restart);
-
- /**
- * Is the connection factory alive
- * @return true if alive; false otherwise.
- */
- boolean isAlive();
-
+ ServerConnection getConnection(Properties connectionProperties) throws CommunicationException, ConnectionException;
}
Deleted: trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,241 +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 com.metamatrix.common.comm.platform.client;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Properties;
-
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminObject;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.client.ExceptionUtil;
-import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.api.ServerConnectionFactory;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-
-/**
- * Singleton factory for ServerAdmins.
- * @since 4.3
- */
-public class ServerAdminFactory {
-
- private static final int DEFAULT_BOUNCE_WAIT = 2000;
-
- private final class ReconnectingProxy implements InvocationHandler {
-
- private Admin target;
- private ServerConnection registry;
- private Properties p;
- private boolean closed;
-
- public ReconnectingProxy(Properties p) throws ConnectionException, CommunicationException {
- this.p = p;
- this.registry = serverConnectionFactory.createConnection(p);
- }
-
- private synchronized Admin getTarget() throws AdminComponentException, CommunicationException {
- if (closed) {
- throw new AdminComponentException(CommPlatformPlugin.Util.getString("ERR.014.001.0001")); //$NON-NLS-1$
- }
- if (target != null && registry.isOpen()) {
- return target;
- }
- try {
- registry = serverConnectionFactory.createConnection(p);
- } catch (ConnectionException e) {
- throw new AdminComponentException(e.getMessage());
- }
- target = registry.getService(Admin.class);
- return target;
- }
-
- //## JDBC4.0-begin ##
- @Override
- //## JDBC4.0-end ##
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- if (method.getName().equals("close")) { //$NON-NLS-1$
- close();
- return null;
- }
- Throwable t = null;
- for (int i = 0; i < 3; i++) {
- try {
- return method.invoke(getTarget(), args);
- } catch (InvocationTargetException e) {
- if (ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
- // communication exception occurred, lose the old connection and try again.
- this.target = null;
- if (method.getName().endsWith("restart")) { //$NON-NLS-1$
- bounceSystem(true);
- return null;
- }
- continue;
- }
- throw e.getTargetException();
- } catch (CommunicationException e) {
- t = e;
- }
- }
- throw t;
- }
-
- public synchronized void close() {
- if (closed) {
- return;
- }
- this.closed = true;
- if (registry != null) {
- registry.shutdown();
- }
- }
-
- public void bounceSystem(boolean waitUntilDone) {
- if (!waitUntilDone) {
- return;
- }
- //we'll wait 2 seconds for the server to come up
- try {
- Thread.sleep(bounceWait);
- } catch (InterruptedException e) {
- throw new MetaMatrixRuntimeException(e);
- }
-
- //we'll wait 30 seconds for the server to come back up
- for (int i = 0; i < 15; i++) {
- try {
- getTarget().getProcesses(AdminObject.WILDCARD);
- return;
- } catch (Exception e) {
- //reestablish a connection and retry
- try {
- Thread.sleep(bounceWait);
- } catch (InterruptedException ex) {
- throw new MetaMatrixRuntimeException(ex);
- }
- }
- }
- }
- }
-
- public static final String DEFAULT_APPLICATION_NAME = "Admin"; //$NON-NLS-1$
-
- /**Singleton instance*/
- private static ServerAdminFactory instance = new ServerAdminFactory(SocketServerConnectionFactory.getInstance(), DEFAULT_BOUNCE_WAIT);
-
- private ServerConnectionFactory serverConnectionFactory;
- private int bounceWait;
-
- ServerAdminFactory(ServerConnectionFactory connFactory, int bounceWait) {
- this.serverConnectionFactory = connFactory;
- this.bounceWait = bounceWait;
- }
-
- /**Get the singleton instance*/
- public static ServerAdminFactory getInstance() {
- return instance;
- }
-
-
- /**
- * Creates a ServerAdmin with the specified connection properties.
- * Uses the DEFAULT_APPLICATION_NAME as the application name.
- * @param userName
- * @param password
- * @param serverURL
- * @return
- * @throws LogonException
- * @throws AdminException
- * @throws CommunicationException
- * @throws LogonException
- * @since 4.3
- */
- public Admin createAdmin(String userName,
- char[] password,
- String serverURL) throws AdminException {
-
- return createAdmin(userName, password, serverURL, DEFAULT_APPLICATION_NAME);
-
- }
-
- /**
- * Creates a ServerAdmin with the specified connection properties.
- * @param userName
- * @param password
- * @param serverURL
- * @return
- * @throws LogonException
- * @throws AdminException
- * @throws CommunicationException
- * @throws LogonException
- * @since 4.3
- */
- public Admin createAdmin(String userName,
- char[] password,
- String serverURL,
- String applicationName) throws AdminException {
-
- if (userName == null || userName.trim().length() == 0) {
- throw new IllegalArgumentException(AdminPlugin.Util.getString("ERR.014.001.0099")); //$NON-NLS-1$
- }
-
- final Properties p = new Properties();
- p.setProperty(MMURL.CONNECTION.APP_NAME, applicationName);
- p.setProperty(MMURL.CONNECTION.USER_NAME, userName);
- if (password != null) {
- p.setProperty(MMURL.CONNECTION.PASSWORD, new String(password));
- }
- p.setProperty(MMURL.CONNECTION.SERVER_URL, serverURL);
- return createAdmin(p);
- }
-
- public Admin createAdmin(Properties p) throws AdminException {
- p = PropertiesUtils.clone(p);
- p.remove(MMURL.JDBC.VDB_NAME);
- p.remove(MMURL.JDBC.VDB_VERSION);
- p.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
-
- try {
- Admin serverAdmin = (Admin)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Admin.class }, new ReconnectingProxy(p));
- return serverAdmin;
- } catch (ConnectionException e) {
- throw new AdminComponentException(e.getMessage());
- } catch (CommunicationException e) {
- throw new AdminComponentException(e.getMessage());
- }
- }
-
-}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,14 +22,17 @@
package com.metamatrix.common.comm.platform.socket;
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import com.metamatrix.common.util.ApplicationInfo;
/**
* Represents the information needed in a socket connection handshake
*/
-public class Handshake implements Serializable {
+public class Handshake implements Externalizable {
private static final long serialVersionUID = 7839271224736355515L;
@@ -63,6 +66,18 @@
public void setPublicKey(byte[] key) {
this.publicKey = key;
}
-
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ version = (String)in.readObject();
+ publicKey = (byte[])in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(version);
+ out.writeObject(publicKey);
+ }
+
}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -31,6 +31,7 @@
import java.io.ObjectOutput;
import com.metamatrix.core.util.ArgCheck;
+import com.metamatrix.core.util.ExternalizeUtil;
public final class ServiceInvocationStruct implements Externalizable {
private static final long serialVersionUID = 1207674062670068350L;
@@ -43,7 +44,7 @@
}
public ServiceInvocationStruct(Object[] args, String methodName,
- Class targetClass) {
+ Class<?> targetClass) {
ArgCheck.isNotNull(methodName);
ArgCheck.isNotNull(targetClass);
this.args = args;
@@ -55,12 +56,12 @@
ClassNotFoundException {
this.targetClass = (String)in.readObject();
this.methodName = (String)in.readObject();
- this.args = (Object[])in.readObject();
+ this.args = ExternalizeUtil.readArray(in, Object.class);
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(targetClass);
out.writeObject(methodName);
- out.writeObject(args);
+ ExternalizeUtil.writeArray(out, args);
}
}
\ No newline at end of file
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -110,7 +110,7 @@
} catch (InvalidSessionException e) {
shutdown(false);
} catch (MetaMatrixComponentException e) {
- shutdown();
+ close();
}
this.cancel();
}
@@ -190,7 +190,7 @@
if (e.getCause() instanceof CommunicationException) {
throw (CommunicationException)e.getCause();
}
- throw new CommunicationException(e, CommPlatformPlugin.Util.getString("PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to_MetaMatrix")); //$NON-NLS-1$
+ throw new CommunicationException(e, CommPlatformPlugin.Util.getString("PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to")); //$NON-NLS-1$
}
}
@@ -244,7 +244,7 @@
public <T> T getService(Class<T> iface) {
return (T)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new ServerConnectionInvocationHandler(iface));
}
- public synchronized void shutdown() {
+ public synchronized void close() {
shutdown(true);
}
private synchronized void shutdown(boolean logoff) {
@@ -318,5 +318,4 @@
public void setFailOver(boolean failOver) {
this.failOver = failOver;
}
-
}
\ No newline at end of file
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -179,7 +179,6 @@
}
- @Override
public void initialize(Properties info) {
PropertiesUtils.setBeanProperties(this, info, "org.teiid.sockets"); //$NON-NLS-1$
this.pingTimer = new Timer("SocketPing", true); //$NON-NLS-1$
@@ -237,13 +236,13 @@
/**
* @param connectionProperties will be updated with additional information before logon
*/
- public SocketServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
+ public SocketServerConnection getConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
updateConnectionProperties(connectionProperties);
MMURL url = new MMURL(connectionProperties.getProperty(MMURL.CONNECTION.SERVER_URL));
- String discoveryStrategyName = connectionProperties.getProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, AdminApiServerDiscovery.class.getName());
+ String discoveryStrategyName = connectionProperties.getProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, URL);
ServerDiscovery discovery;
@@ -288,16 +287,4 @@
this.maxCachedInstances = maxCachedInstances;
}
-
- @Override
- public void shutdown(boolean restart) {
- // only applies in the Embedded scenario.
- }
-
- @Override
- public boolean isAlive() {
- // only applies in the Embedded scenario.
- return false;
- }
-
}
Modified: trunk/client/src/main/java/com/metamatrix/common/xa/MMXid.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/xa/MMXid.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/common/xa/MMXid.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -28,7 +28,7 @@
import javax.transaction.xa.Xid;
/**
- * MetaMatrix implementation of Xid.
+ * Teiid implementation of Xid.
*/
public class MMXid implements Xid, Serializable {
private static final long serialVersionUID = -7078441828703404308L;
@@ -113,7 +113,7 @@
if (toString == null) {
StringBuffer sb = new StringBuffer();
- sb.append("MMXid global:"); //$NON-NLS-1$
+ sb.append("Teiid-Xid global:"); //$NON-NLS-1$
sb.append(getByteArrayString(globalTransactionId));
sb.append(" branch:"); //$NON-NLS-1$
sb.append(getByteArrayString(branchQualifier));
Deleted: trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -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 com.metamatrix.dqp.client;
-
-import java.util.List;
-
-import javax.transaction.xa.Xid;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.common.lob.LobChunk;
-import com.metamatrix.common.xa.MMXid;
-import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.dqp.message.RequestMessage;
-import com.metamatrix.dqp.message.ResultsMessage;
-
-public interface ClientSideDQP {
-
- ResultsFuture<ResultsMessage> executeRequest(long reqID, RequestMessage message) throws MetaMatrixProcessingException, MetaMatrixComponentException;
-
- ResultsFuture<ResultsMessage> processCursorRequest(long reqID, int batchFirst, int fetchSize) throws MetaMatrixProcessingException;
-
- ResultsFuture<?> closeRequest(long requestID) throws MetaMatrixProcessingException, MetaMatrixComponentException;
-
- void cancelRequest(long requestID) throws MetaMatrixProcessingException, MetaMatrixComponentException;
-
- ResultsFuture<?> closeLobChunkStream(int lobRequestId, long requestId, String streamId) throws MetaMatrixProcessingException, MetaMatrixComponentException;
-
- ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId, long requestId, String streamId) throws MetaMatrixProcessingException, MetaMatrixComponentException;
-
- List getXmlSchemas(String docName) throws MetaMatrixComponentException, QueryMetadataException;
-
- MetadataResult getMetadata(long requestID) throws MetaMatrixComponentException, MetaMatrixProcessingException;
-
- MetadataResult getMetadata(long requestID, String preparedSql, boolean allowDoubleQuotedVariable) throws MetaMatrixComponentException, MetaMatrixProcessingException;
-
- // local transaction
- void begin() throws XATransactionException;
-
- void commit() throws XATransactionException;
-
- void rollback() throws XATransactionException;
-
- // XA
- int prepare(MMXid xid) throws XATransactionException;
-
- void commit(MMXid xid, boolean onePhase) throws XATransactionException;
-
- void rollback(MMXid xid) throws XATransactionException;
-
- Xid[] recover(int flag) throws XATransactionException;
-
- void forget(MMXid xid) throws XATransactionException;
-
- void start(MMXid xid,
- int flags,
- int timeout) throws XATransactionException;
-
- void end(MMXid xid,
- int flags) throws XATransactionException;
-
-}
Copied: trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java (from rev 1900, branches/JCA/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java)
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java (rev 0)
+++ trunk/client/src/main/java/com/metamatrix/dqp/client/ClientSideDQP.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,85 @@
+/*
+ * 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 com.metamatrix.dqp.client;
+
+import java.util.List;
+
+import javax.transaction.xa.Xid;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.common.lob.LobChunk;
+import com.metamatrix.common.xa.MMXid;
+import com.metamatrix.common.xa.XATransactionException;
+import com.metamatrix.dqp.message.RequestMessage;
+import com.metamatrix.dqp.message.ResultsMessage;
+
+public interface ClientSideDQP {
+
+ ResultsFuture<ResultsMessage> executeRequest(long reqID, RequestMessage message) throws MetaMatrixProcessingException, MetaMatrixComponentException;
+
+ ResultsFuture<ResultsMessage> processCursorRequest(long reqID, int batchFirst, int fetchSize) throws MetaMatrixProcessingException;
+
+ ResultsFuture<?> closeRequest(long requestID) throws MetaMatrixProcessingException, MetaMatrixComponentException;
+
+ boolean cancelRequest(long requestID) throws MetaMatrixProcessingException, MetaMatrixComponentException;
+
+ ResultsFuture<?> closeLobChunkStream(int lobRequestId, long requestId, String streamId) throws MetaMatrixProcessingException, MetaMatrixComponentException;
+
+ ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId, long requestId, String streamId) throws MetaMatrixProcessingException, MetaMatrixComponentException;
+
+ List<String> getXmlSchemas(String docName) throws MetaMatrixComponentException, QueryMetadataException;
+
+ MetadataResult getMetadata(long requestID) throws MetaMatrixComponentException, MetaMatrixProcessingException;
+
+ MetadataResult getMetadata(long requestID, String preparedSql, boolean allowDoubleQuotedVariable) throws MetaMatrixComponentException, MetaMatrixProcessingException;
+
+ // local transaction
+
+ ResultsFuture<?> begin() throws XATransactionException;
+
+ ResultsFuture<?> commit() throws XATransactionException;
+
+ ResultsFuture<?> rollback() throws XATransactionException;
+
+ // XA
+
+ ResultsFuture<?> start(MMXid xid,
+ int flags,
+ int timeout) throws XATransactionException;
+
+ ResultsFuture<?> end(MMXid xid,
+ int flags) throws XATransactionException;
+
+ ResultsFuture<Integer> prepare(MMXid xid) throws XATransactionException;
+
+ ResultsFuture<?> commit(MMXid xid, boolean onePhase) throws XATransactionException;
+
+ ResultsFuture<?> rollback(MMXid xid) throws XATransactionException;
+
+ ResultsFuture<?> forget(MMXid xid) throws XATransactionException;
+
+ ResultsFuture<Xid[]> recover(int flag) throws XATransactionException;
+
+}
Copied: trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java (from rev 1900, branches/JCA/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java)
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java (rev 0)
+++ trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package com.metamatrix.dqp.client;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.impl.RequestMetadata;
+import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
+
+
+public interface DQPManagement {
+ List<RequestMetadata> getRequestsForSession(long sessionId) ;
+ List<RequestMetadata> getRequests();
+ WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier);
+ void terminateSession(long terminateeId);
+ boolean cancelRequest(long sessionId, long requestId) throws AdminException;
+ Collection<String> getCacheTypes();
+ void clearCache(String cacheType);
+ Collection<SessionMetadata> getActiveSessions() throws AdminException;
+ int getActiveSessionsCount() throws AdminException;
+ Collection<org.teiid.adminapi.Transaction> getTransactions();
+ void terminateTransaction(String xid) throws AdminException ;
+}
Modified: trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,10 +22,15 @@
package com.metamatrix.dqp.client;
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.Map;
-public class MetadataResult implements Serializable {
+import com.metamatrix.core.util.ExternalizeUtil;
+
+public class MetadataResult implements Externalizable {
private static final long serialVersionUID = -1520482281079030324L;
private Map[] columnMetadata;
private int parameterCount;
@@ -42,6 +47,17 @@
return parameterCount;
}
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ columnMetadata = ExternalizeUtil.readArray(in, Map.class);
+ parameterCount = in.readInt();
+ }
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ ExternalizeUtil.writeArray(out, columnMetadata);
+ out.writeInt(parameterCount);
+ }
}
Modified: trunk/client/src/main/java/com/metamatrix/dqp/client/ResultsFuture.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/client/ResultsFuture.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/dqp/client/ResultsFuture.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -36,6 +36,12 @@
*/
public class ResultsFuture<T> implements Future<T> {
+ public static ResultsFuture<Void> NULL_FUTURE = new ResultsFuture<Void>();
+
+ static {
+ NULL_FUTURE.getResultsReceiver().receiveResults(null);
+ }
+
public interface CompletionListener<T> {
void onCompletion(ResultsFuture<T> future);
}
Modified: trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -67,7 +67,6 @@
public static final String BOOTURL = "bootURL"; //$NON-NLS-1$
public static final String ENABLE_SOCKETS = "sockets.enabled"; //$NON-NLS-1$
public static final String HOST_ADDRESS = "hostAddress"; //$NON-NLS-1$
- public static final String DQP_BOOTSTRAP_FILE = "bootstrapFile"; //$NON-NLS-1$
public static final String TEIID_HOME = "teiid.home"; //$NON-NLS-1$
public static final String TEIID_LOGDIR = "teiid.logdir"; //$NON-NLS-1$
Deleted: trunk/client/src/main/java/com/metamatrix/dqp/message/RequestID.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/RequestID.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/RequestID.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,167 +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 com.metamatrix.dqp.message;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-/**
- * <p>This class represents an identifier for a request. However, there are some
- * differences in what constitutes "uniqueness" for a given RequestID that
- * is based on context (where the id is used). The RequestID has 2 parts:
- * connectionID, and executionIDFor the purposes of the RequestID, the combined
- * representation is "connectionID.executionID" - this implies a scoping
- * for the name parts. The connectionID specifies a particular connection that
- * is making requests. Each connection generates a unique executionID for each
- * request execution, so the executionID is only unique in the context of a
- * connectionID. </p>
- *
- * <p>When this class is used between client and server, the connectionID is implied
- * and thus only the executionID part will be used. The server will qualify the
- * executionID with a connectionID when it reaches the server. </p>
- *
- * <p>RequestIDs are immutable so no setters exist. This allows hashcodes to be
- * pre-computed for faster comparison in equals.</p>
- */
-public class RequestID implements Externalizable {
-
- static final long serialVersionUID = -2888539138291776071L;
-
- public static final String NO_CONNECTION_STR = "C"; //$NON-NLS-1$
- private static final String SEPARATOR = "."; //$NON-NLS-1$
-
- // Basic state
- private String connectionID;
- private long executionID;
-
- // Derived state
- private String combinedID;
- private int hash;
-
- /**
- * Necessary for implementing Externalizable
- */
- public RequestID() {
- }
-
- /**
- * Create a RequestID using all of the ID parts.
- * @param connectionID Identifies a connection, may be null
- * @param executionID Identifies an execution, cannot be null
- */
- public RequestID(String connectionID, long executionID) {
- this.connectionID = connectionID;
- this.executionID = executionID;
-
- createCombinedID();
- computeHashCode();
- }
-
- /**
- * Create a RequestID for an execution where the connection is
- * not specified.
- * @param executionID Identifies an execution, cannot be null
- */
- public RequestID(long executionID) {
- this(null, executionID);
- }
-
-
- /**
- * Return connectionID, may be null if connection has not been specified.
- * @return Connection ID, may be null
- */
- public String getConnectionID() {
- return this.connectionID;
- }
-
- /**
- * Return executionID, which identifies a per-connection execution.
- * @return Execution ID
- */
- public long getExecutionID() {
- return this.executionID;
- }
-
- /**
- * Create a unique combined ID string from the RequestID parts.
- */
- private void createCombinedID() {
- StringBuffer combinedStr = new StringBuffer();
- if(this.connectionID != null) {
- combinedStr.append(this.connectionID);
- } else {
- combinedStr.append(NO_CONNECTION_STR);
- }
- combinedStr.append(SEPARATOR);
- combinedStr.append(this.executionID);
-
- this.combinedID = combinedStr.toString();
- }
-
- private void computeHashCode() {
- this.hash = combinedID.hashCode();
- }
-
- public int hashCode() {
- return this.hash;
- }
-
- public boolean equals(Object obj) {
- if(obj == this) {
- return true;
- } else if(obj == null || !(obj instanceof RequestID) || obj.hashCode() != this.hashCode()) {
- return false;
- } else {
- return this.toString().equals(obj.toString());
- }
- }
-
- /**
- * Return a combined string for the ID.
- */
- public String toString() {
- return this.combinedID;
- }
-
- /**
- * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
- */
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- connectionID = (String)in.readObject();
- executionID = in.readLong();
-
- createCombinedID();
- computeHashCode();
- }
-
- /**
- * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
- */
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(connectionID);
- out.writeLong(executionID);
- }
-}
Modified: trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,58 +22,54 @@
package com.metamatrix.dqp.message;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Date;
import java.util.List;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.comm.CommonCommPlugin;
+import com.metamatrix.core.util.ExternalizeUtil;
import com.metamatrix.jdbc.api.ExecutionProperties;
/**
* Request Message, used by MMXStatement for submitting queries.
*/
-public class RequestMessage implements Serializable {
+public class RequestMessage implements Externalizable {
- static final long serialVersionUID = 2258063872049251854L;
-
public static final int DEFAULT_FETCH_SIZE = 2048;
+
+ public enum StatementType {
+ PREPARED, CALLABLE, STATEMENT
+ }
+
+ public enum ResultsMode {
+ RESULTSET, UPDATECOUNT, EITHER
+ }
private String[] commands;
private boolean isBatchedUpdate;
private int fetchSize = DEFAULT_FETCH_SIZE;
private int cursorType;
private boolean partialResultsFlag;
- private boolean isPreparedStatement;
- private boolean isCallableStatement;
- private boolean isPreparedBatchUpdate;
- private List parameterValues;
+ private StatementType statementType = StatementType.STATEMENT;
+ private List<?> parameterValues;
private boolean validationMode;
private String txnAutoWrapMode;
private String XMLFormat;
private String styleSheet;
- private Boolean requireResultSet;
-
- /**The time when the command was created by the client.*/
- private Date submittedTimestamp;
-
- /**The time when command begins processing on the server.*/
- private Date processingTimestamp;
-
+ private ResultsMode resultsMode = ResultsMode.EITHER;
//whether to use ResultSet cache if there is one
private boolean useResultSetCache;
-
// Treat the double quoted strings as variables in the command
private boolean ansiQuotedIdentifiers = true;
-
- private boolean showPlan = false;
-
+ private boolean showPlan;
private int rowLimit;
-
private Serializable executionPayload;
-
private long executionId;
public RequestMessage() {
@@ -110,34 +106,24 @@
* @return True if this request includes a prepared statement.
*/
public boolean isPreparedStatement() {
- return isPreparedStatement;
+ return this.statementType == StatementType.PREPARED;
}
/**
* @return True if this request includes a callable statement.
*/
public boolean isCallableStatement() {
- return isCallableStatement;
+ return this.statementType == StatementType.CALLABLE;
}
-
- /**
- * @param isPreparedStatement
- */
- public void setPreparedStatement(boolean isPreparedStatement) {
- this.isPreparedStatement = isPreparedStatement;
- }
-
- /**
- * @param isCallableStatement
- */
- public void setCallableStatement(boolean isCallableStatement) {
- this.isCallableStatement = isCallableStatement;
- }
-
- /**
+
+ public void setStatementType(StatementType statementType) {
+ this.statementType = statementType;
+ }
+
+ /**
* @return A list of parameter values. May be null.
*/
- public List getParameterValues() {
+ public List<?> getParameterValues() {
if (parameterValues == null) {
return Collections.EMPTY_LIST;
}
@@ -147,7 +133,7 @@
/**
* @param values
*/
- public void setParameterValues(List values) {
+ public void setParameterValues(List<?> values) {
parameterValues = values;
}
@@ -238,55 +224,6 @@
this.styleSheet = styleSheet;
}
- /**
- * Get time that the time when the command was created by the client.
- * @return timestamp in millis
- */
- public Date getSubmittedTimestamp() {
- return submittedTimestamp;
- }
-
- /**
- * Set time that the time when the command was created by the client.
- * NOTE: By default, this gets set to the current time by the constructor.
- * @param submittedTimestamp Time submitted to server.
- */
- public void setSubmittedTimestamp(Date submittedTimestamp) {
- this.submittedTimestamp = submittedTimestamp;
- }
-
- /**
- * Start the clock on submission start - this should be called when the request is originally created.
- */
- public void markSubmissionStart() {
- setSubmittedTimestamp(new Date());
- }
-
-
- /**
- * Get time that the request was assigned a unique ID by the server.
- * @return timestamp in millis
- */
- public Date getProcessingTimestamp() {
- return processingTimestamp;
- }
-
- /**
- * Set time that the request is submitted on the server.
- * @param processingTimestamp Time submitted to server.
- */
- public void setProcessingTimestamp(Date processingTimestamp) {
- this.processingTimestamp = processingTimestamp;
- }
-
- /**
- * Start the clock on processing times - this should be called when the query
- * hits the QueryService or SubscriptionService.
- */
- public void markProcessingStart() {
- setProcessingTimestamp(new Date());
- }
-
public boolean useResultSetCache() {
//not use caching when there is a txn
return useResultSetCache;
@@ -354,14 +291,6 @@
this.commands = batchedCommands;
}
- public boolean isPreparedBatchUpdate() {
- return isPreparedBatchUpdate;
- }
-
- public void setPreparedBatchUpdate(boolean isPreparedBatchUpdate) {
- this.isPreparedBatchUpdate = isPreparedBatchUpdate;
- }
-
public void setExecutionPayload(Serializable executionPayload) {
this.executionPayload = executionPayload;
}
@@ -377,7 +306,7 @@
public void setExecutionId(long executionId) {
this.executionId = executionId;
}
-
+
public void setBatchedUpdate(boolean isBatchedUpdate) {
this.isBatchedUpdate = isBatchedUpdate;
}
@@ -385,13 +314,58 @@
public boolean isBatchedUpdate() {
return isBatchedUpdate;
}
-
- public Boolean getRequireResultSet() {
- return requireResultSet;
+
+ public ResultsMode getResultsMode() {
+ return resultsMode;
}
- public void setRequireResultSet(Boolean requireResultSet) {
- this.requireResultSet = requireResultSet;
+ public void setResultsMode(ResultsMode resultsMode) {
+ this.resultsMode = resultsMode;
}
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.commands = ExternalizeUtil.readStringArray(in);
+ this.isBatchedUpdate = in.readBoolean();
+ this.fetchSize = in.readInt();
+ this.cursorType = in.readInt();
+ this.partialResultsFlag = in.readBoolean();
+ this.statementType = StatementType.values()[in.readByte()];
+ this.parameterValues = ExternalizeUtil.readList(in);
+ this.validationMode = in.readBoolean();
+ this.txnAutoWrapMode = (String)in.readObject();
+ this.XMLFormat = (String)in.readObject();
+ this.styleSheet = (String)in.readObject();
+ this.resultsMode = ResultsMode.values()[in.readByte()];
+ this.useResultSetCache = in.readBoolean();
+ this.ansiQuotedIdentifiers = in.readBoolean();
+ this.showPlan = in.readBoolean();
+ this.rowLimit = in.readInt();
+ this.executionPayload = (Serializable)in.readObject();
+ this.executionId = in.readLong();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ ExternalizeUtil.writeArray(out, commands);
+ out.writeBoolean(isBatchedUpdate);
+ out.writeInt(fetchSize);
+ out.writeInt(cursorType);
+ out.writeBoolean(partialResultsFlag);
+ out.writeByte(statementType.ordinal());
+ ExternalizeUtil.writeList(out, parameterValues);
+ out.writeBoolean(validationMode);
+ out.writeObject(txnAutoWrapMode);
+ out.writeObject(XMLFormat);
+ out.writeObject(styleSheet);
+ out.writeByte(resultsMode.ordinal());
+ out.writeBoolean(useResultSetCache);
+ out.writeBoolean(ansiQuotedIdentifiers);
+ out.writeBoolean(showPlan);
+ out.writeInt(rowLimit);
+ out.writeObject(executionPayload);
+ out.writeLong(executionId);
+ }
+
}
Modified: trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -28,7 +28,6 @@
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -69,12 +68,6 @@
/** The parameters of a Stored Procedure */
private List parameters;
- /** This object represents the time when command is submitted to the server. */
- private Date processingTimestamp;
-
- /** This object represents the time when results are produced on the server. */
- private Date completedTimestamp;
-
/** OPTION DEBUG log if OPTION DEBUG was used */
private String debugLog;
@@ -100,10 +93,6 @@
* @since 4.2
*/
public ResultsMessage(RequestMessage requestMsg){
- if(requestMsg != null){
- this.processingTimestamp = requestMsg.getProcessingTimestamp();
- this.completedTimestamp = new Date();
- }
this.results = new ArrayList[0];
}
@@ -236,13 +225,6 @@
parameters = list;
}
- public Date getProcessingTimestamp() {
- return this.processingTimestamp;
- }
-
- public Date getCompletedTimestamp() {
- return this.completedTimestamp;
- }
/**
* @param strings
*/
@@ -284,8 +266,6 @@
//Parameters
parameters = ExternalizeUtil.readList(in);
- processingTimestamp = (Date)in.readObject();
- completedTimestamp = (Date)in.readObject();
debugLog = (String)in.readObject();
annotations = (Collection)in.readObject();
isUpdateResult = in.readBoolean();
@@ -320,8 +300,6 @@
// Parameters
ExternalizeUtil.writeList(out, parameters);
- out.writeObject(processingTimestamp);
- out.writeObject(completedTimestamp);
out.writeObject(debugLog);
out.writeObject(annotations);
out.writeBoolean(isUpdateResult);
Deleted: trunk/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,80 +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 com.metamatrix.jdbc.api;
-
-import com.metamatrix.common.api.MMURL;
-
-
-/**
- * MetaMatrix-specific connection properties. These connection properties can
- * be set via the java.sql.DriverManager.getConnection(jdbcUrl, connectionProps)
- * method.
- *
- * WARNING: This class does not contain all possible properties.
- */
-public interface ConnectionProperties {
-
- // constant defined for connection properties indicating the value is a Serializable token
- // that may be used in the connector for this client's requests
-
- /**
- * Connection property name for trusted session payload.
- * The <i>optional</i> client token that will be passed directly through to connectors,
- * which may use it and/or pass it down to their underlying data source.
- * <p>
- * The form and type of the client payload object is up to the client but it <i>must</i>
- * implement the <code>Serializable</code> interface. MetaMatrix does nothing with this
- * object except to make it available for authentication/augmentation/replacement upon
- * authentication to the system and to connectors that may require it at the data source
- * level.</p>
- */
- public static final String PROP_CLIENT_SESSION_PAYLOAD = MMURL.CONNECTION.CLIENT_TOKEN_PROP;
-
- /**
- * <p>Data source credential sets. The credentials will be decoded and passed in a
- * CredentialMap object as the session payload. It is an error to use this property
- * in conjunction with {@link #PROP_CLIENT_SESSION_PAYLOAD} as the CredentialMap
- * is used as the payload. If a per-user connection factory is used with the
- * ConnectionPool in the Connector API, the CredentialMap can be used to obtain
- * per-system credentials and use per-user connection pooling. In particular, the
- * MetaMatrix JDBC Connectors have pre-built connection factories that can be
- * used with credentials for this purpose. </p>
- *
- * <p>Credentials take the following basic form: <code>credentials=(system=sys1,user=u1,password=p1/
- * system=sys2,user=u2,password=p2)</code>. Each set of system credentials <b>must</b>
- * contain a system property. The properties "user" and "password" are also well-known
- * property names used by the connection factory although any property name is allowed
- * and may be used by a connector to extract credentials.</>
- *
- * <p>Additionally, the credentials property allows an additional attribute before the
- * credentials list: <code>defaultToLogon</code> as follows: <code>credentials=defaultToLogon</code
- * or <code>credentials=defaultToLogon,(system=sys1,user=u1,password=p2)</code>. When this attribute
- * is used, the user's logon credentials are used as defaults when a connector asks for
- * credentials from the CredentialMap.
- * </p>
- */
- public static final String PROP_CREDENTIALS = MMURL.JDBC.CREDENTIALS;
-
- public static final String DEFAULT_TO_LOGON = "defaultToLogon"; //$NON-NLS-1$
-
-}
Modified: trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/ILogon.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -53,5 +53,4 @@
ResultsFuture<?> logoff() throws InvalidSessionException, MetaMatrixComponentException;
void assertIdentity(SessionToken sessionId) throws InvalidSessionException, MetaMatrixComponentException;
-
}
Modified: trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/LogonResult.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -23,7 +23,6 @@
package com.metamatrix.platform.security.api;
import java.io.Serializable;
-import java.util.Properties;
import java.util.TimeZone;
@@ -38,18 +37,19 @@
private static final long serialVersionUID = 4481443514871448269L;
private TimeZone timeZone = TimeZone.getDefault();
- private final Properties productInfo;
private String clusterName;
private SessionToken sessionToken;
+ private String vdbName;
+ private int vdbVersion;
public LogonResult() {
- this.productInfo = new Properties();
}
- public LogonResult(SessionToken token, Properties productInfo, String clusterName) {
- this.productInfo = productInfo;
+ public LogonResult(SessionToken token, String vdbName, int vdbVersion, String clusterName) {
this.clusterName = clusterName;
this.sessionToken = token;
+ this.vdbName = vdbName;
+ this.vdbVersion = vdbVersion;
}
/**
@@ -57,7 +57,7 @@
* @return
* @since 4.3
*/
- public MetaMatrixSessionID getSessionID() {
+ public long getSessionID() {
return this.sessionToken.getSessionID();
}
@@ -65,9 +65,6 @@
return timeZone;
}
- public String getProductInfo(String key) {
- return this.productInfo.getProperty(key);
- }
public String getUserName() {
return this.sessionToken.getUsername();
@@ -80,5 +77,13 @@
public SessionToken getSessionToken() {
return sessionToken;
}
+
+ public String getVdbName() {
+ return vdbName;
+ }
+
+ public int getVdbVersion() {
+ return vdbVersion;
+ }
}
Deleted: trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionID.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,85 +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 com.metamatrix.platform.security.api;
-
-import java.io.Serializable;
-
-/**
- * This immutable class represents an identifier for a unique session.
- */
-public final class MetaMatrixSessionID implements
- Serializable {
-
- public final static long serialVersionUID = -7872739911360962975L;
-
- private long id;
-
- public MetaMatrixSessionID(long id) {
- this.id = id;
- }
-
- /**
- * Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with
- * <code>compareTo()</code>.
- *
- * @param obj
- * the object that this instance is to be compared to.
- * @return whether the object is equal to this object.
- */
- public boolean equals(Object obj) {
- // Check if instances are identical ...
- if (this == obj) {
- return true;
- }
-
- // Check if object can be compared to this one
- // (this includes checking for null ) ...
- if (obj instanceof MetaMatrixSessionID) {
- MetaMatrixSessionID that = (MetaMatrixSessionID)obj;
- return this.id == that.id;
- }
-
- // Otherwise not comparable ...
- return false;
- }
-
- /**
- * Returns the hash code value for this object.
- *
- * @return a hash code value for this object.
- */
- public final int hashCode() {
- return (int)id;
- }
-
- /**
- * Returns a string representing the current state of the object.
- *
- * @return the string representation of this instance.
- */
- public final String toString() {
- return String.valueOf(id);
- }
-
-}
-
Modified: trunk/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -33,12 +33,25 @@
* transit if sent to the client. Also it should only be sent to the client
* who creates the session.
*/
-public class SessionToken implements Serializable,
- Cloneable {
+public class SessionToken implements Serializable, Cloneable {
public final static long serialVersionUID = -2853708320435636107L;
+ private static ThreadLocal<SessionToken> CONTEXTS = new ThreadLocal<SessionToken>() {
+ protected SessionToken initialValue() {
+ return null;
+ }
+ };
+
+ public static SessionToken getSession() {
+ return CONTEXTS.get();
+ }
+
+ public static void setSession(SessionToken context) {
+ CONTEXTS.set(context);
+ }
+
/** The session ID */
- private MetaMatrixSessionID sessionID;
+ private long sessionID;
private String userName;
private UUID secret;
@@ -46,7 +59,7 @@
* Fake SessionToken representing a trusted user
*/
public SessionToken() {
- this.sessionID = new MetaMatrixSessionID(-1);
+ this.sessionID = -1L;
this.userName = "trusted"; //$NON-NLS-1$
this.secret = new UUID(1,1);
}
@@ -60,12 +73,12 @@
* @param userName
* (String) the userName for this session
* @throws IllegalArgumentException
- */
- public SessionToken(MetaMatrixSessionID id, String userName) {
+ */
+ public SessionToken(long id, String userName) {
this.sessionID = id;
this.userName = userName;
this.secret = UUID.randomUUID();
- }
+ }
public UUID getSecret() {
return secret;
@@ -76,20 +89,11 @@
*
* @return the session ID
*/
- public MetaMatrixSessionID getSessionID() {
+ public long getSessionID() {
return this.sessionID;
}
/**
- * Returns unique session identifier
- *
- * @return the session ID value
- */
- public String getSessionIDValue() {
- return this.sessionID.toString();
- }
-
- /**
* Get the principal name for this session's user.
*
* @return the user name
@@ -119,7 +123,7 @@
return false;
}
SessionToken that = (SessionToken) obj;
- return (this.sessionID.equals(that.sessionID))
+ return (this.sessionID == that.sessionID)
&& this.userName.equals(that.userName)
&& this.secret.equals(that.secret);
}
@@ -132,14 +136,14 @@
* @see Object#equals(Object)
*/
public int hashCode() {
- return this.sessionID.hashCode();
+ return new Long(this.sessionID).hashCode();
}
/**
* Returns a string representing the current state of the object.
*/
public String toString() {
- return "SessionToken[" + getUsername() + "," + getSessionIDValue() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return "SessionToken[" + getUsername() + "," + this.sessionID + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/**
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,10 +22,359 @@
package org.teiid.adminapi;
-/**
- * Marker interface for all MetaMatrix administration - core.
- *
- * @since 4.3
- */
-public interface Admin extends ConfigurationAdmin, MonitoringAdmin, RuntimeStateAdmin, SecurityAdmin {
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.Set;
+
+public interface Admin {
+
+ public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE, CONNECTOR_RESULT_SET_CACHE};
+
+ /**
+ * Assign a {@link ConnectorBinding} to a {@link VDB}'s Model
+ *
+ * @param connectorBindingName
+ * Name of the ConnectorBinding
+ * @param vdbName
+ * Name of the VDB
+ * @param vdbVersion
+ * Version of the VDB
+ * @param modelName
+ * Name of the Model to map Connector Binding
+ * @throws AdminException
+ * if there's a system error or if there's a user input error.
+ */
+ void assignBindingToModel(String vdbName,
+ int vdbVersion,
+ String modelName,
+ String connectorBindingName) throws AdminException;
+
+ void assignBindingsToModel(String vdbName,
+ int vdbVersion,
+ String modelName,
+ String[] connectorBindingName) throws AdminException;
+
+ /**
+ * Set/update the property for the Connector Binding identified by the given deployed name.
+ * @param deployedName
+ * @param propertyName
+ * @param propertyValue
+ * @throws AdminException
+ */
+ void setConnectorBindingProperty(String deployedName, String propertyName, String propertyValue) throws AdminException;
+
+ /**
+ * Add Connector Type, will import Connector Type from a file
+ *
+ * @param name of the Connector Type to add
+ * @param URL URL to RAR file
+ * @throws AdminException if there's a system error.
+ */
+ void addConnectorType(String name, URL rarURL) throws AdminException;
+
+ /**
+ * Delete Connector Type from Next Configuration
+ *
+ * @param name String name of the Connector Type to delete
+ * @throws AdminException
+ * if there's a system error.
+ */
+ void deleteConnectorType(String name) throws AdminException;
+
+ /**
+ * Export Connector Type rar file
+ *
+ * @param @param name of the Connector Type
+ * @return InputStream of contents of the rar file
+ * @throws AdminException if there's a system error.
+ */
+ InputStream exportConnectorType(String name) throws AdminException;
+
+ /**
+ * Deploy a {@link ConnectorBinding} to Configuration
+ *
+ * @param deployedName Connector Binding name that will be added to Configuration
+ * @param typeName Connector type name.
+ * @param properties Name & Value pair need to deploy the Connector Binding
+
+ * @throws AdminException if there's a system error.
+ */
+ void addConnectorBinding(String deployedName, String typeName, Properties properties) throws AdminException;
+
+ /**
+ * Delete the {@link ConnectorBinding} from the Configuration
+ *
+ * @param deployedName - deployed name of the connector binding
+ * @throws AdminException if there's a system error.
+ */
+ void deleteConnectorBinding(String deployedName) throws AdminException;
+
+ /**
+ * Export a {@link ConnectorBinding} to character Array in XML format
+ *
+ * @param deployedName the unique identifier for a {@link ConnectorBinding}.
+ * @return character Array in XML format
+ * @throws AdminException
+ * if there's a system error.
+ */
+ InputStream exportConnectorBinding(String deployedName) throws AdminException;
+
+ /**
+ * Deploy a {@link VDB} file.
+ * @param name Name of the VDB file to save under
+ * @param URL VDB file location.
+ * @throws AdminException
+ * if there's a system error.
+ * @return the {@link VDB} representing the current property values and runtime state.
+ */
+ public void deployVDB(String fileName, URL vdbURL) 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;
+
+ /**
+ * Export VDB to byte array
+ *
+ * @param vdbName identifier of the {@link VDB}
+ * @param vdbVersion {@link VDB} version
+ * @return InputStream of the VDB
+ * @throws AdminException if there's a system error.
+ */
+ InputStream exportVDB(String vdbName, int vdbVersion) throws AdminException;
+
+ /**
+ * Set a process level property.
+ * @param propertyName - name of the property
+ * @param propertyValue - value of the property
+ */
+ void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException;
+
+ /**
+ * Get the Connector Types available in the configuration.
+ *
+ * @return Set of connector types.
+ * @throws AdminException if there's a system error.
+ */
+ Set<String> getConnectorTypes() 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 if there's a system error.
+ */
+ Set<VDB> getVDBs() throws AdminException;
+
+ /**
+ * Get the VDB
+ * @param vdbName
+ * @param vbdVersion
+ * @throws AdminException if there's a system error.
+ * @return
+ */
+ VDB getVDB(String vdbName, int vbdVersion) throws AdminException;
+
+ /**
+ * Get the Connector Bindings that are available in the configuration
+ *
+ * @return Collection of {@link ConnectorBinding}
+ * @throws AdminException if there's a system error.
+ */
+ Collection<ConnectorBinding> getConnectorBindings() throws AdminException;
+
+ /**
+ * Get the connector binding by the given the deployed name.
+ * @param deployedName - name of the deployed connector binding
+ * @return null if not found a connector binding by the given name
+ * @throws AdminException if there's a system error.
+ */
+ ConnectorBinding getConnectorBinding(String deployedName) throws AdminException;
+
+ /**
+ * Get all the Connector Bindings for the given VDB identifier pattern
+ * @param vdbName - Name of the VDB
+ * @param vdbVersion - version of the VDB
+ * @return Collection of {@link ConnectorBinding}
+ * @throws AdminException if there's a system error.
+ */
+ Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, int vdbVersion) throws AdminException;
+
+ /**
+ * Get the Work Manager stats that correspond to the specified identifier pattern.
+ *
+ * @param identifier - an identifier for the queues {@link QueueWorkerPool}. "runtime" will return the stats for Query
+ * runtime Worker Pool. Also any Connector Binding name will return the stats for that connector binding.
+ * @return Collection of {@link QueueWorkerPool}
+ * @throws AdminException if there's a system error.
+ */
+ WorkerPoolStatistics getWorkManagerStats(String identifier) throws AdminException;
+
+
+ /**
+ * Get the Connection Pool Stats that correspond to the specified identifier pattern.
+ * If the {@link ConnectionPoolStatistics ConnectionPool} represents an XA connection, there
+ * will be 2 {@link ConnectionPoolStatistics ConnectionPool}s.
+ *
+ * @param deployedName - an identifier that corresponds to the ConnectorBinding Name
+ * @return {@link ConnectionPoolStatistics}
+ * @throws AdminException if there's a system error.
+ */
+ ConnectionPoolStatistics getConnectorConnectionPoolStats(String deployedName) throws AdminException;
+
+
+ /**
+ * Get the Caches that correspond to the specified identifier pattern
+ * @return Collection of {@link String}
+ * @throws AdminException if there's a system error.
+ */
+ Collection<String> getCacheTypes() throws AdminException;
+
+ /**
+ * Get all the current Sessions.
+ * @return Collection of {@link Session}
+ * @throws AdminException if there's a system error.
+ */
+ Collection<Session> getSessions() throws AdminException;
+
+ /**
+ * Get the all Requests that are currently in process
+ * @return Collection of {@link Request}
+ * @throws AdminException if there's a system error.
+ */
+ Collection<Request> getRequests() throws AdminException;
+
+ /**
+ * Get the Requests for the given session
+ * @return Collection of {@link Request}
+ * @throws AdminException if there's a system error.
+ */
+ Collection<Request> getRequestsForSession(long sessionId) throws AdminException;
+
+
+ /**
+ * Get all of the available Configuration Properties for the specified AdminObject, and details about them.
+ * @param connectorTypeIdentifier
+ * @return
+ * @throws AdminException
+ */
+ Collection<PropertyDefinition> getConnectorTypePropertyDefinitions(String connectorTypeIdentifier) throws AdminException;
+
+
+ /**
+ * Get all transaction matching the identifier.
+ * @return
+ * @throws AdminException
+ */
+ Collection<Transaction> getTransactions() throws AdminException;
+
+ /**
+ * Get the processes that correspond to the specified identifier pattern.
+ *
+ * @param processIdentifier the unique identifier for for a {@link org.teiid.adminapi.ProcessObject ProcessObject}
+ * in the system or "{@link org.teiid.adminapi.AdminObject#WILDCARD WILDCARD}"
+ * if all Processes are desired.
+ * @return Collection of {@link org.teiid.adminapi.ProcessObject ProcessObject}
+ * @throws AdminException if there's a system error.
+ */
+ Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException;
+
+
+ /**
+ * Start Connector Binding
+ *
+ * @param deployedName
+ * @throws AdminException if there's a system error.
+ */
+ void startConnectorBinding(ConnectorBinding binding) throws AdminException;
+
+ /**
+ * Stop Connector Binding
+ *
+ * @param deployedName identifier for {@link org.teiid.adminapi.ConnectorBinding}
+ */
+ void stopConnectorBinding(ConnectorBinding binding) 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 if there's a system error.
+ */
+ void clearCache(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 if there's a system error.
+ */
+ void terminateSession(long sessionId) throws AdminException;
+
+ /**
+ * Cancel Request
+ *
+ * @param sessionId session Identifier for the request.
+ * @param requestId request Identifier
+ *
+ * @throws AdminException if there's a system error.
+ */
+ void cancelRequest(long sessionId, long requestId) throws AdminException;
+
+ /**
+ * Mark the given global transaction as rollback only.
+ * @param transactionId
+ * @throws AdminException
+ */
+ void terminateTransaction(String transactionId) throws AdminException;
+
+ /**
+ * Stop the Teiid. If millisToWait is >0, then close to incoming queries, wait the time period
+ * for work to stop, then stop the MM Query. Otherwise, stop immediately, aborting all running queries.
+ * @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
+ * @throws AdminException
+ */
+ void shutdown(int millisToWait) throws AdminException;
+
+ /**
+ * Restart System
+ * @throws AdminException if there's a system error.
+ */
+ void restart() throws AdminException;
+
+ /**
+ * Adds JDBC XA Data Source in the container.
+ * @param dsName - name of the source
+ * @param properties - properties
+ * @throws AdminException
+ */
+ void addDataSource(String deploymentName, Properties properties) throws AdminException;
+
+ /**
+ * Delete data source.
+ * @param dsName
+ * @throws AdminException
+ */
+ void deleteDataSource(String deploymentName) throws AdminException;
+
+ /**
+ * Get the property definitions for creating the JDBC data source.
+ * @return
+ * @throws AdminException
+ */
+ Collection<PropertyDefinition> getDataSourcePropertyDefinitions() throws AdminException;
+
+ /**
+ * Closes the admin connection
+ */
+ void close();
}
Copied: trunk/client/src/main/java/org/teiid/adminapi/AdminFactory.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/AdminFactory.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminFactory.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminFactory.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,243 @@
+/*
+ * 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.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+
+import com.metamatrix.admin.AdminPlugin;
+import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.client.ExceptionUtil;
+import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.api.ServerConnectionFactory;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.comm.platform.CommPlatformPlugin;
+import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+
+/**
+ * Singleton factory for ServerAdmins.
+ * @since 4.3
+ */
+public class AdminFactory {
+
+ private static final int DEFAULT_BOUNCE_WAIT = 2000;
+
+ private final class ReconnectingProxy implements InvocationHandler {
+
+ private Admin target;
+ private ServerConnection registry;
+ private Properties p;
+ private boolean closed;
+
+ public ReconnectingProxy(Properties p) throws ConnectionException, CommunicationException {
+ this.p = p;
+ this.registry = serverConnectionFactory.getConnection(p);
+ this.target = registry.getService(Admin.class);
+ }
+
+ private synchronized Admin getTarget() throws AdminComponentException, CommunicationException {
+ if (closed) {
+ throw new AdminComponentException(CommPlatformPlugin.Util.getString("ERR.014.001.0001")); //$NON-NLS-1$
+ }
+ if (target != null && registry.isOpen()) {
+ return target;
+ }
+ try {
+ registry = serverConnectionFactory.getConnection(p);
+ } catch (ConnectionException e) {
+ throw new AdminComponentException(e);
+ }
+ target = registry.getService(Admin.class);
+ return target;
+ }
+
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ if (method.getName().equals("close")) { //$NON-NLS-1$
+ close();
+ return null;
+ }
+ Throwable t = null;
+ for (int i = 0; i < 3; i++) {
+ try {
+ return method.invoke(getTarget(), args);
+ } catch (InvocationTargetException e) {
+ if (ExceptionUtil.getExceptionOfType(e, CommunicationException.class) != null) {
+ // communication exception occurred, lose the old connection and try again.
+ this.target = null;
+ if (method.getName().endsWith("restart")) { //$NON-NLS-1$
+ bounceSystem(true);
+ return null;
+ }
+ continue;
+ }
+ throw e.getTargetException();
+ } catch (CommunicationException e) {
+ t = e;
+ }
+ }
+ throw t;
+ }
+
+ public synchronized void close() {
+ if (closed) {
+ return;
+ }
+ this.closed = true;
+ if (registry != null) {
+ registry.close();
+ }
+ }
+
+ public void bounceSystem(boolean waitUntilDone) {
+ if (!waitUntilDone) {
+ return;
+ }
+ //we'll wait 2 seconds for the server to come up
+ try {
+ Thread.sleep(bounceWait);
+ } catch (InterruptedException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
+
+ //we'll wait 30 seconds for the server to come back up
+ for (int i = 0; i < 15; i++) {
+ try {
+ getTarget().getProcesses(AdminObject.WILDCARD);
+ return;
+ } catch (Exception e) {
+ //reestablish a connection and retry
+ try {
+ Thread.sleep(bounceWait);
+ } catch (InterruptedException ex) {
+ throw new MetaMatrixRuntimeException(ex);
+ }
+ }
+ }
+ }
+ }
+
+ public static final String DEFAULT_APPLICATION_NAME = "Admin"; //$NON-NLS-1$
+
+ /**Singleton instance*/
+ private static AdminFactory instance = new AdminFactory(SocketServerConnectionFactory.getInstance(), DEFAULT_BOUNCE_WAIT);
+
+ private ServerConnectionFactory serverConnectionFactory;
+ private int bounceWait;
+
+ AdminFactory(ServerConnectionFactory connFactory, int bounceWait) {
+ this.serverConnectionFactory = connFactory;
+ this.bounceWait = bounceWait;
+ }
+
+ /**Get the singleton instance*/
+ public static AdminFactory getInstance() {
+ return instance;
+ }
+
+
+ /**
+ * Creates a ServerAdmin with the specified connection properties.
+ * Uses the DEFAULT_APPLICATION_NAME as the application name.
+ * @param userName
+ * @param password
+ * @param serverURL
+ * @return
+ * @throws LogonException
+ * @throws AdminException
+ * @throws CommunicationException
+ * @throws LogonException
+ * @since 4.3
+ */
+ public Admin createAdmin(String userName,
+ char[] password,
+ String serverURL) throws AdminException {
+
+ return createAdmin(userName, password, serverURL, DEFAULT_APPLICATION_NAME);
+
+ }
+
+ /**
+ * Creates a ServerAdmin with the specified connection properties.
+ * @param userName
+ * @param password
+ * @param serverURL
+ * @return
+ * @throws LogonException
+ * @throws AdminException
+ * @throws CommunicationException
+ * @throws LogonException
+ * @since 4.3
+ */
+ public Admin createAdmin(String userName,
+ char[] password,
+ String serverURL,
+ String applicationName) throws AdminException {
+
+ if (userName == null || userName.trim().length() == 0) {
+ throw new IllegalArgumentException(AdminPlugin.Util.getString("ERR.014.001.0099")); //$NON-NLS-1$
+ }
+
+ final Properties p = new Properties();
+ p.setProperty(MMURL.CONNECTION.APP_NAME, applicationName);
+ p.setProperty(MMURL.CONNECTION.USER_NAME, userName);
+ if (password != null) {
+ p.setProperty(MMURL.CONNECTION.PASSWORD, new String(password));
+ }
+ p.setProperty(MMURL.CONNECTION.SERVER_URL, serverURL);
+ return createAdmin(p);
+ }
+
+ public Admin createAdmin(Properties p) throws AdminException {
+ p = PropertiesUtils.clone(p);
+ p.remove(MMURL.JDBC.VDB_NAME);
+ p.remove(MMURL.JDBC.VDB_VERSION);
+ p.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
+ p.setProperty(MMURL.CONNECTION.ADMIN, Boolean.TRUE.toString());
+
+ try {
+ Admin serverAdmin = (Admin)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Admin.class }, new ReconnectingProxy(p));
+ return serverAdmin;
+ } catch (ConnectionException e) {
+ throw new AdminComponentException(e);
+ } catch (CommunicationException e) {
+ throw new AdminComponentException(e);
+ }
+ }
+
+}
Modified: trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminObject.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,6 +22,7 @@
package org.teiid.adminapi;
+import java.io.Serializable;
import java.util.Properties;
/**
@@ -36,7 +37,7 @@
*
* @since 4.3
*/
-public interface AdminObject {
+public interface AdminObject extends Serializable {
/**
* The character that delimits the atomic components of the identifier.
@@ -76,17 +77,7 @@
*/
public static final String ESCAPED_WILDCARD = "\\" + WILDCARD; //$NON-NLS-1$
-
/**
- * Get the Full Name for this AdminObject. This identifier will uniquely identify this object in the Teiid
- * system.
- *
- * @return String the unique Identifier
- * @since 4.3
- */
- String getIdentifier();
-
- /**
* Get the name for this AdminObject, usually the last component of the identifier.
*
* @return String Name
Modified: trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -47,7 +47,7 @@
* @return the <code>Set</code> of <code>String</code> role names.
* @since 4.3
*/
- public static Set getAllRoleNames() {
+ public static Set<String> getAllRoleNames() {
return roleSet;
}
Copied: trunk/client/src/main/java/org/teiid/adminapi/ConnectionPoolStatistics.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/ConnectionPoolStatistics.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectionPoolStatistics.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectionPoolStatistics.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi;
+
+import java.io.Serializable;
+
+
+/**
+ * This object holds the statistics for a ConnectionPool that is being utilized by a Connector.
+ * As per how many available connections
+ * processed etc.
+ */
+public interface ConnectionPoolStatistics extends AdminObject, Serializable {
+
+ /**
+ * The maximum number of connections that are available
+ * @return
+ */
+ long getAvailableConnectionCount();
+
+ /**
+ * The number of connections that are currently in the pool
+ * @return
+ */
+ int getConnectionCount();
+
+ /**
+ * The number of connections that have been created since the connector was last started
+ * @return
+ */
+ int getConnectionCreatedCount();
+
+ /**
+ * The number of connections that have been destroyed since the connector was last started
+ * @return
+ */
+ int getConnectionDestroyedCount();
+
+
+ /**
+ * The number of connections that are currently in use
+ * @return
+ */
+ long getInUseConnectionCount();
+
+ /**
+ * The most connections that have been simultaneously in use since this connector was started
+ * @return
+ */
+ long getMaxConnectionsInUseCount();
+
+ /**
+ * Max size
+ * @return
+ */
+ int getMaxSize();
+
+ /**
+ * Min Size
+ * @return
+ */
+ int getMinSize();
+}
Modified: trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/ConnectorBinding.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,83 +22,21 @@
package org.teiid.adminapi;
-import java.util.Date;
/**
- * Represents a connector binding (the instance of a connector type) in the MetaMatrix system.
- *
- * <p>The unique identifier pattern is [host]<{@link #DELIMITER}>[process]<{@link #DELIMITER}>[Connector Binding Name]
- * when running against a MetaMatrix server. The [Connector Binding Name] can itself have spaces in the name.
- * In the case of the MM Query, the [host] and [process] do not apply as MM Query is always local.</p>
- *
- * @since 4.3
+ * Represents a connector binding (the instance of a connector type) in the Teiid system.
*/
-public interface ConnectorBinding extends
- AdminObject {
- /**Registered by not initialized*/
- public static final int STATE_NOT_INITIALIZED = 0;
- /**Open and running*/
- public static final int STATE_OPEN = 1;
- /**Registered but closed*/
- public static final int STATE_CLOSED = 2;
- /**Failed after running successfully*/
- public static final int STATE_FAILED = 3;
- /**Failed during initialization*/
- public static final int STATE_INIT_FAILED = 4;
- /**Not registered*/
- public static final int STATE_NOT_REGISTERED = 5;
- /**Running, but the underlying data source is unavailable*/
- public static final int STATE_DATA_SOURCE_UNAVAILABLE = 6;
- /**Running, not deployed*/
- public static final int STATE_NOT_DEPLOYED = 7;
- /** failed to check the status */
- public static final int STATE_FAILED_TO_CHECK = 8;
+public interface ConnectorBinding extends AdminObject {
- /** Password connector property name */
- public static final String PASSWORD = "Password"; //$NON-NLS-1$
-
-
/**
- * Retrieve the current connector state. This will be one of the constants:
- * {@link ConnectorBinding#STATE_OPEN DQP.STATE_OPEN}.
- * {@link ConnectorBinding#STATE_NOT_INITIALIZED DQP.STATE_NOT_INITIALIZED}.
- * {@link ConnectorBinding#STATE_CLOSED DQP.STATE_CLOSED}.
- * {@link ConnectorBinding#STATE_FAILED DQP.STATE_FAILED}.
- * {@link ConnectorBinding#STATE_INIT_FAILED DQP.STATE_INIT_FAILED}.
- * {@link ConnectorBinding#STATE_NOT_REGISTERED DQP.STATE_NOT_REGISTERED}.
- * {@link ConnectorBinding#STATE_DATA_SOURCE_UNAVAILABLE DQP.STATE_DATA_SOURCE_UNAVAILABLE}.
- * {@link ConnectorBinding#STATE_NOT_DEPLOYED DQP.STATE_NOT_DEPLOYED}.
- * @return current connector state.
+ * Get the identifier for this connector binding's RAR file name
+ * @return Name of the RAR file used to create this binding
*/
- int getState();
+ String getRARFileName();
/**
- * Retrieve the current connector state as a printable <code>String</code>.
- * @return current connector state in String form.
+ * Get the JNDI Name of this connector
+ * @return
*/
- String getStateAsString();
-
- /**
- * Returns time of last state change.
- *
- * @return time of last state change.
- * @since 4.3
- */
- Date getStateChangedTime();
-
- /**
- * Returns the description
- *
- * @return description
- */
- String getDescription();
-
- /**
- * Get the identifier for this connector binding's {@link ConnectorType}.
- * @return the Connector Type identifier which can be used to
- * find the ConnectorType.
- * @since 4.3
- */
- String getConnectorTypeName();
-
+ String getJNDIName();
}
Copied: trunk/client/src/main/java/org/teiid/adminapi/Logger.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/Logger.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Logger.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/Logger.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+
+/**
+ * Custom logging interface that provides a hook for custom implementations to log messages
+ * produced by MM Query.
+ * @since 4.3
+ */
+public interface Logger {
+
+ /**
+ * Logs the given message if the current logging level is >= the logLevel parameter.
+ * @param logLevel logging level for this message
+ * @param timestamp timestamp at which this log message was generated
+ * @param componentName name of the component that generated this message
+ * @param threadName name of the thread that generated this message
+ * @param message message body. May be null.
+ * @param throwable exception thrown. May be null.
+ * @since 4.3
+ */
+ void log(int logLevel, long timestamp, String componentName, String threadName, String message, Throwable throwable);
+}
Modified: trunk/client/src/main/java/org/teiid/adminapi/Model.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Model.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/Model.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -24,62 +24,47 @@
import java.util.List;
+
/**
- * Represents a metadata model in the MetaMatrix system.
+ * Represents a metadata model in the Teiid system.
*
* @since 4.3
*/
public interface Model extends AdminObject {
-
+
+ enum Type {PHYSICAL, VIRTUAL, FUNCTION};
+
/**
- * Return the connector binding names for this Virtual Databse.
- * @return connector bindings bound to this model.
- */
- List getConnectorBindingNames();
-
- /**
- * Determine if this model is a physical type.
+ * Determine if this model is a Source model.
*
- * @return <code>true</code> iff it contains physical group(s).
+ * @return <code>true</code> if it contains physical group(s).
*/
- boolean isPhysical();
+ boolean isSource();
/**
* Determine whether this model is exposed for querying.
*
- * @return <code>true</code> iff the model is visible
+ * @return <code>true</code> if the model is visible
* for querying.
*/
boolean isVisible();
/**
* Retrieve the model type.
- * TODO: one of ...
* @return model type
*/
- String getModelType();
+ Type getModelType();
- /**
- * Retrive the model URI.
- *
- * @return model URI
- */
- String getModelURI();
-
/**
* Determine whether this model can support more than one connector binding.
*
- * @return <code>true</code> iff this model supports multi-source bindings
+ * @return <code>true</code> if this model supports multi-source bindings
*/
- boolean supportsMultiSourceBindings();
+ boolean isSupportsMultiSourceBindings();
- /**
- * Determine whether this model is a Materialization Model
- *
- * @return isMaterialization whether the model is a Materialization Model.
- * @since 4.3
+ /**
+ * Associated Source Names for the Models (Connector Bindings)
+ * @return String
*/
-
- boolean isMaterialization();
-
+ List<String> getSourceNames();
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/ProcessObject.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -136,5 +136,5 @@
* @return Returns the queueWorkerPool.
* @since 4.3
*/
- public QueueWorkerPool getQueueWorkerPool();
+ public WorkerPoolStatistics getQueueWorkerPool();
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/PropertyDefinition.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -42,14 +42,7 @@
public static final int UNBOUNDED_VALUE = Integer.MAX_VALUE;
-
/**
- * Get the current value of this property.
- * @return the current value of this property.
- */
- String getValue();
-
- /**
* Get the localized display name of this property.
* @return the displayable name for this property
*/
@@ -62,15 +55,7 @@
String getDescription();
-
/**
- * Get the type for values of this property.
- * @return the type that best describes the values of this property.
- */
- String getPropertyType();
-
-
- /**
* 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.
*/
@@ -120,7 +105,7 @@
* @return true if this property is to be marked with the expert flag,
* or false otherwise.
*/
- boolean isExpert();
+ 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
Modified: trunk/client/src/main/java/org/teiid/adminapi/Request.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Request.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/Request.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,7 +22,6 @@
package org.teiid.adminapi;
-import java.util.Date;
/**
@@ -33,73 +32,50 @@
*
* <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>
- * @since 4.3
*/
public interface Request extends AdminObject {
+
/**
- * @return Date the request was created
- * @since 4.3
+ * Get the ExecutionId for a Request
+ * @return ExecutionId
*/
- public Date getCreated();
-
- /**
- * Get the RequestID for a Request
- * @return RequestID
- */
- public String getRequestID();
+ public long getExecutionId();
/**
* Get the SessionID for a Request
*
* @return long SessionID
*/
- public String getSessionID();
+ public long getSessionId();
/**
* Get the SQL Command sent to the Server for a Request
*
- * @return MetaMatrix SQL Command
+ * @return SQL Command
*/
- public String getSqlCommand();
+ public String getCommand();
/**
- * Get the Date processing began for the Request
+ * Get when the processing began for this Request
* @return Date processing began
*/
- public Date getProcessingDate();
+ public long getProcessingTime();
/**
* Get the TransactionID of the Request
*
* @return String of TransactionID if in a transaction
*/
- public String getTransactionID();
+ public String getTransactionId();
-
- /**
- * Get the UserName of the Request
- *
- * @return String username for the Request
- */
- public String getUserName();
-
-
/**
- * @return Returns the connectorBindingName.
- * @since 4.3
- */
- public String getConnectorBindingName();
-
- /**
* @return Returns whether this is a Source Request.
- * @since 4.3
*/
- public boolean isSource();
+ public boolean sourceRequest();
/**
* @return In the case that this is a source request this represents the node id. Otherwise blank
- * @since 4.3
*/
- public String getNodeID();
+ public int getNodeId();
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/Session.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Session.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/Session.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,104 +22,24 @@
package org.teiid.adminapi;
-import java.util.Date;
/**
- * A Session is a lasting connection between a client and a MetaMatrix System.
+ * A Session is a lasting connection between a client and a Teiid System.
*
* A user may be allowed to have multiple sessions active simultaneously.
*
- * <p>a Session identifier gets automatically assigned
- * to a connection when user logs into the system</p>
- *
- * @since 4.3
*/
-public interface Session extends
- AdminObject {
+public interface Session extends AdminObject {
-
/**
- * The session is open (active).
- */
- public static final int STATE_ACTIVE = 1;
-
- /**
- * The ejb server has passivated the session - it may become
- *open again in the future
- */
- public static final int STATE_PASSIVATED = 2;
-
- /**
- * The session is closed - this state cannot change once it
- *is reached.
- */
- public static final int STATE_CLOSED = 3;
-
- /**
- * The session has expired - this state cannot change once it
- *is reached.
- */
- public static final int STATE_EXPIRED = 4;
-
- /**
- * The session is terminated - this state cannot change once it
- *is reached.
- */
- public static final int STATE_TERMINATED = 5;
-
- /**
- * The description when the session has expired - this state cannot change once it
- * is reached.
- */
- public static final String EXPIRED_STATE_DESC = "Expired"; //$NON-NLS-1$
-
- /**
- * The description when the session is open (active).
- */
- public static final String ACTIVE_STATE_DESC = "Active";//$NON-NLS-1$
-
- /**
- * The description when the session is closed - this state cannot change once it
- * is reached.
- */
- public static final String CLOSED_STATE_DESC = "Closed";//$NON-NLS-1$
-
- /**
- * The description when the session is terminated - this state cannot change once it
- *is reached.
- */
- public static final String TERMINATED_STATE_DESC = "Terminated";//$NON-NLS-1$
-
- /**
- * The description when the ejb server has passivated the session - it may become
- * open again in the future
- */
- public static final String PASSIVATED_STATE_DESC = "Passivated";//$NON-NLS-1$
-
- /**
- * The description when the state of the session is not known.
- */
- public static final String UNKNOWN_STATE_DESC = "Unknown";//$NON-NLS-1$
-
-
-
-
- /**
* 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 Date getLastPingTime();
+ public long getLastPingTime();
/**
- * Get the Session State as a String.
- *
- * @return SessionState
- */
- public String getStateAsString();
-
- /**
* Get the Application Name
*
* @return String of the Application Name
@@ -127,21 +47,14 @@
public String getApplicationName();
/**
- * Get the unique MetaMatrix session
- * within a given MetaMatrix System
+ * Get the unique Teiid session
+ * within a given Teiid System
*
* @return String of the Session ID
*/
- public String getSessionID();
+ public long getSessionId();
/**
- * Get the State of the Session
- *
- * @return int of the Session's state
- */
- public int getState();
-
- /**
* Get User Name for this Session
*
* @return String of UserName
@@ -160,7 +73,7 @@
*
* @return String name/number of the VDB Version
*/
- public String getVDBVersion();
+ public int getVDBVersion();
/**
* Get the IPAddress for this Session
@@ -174,13 +87,19 @@
* accessing from
* @return
*/
- public String getHostName() ;
+ public String getClientHostName();
/**
* Get the time the {@link Session} was created.
* @return
*/
- public Date getCreatedDate();
+ public long getCreatedTime();
+
+ /**
+ * Security Domain user logged into currently
+ * @return
+ */
+ public String getSecurityDomain();
}
\ No newline at end of file
Copied: trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,60 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+
+
+public abstract class TeiidAdmin implements Admin, Serializable {
+
+ @Override
+ public void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String connectorBindingName)
+ throws AdminException {
+ // rameshTODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
+ ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
+ //list.add(manager.getProcess());
+ return list;
+ }
+
+ @Override
+ public void restart() throws AdminException {
+ // rameshTODO Auto-generated method stub
+ }
+
+ @Override
+ public void shutdown(int millisToWait) throws AdminException {
+ // rameshTODO Auto-generated method stub
+ }
+
+ @Override
+ public void setRuntimeProperty(String propertyName, String propertyValue) throws AdminException {
+ // rameshTODO Auto-generated method stub
+ }
+}
Modified: trunk/client/src/main/java/org/teiid/adminapi/Transaction.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Transaction.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/Transaction.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,10 +22,7 @@
package org.teiid.adminapi;
-import java.util.Date;
-import javax.transaction.xa.Xid;
-
public interface Transaction extends AdminObject {
/**
@@ -33,7 +30,7 @@
* May be null for an unassociated Global transaction.
* @return
*/
- String getAssociatedSession();
+ long getAssociatedSession();
/**
* Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST
@@ -45,19 +42,13 @@
* Return the Xid of the Global transaction. Will be null for non-Global transactions.
* @return
*/
- Xid getXid();
+ String getXid();
- /**
- * Get the current status. See {@link javax.transaction.Status} for
- * possible values.
- * @return
- */
- String getStatus();
/**
* Get the date the transaction was created.
* @return
*/
- Date getCreated();
+ long getCreatedTime();
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/VDB.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/java/org/teiid/adminapi/VDB.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -22,13 +22,11 @@
package org.teiid.adminapi;
-import java.util.Collection;
-import java.util.Date;
+import java.util.Collection;
+import java.util.List;
-import com.metamatrix.core.vdb.VDBStatus;
-
/**
- * Represents a Virtual Database in the MetaMatrix system.
+ * 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>,
@@ -41,8 +39,7 @@
*
* @since 4.3
*/
-public interface VDB extends
- AdminObject {
+public interface VDB extends AdminObject {
/**
* Constant to denote the latest version of a VDB located
@@ -50,81 +47,46 @@
* VDB to the MetaMatrix Server from the server repository.
*/
public static final String SERVER_REPOSITORY_LATEST_VERSION = "LATEST"; //$NON-NLS-1$
-
- /**
- * Incomplete (if import does not have all the connector bindings)
- *
- * @since 4.3
- */
- public static final int INCOMPLETE = VDBStatus.INCOMPLETE;
- /**
- * Inactive VDB (can edit connector binding)
- *
- * @since 4.3
- */
- public static final int INACTIVE = VDBStatus.INACTIVE;
- /**
- * Active VDB
- *
- * @since 4.3
- */
- public static final int ACTIVE = VDBStatus.ACTIVE;
- /**
- * Mark VDB for Deletion
- *
- * @since 4.3
- */
- public static final int DELETED = VDBStatus.DELETED;
- /**
- * Active Default
- *
- * @since 5.5.3
- */
- public static final int ACTIVE_DEFAULT = VDBStatus.ACTIVE_DEFAULT;
+
+ public static enum Status{INCOMPLETE, INACTIVE, ACTIVE, DELETED, ACTIVE_DEFAULT};
- /**
- * @return date the VDB was versioned
- */
- public Date getVersionedDate();
/**
- * @return user that versioned the VDB
- */
- public String getVersionedBy();
-
- /**
* @return Collection of MMModels
*/
- public Collection getModels();
-
+ public Collection<? extends Model> getModels();
+
/**
* @return the status
*/
- public int getState();
+ public Status getStatus();
/**
- * @return the status
- */
- public String getStateAsString();
-
- /**
* @return the VDB version
*/
- public String getVDBVersion();
-
- /**
- * Check to see if this VDB has any Materialized Models
- *
- * @return true or false
- * @since 4.3
- */
- public boolean hasMaterializedViews();
-
- /**
- * Check to see if this VDB contains a WSDL.
- * @return true if it contains a WSDL.
- * @since 5.5.3
- */
- public boolean hasWSDL();
-
+ 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();
}
Copied: trunk/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/WorkerPoolStatistics.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi;
+
+public interface WorkerPoolStatistics extends AdminObject {
+
+ /**
+ * Current active thread count
+ * @return
+ */
+ public int getActiveThreads();
+
+ /**
+ * Highest Active threads recorded so far
+ * @return
+ */
+ public int getHighestActiveThreads();
+
+
+ /**
+ * Queue Name
+ * @return
+ */
+ public String getQueueName();
+
+
+ /**
+ * Max number of active threads allowed
+ * @return
+ */
+ public int getMaxThreads();
+
+ /**
+ * @return Returns the number of requests queued.
+ * @since 4.3
+ */
+ public int getQueued();
+
+ /**
+ * @return The number of completed tasks
+ */
+ long getTotalCompleted();
+
+
+ /**
+ * @return The number of submitted tasks
+ */
+ long getTotalSubmitted();
+
+ /**
+ * @return Returns the highest queue size
+ */
+ public int getHighestQueued();
+}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl)
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,170 +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>() {
- @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();
- for (String key:props.stringPropertyNames()) {
- addProperty(key, props.getProperty(key));
- }
- }
-
- protected List<PropertyMetadata> getJAXBProperties(){
- return properties;
- }
-
- @Override
- public String getPropertyValue(String name) {
- return this.properties.getMap().get(name).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");
- 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");
- 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");
- 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");
- 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");
- 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");
- Object result = this.attachments.get(key);
- if (result == null)
- return null;
- return result;
- }
-
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,170 @@
+/*
+ * 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>() {
+ @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();
+ for (String key:props.stringPropertyNames()) {
+ addProperty(key, props.getProperty(key));
+ }
+ }
+
+ protected List<PropertyMetadata> getJAXBProperties(){
+ return properties;
+ }
+
+ @Override
+ public String getPropertyValue(String name) {
+ return this.properties.getMap().get(name).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");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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");
+ Object result = this.attachments.get(key);
+ if (result == null)
+ return null;
+ return result;
+ }
+
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,133 +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.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.ConnectionPoolStatistics;
-
-public class ConnectionPoolStatisticsMetadata extends AdminObjectImpl implements ConnectionPoolStatistics {
-
- private static final long serialVersionUID = 4420845831075045579L;
- private long availableConnectionCount;
- private int connectionCount;
- private int connectionCreatedCount;
- private int connectionDestroyedCount;
- private long inUseConnectionCount;
- private long maxConnectionsInUseCount;
- private int maxSize;
- private int minSize;
-
-
- @Override
- @ManagementProperty(description="The maximum number of connections that are available", readOnly=true)
- public long getAvailableConnectionCount() {
- return availableConnectionCount;
- }
-
- @Override
- @ManagementProperty(description="The number of connections that are currently in the pool", readOnly=true)
- public int getConnectionCount() {
- return connectionCount;
- }
-
- @Override
- @ManagementProperty(description="The number of connections that have been created since the connector was last started", readOnly=true)
- public int getConnectionCreatedCount() {
- return connectionCreatedCount;
- }
-
- @Override
- @ManagementProperty(description="The number of connections that have been destroyed since the connector was last started", readOnly=true)
- public int getConnectionDestroyedCount() {
- return connectionDestroyedCount;
- }
-
- @Override
- @ManagementProperty(description="The number of connections that are currently in use", readOnly=true)
- public long getInUseConnectionCount() {
- return inUseConnectionCount;
- }
-
- @Override
- @ManagementProperty(description="The most connections that have been simultaneously in use since this connector was started", readOnly=true)
- public long getMaxConnectionsInUseCount() {
- return maxConnectionsInUseCount;
- }
-
- @Override
- @ManagementProperty(description="Max configured size", readOnly=true)
- public int getMaxSize() {
- return maxSize;
- }
-
- @Override
- @ManagementProperty(description="Min Configured Size", readOnly=true)
- public int getMinSize() {
- return minSize;
- }
-
- public void setMaxSize(int maxSize) {
- this.maxSize = maxSize;
- }
-
- public void setAvailableConnectionCount(long availableConnectionCount) {
- this.availableConnectionCount = availableConnectionCount;
- }
-
- public void setConnectionCount(int connectionCount) {
- this.connectionCount = connectionCount;
- }
-
- public void setConnectionCreatedCount(int connectionCreatedCount) {
- this.connectionCreatedCount = connectionCreatedCount;
- }
-
- public void setConnectionDestroyedCount(int connectionDestroyedCount) {
- this.connectionDestroyedCount = connectionDestroyedCount;
- }
-
- public void setInUseConnectionCount(long inUseConnectionCount) {
- this.inUseConnectionCount = inUseConnectionCount;
- }
-
- public void setMaxConnectionsInUseCount(long maxConnectionsInUseCount) {
- this.maxConnectionsInUseCount = maxConnectionsInUseCount;
- }
-
- public void setMinSize(int minSize) {
- this.minSize = minSize;
- }
-
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append("ConnectionPoolStatisticsMetadata:"); //$NON-NLS-1$
- str.append(" availableConnectionCount = " + availableConnectionCount); //$NON-NLS-1$
- str.append("; connectionCount = " + connectionCount); //$NON-NLS-1$
- str.append("; connectionCreatedCount = " + connectionCreatedCount); //$NON-NLS-1$
- str.append("; connectionDestroyedCount = " + connectionDestroyedCount); //$NON-NLS-1$
- str.append("; inUseConnectionCount = " + inUseConnectionCount); //$NON-NLS-1$
- str.append("; maxConnectionsInUseCount = " + maxConnectionsInUseCount); //$NON-NLS-1$
- str.append("; maxSize = " + maxSize); //$NON-NLS-1$
- str.append("; minSize = " + minSize); //$NON-NLS-1$
- return str.toString();
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectionPoolStatisticsMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,133 @@
+/*
+ * 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.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.ConnectionPoolStatistics;
+
+public class ConnectionPoolStatisticsMetadata extends AdminObjectImpl implements ConnectionPoolStatistics {
+
+ private static final long serialVersionUID = 4420845831075045579L;
+ private long availableConnectionCount;
+ private int connectionCount;
+ private int connectionCreatedCount;
+ private int connectionDestroyedCount;
+ private long inUseConnectionCount;
+ private long maxConnectionsInUseCount;
+ private int maxSize;
+ private int minSize;
+
+
+ @Override
+ @ManagementProperty(description="The maximum number of connections that are available", readOnly=true)
+ public long getAvailableConnectionCount() {
+ return availableConnectionCount;
+ }
+
+ @Override
+ @ManagementProperty(description="The number of connections that are currently in the pool", readOnly=true)
+ public int getConnectionCount() {
+ return connectionCount;
+ }
+
+ @Override
+ @ManagementProperty(description="The number of connections that have been created since the connector was last started", readOnly=true)
+ public int getConnectionCreatedCount() {
+ return connectionCreatedCount;
+ }
+
+ @Override
+ @ManagementProperty(description="The number of connections that have been destroyed since the connector was last started", readOnly=true)
+ public int getConnectionDestroyedCount() {
+ return connectionDestroyedCount;
+ }
+
+ @Override
+ @ManagementProperty(description="The number of connections that are currently in use", readOnly=true)
+ public long getInUseConnectionCount() {
+ return inUseConnectionCount;
+ }
+
+ @Override
+ @ManagementProperty(description="The most connections that have been simultaneously in use since this connector was started", readOnly=true)
+ public long getMaxConnectionsInUseCount() {
+ return maxConnectionsInUseCount;
+ }
+
+ @Override
+ @ManagementProperty(description="Max configured size", readOnly=true)
+ public int getMaxSize() {
+ return maxSize;
+ }
+
+ @Override
+ @ManagementProperty(description="Min Configured Size", readOnly=true)
+ public int getMinSize() {
+ return minSize;
+ }
+
+ public void setMaxSize(int maxSize) {
+ this.maxSize = maxSize;
+ }
+
+ public void setAvailableConnectionCount(long availableConnectionCount) {
+ this.availableConnectionCount = availableConnectionCount;
+ }
+
+ public void setConnectionCount(int connectionCount) {
+ this.connectionCount = connectionCount;
+ }
+
+ public void setConnectionCreatedCount(int connectionCreatedCount) {
+ this.connectionCreatedCount = connectionCreatedCount;
+ }
+
+ public void setConnectionDestroyedCount(int connectionDestroyedCount) {
+ this.connectionDestroyedCount = connectionDestroyedCount;
+ }
+
+ public void setInUseConnectionCount(long inUseConnectionCount) {
+ this.inUseConnectionCount = inUseConnectionCount;
+ }
+
+ public void setMaxConnectionsInUseCount(long maxConnectionsInUseCount) {
+ this.maxConnectionsInUseCount = maxConnectionsInUseCount;
+ }
+
+ public void setMinSize(int minSize) {
+ this.minSize = minSize;
+ }
+
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("ConnectionPoolStatisticsMetadata:"); //$NON-NLS-1$
+ str.append(" availableConnectionCount = " + availableConnectionCount); //$NON-NLS-1$
+ str.append("; connectionCount = " + connectionCount); //$NON-NLS-1$
+ str.append("; connectionCreatedCount = " + connectionCreatedCount); //$NON-NLS-1$
+ str.append("; connectionDestroyedCount = " + connectionDestroyedCount); //$NON-NLS-1$
+ str.append("; inUseConnectionCount = " + inUseConnectionCount); //$NON-NLS-1$
+ str.append("; maxConnectionsInUseCount = " + maxConnectionsInUseCount); //$NON-NLS-1$
+ str.append("; maxSize = " + maxSize); //$NON-NLS-1$
+ str.append("; minSize = " + minSize); //$NON-NLS-1$
+ return str.toString();
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,65 +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.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.ConnectorBinding;
-
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="connector"))
-public class ConnectorBindingMetaData extends AdminObjectImpl implements ConnectorBinding {
-
- private static final long serialVersionUID = -4865836616882247016L;
- private transient Object type;
-
- @ManagementProperty(description="Connector Binding Name", readOnly=true)
- @ManagementObjectID(type="binding")
- public String getName() {
- return super.getName();
- }
-
- @Override
- @ManagementProperty(description="RAR file name", readOnly=true)
- public String getRARFileName() {
- return getPropertyValue("rar-name");
- }
-
- @Override
- @ManagementProperty(description="JNDI name", readOnly=true)
- public String getJNDIName() {
- return getPropertyValue("jndi-name");
- }
-
- public void setComponentType(Object type) {
- this.type = type;
- }
-
- public Object getComponentType() {
- return this.type;
- }
-
- public String toString() {
- return getName();
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,65 @@
+/*
+ * 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.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.ConnectorBinding;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="connector"))
+public class ConnectorBindingMetaData extends AdminObjectImpl implements ConnectorBinding {
+
+ private static final long serialVersionUID = -4865836616882247016L;
+ private transient Object type;
+
+ @ManagementProperty(description="Connector Binding Name", readOnly=true)
+ @ManagementObjectID(type="binding")
+ public String getName() {
+ return super.getName();
+ }
+
+ @Override
+ @ManagementProperty(description="RAR file name", readOnly=true)
+ public String getRARFileName() {
+ return getPropertyValue("rar-name");
+ }
+
+ @Override
+ @ManagementProperty(description="JNDI name", readOnly=true)
+ public String getJNDIName() {
+ return getPropertyValue("jndi-name");
+ }
+
+ public void setComponentType(Object type) {
+ this.type = type;
+ }
+
+ public Object getComponentType() {
+ return this.type;
+ }
+
+ public String toString() {
+ return getName();
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -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 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.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.managed.api.annotation.ManagementObject;
-
-
-/**
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="resource-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="allow-create" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * <element name="allow-read" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * <element name="allow-update" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * <element name="allow-delete" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * </sequence>
- * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- */
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "description",
- "resourceName",
- "allowCreate",
- "allowRead",
- "allowUpdate",
- "allowDelete"
-})
-@ManagementObject
-public class DataRoleMetadata implements Serializable {
-
- @XmlAttribute(name = "name", required = true)
- protected String name;
- @XmlElement(name = "description")
- protected String description;
- @XmlElement(name = "resource-name", required = true)
- protected 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;
-
- public String getName() {
- return name;
- }
-
- public void setName(String value) {
- this.name = value;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String value) {
- this.description = value;
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String value) {
- this.resourceName = value;
- }
-
- public Boolean isAllowCreate() {
- return allowCreate;
- }
-
- public void setAllowCreate(Boolean value) {
- this.allowCreate = value;
- }
-
- public Boolean isAllowRead() {
- return allowRead;
- }
-
- public void setAllowRead(Boolean value) {
- this.allowRead = value;
- }
-
- public Boolean isAllowUpdate() {
- return allowUpdate;
- }
-
- public void setAllowUpdate(Boolean value) {
- this.allowUpdate = value;
- }
-
- public Boolean isAllowDelete() {
- return allowDelete;
- }
-
- public void setAllowDelete(Boolean value) {
- this.allowDelete = value;
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import 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.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+
+
+/**
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="resource-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="allow-create" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * <element name="allow-read" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * <element name="allow-update" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * <element name="allow-delete" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "description",
+ "resourceName",
+ "allowCreate",
+ "allowRead",
+ "allowUpdate",
+ "allowDelete"
+})
+@ManagementObject
+public class DataRoleMetadata implements Serializable {
+
+ @XmlAttribute(name = "name", required = true)
+ protected String name;
+ @XmlElement(name = "description")
+ protected String description;
+ @XmlElement(name = "resource-name", required = true)
+ protected 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;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String value) {
+ this.resourceName = value;
+ }
+
+ public Boolean isAllowCreate() {
+ return allowCreate;
+ }
+
+ public void setAllowCreate(Boolean value) {
+ this.allowCreate = value;
+ }
+
+ public Boolean isAllowRead() {
+ return allowRead;
+ }
+
+ public void setAllowRead(Boolean value) {
+ this.allowRead = value;
+ }
+
+ public Boolean isAllowUpdate() {
+ return allowUpdate;
+ }
+
+ public void setAllowUpdate(Boolean value) {
+ this.allowUpdate = value;
+ }
+
+ public Boolean isAllowDelete() {
+ return allowDelete;
+ }
+
+ public void setAllowDelete(Boolean value) {
+ this.allowDelete = value;
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright (C) 2008 Red Hat, Inc.
- * Copyright (C) 2000-2007 MetaMatrix, 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.util.AbstractList;
-import java.util.LinkedHashMap;
-import java.util.Set;
-
-final class ListOverMap<E> extends AbstractList<E> {
-
- private LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
- private 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> {
- String getKey(E entry);
-}
-
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2000-2007 MetaMatrix, 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.util.AbstractList;
+import java.util.LinkedHashMap;
+import java.util.Set;
+
+final class ListOverMap<E> extends AbstractList<E> {
+
+ private LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
+ private 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> {
+ String getKey(E entry);
+}
+
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,267 +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 java.util.Properties;
-
-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 javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.Model;
-
-import com.metamatrix.core.vdb.ModelType;
-
-
-(a)XmlAccessorType(XmlAccessType.NONE)
-@XmlType(name = "", propOrder = {
- "JAXBProperties",
- "JAXBSources",
- "errors"
-})
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
-public class ModelMetaData extends AdminObjectImpl implements Model {
-
- private static final String SUPPORTS_MULTI_SOURCE_BINDINGS_KEY = "supports-multi-source-bindings"; //$NON-NLS-1$
- private static final long serialVersionUID = 3714234763056162230L;
-
- private ListOverMap<SourceMapping> sources = new ListOverMap(new KeyBuilder<SourceMapping>() {
- @Override
- public String getKey(SourceMapping entry) {
- return entry.getName();
- }
- });
-
- @XmlAttribute(name = "type")
- protected String modelType = Type.PHYSICAL.name(); //$NON-NLS-1$
-
- @XmlAttribute(name = "visible")
- private Boolean visible = true;
-
- @XmlElement(name = "validation-error")
- protected List<ValidationError> errors;
-
- @ManagementProperty(description="Model Name", readOnly=true)
- @ManagementObjectID(type="model")
- @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
- @ManagementProperty(description = "Is Model Source model", readOnly=true)
- public boolean isSource() {
- if (modelType != null) {
- return ModelType.parseString(modelType.toUpperCase()) == ModelType.PHYSICAL;
- }
- throw new IllegalStateException("Model state is not correctly set");
- }
-
- @Override
- @ManagementProperty(description = "Is Model Visible", readOnly=true)
- public boolean isVisible() {
- return this.visible;
- }
-
- @Override
- @ManagementProperty(description = "Model Type", readOnly=true)
- public Type getModelType() {
- return Type.valueOf(modelType);
- }
-
- @Override
- @ManagementProperty(description = "Does Model supports multi-source bindings", readOnly=true)
- public boolean isSupportsMultiSourceBindings() {
- String supports = getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY);
- return Boolean.parseBoolean(supports);
- }
-
- @Override
- @ManagementProperty(description = "Properties", readOnly=true)
- public Properties getProperties() {
- return new Properties(super.getProperties());
- }
-
- @Override
- @XmlElement(name = "property", type = PropertyMetadata.class)
- protected List<PropertyMetadata> getJAXBProperties(){
- return super.getJAXBProperties();
- }
-
- public void setSupportsMultiSourceBindings(boolean supports) {
- addProperty(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY, Boolean.toString(supports));
- }
-
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
- public String toString() {
- return getName() + this.sources;
- }
-
- public void setVisible(Boolean value) {
- this.visible = value;
- }
-
- @ManagementProperty(description = "Source Mappings (defined by user)")
- public List<SourceMapping> getSourceMappings(){
- return new ArrayList<SourceMapping>(this.sources.getMap().values());
- }
-
- @XmlElement(name = "source")
- protected List<SourceMapping> getJAXBSources(){
- // do not wrap this in another List object; we need direct access for jaxb
- return this.sources;
- }
-
- @Override
- public List<String> getSourceNames() {
- return new ArrayList<String>(this.sources.getMap().keySet());
- }
-
- public String getSourceJndiName(String sourceName) {
- SourceMapping s = this.sources.getMap().get(sourceName);
- return s.getJndiName();
- }
-
- public void addSourceMapping(String name, String jndiName) {
- this.sources.getMap().put(name, new SourceMapping(name, jndiName));
- }
-
- @ManagementProperty(description = "Model Validity Errors", readOnly=true)
- public List<ValidationError> getErrors(){
- return this.errors;
- }
-
- public void addError(String severity, String message) {
- if (this.errors == null) {
- this.errors = new ArrayList<ValidationError>();
- }
- this.errors.add(new ValidationError(severity, message));
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "", propOrder = {
- "value"
- })
- @ManagementObject(properties=ManagementProperties.EXPLICIT)
- public static class ValidationError implements Serializable{
- private static final long serialVersionUID = 2044197069467559527L;
-
- public enum Severity {ERROR, WARNING};
-
- @XmlValue
- protected String value;
-
- @XmlAttribute(name = "severity")
- protected String severity;
-
- public ValidationError() {};
-
- public ValidationError(String severity, String msg) {
- this.severity = severity;
- this.value = msg;
- }
-
- @ManagementProperty (description="Error Message", readOnly = true)
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- @ManagementProperty (description="Severity", readOnly = true)
- public String getSeverity() {
- return severity;
- }
-
- public void setSeverity(String severity) {
- this.severity = severity;
- }
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "")
- @ManagementObject(properties=ManagementProperties.EXPLICIT)
- public static class SourceMapping implements Serializable {
- private static final long serialVersionUID = -4417878417697685794L;
-
- @XmlAttribute(name = "name", required = true)
- private String name;
-
- @XmlAttribute(name = "jndi-name")
- private String jndiName;
-
-
- public SourceMapping() {}
-
- public SourceMapping(String name, String jndiName) {
- this.name = name;
- this.jndiName = jndiName;
- }
-
- @ManagementProperty (description="Source Name", readOnly = true)
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @ManagementProperty (description="JNDI Name of the resource to assosiate with Source name")
- public String getJndiName() {
- // this default could be controlled if needed.
- if (this.jndiName == null) {
- return "java:"+name;
- }
- return jndiName;
- }
-
- public void setJndiName(String jndiName) {
- this.jndiName = jndiName;
- }
-
- public String toString() {
- return getName()+":"+getJndiName();
- }
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,267 @@
+/*
+ * 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 java.util.Properties;
+
+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 javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.Model;
+
+import com.metamatrix.core.vdb.ModelType;
+
+
+(a)XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "", propOrder = {
+ "JAXBProperties",
+ "JAXBSources",
+ "errors"
+})
+(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
+public class ModelMetaData extends AdminObjectImpl implements Model {
+
+ private static final String SUPPORTS_MULTI_SOURCE_BINDINGS_KEY = "supports-multi-source-bindings"; //$NON-NLS-1$
+ private static final long serialVersionUID = 3714234763056162230L;
+
+ private ListOverMap<SourceMapping> sources = new ListOverMap(new KeyBuilder<SourceMapping>() {
+ @Override
+ public String getKey(SourceMapping entry) {
+ return entry.getName();
+ }
+ });
+
+ @XmlAttribute(name = "type")
+ protected String modelType = Type.PHYSICAL.name(); //$NON-NLS-1$
+
+ @XmlAttribute(name = "visible")
+ private Boolean visible = true;
+
+ @XmlElement(name = "validation-error")
+ protected List<ValidationError> errors;
+
+ @ManagementProperty(description="Model Name", readOnly=true)
+ @ManagementObjectID(type="model")
+ @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
+ @ManagementProperty(description = "Is Model Source model", readOnly=true)
+ public boolean isSource() {
+ if (modelType != null) {
+ return ModelType.parseString(modelType.toUpperCase()) == ModelType.PHYSICAL;
+ }
+ throw new IllegalStateException("Model state is not correctly set");
+ }
+
+ @Override
+ @ManagementProperty(description = "Is Model Visible", readOnly=true)
+ public boolean isVisible() {
+ return this.visible;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model Type", readOnly=true)
+ public Type getModelType() {
+ return Type.valueOf(modelType);
+ }
+
+ @Override
+ @ManagementProperty(description = "Does Model supports multi-source bindings", readOnly=true)
+ public boolean isSupportsMultiSourceBindings() {
+ String supports = getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY);
+ return Boolean.parseBoolean(supports);
+ }
+
+ @Override
+ @ManagementProperty(description = "Properties", readOnly=true)
+ public Properties getProperties() {
+ return new Properties(super.getProperties());
+ }
+
+ @Override
+ @XmlElement(name = "property", type = PropertyMetadata.class)
+ protected List<PropertyMetadata> getJAXBProperties(){
+ return super.getJAXBProperties();
+ }
+
+ public void setSupportsMultiSourceBindings(boolean supports) {
+ addProperty(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY, Boolean.toString(supports));
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public String toString() {
+ return getName() + this.sources;
+ }
+
+ public void setVisible(Boolean value) {
+ this.visible = value;
+ }
+
+ @ManagementProperty(description = "Source Mappings (defined by user)")
+ public List<SourceMapping> getSourceMappings(){
+ return new ArrayList<SourceMapping>(this.sources.getMap().values());
+ }
+
+ @XmlElement(name = "source")
+ protected List<SourceMapping> getJAXBSources(){
+ // do not wrap this in another List object; we need direct access for jaxb
+ return this.sources;
+ }
+
+ @Override
+ public List<String> getSourceNames() {
+ return new ArrayList<String>(this.sources.getMap().keySet());
+ }
+
+ public String getSourceJndiName(String sourceName) {
+ SourceMapping s = this.sources.getMap().get(sourceName);
+ return s.getJndiName();
+ }
+
+ public void addSourceMapping(String name, String jndiName) {
+ this.sources.getMap().put(name, new SourceMapping(name, jndiName));
+ }
+
+ @ManagementProperty(description = "Model Validity Errors", readOnly=true)
+ public List<ValidationError> getErrors(){
+ return this.errors;
+ }
+
+ public void addError(String severity, String message) {
+ if (this.errors == null) {
+ this.errors = new ArrayList<ValidationError>();
+ }
+ this.errors.add(new ValidationError(severity, message));
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = {
+ "value"
+ })
+ @ManagementObject(properties=ManagementProperties.EXPLICIT)
+ public static class ValidationError implements Serializable{
+ private static final long serialVersionUID = 2044197069467559527L;
+
+ public enum Severity {ERROR, WARNING};
+
+ @XmlValue
+ protected String value;
+
+ @XmlAttribute(name = "severity")
+ protected String severity;
+
+ public ValidationError() {};
+
+ public ValidationError(String severity, String msg) {
+ this.severity = severity;
+ this.value = msg;
+ }
+
+ @ManagementProperty (description="Error Message", readOnly = true)
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @ManagementProperty (description="Severity", readOnly = true)
+ public String getSeverity() {
+ return severity;
+ }
+
+ public void setSeverity(String severity) {
+ this.severity = severity;
+ }
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "")
+ @ManagementObject(properties=ManagementProperties.EXPLICIT)
+ public static class SourceMapping implements Serializable {
+ private static final long serialVersionUID = -4417878417697685794L;
+
+ @XmlAttribute(name = "name", required = true)
+ private String name;
+
+ @XmlAttribute(name = "jndi-name")
+ private String jndiName;
+
+
+ public SourceMapping() {}
+
+ public SourceMapping(String name, String jndiName) {
+ this.name = name;
+ this.jndiName = jndiName;
+ }
+
+ @ManagementProperty (description="Source Name", readOnly = true)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManagementProperty (description="JNDI Name of the resource to assosiate with Source name")
+ public String getJndiName() {
+ // this default could be controlled if needed.
+ if (this.jndiName == null) {
+ return "java:"+name;
+ }
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ public String toString() {
+ return getName()+":"+getJndiName();
+ }
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.lang.reflect.Type;
-import java.util.Properties;
-
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.PropertiesMetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
-import org.jboss.metatype.spi.values.MetaMapper;
-
-public class ModelMetadataMapper extends MetaMapper<ModelMetaData> {
- private static final MutableCompositeMetaType metaType;
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- static {
- metaType = new MutableCompositeMetaType(ModelMetaData.class.getName(), "The Model meta data");
- metaType.addItem("name", "name", SimpleMetaType.STRING);
- metaType.addItem("visible", "visible", SimpleMetaType.BOOLEAN_PRIMITIVE);
- metaType.addItem("modelType", "modelType", SimpleMetaType.STRING);
-
-
-
- //metaType.addItem("properties", "properties", new MapCompositeMetaType());
- metaType.freeze();
- }
-
- @Override
- public Type mapToType() {
- return ModelMetaData.class;
- }
-
- @Override
- public MetaType getMetaType() {
- return metaType;
- }
-
- @Override
- public MetaValue createMetaValue(MetaType metaType, ModelMetaData object) {
- if (object == null)
- return null;
- if (metaType instanceof CompositeMetaType) {
- CompositeMetaType composite = (CompositeMetaType) metaType;
- CompositeValueSupport request = new CompositeValueSupport(composite);
-
- request.set("modelType", SimpleValueSupport.wrap(object.getModelType().name()));
- request.set("visible", SimpleValueSupport.wrap(object.isVisible()));
- request.set("name",SimpleValueSupport.wrap(object.getName()));
- request.set("properties", new PropertiesMetaValue(object.getProperties()));
-
- return request;
- }
- throw new IllegalArgumentException("Cannot convert request " + object);
- }
-
- @Override
- public ModelMetaData unwrapMetaValue(MetaValue metaValue) {
- if (metaValue == null)
- return null;
-
- if (metaValue instanceof CompositeValue) {
- CompositeValue compositeValue = (CompositeValue) metaValue;
-
- ModelMetaData model = new ModelMetaData();
- String type = (String) metaValueFactory.unwrap(compositeValue.get("modelType"));
- if (type != null) {
- model.setModelType(type);
- }
- else {
- model.setModelType("PHYSICAL");
- }
-
- model.setVisible((Boolean) metaValueFactory.unwrap(compositeValue.get("visible")));
- model.setName((String) metaValueFactory.unwrap(compositeValue.get("name")));
- model.setProperties((Properties) metaValueFactory.unwrap(compositeValue.get("properties")));
- return model;
- }
- throw new IllegalStateException("Unable to unwrap request " + metaValue);
- }
-
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.lang.reflect.Type;
+import java.util.Properties;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.PropertiesMetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class ModelMetadataMapper extends MetaMapper<ModelMetaData> {
+ private static final MutableCompositeMetaType metaType;
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ static {
+ metaType = new MutableCompositeMetaType(ModelMetaData.class.getName(), "The Model meta data");
+ metaType.addItem("name", "name", SimpleMetaType.STRING);
+ metaType.addItem("visible", "visible", SimpleMetaType.BOOLEAN_PRIMITIVE);
+ metaType.addItem("modelType", "modelType", SimpleMetaType.STRING);
+
+
+
+ //metaType.addItem("properties", "properties", new MapCompositeMetaType());
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return ModelMetaData.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, ModelMetaData object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport request = new CompositeValueSupport(composite);
+
+ request.set("modelType", SimpleValueSupport.wrap(object.getModelType().name()));
+ request.set("visible", SimpleValueSupport.wrap(object.isVisible()));
+ request.set("name",SimpleValueSupport.wrap(object.getName()));
+ request.set("properties", new PropertiesMetaValue(object.getProperties()));
+
+ return request;
+ }
+ throw new IllegalArgumentException("Cannot convert request " + object);
+ }
+
+ @Override
+ public ModelMetaData unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ ModelMetaData model = new ModelMetaData();
+ String type = (String) metaValueFactory.unwrap(compositeValue.get("modelType"));
+ if (type != null) {
+ model.setModelType(type);
+ }
+ else {
+ model.setModelType("PHYSICAL");
+ }
+
+ model.setVisible((Boolean) metaValueFactory.unwrap(compositeValue.get("visible")));
+ model.setName((String) metaValueFactory.unwrap(compositeValue.get("name")));
+ model.setProperties((Properties) metaValueFactory.unwrap(compositeValue.get("properties")));
+ return model;
+ }
+ throw new IllegalStateException("Unable to unwrap request " + metaValue);
+ }
+
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,215 +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;
-
-import com.metamatrix.admin.AdminPlugin;
-
-
-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(AdminPlugin.Util.getString("MMPropertyDefinition.Display_name")).append(getDisplayName()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Description")).append(getDescription()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Property_type_class_name")).append(getPropertyTypeClassName()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Default_value")).append(getDefaultValue()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Constrained_to_allow_values")).append(isConstrainedToAllowedValues()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Allowed_values")).append(getAllowedValues()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Required")).append(isRequired()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Expert")).append(isAdvanced()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Masked")).append(isMasked()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Modifiable")).append(isModifiable()); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMPropertyDefinition.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();
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyDefinitionMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,215 @@
+/*
+ * 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;
+
+import com.metamatrix.admin.AdminPlugin;
+
+
+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(AdminPlugin.Util.getString("MMPropertyDefinition.Display_name")).append(getDisplayName()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Description")).append(getDescription()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Property_type_class_name")).append(getPropertyTypeClassName()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Default_value")).append(getDefaultValue()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Constrained_to_allow_values")).append(isConstrainedToAllowedValues()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Allowed_values")).append(getAllowedValues()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Required")).append(isRequired()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Expert")).append(isAdvanced()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Masked")).append(isMasked()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.Modifiable")).append(isModifiable()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMPropertyDefinition.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: trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -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;
- }
-}
\ No newline at end of file
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/PropertyMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <pre>
+ * <complexType name="property">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(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;
+ }
+}
\ No newline at end of file
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,130 +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.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-
-/**
- * <pre>
- * <complexType name="reference-mapping">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="ref-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="resource-name" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.NONE)
-@XmlType(name = "reference-mapping", propOrder = {
- "refName",
- "resourceNames"
-})
-@ManagementObject
-public class ReferenceMappingMetadata implements Serializable {
-
- @XmlElement(name = "ref-name", required = true)
- protected String refName;
-
- @XmlElement(name = "resource-name", required = true)
- protected List<String> resourceNames;
-
- public ReferenceMappingMetadata() {
- }
-
- public ReferenceMappingMetadata(String refName, String resourceName) {
- setRefName(refName);
- addResourceName(resourceName);
- }
-
- public ReferenceMappingMetadata(String refName, List<String> resourceNames) {
- setRefName(refName);
- this.resourceNames = new ArrayList<String>(resourceNames);
- }
-
- @ManagementProperty(description="Reference Name", readOnly=true)
- public String getRefName() {
- return refName;
- }
-
- public void setRefName(String value) {
- this.refName = value;
- }
-
- @ManagementProperty(description="Resource Names")
- public List<String> getResourceNames() {
- if (this.resourceNames == null) {
- this.resourceNames = new ArrayList<String>();
- }
- return this.resourceNames;
- }
-
- public void setResourceNames(List<String> names) {
- this.resourceNames = new ArrayList<String>(names);
- }
-
- public void addResourceName(String name) {
- getResourceNames().add(name);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((refName == null) ? 0 : refName.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ReferenceMappingMetadata other = (ReferenceMappingMetadata) obj;
- if (refName == null) {
- if (other.refName != null)
- return false;
- } else if (!refName.equals(other.refName))
- return false;
- return true;
- }
-
-
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ReferenceMappingMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,130 @@
+/*
+ * 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.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+
+/**
+ * <pre>
+ * <complexType name="reference-mapping">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="ref-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="resource-name" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "reference-mapping", propOrder = {
+ "refName",
+ "resourceNames"
+})
+@ManagementObject
+public class ReferenceMappingMetadata implements Serializable {
+
+ @XmlElement(name = "ref-name", required = true)
+ protected String refName;
+
+ @XmlElement(name = "resource-name", required = true)
+ protected List<String> resourceNames;
+
+ public ReferenceMappingMetadata() {
+ }
+
+ public ReferenceMappingMetadata(String refName, String resourceName) {
+ setRefName(refName);
+ addResourceName(resourceName);
+ }
+
+ public ReferenceMappingMetadata(String refName, List<String> resourceNames) {
+ setRefName(refName);
+ this.resourceNames = new ArrayList<String>(resourceNames);
+ }
+
+ @ManagementProperty(description="Reference Name", readOnly=true)
+ public String getRefName() {
+ return refName;
+ }
+
+ public void setRefName(String value) {
+ this.refName = value;
+ }
+
+ @ManagementProperty(description="Resource Names")
+ public List<String> getResourceNames() {
+ if (this.resourceNames == null) {
+ this.resourceNames = new ArrayList<String>();
+ }
+ return this.resourceNames;
+ }
+
+ public void setResourceNames(List<String> names) {
+ this.resourceNames = new ArrayList<String>(names);
+ }
+
+ public void addResourceName(String name) {
+ getResourceNames().add(name);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((refName == null) ? 0 : refName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReferenceMappingMetadata other = (ReferenceMappingMetadata) obj;
+ if (refName == null) {
+ if (other.refName != null)
+ return false;
+ } else if (!refName.equals(other.refName))
+ return false;
+ return true;
+ }
+
+
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,151 +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.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
-import org.teiid.adminapi.Request;
-
-import com.metamatrix.core.util.HashCodeUtil;
-
-
-(a)MetaMapping(RequestMetadataMapper.class)
-public class RequestMetadata extends AdminObjectImpl implements Request {
-
- private static final long serialVersionUID = -2779106368517784259L;
-
- private long executionId;
- private long sessionId;
- private String command;
- private long createdTime;
- private long processTime;
- private boolean sourceRequest;
- private int nodeID = Integer.MIN_VALUE;
- private String transactionId;
-
- @Override
- @ManagementProperty(description="Unique Identifier for Request", readOnly=true)
- public long getExecutionId() {
- return executionId;
- }
-
- public void setExecutionId(long id) {
- this.executionId = id;
- }
-
- @Override
- @ManagementProperty(description="Session ID", readOnly=true)
- public long getSessionId() {
- return this.sessionId;
- }
-
- public void setSessionId(long session) {
- this.sessionId = session;
- }
-
- @Override
- @ManagementProperty(description="Processing time for the request", readOnly=true)
- public long getProcessingTime() {
- return this.processTime;
- }
-
- public void setProcessingTime(long time) {
- this.processTime = time;
- }
-
- @Override
- @ManagementProperty(description="Executing Command", readOnly=true)
- public String getCommand() {
- return this.command;
- }
-
- public void setCommand(String cmd) {
- this.command = cmd;
- }
-
- @Override
- @ManagementProperty(description="Is this Connector level request", readOnly=true)
- public boolean sourceRequest() {
- return sourceRequest;
- }
-
- public void setSourceRequest(boolean sourceRequest) {
- this.sourceRequest = sourceRequest;
- }
-
- @Override
- @ManagementProperty(description="Node Id", readOnly=true)
- public int getNodeId() {
- return this.nodeID;
- }
-
- public void setNodeId(int nodeID) {
- this.nodeID = nodeID;
- }
-
- @Override
- @ManagementProperty(description="Get Transaction XID if transaction involved", readOnly=true)
- 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 == value.nodeID;
- }
-
- public int hashCode() {
- return HashCodeUtil.hashCode((int)executionId, (int)sessionId);
- }
-
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append("Request: sessionid=").append(sessionId);
- str.append("; executionId=").append(executionId);
- if (nodeID != Integer.MIN_VALUE) {
- str.append("; nodeId=").append(nodeID);
- }
- if (transactionId != null) {
- str.append("; transactionId=").append(transactionId);
- }
- str.append("; sourceRequest=").append(sourceRequest);
- str.append("; createdTime=").append(new Date(createdTime));
- str.append("; processingTime=").append(new Date(processTime));
- str.append("; command=").append(command);
-
- return str.toString();
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.util.Date;
+
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.teiid.adminapi.Request;
+
+import com.metamatrix.core.util.HashCodeUtil;
+
+
+(a)MetaMapping(RequestMetadataMapper.class)
+public class RequestMetadata extends AdminObjectImpl implements Request {
+
+ private static final long serialVersionUID = -2779106368517784259L;
+
+ private long executionId;
+ private long sessionId;
+ private String command;
+ private long createdTime;
+ private long processTime;
+ private boolean sourceRequest;
+ private int nodeID = Integer.MIN_VALUE;
+ private String transactionId;
+
+ @Override
+ @ManagementProperty(description="Unique Identifier for Request", readOnly=true)
+ public long getExecutionId() {
+ return executionId;
+ }
+
+ public void setExecutionId(long id) {
+ this.executionId = id;
+ }
+
+ @Override
+ @ManagementProperty(description="Session ID", readOnly=true)
+ public long getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(long session) {
+ this.sessionId = session;
+ }
+
+ @Override
+ @ManagementProperty(description="Processing time for the request", readOnly=true)
+ public long getProcessingTime() {
+ return this.processTime;
+ }
+
+ public void setProcessingTime(long time) {
+ this.processTime = time;
+ }
+
+ @Override
+ @ManagementProperty(description="Executing Command", readOnly=true)
+ public String getCommand() {
+ return this.command;
+ }
+
+ public void setCommand(String cmd) {
+ this.command = cmd;
+ }
+
+ @Override
+ @ManagementProperty(description="Is this Connector level request", readOnly=true)
+ public boolean sourceRequest() {
+ return sourceRequest;
+ }
+
+ public void setSourceRequest(boolean sourceRequest) {
+ this.sourceRequest = sourceRequest;
+ }
+
+ @Override
+ @ManagementProperty(description="Node Id", readOnly=true)
+ public int getNodeId() {
+ return this.nodeID;
+ }
+
+ public void setNodeId(int nodeID) {
+ this.nodeID = nodeID;
+ }
+
+ @Override
+ @ManagementProperty(description="Get Transaction XID if transaction involved", readOnly=true)
+ 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 == value.nodeID;
+ }
+
+ public int hashCode() {
+ return HashCodeUtil.hashCode((int)executionId, (int)sessionId);
+ }
+
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("Request: sessionid=").append(sessionId);
+ str.append("; executionId=").append(executionId);
+ if (nodeID != Integer.MIN_VALUE) {
+ str.append("; nodeId=").append(nodeID);
+ }
+ if (transactionId != null) {
+ str.append("; transactionId=").append(transactionId);
+ }
+ str.append("; sourceRequest=").append(sourceRequest);
+ str.append("; createdTime=").append(new Date(createdTime));
+ str.append("; processingTime=").append(new Date(processTime));
+ str.append("; command=").append(command);
+
+ return str.toString();
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.lang.reflect.Type;
-
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
-import org.jboss.metatype.spi.values.MetaMapper;
-
-public class RequestMetadataMapper extends MetaMapper<RequestMetadata> {
- private static final MutableCompositeMetaType metaType;
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- static {
- metaType = new MutableCompositeMetaType(RequestMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("executionId", "executionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("processingTime", "processingTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("command", "command", SimpleMetaType.STRING);
- metaType.addItem("sourceRequest", "sourceRequest", SimpleMetaType.BOOLEAN_PRIMITIVE);
- metaType.addItem("nodeId", "nodeId", SimpleMetaType.INTEGER_PRIMITIVE);
- metaType.addItem("transactionId", "transactionId", SimpleMetaType.STRING);
- metaType.freeze();
- }
-
- @Override
- public Type mapToType() {
- return RequestMetadata.class;
- }
-
- @Override
- public MetaType getMetaType() {
- return metaType;
- }
-
- @Override
- public MetaValue createMetaValue(MetaType metaType, RequestMetadata object) {
- if (object == null)
- return null;
- if (metaType instanceof CompositeMetaType) {
- CompositeMetaType composite = (CompositeMetaType) metaType;
- CompositeValueSupport request = new CompositeValueSupport(composite);
-
- request.set("executionId", SimpleValueSupport.wrap(object.getExecutionId()));
- request.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
- request.set("processingTime", SimpleValueSupport.wrap(object.getProcessingTime()));
- request.set("command", SimpleValueSupport.wrap(object.getCommand()));
- request.set("sourceRequest", SimpleValueSupport.wrap(object.sourceRequest()));
- request.set("nodeId", SimpleValueSupport.wrap(object.getNodeId()));
- request.set("transactionId",SimpleValueSupport.wrap(object.getTransactionId()));
-
- return request;
- }
- throw new IllegalArgumentException("Cannot convert request " + object);
- }
-
- @Override
- public RequestMetadata unwrapMetaValue(MetaValue metaValue) {
- if (metaValue == null)
- return null;
-
- if (metaValue instanceof CompositeValue) {
- CompositeValue compositeValue = (CompositeValue) metaValue;
-
- RequestMetadata request = new RequestMetadata();
- request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get("executionId")));
- request.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
- request.setProcessingTime((Long) metaValueFactory.unwrap(compositeValue.get("processingTime")));
- request.setCommand((String) metaValueFactory.unwrap(compositeValue.get("command")));
- request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get("sourceRequest")));
- request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get("nodeId")));
- request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get("transactionId")));
- return request;
- }
- throw new IllegalStateException("Unable to unwrap request " + metaValue);
- }
-
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class RequestMetadataMapper extends MetaMapper<RequestMetadata> {
+ private static final MutableCompositeMetaType metaType;
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ static {
+ metaType = new MutableCompositeMetaType(RequestMetadata.class.getName(), "The Session domain meta data");
+ metaType.addItem("executionId", "executionId", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("processingTime", "processingTime", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("command", "command", SimpleMetaType.STRING);
+ metaType.addItem("sourceRequest", "sourceRequest", SimpleMetaType.BOOLEAN_PRIMITIVE);
+ metaType.addItem("nodeId", "nodeId", SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem("transactionId", "transactionId", SimpleMetaType.STRING);
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return RequestMetadata.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, RequestMetadata object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport request = new CompositeValueSupport(composite);
+
+ request.set("executionId", SimpleValueSupport.wrap(object.getExecutionId()));
+ request.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
+ request.set("processingTime", SimpleValueSupport.wrap(object.getProcessingTime()));
+ request.set("command", SimpleValueSupport.wrap(object.getCommand()));
+ request.set("sourceRequest", SimpleValueSupport.wrap(object.sourceRequest()));
+ request.set("nodeId", SimpleValueSupport.wrap(object.getNodeId()));
+ request.set("transactionId",SimpleValueSupport.wrap(object.getTransactionId()));
+
+ return request;
+ }
+ throw new IllegalArgumentException("Cannot convert request " + object);
+ }
+
+ @Override
+ public RequestMetadata unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ RequestMetadata request = new RequestMetadata();
+ request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get("executionId")));
+ request.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
+ request.setProcessingTime((Long) metaValueFactory.unwrap(compositeValue.get("processingTime")));
+ request.setCommand((String) metaValueFactory.unwrap(compositeValue.get("command")));
+ request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get("sourceRequest")));
+ request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get("nodeId")));
+ request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get("transactionId")));
+ return request;
+ }
+ throw new IllegalStateException("Unable to unwrap request " + metaValue);
+ }
+
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,165 +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.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
-import org.teiid.adminapi.Session;
-
-
-/**
- * Add and delete properties also in the Mapper class for correct wrapping for profile service.
- */
-(a)MetaMapping(SessionMetadataMapper.class)
-public class SessionMetadata extends AdminObjectImpl implements Session {
-
- private static final long serialVersionUID = 918638989081830034L;
- private String applicationName;
- private long lastPingTime;
- private long createdTime;
- private String ipAddress;
- private String clientHostName;
- private String userName;
- private String vdbName;
- private int vdbVersion;
- private long sessionId;
- private String securityDomain;
-
- @Override
- @ManagementProperty(description="Application assosiated with Session", readOnly=true)
- public String getApplicationName() {
- return this.applicationName;
- }
-
- public void setApplicationName(String applicationName) {
- this.applicationName = applicationName;
- }
-
- @Override
- @ManagementProperty(description="When session created", readOnly=true)
- public long getCreatedTime() {
- return this.createdTime;
- }
-
- public void setCreatedTime(long createdTime) {
- this.createdTime = createdTime;
- }
-
- @Override
- @ManagementProperty(description="Host name from where the session created", readOnly=true)
- public String getClientHostName() {
- return this.clientHostName;
- }
-
- public void setClientHostName(String clientHostname) {
- this.clientHostName = clientHostname;
- }
-
- @Override
- @ManagementProperty(description="IP address from where session is created", readOnly=true)
- public String getIPAddress() {
- return this.ipAddress;
- }
-
- public void setIPAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- }
-
- @Override
- @ManagementProperty(description="Last ping time", readOnly=true)
- public long getLastPingTime() {
- return this.lastPingTime;
- }
-
- public void setLastPingTime(long lastPingTime) {
- this.lastPingTime = lastPingTime;
- }
-
- @Override
- @ManagementProperty(description="Session ID", readOnly=true)
- @ManagementObjectID(type="session")
- public long getSessionId() {
- return this.sessionId;
- }
-
- public void setSessionId(long sessionId) {
- this.sessionId = sessionId;
- }
-
- @Override
- @ManagementProperty(description="User name assosiated with session", readOnly=true)
- public String getUserName() {
- return this.userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- @Override
- @ManagementProperty(description="VDB name assosiated with session", readOnly=true)
- public String getVDBName() {
- return this.vdbName;
- }
-
- public void setVDBName(String vdbName) {
- this.vdbName = vdbName;
- }
-
- @Override
- @ManagementProperty(description="VDB version name assosiated with session", readOnly=true)
- public int getVDBVersion() {
- return this.vdbVersion;
- }
-
- public void setVDBVersion(int vdbVersion) {
- this.vdbVersion = vdbVersion;
- }
-
- @Override
- @ManagementProperty(description="Security Domain that session logged into", readOnly=true)
- public String getSecurityDomain() {
- return this.securityDomain;
- }
-
- public void setSecurityDomain(String domain) {
- this.securityDomain = domain;
- }
-
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append("session: sessionid=").append(sessionId);
- str.append("; userName=").append(userName);
- str.append("; vdbName=").append(vdbName);
- str.append("; vdbVersion=").append(vdbVersion);
- str.append("; createdTime=").append(new Date(createdTime));
- str.append("; applicationName=").append(applicationName);
- str.append("; clientHostName=").append(clientHostName);
- str.append("; IPAddress=").append(ipAddress);
- str.append("; securityDomain=").append(securityDomain);
- str.append("; lastPingTime=").append(new Date(lastPingTime));
- return str.toString();
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,165 @@
+/*
+ * 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.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.teiid.adminapi.Session;
+
+
+/**
+ * Add and delete properties also in the Mapper class for correct wrapping for profile service.
+ */
+(a)MetaMapping(SessionMetadataMapper.class)
+public class SessionMetadata extends AdminObjectImpl implements Session {
+
+ private static final long serialVersionUID = 918638989081830034L;
+ private String applicationName;
+ private long lastPingTime;
+ private long createdTime;
+ private String ipAddress;
+ private String clientHostName;
+ private String userName;
+ private String vdbName;
+ private int vdbVersion;
+ private long sessionId;
+ private String securityDomain;
+
+ @Override
+ @ManagementProperty(description="Application assosiated with Session", readOnly=true)
+ public String getApplicationName() {
+ return this.applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+ @Override
+ @ManagementProperty(description="When session created", readOnly=true)
+ public long getCreatedTime() {
+ return this.createdTime;
+ }
+
+ public void setCreatedTime(long createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Override
+ @ManagementProperty(description="Host name from where the session created", readOnly=true)
+ public String getClientHostName() {
+ return this.clientHostName;
+ }
+
+ public void setClientHostName(String clientHostname) {
+ this.clientHostName = clientHostname;
+ }
+
+ @Override
+ @ManagementProperty(description="IP address from where session is created", readOnly=true)
+ public String getIPAddress() {
+ return this.ipAddress;
+ }
+
+ public void setIPAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ @Override
+ @ManagementProperty(description="Last ping time", readOnly=true)
+ public long getLastPingTime() {
+ return this.lastPingTime;
+ }
+
+ public void setLastPingTime(long lastPingTime) {
+ this.lastPingTime = lastPingTime;
+ }
+
+ @Override
+ @ManagementProperty(description="Session ID", readOnly=true)
+ @ManagementObjectID(type="session")
+ public long getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ @Override
+ @ManagementProperty(description="User name assosiated with session", readOnly=true)
+ public String getUserName() {
+ return this.userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Override
+ @ManagementProperty(description="VDB name assosiated with session", readOnly=true)
+ public String getVDBName() {
+ return this.vdbName;
+ }
+
+ public void setVDBName(String vdbName) {
+ this.vdbName = vdbName;
+ }
+
+ @Override
+ @ManagementProperty(description="VDB version name assosiated with session", readOnly=true)
+ public int getVDBVersion() {
+ return this.vdbVersion;
+ }
+
+ public void setVDBVersion(int vdbVersion) {
+ this.vdbVersion = vdbVersion;
+ }
+
+ @Override
+ @ManagementProperty(description="Security Domain that session logged into", readOnly=true)
+ public String getSecurityDomain() {
+ return this.securityDomain;
+ }
+
+ public void setSecurityDomain(String domain) {
+ this.securityDomain = domain;
+ }
+
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("session: sessionid=").append(sessionId);
+ str.append("; userName=").append(userName);
+ str.append("; vdbName=").append(vdbName);
+ str.append("; vdbVersion=").append(vdbVersion);
+ str.append("; createdTime=").append(new Date(createdTime));
+ str.append("; applicationName=").append(applicationName);
+ str.append("; clientHostName=").append(clientHostName);
+ str.append("; IPAddress=").append(ipAddress);
+ str.append("; securityDomain=").append(securityDomain);
+ str.append("; lastPingTime=").append(new Date(lastPingTime));
+ return str.toString();
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.lang.reflect.Type;
-
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
-import org.jboss.metatype.spi.values.MetaMapper;
-
-public class SessionMetadataMapper extends MetaMapper<SessionMetadata> {
- private static final MutableCompositeMetaType metaType;
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- static {
- metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("applicationName", "applicationName", SimpleMetaType.STRING);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("clientHostName", "clientHostName", SimpleMetaType.STRING);
- metaType.addItem("IPAddress", "IPAddress", SimpleMetaType.STRING);
- metaType.addItem("lastPingTime", "lastPingTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("userName", "userName", SimpleMetaType.STRING);
- metaType.addItem("VDBName", "VDBName", SimpleMetaType.STRING);
- metaType.addItem("VDBVersion", "VDBVersion", SimpleMetaType.INTEGER_PRIMITIVE);
- metaType.addItem("securityDomain", "SecurityDomain", SimpleMetaType.STRING);
- metaType.freeze();
- }
-
- @Override
- public Type mapToType() {
- return SessionMetadata.class;
- }
-
- @Override
- public MetaType getMetaType() {
- return metaType;
- }
-
- @Override
- public MetaValue createMetaValue(MetaType metaType, SessionMetadata object) {
- if (object == null)
- return null;
- if (metaType instanceof CompositeMetaType) {
- CompositeMetaType composite = (CompositeMetaType) metaType;
- CompositeValueSupport session = new CompositeValueSupport(composite);
-
- session.set("applicationName", SimpleValueSupport.wrap(object.getName()));
- session.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
- session.set("clientHostName", SimpleValueSupport.wrap(object.getClientHostName()));
- session.set("IPAddress", SimpleValueSupport.wrap(object.getIPAddress()));
- session.set("lastPingTime", SimpleValueSupport.wrap(object.getLastPingTime()));
- session.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
- session.set("userName", SimpleValueSupport.wrap(object.getUserName()));
- session.set("VDBName",SimpleValueSupport.wrap(object.getVDBName()));
- session.set("VDBVersion", SimpleValueSupport.wrap(object.getVDBVersion()));
- session.set("securityDomain", SimpleValueSupport.wrap(object.getSecurityDomain()));
-
- return session;
- }
- throw new IllegalArgumentException("Cannot convert session " + object);
- }
-
- @Override
- public SessionMetadata unwrapMetaValue(MetaValue metaValue) {
- if (metaValue == null)
- return null;
-
- if (metaValue instanceof CompositeValue) {
- CompositeValue compositeValue = (CompositeValue) metaValue;
-
- SessionMetadata session = new SessionMetadata();
- session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get("applicationName")));
- session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
- session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get("clientHostName")));
- session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get("IPAddress")));
- session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get("lastPingTime")));
- session.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
- session.setUserName((String) metaValueFactory.unwrap(compositeValue.get("userName")));
- session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get("VDBName")));
- session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get("VDBVersion")));
- session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get("securityDomain")));
- return session;
- }
- throw new IllegalStateException("Unable to unwrap session " + metaValue);
- }
-
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.adminapi.impl;
+
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class SessionMetadataMapper extends MetaMapper<SessionMetadata> {
+ private static final MutableCompositeMetaType metaType;
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ static {
+ metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data");
+ metaType.addItem("applicationName", "applicationName", SimpleMetaType.STRING);
+ metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("clientHostName", "clientHostName", SimpleMetaType.STRING);
+ metaType.addItem("IPAddress", "IPAddress", SimpleMetaType.STRING);
+ metaType.addItem("lastPingTime", "lastPingTime", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("sessionId", "sessionId", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("userName", "userName", SimpleMetaType.STRING);
+ metaType.addItem("VDBName", "VDBName", SimpleMetaType.STRING);
+ metaType.addItem("VDBVersion", "VDBVersion", SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem("securityDomain", "SecurityDomain", SimpleMetaType.STRING);
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return SessionMetadata.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, SessionMetadata object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport session = new CompositeValueSupport(composite);
+
+ session.set("applicationName", SimpleValueSupport.wrap(object.getName()));
+ session.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
+ session.set("clientHostName", SimpleValueSupport.wrap(object.getClientHostName()));
+ session.set("IPAddress", SimpleValueSupport.wrap(object.getIPAddress()));
+ session.set("lastPingTime", SimpleValueSupport.wrap(object.getLastPingTime()));
+ session.set("sessionId", SimpleValueSupport.wrap(object.getSessionId()));
+ session.set("userName", SimpleValueSupport.wrap(object.getUserName()));
+ session.set("VDBName",SimpleValueSupport.wrap(object.getVDBName()));
+ session.set("VDBVersion", SimpleValueSupport.wrap(object.getVDBVersion()));
+ session.set("securityDomain", SimpleValueSupport.wrap(object.getSecurityDomain()));
+
+ return session;
+ }
+ throw new IllegalArgumentException("Cannot convert session " + object);
+ }
+
+ @Override
+ public SessionMetadata unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ SessionMetadata session = new SessionMetadata();
+ session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get("applicationName")));
+ session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
+ session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get("clientHostName")));
+ session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get("IPAddress")));
+ session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get("lastPingTime")));
+ session.setSessionId((Long) metaValueFactory.unwrap(compositeValue.get("sessionId")));
+ session.setUserName((String) metaValueFactory.unwrap(compositeValue.get("userName")));
+ session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get("VDBName")));
+ session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get("VDBVersion")));
+ session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get("securityDomain")));
+ return session;
+ }
+ throw new IllegalStateException("Unable to unwrap session " + metaValue);
+ }
+
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -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 java.util.Date;
-
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
-import org.teiid.adminapi.Transaction;
-
-import com.metamatrix.admin.AdminPlugin;
-
-(a)MetaMapping(TransactionMetadataMapper.class)
-public class TransactionMetadata extends AdminObjectImpl implements Transaction {
-
- private static final long serialVersionUID = -8588785315218789068L;
- private long associatedSession;
- private String scope;
- private String xid;
- private long createdTime;
-
- @Override
- @ManagementProperty(description="Session ID", readOnly=true)
- public long getAssociatedSession() {
- return associatedSession;
- }
-
- public void setAssociatedSession(long associatedSession) {
- this.associatedSession = associatedSession;
- }
-
- @Override
- @ManagementProperty(description="Scope", readOnly=true)
- public String getScope() {
- return scope;
- }
-
- public void setScope(String scope) {
- this.scope = scope;
- }
-
- @Override
- @ManagementProperty(description="XID", readOnly=true)
- public String getXid() {
- return xid;
- }
-
- public void setXid(String xid) {
- this.xid = xid;
- }
-
- @Override
- @ManagementProperty(description="Transaction created time", readOnly=true)
- public long getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(long time) {
- this.createdTime = time;
- }
-
- @Override
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("TransactionImpl.associatedSession")).append(associatedSession); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("TransactionImpl.scope")).append(scope); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("TransactionImpl.xid")).append(xid); //$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("TransactionImpl.createdTime")).append(new Date(createdTime)); //$NON-NLS-1$
- return result.toString();
- }
-
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.util.Date;
+
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.teiid.adminapi.Transaction;
+
+import com.metamatrix.admin.AdminPlugin;
+
+(a)MetaMapping(TransactionMetadataMapper.class)
+public class TransactionMetadata extends AdminObjectImpl implements Transaction {
+
+ private static final long serialVersionUID = -8588785315218789068L;
+ private long associatedSession;
+ private String scope;
+ private String xid;
+ private long createdTime;
+
+ @Override
+ @ManagementProperty(description="Session ID", readOnly=true)
+ public long getAssociatedSession() {
+ return associatedSession;
+ }
+
+ public void setAssociatedSession(long associatedSession) {
+ this.associatedSession = associatedSession;
+ }
+
+ @Override
+ @ManagementProperty(description="Scope", readOnly=true)
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ @Override
+ @ManagementProperty(description="XID", readOnly=true)
+ public String getXid() {
+ return xid;
+ }
+
+ public void setXid(String xid) {
+ this.xid = xid;
+ }
+
+ @Override
+ @ManagementProperty(description="Transaction created time", readOnly=true)
+ public long getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(long time) {
+ this.createdTime = time;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append(AdminPlugin.Util.getString("TransactionImpl.associatedSession")).append(associatedSession); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("TransactionImpl.scope")).append(scope); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("TransactionImpl.xid")).append(xid); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("TransactionImpl.createdTime")).append(new Date(createdTime)); //$NON-NLS-1$
+ return result.toString();
+ }
+
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import java.lang.reflect.Type;
-
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
-import org.jboss.metatype.spi.values.MetaMapper;
-
-public class TransactionMetadataMapper extends MetaMapper<TransactionMetadata> {
- private static final MutableCompositeMetaType metaType;
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- static {
- metaType = new MutableCompositeMetaType(TransactionMetadata.class.getName(), "The Session domain meta data");
- metaType.addItem("associatedSession", "associatedSession", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem("scope", "scope", SimpleMetaType.STRING);
- metaType.addItem("xid", "xid", SimpleMetaType.STRING);
- metaType.freeze();
- }
-
- @Override
- public Type mapToType() {
- return TransactionMetadata.class;
- }
-
- @Override
- public MetaType getMetaType() {
- return metaType;
- }
-
- @Override
- public MetaValue createMetaValue(MetaType metaType, TransactionMetadata object) {
- if (object == null)
- return null;
- if (metaType instanceof CompositeMetaType) {
- CompositeMetaType composite = (CompositeMetaType) metaType;
- CompositeValueSupport transaction = new CompositeValueSupport(composite);
-
- transaction.set("associatedSession", SimpleValueSupport.wrap(object.getAssociatedSession()));
- transaction.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
- transaction.set("scope", SimpleValueSupport.wrap(object.getScope()));
- transaction.set("xid", SimpleValueSupport.wrap(object.getXid()));
-
- return transaction;
- }
- throw new IllegalArgumentException("Cannot convert session " + object);
- }
-
- @Override
- public TransactionMetadata unwrapMetaValue(MetaValue metaValue) {
- if (metaValue == null)
- return null;
-
- if (metaValue instanceof CompositeValue) {
- CompositeValue compositeValue = (CompositeValue) metaValue;
-
- TransactionMetadata transaction = new TransactionMetadata();
- transaction.setAssociatedSession((Long) metaValueFactory.unwrap(compositeValue.get("associatedSession")));
- transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
- transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get("scope")));
- transaction.setXid((String) metaValueFactory.unwrap(compositeValue.get("xid")));
- return transaction;
- }
- throw new IllegalStateException("Unable to unwrap session " + metaValue);
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class TransactionMetadataMapper extends MetaMapper<TransactionMetadata> {
+ private static final MutableCompositeMetaType metaType;
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ static {
+ metaType = new MutableCompositeMetaType(TransactionMetadata.class.getName(), "The Session domain meta data");
+ metaType.addItem("associatedSession", "associatedSession", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("createdTime", "createdTime", SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem("scope", "scope", SimpleMetaType.STRING);
+ metaType.addItem("xid", "xid", SimpleMetaType.STRING);
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return TransactionMetadata.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, TransactionMetadata object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport transaction = new CompositeValueSupport(composite);
+
+ transaction.set("associatedSession", SimpleValueSupport.wrap(object.getAssociatedSession()));
+ transaction.set("createdTime", SimpleValueSupport.wrap(object.getCreatedTime()));
+ transaction.set("scope", SimpleValueSupport.wrap(object.getScope()));
+ transaction.set("xid", SimpleValueSupport.wrap(object.getXid()));
+
+ return transaction;
+ }
+ throw new IllegalArgumentException("Cannot convert session " + object);
+ }
+
+ @Override
+ public TransactionMetadata unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ TransactionMetadata transaction = new TransactionMetadata();
+ transaction.setAssociatedSession((Long) metaValueFactory.unwrap(compositeValue.get("associatedSession")));
+ transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get("createdTime")));
+ transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get("scope")));
+ transaction.setXid((String) metaValueFactory.unwrap(compositeValue.get("xid")));
+ return transaction;
+ }
+ throw new IllegalStateException("Unable to unwrap session " + metaValue);
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,251 +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.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-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 javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
-
-import com.metamatrix.core.CoreConstants;
-
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="vdb"))
-(a)XmlAccessorType(XmlAccessType.NONE)
-@XmlType(name = "", propOrder = {
- "description",
- "JAXBProperties",
- "JAXBModels",
- "securityRoleMappings"
-})
-@XmlRootElement(name = "vdb")
-public class VDBMetaData extends AdminObjectImpl implements VDB {
- private static final String STATUS_KEY = "status"; //$NON-NLS-1$
-
- private static final long serialVersionUID = -4723595252013356436L;
-
- private ListOverMap<ModelMetaData> models = new ListOverMap<ModelMetaData>(new KeyBuilder<ModelMetaData>() {
- @Override
- public String getKey(ModelMetaData entry) {
- return entry.getName();
- }
- });
-
- @XmlAttribute(name = "version", required = true)
- private int version = 1;
-
- @XmlElement(name = "description")
- private String description;
-
- @XmlElement(name = "role-mapping")
- protected ListOverMap<ReferenceMappingMetadata> securityRoleMappings = new ListOverMap<ReferenceMappingMetadata>(new KeyBuilder<ReferenceMappingMetadata>() {
- @Override
- public String getKey(ReferenceMappingMetadata entry) {
- return entry.getRefName();
- }
- });
-
- private String fileUrl = null;
-
- public VDBMetaData() {
- // auto add sytem model.
- ModelMetaData system = new ModelMetaData();
- system.setName(CoreConstants.SYSTEM_MODEL);
- system.setVisible(true);
- system.setModelType(Model.Type.PHYSICAL.name());
- system.addSourceMapping("system", "system");
- system.setSupportsMultiSourceBindings(false);
-
- addModel(system);
- }
-
- @ManagementProperty(description="Name of the VDB", readOnly=true)
- @ManagementObjectID(type="vdb")
- @XmlAttribute(name = "name", required = true)
- public String getName() {
- return super.getName();
- }
-
- // This needed by JAXB marshaling
- public void setName(String name) {
- super.setName(name);
- }
-
- @Override
- @ManagementProperty(description="VDB Status")
- public Status getStatus() {
- String status = getPropertyValue(STATUS_KEY);
- if (status != null) {
- return VDB.Status.valueOf(status);
- }
- return VDB.Status.ACTIVE;
- }
-
- public void setStatus(Status s) {
- addProperty(STATUS_KEY, s.name());
- }
-
- @Override
- @ManagementProperty(description="VDB version", readOnly=true)
- public int getVersion() {
- return this.version;
- }
-
- public void setVersion(int version) {
- this.version = version;
- }
-
- @Override
- @ManagementProperty(description = "The VDB file url", readOnly=true)
- public String getUrl() {
- return this.fileUrl;
- }
-
- public void setUrl(String url) {
- this.fileUrl = url;
- }
-
- @ManagementProperty(description="Models in a VDB", managed=true)
- public List<ModelMetaData> getModels(){
- return new ArrayList<ModelMetaData>(this.models.getMap().values());
- }
-
- /**
- * 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.
- * @return
- */
- @XmlElement(name = "model", required = true, type = ModelMetaData.class)
- protected List<ModelMetaData> getJAXBModels(){
- return models;
- }
-
- public void addModel(ModelMetaData m) {
- this.models.getMap().put(m.getName(), m);
- }
-
- @Override
- @ManagementProperty(description = "Description", readOnly=true)
- public String getDescription() {
- return this.description;
- }
-
- public void setDescription(String desc) {
- this.description = desc;
- }
-
- @Override
- @ManagementProperty(description = "VDB validity errors", readOnly=true)
- 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
- @ManagementProperty(description = "Is VDB Valid", readOnly=true)
- 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;
- }
- }
- }
- return true;
- }
-
- public String toString() {
- return getName()+"."+getVersion()+ models.getMap().values(); //$NON-NLS-1$
- }
-
- @ManagementOperation(description = "Get the model with given name")
- public ModelMetaData getModel(String modelName) {
- return this.models.getMap().get(modelName);
- }
-
- 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;
- }
-
- @ManagementProperty(description="Security refrence mappings", managed=true)
- public List<ReferenceMappingMetadata> getSecurityRoleMappings() {
- return new ArrayList<ReferenceMappingMetadata>(this.securityRoleMappings);
- }
-
- public void addSecurityRoleMapping(ReferenceMappingMetadata data) {
- this.securityRoleMappings.getMap().put(data.getRefName(), data);
- }
-
- // this one manages the Management API
- @Override
- @ManagementProperty(description = "Properties", readOnly=true)
- public Properties getProperties() {
- return super.getProperties();
- }
-
- // This one manages the JAXB binding
- @Override
- @XmlElement(name = "property", type = PropertyMetadata.class)
- protected List<PropertyMetadata> getJAXBProperties(){
- return super.getJAXBProperties();
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,251 @@
+/*
+ * 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.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+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 javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
+
+import com.metamatrix.core.CoreConstants;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="vdb"))
+(a)XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "", propOrder = {
+ "description",
+ "JAXBProperties",
+ "JAXBModels",
+ "securityRoleMappings"
+})
+@XmlRootElement(name = "vdb")
+public class VDBMetaData extends AdminObjectImpl implements VDB {
+ private static final String STATUS_KEY = "status"; //$NON-NLS-1$
+
+ private static final long serialVersionUID = -4723595252013356436L;
+
+ private ListOverMap<ModelMetaData> models = new ListOverMap<ModelMetaData>(new KeyBuilder<ModelMetaData>() {
+ @Override
+ public String getKey(ModelMetaData entry) {
+ return entry.getName();
+ }
+ });
+
+ @XmlAttribute(name = "version", required = true)
+ private int version = 1;
+
+ @XmlElement(name = "description")
+ private String description;
+
+ @XmlElement(name = "role-mapping")
+ protected ListOverMap<ReferenceMappingMetadata> securityRoleMappings = new ListOverMap<ReferenceMappingMetadata>(new KeyBuilder<ReferenceMappingMetadata>() {
+ @Override
+ public String getKey(ReferenceMappingMetadata entry) {
+ return entry.getRefName();
+ }
+ });
+
+ private String fileUrl = null;
+
+ public VDBMetaData() {
+ // auto add sytem model.
+ ModelMetaData system = new ModelMetaData();
+ system.setName(CoreConstants.SYSTEM_MODEL);
+ system.setVisible(true);
+ system.setModelType(Model.Type.PHYSICAL.name());
+ system.addSourceMapping("system", "system");
+ system.setSupportsMultiSourceBindings(false);
+
+ addModel(system);
+ }
+
+ @ManagementProperty(description="Name of the VDB", readOnly=true)
+ @ManagementObjectID(type="vdb")
+ @XmlAttribute(name = "name", required = true)
+ public String getName() {
+ return super.getName();
+ }
+
+ // This needed by JAXB marshaling
+ public void setName(String name) {
+ super.setName(name);
+ }
+
+ @Override
+ @ManagementProperty(description="VDB Status")
+ public Status getStatus() {
+ String status = getPropertyValue(STATUS_KEY);
+ if (status != null) {
+ return VDB.Status.valueOf(status);
+ }
+ return VDB.Status.ACTIVE;
+ }
+
+ public void setStatus(Status s) {
+ addProperty(STATUS_KEY, s.name());
+ }
+
+ @Override
+ @ManagementProperty(description="VDB version", readOnly=true)
+ public int getVersion() {
+ return this.version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ @Override
+ @ManagementProperty(description = "The VDB file url", readOnly=true)
+ public String getUrl() {
+ return this.fileUrl;
+ }
+
+ public void setUrl(String url) {
+ this.fileUrl = url;
+ }
+
+ @ManagementProperty(description="Models in a VDB", managed=true)
+ public List<ModelMetaData> getModels(){
+ return new ArrayList<ModelMetaData>(this.models.getMap().values());
+ }
+
+ /**
+ * 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.
+ * @return
+ */
+ @XmlElement(name = "model", required = true, type = ModelMetaData.class)
+ protected List<ModelMetaData> getJAXBModels(){
+ return models;
+ }
+
+ public void addModel(ModelMetaData m) {
+ this.models.getMap().put(m.getName(), m);
+ }
+
+ @Override
+ @ManagementProperty(description = "Description", readOnly=true)
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ @Override
+ @ManagementProperty(description = "VDB validity errors", readOnly=true)
+ 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
+ @ManagementProperty(description = "Is VDB Valid", readOnly=true)
+ 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;
+ }
+ }
+ }
+ return true;
+ }
+
+ public String toString() {
+ return getName()+"."+getVersion()+ models.getMap().values(); //$NON-NLS-1$
+ }
+
+ @ManagementOperation(description = "Get the model with given name")
+ public ModelMetaData getModel(String modelName) {
+ return this.models.getMap().get(modelName);
+ }
+
+ 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;
+ }
+
+ @ManagementProperty(description="Security refrence mappings", managed=true)
+ public List<ReferenceMappingMetadata> getSecurityRoleMappings() {
+ return new ArrayList<ReferenceMappingMetadata>(this.securityRoleMappings);
+ }
+
+ public void addSecurityRoleMapping(ReferenceMappingMetadata data) {
+ this.securityRoleMappings.getMap().put(data.getRefName(), data);
+ }
+
+ // this one manages the Management API
+ @Override
+ @ManagementProperty(description = "Properties", readOnly=true)
+ public Properties getProperties() {
+ return super.getProperties();
+ }
+
+ // This one manages the JAXB binding
+ @Override
+ @XmlElement(name = "property", type = PropertyMetadata.class)
+ protected List<PropertyMetadata> getJAXBProperties(){
+ return super.getJAXBProperties();
+ }
+}
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi.impl;
-
-import org.jboss.managed.api.annotation.ManagementProperty;
-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
- @ManagementProperty(description="Number of Active Threads", readOnly=true)
- public int getActiveThreads() {
- return activeThreads;
- }
-
- @Override
- @ManagementProperty(description="Highest active threads", readOnly=true)
- public int getHighestActiveThreads() {
- return highestActiveThreads;
- }
-
- @Override
- @ManagementProperty(description="Total Completed Tasks", readOnly=true)
- public long getTotalCompleted() {
- return totalCompleted;
- }
-
- @Override
- @ManagementProperty(description="Total submitted Tasks", readOnly=true)
- public long getTotalSubmitted() {
- return totalSubmitted;
- }
-
- @Override
- @ManagementProperty(description="Queue Name", readOnly=true)
- public String getQueueName() {
- return getName();
- }
-
- @Override
- @ManagementProperty(description="Currently Queued Tasks", readOnly=true)
- public int getQueued() {
- return queued;
- }
-
- @Override
- @ManagementProperty(description="Highest Queued Tasks", readOnly=true)
- public int getHighestQueued() {
- return highestQueued;
- }
-
- @Override
- @ManagementProperty(description="Max Threads", readOnly=true)
- 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();
- }
-
-}
-
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/WorkerPoolStatisticsMetadata.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import org.jboss.managed.api.annotation.ManagementProperty;
+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
+ @ManagementProperty(description="Number of Active Threads", readOnly=true)
+ public int getActiveThreads() {
+ return activeThreads;
+ }
+
+ @Override
+ @ManagementProperty(description="Highest active threads", readOnly=true)
+ public int getHighestActiveThreads() {
+ return highestActiveThreads;
+ }
+
+ @Override
+ @ManagementProperty(description="Total Completed Tasks", readOnly=true)
+ public long getTotalCompleted() {
+ return totalCompleted;
+ }
+
+ @Override
+ @ManagementProperty(description="Total submitted Tasks", readOnly=true)
+ public long getTotalSubmitted() {
+ return totalSubmitted;
+ }
+
+ @Override
+ @ManagementProperty(description="Queue Name", readOnly=true)
+ public String getQueueName() {
+ return getName();
+ }
+
+ @Override
+ @ManagementProperty(description="Currently Queued Tasks", readOnly=true)
+ public int getQueued() {
+ return queued;
+ }
+
+ @Override
+ @ManagementProperty(description="Highest Queued Tasks", readOnly=true)
+ public int getHighestQueued() {
+ return highestQueued;
+ }
+
+ @Override
+ @ManagementProperty(description="Max Threads", readOnly=true)
+ 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();
+ }
+
+}
+
Copied: trunk/client/src/main/java/org/teiid/transport (from rev 1900, branches/JCA/client/src/main/java/org/teiid/transport)
Deleted: trunk/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -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.transport;
-
-import com.metamatrix.api.exception.ComponentNotFoundException;
-
-public interface ClientServiceRegistry {
-
- <T> T getClientService(Class<T> iface) throws ComponentNotFoundException;
-
-}
Copied: trunk/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.transport;
+
+import com.metamatrix.api.exception.ComponentNotFoundException;
+
+public interface ClientServiceRegistry {
+
+ <T> T getClientService(Class<T> iface) throws ComponentNotFoundException;
+
+}
Deleted: trunk/client/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/transport/LocalServerConnection.java 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/client/src/main/java/org/teiid/transport/LocalServerConnection.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -1,148 +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.transport;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.LogonException;
-import com.metamatrix.client.ExceptionUtil;
-import com.metamatrix.common.comm.CommonCommPlugin;
-import com.metamatrix.common.comm.api.ServerConnection;
-import com.metamatrix.common.comm.exception.CommunicationException;
-import com.metamatrix.common.comm.exception.ConnectionException;
-import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-import com.metamatrix.platform.security.api.ILogon;
-import com.metamatrix.platform.security.api.LogonResult;
-import com.metamatrix.platform.security.api.SessionToken;
-
-public class LocalServerConnection implements ServerConnection {
- private static final String TEIID_RUNTIME = "teiid/engine-deployer";
-
- private final LogonResult result;
- private boolean shutdown;
-
- public LocalServerConnection(Properties connectionProperties) throws CommunicationException, ConnectionException{
- this.result = authenticate(connectionProperties);
- }
-
- public synchronized LogonResult authenticate(Properties connProps) throws ConnectionException, CommunicationException {
- try {
- connProps.setProperty(ServerConnection.LOCAL_CONNECTION, Boolean.TRUE.toString());
- LogonResult logonResult = this.getService(ILogon.class).logon(connProps);
- return logonResult;
- } catch (LogonException e) {
- // Propagate the original message as it contains the message we want
- // to give to the user
- throw new ConnectionException(e, e.getMessage());
- } catch (MetaMatrixComponentException e) {
- if (e.getCause() instanceof CommunicationException) {
- throw (CommunicationException)e.getCause();
- }
- throw new CommunicationException(e, CommPlatformPlugin.Util.getString("PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to_MetaMatrix")); //$NON-NLS-1$
- }
- }
-
- public <T> T getService(final Class<T> iface) {
- return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new InvocationHandler() {
-
- public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable {
- if (!isOpen()) {
- throw ExceptionUtil.convertException(arg1, new MetaMatrixComponentException(CommonCommPlugin.Util.getString("LocalTransportHandler.Transport_shutdown"))); //$NON-NLS-1$
- }
- try {
- ClientServiceRegistry scf = lookup(TEIID_RUNTIME);
- T service = scf.getClientService(iface);
-
- if (!(iface.equals(ILogon.class))) {
- SessionToken.setSession(result.getSessionToken());
- }
-
- return arg1.invoke(service, arg2);
- } catch(NamingException e){
- throw ExceptionUtil.convertException(arg1, new MetaMatrixComponentException(CommonCommPlugin.Util.getString("LocalTransportHandler.Transport_shutdown"))); //$NON-NLS-1$
- } finally {
- SessionToken.setSession(null);
- }
- }
- }));
- }
-
- public boolean isOpen() {
- return !shutdown;
- }
-
- public void close() {
- shutdown(true);
- }
-
- private void shutdown(boolean logoff) {
- if (shutdown) {
- return;
- }
-
- if (logoff) {
- try {
- //make a best effort to send the logoff
- Future<?> writeFuture = this.getService(ILogon.class).logoff();
- if (writeFuture != null) {
- writeFuture.get(5000, TimeUnit.MILLISECONDS);
- }
- } catch (InvalidSessionException e) {
- //ignore
- } catch (InterruptedException e) {
- //ignore
- } catch (ExecutionException e) {
- //ignore
- } catch (TimeoutException e) {
- //ignore
- }
- }
- this.shutdown = true;
- }
-
- public LogonResult getLogonResult() {
- return result;
- }
-
- @Override
- public boolean isSameInstance(ServerConnection conn) throws CommunicationException {
- return (conn instanceof LocalServerConnection);
- }
-
- protected <T> T lookup(String jndiName) throws NamingException {
- InitialContext ic = new InitialContext();
- return (T)ic.lookup(jndiName);
- }
-}
Copied: trunk/client/src/main/java/org/teiid/transport/LocalServerConnection.java (from rev 1900, branches/JCA/client/src/main/java/org/teiid/transport/LocalServerConnection.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/transport/LocalServerConnection.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/transport/LocalServerConnection.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,148 @@
+/*
+ * 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.transport;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.client.ExceptionUtil;
+import com.metamatrix.common.comm.CommonCommPlugin;
+import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.common.comm.platform.CommPlatformPlugin;
+import com.metamatrix.platform.security.api.ILogon;
+import com.metamatrix.platform.security.api.LogonResult;
+import com.metamatrix.platform.security.api.SessionToken;
+
+public class LocalServerConnection implements ServerConnection {
+ private static final String TEIID_RUNTIME = "teiid/engine-deployer";
+
+ private final LogonResult result;
+ private boolean shutdown;
+
+ public LocalServerConnection(Properties connectionProperties) throws CommunicationException, ConnectionException{
+ this.result = authenticate(connectionProperties);
+ }
+
+ public synchronized LogonResult authenticate(Properties connProps) throws ConnectionException, CommunicationException {
+ try {
+ connProps.setProperty(ServerConnection.LOCAL_CONNECTION, Boolean.TRUE.toString());
+ LogonResult logonResult = this.getService(ILogon.class).logon(connProps);
+ return logonResult;
+ } catch (LogonException e) {
+ // Propagate the original message as it contains the message we want
+ // to give to the user
+ throw new ConnectionException(e, e.getMessage());
+ } catch (MetaMatrixComponentException e) {
+ if (e.getCause() instanceof CommunicationException) {
+ throw (CommunicationException)e.getCause();
+ }
+ throw new CommunicationException(e, CommPlatformPlugin.Util.getString("PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to_MetaMatrix")); //$NON-NLS-1$
+ }
+ }
+
+ public <T> T getService(final Class<T> iface) {
+ return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new InvocationHandler() {
+
+ public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable {
+ if (!isOpen()) {
+ throw ExceptionUtil.convertException(arg1, new MetaMatrixComponentException(CommonCommPlugin.Util.getString("LocalTransportHandler.Transport_shutdown"))); //$NON-NLS-1$
+ }
+ try {
+ ClientServiceRegistry scf = lookup(TEIID_RUNTIME);
+ T service = scf.getClientService(iface);
+
+ if (!(iface.equals(ILogon.class))) {
+ SessionToken.setSession(result.getSessionToken());
+ }
+
+ return arg1.invoke(service, arg2);
+ } catch(NamingException e){
+ throw ExceptionUtil.convertException(arg1, new MetaMatrixComponentException(CommonCommPlugin.Util.getString("LocalTransportHandler.Transport_shutdown"))); //$NON-NLS-1$
+ } finally {
+ SessionToken.setSession(null);
+ }
+ }
+ }));
+ }
+
+ public boolean isOpen() {
+ return !shutdown;
+ }
+
+ public void close() {
+ shutdown(true);
+ }
+
+ private void shutdown(boolean logoff) {
+ if (shutdown) {
+ return;
+ }
+
+ if (logoff) {
+ try {
+ //make a best effort to send the logoff
+ Future<?> writeFuture = this.getService(ILogon.class).logoff();
+ if (writeFuture != null) {
+ writeFuture.get(5000, TimeUnit.MILLISECONDS);
+ }
+ } catch (InvalidSessionException e) {
+ //ignore
+ } catch (InterruptedException e) {
+ //ignore
+ } catch (ExecutionException e) {
+ //ignore
+ } catch (TimeoutException e) {
+ //ignore
+ }
+ }
+ this.shutdown = true;
+ }
+
+ public LogonResult getLogonResult() {
+ return result;
+ }
+
+ @Override
+ public boolean isSameInstance(ServerConnection conn) throws CommunicationException {
+ return (conn instanceof LocalServerConnection);
+ }
+
+ protected <T> T lookup(String jndiName) throws NamingException {
+ InitialContext ic = new InitialContext();
+ return (T)ic.lookup(jndiName);
+ }
+}
Modified: trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties
===================================================================
--- trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/resources/com/metamatrix/admin/i18n.properties 2010-03-04 18:25:21 UTC (rev 1904)
@@ -200,6 +200,7 @@
TransactionImpl.scope=\n\ Scope:\
TransactionImpl.status=\n\ Status:\
TransactionImpl.xid=\n\ Xid:\
+TransactionImpl.createdTime=\n\ Created Time:\
AdminStatus.CODE_UNKNOWN=Unknown.
AdminStatus.CODE_SUCCESS=Success.
Modified: trunk/client/src/main/resources/com/metamatrix/common/comm/i18n.properties
===================================================================
--- trunk/client/src/main/resources/com/metamatrix/common/comm/i18n.properties 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/resources/com/metamatrix/common/comm/i18n.properties 2010-03-04 18:25:21 UTC (rev 1904)
@@ -27,4 +27,6 @@
TrustedSessionToken.token_null = The trusted token for a session token may not be null.
StreamImpl.Unable_to_read_data_from_stream=Unable to read data from the stream: {0}
-RequestMessage.invalid_txnAutoWrap=''{0}'' is an invalid transaction autowrap mode.
\ No newline at end of file
+RequestMessage.invalid_txnAutoWrap=''{0}'' is an invalid transaction autowrap mode.
+
+LocalTransportHandler.Transport_shutdown=Tranport has been shutdown.
Modified: trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties
===================================================================
--- trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties 2010-03-04 18:25:21 UTC (rev 1904)
@@ -33,8 +33,8 @@
PlatformServerConnectionFactory.Missing_required_property=Missing required property:
PlatformServerConnectionFactory.Error_encrypting_user_password=Error encrypting user password
PlatformServerConnectionFactory.Error_communicating_with_app_server=Error communicating with app server
-PlatformServerConnectionFactory.Error_logging_on_to_MetaMatrix=Error logging on to MetaMatrix: {0}
-PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to_MetaMatrix=Unable to find a component used in logging on to MetaMatrix
+PlatformServerConnectionFactory.Error_logging_on_to_MetaMatrix=Error logging on to Teiid: {0}
+PlatformServerConnectionFactory.Unable_to_find_a_component_used_in_logging_on_to=Unable to find a component used authenticate on to Teiid
PlatformServerConnectionFactory.Unable_to_get_a_PlatformServerConnection=Unable to get a PlatformServerConnection
PlatformServerConnectionFactory.Error_comunicating_with_LogonAPI=Error communicating with LogonAPI
PlatformServerConnectionFactory.JNDI_library_mismatch_plugin=Client library may not match server vendor or version for server {1}. Client code loaded from plugin: {2}, initial context factory: {0}.
Copied: trunk/client/src/main/resources/vdb-deployer.xsd (from rev 1900, branches/JCA/client/src/main/resources/vdb-deployer.xsd)
===================================================================
--- trunk/client/src/main/resources/vdb-deployer.xsd (rev 0)
+++ trunk/client/src/main/resources/vdb-deployer.xsd 2010-03-04 18:25:21 UTC (rev 1904)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:element name="vdb">
+ <xs:annotation>
+ <xs:documentation>Describes the configuration for a VDB</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="property" type="property" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="model" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="property" type="property" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="source" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="jndi-name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="validation-error" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="severity">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="ERROR"/>
+ <xs:enumeration value="WARNING"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="type" default="PHYSICAL">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="PHYSICAL"/>
+ <xs:enumeration value="VIRTUAL"/>
+ <xs:enumeration value="FUNCTION"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="visible" type="xs:boolean" default="true"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="role" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="resource-name" type="xs:string"/>
+ <xs:element name="allow-create" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="allow-read" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="allow-update" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="allow-delete" type="xs:boolean" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="property" type="property" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="path" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="role-mapping" type="reference-mapping" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="version" type="xs:int" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="property">
+ <xs:annotation>
+ <xs:documentation> property</xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="reference-mapping">
+ <xs:sequence>
+ <xs:element name="ref-name" type="xs:string"/>
+ <xs:element name="resource-name" type="xs:string" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
Modified: trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -45,7 +45,6 @@
import com.metamatrix.dqp.client.ResultsFuture;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
-import com.metamatrix.platform.security.api.MetaMatrixSessionID;
import com.metamatrix.platform.security.api.SessionToken;
/**
@@ -82,7 +81,7 @@
Properties connectionProperties)
throws LogonException,
MetaMatrixComponentException {
- return new LogonResult(new SessionToken(new MetaMatrixSessionID(1), "fooUser"), new Properties(), "fake"); //$NON-NLS-1$ //$NON-NLS-2$
+ return new LogonResult(new SessionToken(1, "fooUser"), "foo", 1, "fake"); //$NON-NLS-1$ //$NON-NLS-2$
}
//## JDBC4.0-begin ##
@@ -146,7 +145,7 @@
public void testLogon() throws Exception {
SocketServerConnection connection = createConnection(null);
- assertEquals("1", connection.getLogonResult().getSessionID().toString()); //$NON-NLS-1$
+ assertEquals(1, connection.getLogonResult().getSessionID()); //$NON-NLS-1$
}
/**
Modified: trunk/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/test/java/com/metamatrix/common/xa/TestMMXid.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -53,8 +53,8 @@
public void testToString() {
assertEquals(XID1Copy.toString(), XID1.toString());
- assertEquals("MMXid global:1 branch:null format:0", XID1.toString()); //$NON-NLS-1$
- assertEquals("MMXid global:2 branch:3 format:0", XID2.toString()); //$NON-NLS-1$
+ assertEquals("Teiid-Xid global:1 branch:null format:0", XID1.toString()); //$NON-NLS-1$
+ assertEquals("Teiid-Xid global:2 branch:3 format:0", XID2.toString()); //$NON-NLS-1$
}
}
Modified: trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java 2010-03-04 18:04:53 UTC (rev 1903)
+++ trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java 2010-03-04 18:25:21 UTC (rev 1904)
@@ -23,13 +23,13 @@
package com.metamatrix.dqp.message;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import junit.framework.TestCase;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.dqp.message.RequestMessage.StatementType;
import com.metamatrix.jdbc.api.ExecutionProperties;
public class TestRequestMessage extends TestCase {
@@ -44,7 +44,7 @@
public static RequestMessage example() {
RequestMessage message = new RequestMessage();
- message.setCallableStatement(true);
+ message.setStatementType(StatementType.CALLABLE);
message.setFetchSize(100);
List params = new ArrayList();
params.add(new Integer(100));
@@ -54,9 +54,6 @@
message.setParameterValues(params);
message.setPartialResults(true);
- message.setPreparedStatement(false);
- message.setSubmittedTimestamp(new Date(11111111L));
- message.setProcessingTimestamp(new Date(12345678L));
message.setStyleSheet("myStyleSheet"); //$NON-NLS-1$
message.setExecutionPayload("myExecutionPayload"); //$NON-NLS-1$
try {
@@ -85,8 +82,6 @@
assertEquals(new Integer(400), copy.getParameterValues().get(3));
assertFalse(copy.isPreparedStatement());
- assertEquals(new Date(11111111L), copy.getSubmittedTimestamp());
- assertEquals(new Date(12345678L), copy.getProcessingTimestamp());
assertEquals("myStyleSheet", copy.getStyleSheet()); //$NON-NLS-1$
assertEquals("myExecutionPayload", copy.getExecutionPayload()); //$NON-NLS-1$
assertEquals(ExecutionProperties.TXN_WRAP_ON, copy.getTxnAutoWrapMode()); //$NON-NLS-1$
14 years, 2 months
teiid SVN: r1903 - in trunk/cache-jbosscache: src/main/java/com/metamatrix/cache/jboss and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 13:04:53 -0500 (Thu, 04 Mar 2010)
New Revision: 1903
Modified:
trunk/cache-jbosscache/pom.xml
trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
Log:
TEIID-833 committing JCA merge
Modified: trunk/cache-jbosscache/pom.xml
===================================================================
--- trunk/cache-jbosscache/pom.xml 2010-03-04 18:01:33 UTC (rev 1902)
+++ trunk/cache-jbosscache/pom.xml 2010-03-04 18:04:53 UTC (rev 1903)
@@ -11,17 +11,19 @@
<name>JBoss Cache</name>
<description>JBossCache provider.</description>
<dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-engine</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
</dependency>
- <dependency>
- <groupId>com.google.code.guice</groupId>
- <artifactId>guice</artifactId>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java 2010-03-04 18:01:33 UTC (rev 1902)
+++ trunk/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java 2010-03-04 18:04:53 UTC (rev 1903)
@@ -22,6 +22,14 @@
package com.metamatrix.cache.jboss;
+import java.io.Serializable;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.Region;
@@ -30,39 +38,31 @@
import org.jboss.cache.eviction.FIFOAlgorithmConfig;
import org.jboss.cache.eviction.LFUAlgorithmConfig;
import org.jboss.cache.eviction.LRUAlgorithmConfig;
-import org.jboss.cache.jmx.JmxRegistrationManager;
+import org.jboss.cache.jmx.CacheJmxWrapperMBean;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.name.Named;
import com.metamatrix.cache.Cache;
import com.metamatrix.cache.CacheConfiguration;
import com.metamatrix.cache.CacheFactory;
import com.metamatrix.cache.Cache.Type;
import com.metamatrix.cache.CacheConfiguration.Policy;
-import com.metamatrix.common.util.JMXUtil;
-import com.metamatrix.common.util.JMXUtil.FailedToRegisterException;
import com.metamatrix.core.MetaMatrixRuntimeException;
-@Singleton
-public class JBossCacheFactory implements CacheFactory {
- private static final String NAME = "Cache"; //$NON-NLS-1$
- private org.jboss.cache.Cache cacheStore;
+public class JBossCacheFactory implements CacheFactory, Serializable{
+ private transient org.jboss.cache.Cache cacheStore;
private volatile boolean destroyed = false;
- JmxRegistrationManager jmxManager;
- @Inject
- public JBossCacheFactory(org.jboss.cache.Cache cacheStore, @Named("jmx") JMXUtil jmx) {
- this.cacheStore = cacheStore;
+
+ public void setCacheName(String jmxName) {
try {
- this.cacheStore = cacheStore;
- jmxManager = new JmxRegistrationManager(jmx.getMBeanServer(), cacheStore, jmx.buildName(JMXUtil.MBeanType.SERVICE, NAME));
- jmxManager.registerAllMBeans();
- } catch (FailedToRegisterException e) {
- throw new MetaMatrixRuntimeException(e.getCause());
- }
+ MBeanServer server = MBeanServerFactory.findMBeanServer(null).get(0);
+ ObjectName on = new ObjectName(jmxName);
+ CacheJmxWrapperMBean cacheWrapper = MBeanServerInvocationHandler.newProxyInstance(server, on, CacheJmxWrapperMBean.class, false);
+ this.cacheStore = cacheWrapper.getCache();
+ } catch (MalformedObjectNameException e) {
+ throw new MetaMatrixRuntimeException(e);
+ }
}
-
+
/**
* {@inheritDoc}
*/
@@ -104,9 +104,11 @@
}
public void destroy() {
- jmxManager.unregisterAllMBeans();
- this.cacheStore.stop();
- this.cacheStore.destroy();
this.destroyed = true;
}
+
+ // this will be called by microcontainer.
+ public void stop() {
+ destroy();
+ }
}
14 years, 2 months
teiid SVN: r1902 - in trunk/adminshell: src/main/java/com/metamatrix/script/shell and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 13:01:33 -0500 (Thu, 04 Mar 2010)
New Revision: 1902
Added:
trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java
Removed:
trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java
Modified:
trunk/adminshell/
trunk/adminshell/pom.xml
trunk/adminshell/src/main/resources/scripts/adminapi.bsh
trunk/adminshell/src/main/resources/scripts/context.bsh
trunk/adminshell/src/main/resources/scripts/server.bsh
trunk/adminshell/src/main/resources/scripts/util.bsh
Log:
TEIID-833 committing JCA merge
Property changes on: trunk/adminshell
___________________________________________________________________
Name: svn:mergeinfo
-
Modified: trunk/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml 2010-03-04 17:57:09 UTC (rev 1901)
+++ trunk/adminshell/pom.xml 2010-03-04 18:01:33 UTC (rev 1902)
@@ -13,19 +13,24 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client-jdbc</artifactId>
+ <scope>provided</scope>
</dependency>
+
<dependency>
<groupId>beanshell</groupId>
<artifactId>bsh</artifactId>
</dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Deleted: trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java
===================================================================
--- trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java 2010-03-04 17:57:09 UTC (rev 1901)
+++ trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java 2010-03-04 18:01:33 UTC (rev 1902)
@@ -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 com.metamatrix.script.shell;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.metamatrix.core.util.ObjectConverterUtil;
-import com.metamatrix.jdbc.util.MMJDBCURL;
-
-public class Util {
-
- public static byte[] readBinaryFile(String fileName) throws IOException {
- InputStream is = null;
-
- if(fileName == null) {
- throw new IOException("fileName is null");
- }
- try {
- //try to load file from the classpath
- is = Object.class.getResourceAsStream("/"+fileName);
-
- byte[] result;
- if (is == null) {
- //load from "hardcoded" path
- is = new FileInputStream(new File(fileName));
- }
-
-
- }catch(Exception e) {
- if (is == null) {
- try {
- //load from "hardcoded" path
- is = new FileInputStream(new File(fileName));
- }catch(Exception e2) {
-
- e.printStackTrace();
- return null;
- }
- }
-
- }
-
- //convert to bytes
- byte[] result = ObjectConverterUtil.convertToByteArray(is);
- try {
- is.close();
- }catch(Exception e3) {
- }
- return result;
- }
-
- public static char[] readTextFile(String fileName) throws IOException {
- if(fileName == null) {
- throw new IOException("fileName is null");
- }
- char[] result = null;
-
- try {
- File file = new File(fileName);
-
- // changed to use the ObectConverterUtil, instead of the
- // convertToCharArray() method because it doesn't completely
- // convert the file, the XML reader throws a malform exception
- // the test case for ServerAdminImpl also the ObjectConverterUtil
- // that's why this was changed to use it
- result = ObjectConverterUtil.convertFileToCharArray(file, null);
-
- }catch(Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public static void cleanUpDirectory(String dirName, String[] filesToKeep){
- File dir = new File(dirName);
- if (dir.exists()) {
- File[] files = dir.listFiles();
- for (File f:files) {
- if (f.getName().endsWith(".deleted")) {
- continue;
- }
- boolean delete = true;
- for (String keep:filesToKeep) {
- if (f.getName().equalsIgnoreCase(keep)) {
- delete = false;
- break;
- }
- }
- if (delete) f.delete();
- }
- }
- }
-
- public static char[] convertToCharArray(InputStream in) throws IOException {
- return ObjectConverterUtil.convertToCharArray(in, Integer.MAX_VALUE, null);
- }
-
- public static String extractVDBName(String url) {
- MMJDBCURL mmurl = new MMJDBCURL(url);
- return mmurl.getVDBName();
- }
-
- public static String extractHost(String url) {
- MMJDBCURL mmurl = new MMJDBCURL(url);
- return mmurl.getConnectionURL();
- }
-
-}
Copied: trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java (from rev 1900, branches/JCA/adminshell/src/main/java/com/metamatrix/script/shell/Util.java)
===================================================================
--- trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java (rev 0)
+++ trunk/adminshell/src/main/java/com/metamatrix/script/shell/Util.java 2010-03-04 18:01:33 UTC (rev 1902)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.script.shell;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import com.metamatrix.core.util.ObjectConverterUtil;
+import com.metamatrix.jdbc.util.MMJDBCURL;
+
+public class Util {
+
+ public static byte[] readBinaryFile(String fileName) throws IOException {
+ InputStream is = null;
+
+ if(fileName == null) {
+ throw new IOException("fileName is null");
+ }
+ try {
+ //try to load file from the classpath
+ is = Object.class.getResourceAsStream("/"+fileName);
+
+ byte[] result;
+ if (is == null) {
+ //load from "hardcoded" path
+ is = new FileInputStream(new File(fileName));
+ }
+
+
+ }catch(Exception e) {
+ if (is == null) {
+ try {
+ //load from "hardcoded" path
+ is = new FileInputStream(new File(fileName));
+ }catch(Exception e2) {
+
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ }
+
+ //convert to bytes
+ byte[] result = ObjectConverterUtil.convertToByteArray(is);
+ try {
+ is.close();
+ }catch(Exception e3) {
+ }
+ return result;
+ }
+
+ public static char[] readTextFile(String fileName) throws IOException {
+ if(fileName == null) {
+ throw new IOException("fileName is null");
+ }
+ char[] result = null;
+
+ try {
+ File file = new File(fileName);
+
+ // changed to use the ObectConverterUtil, instead of the
+ // convertToCharArray() method because it doesn't completely
+ // convert the file, the XML reader throws a malform exception
+ // the test case for ServerAdminImpl also the ObjectConverterUtil
+ // that's why this was changed to use it
+ result = ObjectConverterUtil.convertFileToCharArray(file, null);
+
+ }catch(Exception e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ public static void cleanUpDirectory(String dirName, String[] filesToKeep){
+ File dir = new File(dirName);
+ if (dir.exists()) {
+ File[] files = dir.listFiles();
+ for (File f:files) {
+ if (f.getName().endsWith(".deleted")) {
+ continue;
+ }
+ boolean delete = true;
+ for (String keep:filesToKeep) {
+ if (f.getName().equalsIgnoreCase(keep)) {
+ delete = false;
+ break;
+ }
+ }
+ if (delete) f.delete();
+ }
+ }
+ }
+
+ public static char[] convertToCharArray(InputStream in) throws IOException {
+ return ObjectConverterUtil.convertToCharArray(in, Integer.MAX_VALUE, null);
+ }
+
+ public static String extractVDBName(String url) {
+ MMJDBCURL mmurl = new MMJDBCURL(url);
+ return mmurl.getVDBName();
+ }
+
+ public static String extractHost(String url) {
+ MMJDBCURL mmurl = new MMJDBCURL(url);
+ return mmurl.getConnectionURL();
+ }
+
+}
Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-03-04 17:57:09 UTC (rev 1901)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2010-03-04 18:01:33 UTC (rev 1902)
@@ -5,111 +5,43 @@
currentContext().internalVerbose = true;
-// Config API Methods
-
/**
- * Import a {@link VDB} file. <br>
- * A VDB file with internal definitions. This is the default VDB export configuration beginning with MetaMatrix version 4.3.</br>
- *
- * @param name
- * VDB Name
- * @param vdbFile
- * File name of the VDB Archive
+ * Deploy a {@link VDB} file.
+ * @param name Name of the VDB file to save under
+ * @param URL VDB file location.
* @throws AdminException
* if there's a system error.
* @return the {@link VDB} representing the current property values and runtime state.
- * @since 4.3
*/
-VDB addVDB(String name, String vdbFile) {
+VDB deployVDB(String vdbFile) {
debug("Adding VDB " + name + " from " + vdbFile);
checkAdmin();
- return currentContext().internalAdmin.addVDB(name, readBinaryFile(vdbFile), new AdminOptions(AdminOptions.OnConflict.IGNORE));
+ return internalAdmin.addVDB(vdbFile, new File(vdbFile).toURL());
}
/**
- * Import a {@link VDB} file.
- * <br>A VDB file with internal definitions. This is the default VDB export configuration
- * beginning with MetaMatrix version 4.3.</br>
- *
- * @param name
- * VDB Name
- * @param vdbFile
- * byte array of the VDB Archive
- * @param option Code of the AdminOptions to use when executing this method. There are choices about
- * what to do when a connector binding with the given identifier already exists in the system.
- * See {@link AdminOptions}.
+ * Delete the VDB with the given name and version
+ * @param vdbName
+ * @param version
* @throws AdminException
- * if there's a system error.
- * @return the {@link VDB} representing the current property values and runtime state.
- * @since 4.3
*/
-VDB addVDB(String name, String vdbFile, int option) {
- debug("Adding VDB " + name + " from " + vdbFile);
- checkAdmin();
- return currentContext().internalAdmin.addVDB(name, readBinaryFile(vdbFile), new AdminOptions(option));
+void deleteVDB(String name, int version) {
+ checkAdmin();
+ internalAdmin.deleteVDB(name, version);
}
/**
- * Import a {@link VDB} file.
- * <br>A VDB file with internal definitions. This is the default VDB export configuration
- * begining with MetaMatrix version 4.3.</br>
+ * Export VDB to byte array
*
- * @param name
- * VDB Name
- * @param vdbFile
- * byte array of the VDB Archive
- * @param AdminOptions that defines the options on how to import the vdb and its related connector bindings.
- * See {@link AdminOptions}.
- * @throws AdminException
- * if there's a system error.
- * @return the {@link VDB} representing the current property values and runtime state.
- * @since 6.1.0
+ * @param vdbName identifier of the {@link VDB}
+ * @param vdbVersion {@link VDB} version
+ * @return InputStream of the VDB
+ * @throws AdminException if there's a system error.
*/
-VDB addVDB(String name, String vdbFile, AdminOptions options) {
- debug("Adding VDB " + name + " from " + vdbFile);
- checkAdmin();
- return currentContext().internalAdmin.addVDB(name, readBinaryFile(vdbFile), options);
-}
-
-/**
- * Import a {@link VDB} file.
- * <br>A VDB file with internal definitions. This is the default VDB export configuration
- * begining with MetaMatrix version 4.3.</br>
- *
- * @param name
- * VDB Name
- * @param vdbFile
- * byte array of the VDB Archive
- * @param AdminOptions that defines the options on how to import the vdb and its related connector bindings.
- * See {@link AdminOptions}.
- * @throws AdminException
- * if there's a system error.
- * @return the {@link VDB} representing the current property values and runtime state.
- * @since 6.1.0
- */
-VDB addVDB(String name, byte[] vdb, AdminOptions options) {
- debug("Adding VDB " + name);
- checkAdmin();
- return currentContext().internalAdmin.addVDB(name, vdb, options);
-}
-
-/**
- * Export VDB to a file.
- *
- * @param name
- * Name of the {@link VDB}
- * @param vdbVersion
- * version of the VDB
- * @param fileName
- * Name of the file to export
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void exportVDB(String name, String vdbVersion, String fileName){
+void exportVDB(String name, int vdbVersion, String fileName){
debug("Exporting VDB " + name + " version " + vdbVersion + " to file " + fileName);
checkAdmin();
- contents = currentContext().internalAdmin.exportVDB(name, vdbVersion);
+ contents = internalAdmin.exportVDB(name, vdbVersion);
if (contents != null) {
ObjectConverterUtil.write(contents, fileName);
}
@@ -118,164 +50,45 @@
}
}
-
-
-
-//********** Connector Binding Methods *************************
-
-
-
-
-
/**
- * Import a {@link ConnectorBinding} into the Configuration.
- *
- * @param name
- * is the Connector Binding name that will be added to Configuration
- * @param xmlFile
- * Name of the XML file to import.
- * @throws AdminException
- * if there's a system error.
- * @return the {@link ConnectorBinding} representing the current property values and runtime state.
- * @since 4.3
- */
-ConnectorBinding addConnectorBinding(String name, String xmlFile){
- debug("Adding Connector Binding " + name + " from " + xmlFile);
- checkAdmin();
- return currentContext().internalAdmin.addConnectorBinding(name, readTextFile(xmlFile),
- new AdminOptions(AdminOptions.OnConflict.IGNORE));
-}
-
-/**
- * Import a {@link ConnectorBinding} into the Configuration.
- *
- * @param name
- * is the Connector Binding name that will be added to Configuration
- * @param xmlFile
- * Name of the XML file to import.
- * @param option Code of the AdminOptions to use when executing this method. There are choices about
- * what to do when a connector binding with the given identifier already exists in the system.
- * See the interface {@link AdminOptions.OnConflict} for details.
- * <p>
- * Another option is to ignore a binding connection password decrypt error, when adding a connector
- * binding whose password was encrypted with a different keystore, so that the new password property
- * can be set after the connector binding has been added.</p>
- * @throws AdminException
- * if there's a system error.
- * @return the {@link ConnectorBinding} representing the current property values and runtime state.
- * @since 4.3
- */
-ConnectorBinding addConnectorBinding(String name, String xmlFile, int option){
- debug("Adding Connector Binding " + name + " from " + xmlFile);
- checkAdmin();
- return currentContext().internalAdmin.addConnectorBinding(name, readTextFile(xmlFile), new AdminOptions(option));
-}
-
-
-/**
- * Import a {@link ConnectorBinding} into the Configuration.
- *
- * @param name
- * is the Connector Binding name that will be added to Configuration
- * @param binding
- * byte array of the connector binding xml file
- * @param AdminOptions that defines the options on how to import theconnector binding.
- * There are choices about what to do when a connector binding with the given identifier
- @ already exists in the system.
- * See the interface {@link AdminOptions.OnConflict} for details.
- * <p>
- * Another option is to ignore a binding connection password decrypt error, when adding a connector
- * binding whose password was encrypted with a different keystore, so that the new password property
- * can be set after the connector binding has been added.</p>
- * @throws AdminException
- * if there's a system error.
- * @return the {@link ConnectorBinding} representing the current property values and runtime state.
- * @since 4.3
- */
-ConnectorBinding addConnectorBinding(String name, String xmlFile, AdminOptions options){
- debug("Adding Connector Binding " + name + " from a byte array");
- checkAdmin();
- return currentContext().internalAdmin.addConnectorBinding(name, readTextFile(xmlFile), options);
-}
-
-/**
* Deploy a {@link ConnectorBinding} to Configuration
*
- * @param connectorBindingIdentifier
- * Connector Binding Identifer is the Host Name.Process Name.Connector Binding Name
- * @param connectorTypeIdentifier
- * Name of the Connector Type
- * @param properties
- * Name & Value pair need to deploy the Connector Binding
- * @throws AdminException
- * if there's a system error.
- * @return the {@link ConnectorBinding} representing the current property values and runtime state.
- * @since 4.3
- */
-ConnectorBinding addConnectorBinding(String connectorBindingIdentifier, String connectorTypeIdentifier, Properties properties){
- debug("Adding Connector Binding " + connectorBindingIdentifier);
- checkAdmin();
- return currentContext().internalAdmin.addConnectorBinding(connectorBindingIdentifier, connectorTypeIdentifier, properties,
- new AdminOptions(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR));
-}
+ * @param deployedName Connector Binding name that will be added to Configuration
+ * @param typeName Connector type name.
+ * @param properties Name & Value pair need to deploy the Connector Binding
-/**
- * Deploy a {@link ConnectorBinding} to Configuration
- *
- * @param connectorBindingIdentifier
- * Connector Binding Identifer is the Host Name.Process Name.Connector Binding Name
- * @param connectorTypeIdentifier
- * Name of the Connector Type
- * @param properties
- * Name & Value pair need to deploy the Connector Binding
- * @param option Code of the AdminOptions to use when executing this method. There are choices about
- * what to do when a connector binding with the given identifier already exists in the system.
- * See the interface {@link AdminOptions.OnConflict} for details.
- * <p>
- * Another option is to ignore a binding connection password decrypt error, when adding a connector
- * binding whose password was encrypted with a different keystore, so that the new password property
- * can be set after the connector binding has been added.</p>
- * @throws AdminException
- * if there's a system error.
- * @return the {@link ConnectorBinding} representing the current property values and runtime state.
- * @since 4.3
+ * @throws AdminException if there's a system error.
*/
-ConnectorBinding addConnectorBinding(String connectorBindingIdentifier, String connectorTypeIdentifier, Properties properties, int option){
- debug("Adding Connector Binding " + connectorBindingIdentifier);
+void addConnectorBinding(String deployedName, String typeName, Properties properties) {
+ debug("Adding Connector Binding " + deployedName);
checkAdmin();
- return currentContext().internalAdmin.addConnectorBinding(connectorBindingIdentifier, connectorTypeIdentifier, properties, new AdminOptions(option));
+ return internalAdmin.addConnectorBinding(deployedName, typeName, properties);
}
-
-
/**
* Delete the {@link ConnectorBinding} from the Configuration
*
- * @param connectorBindingIdentifier
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
+ * @param deployedName - deployed name of the connector binding
+ * @throws AdminException if there's a system error.
*/
void deleteConnectorBinding(String bindingName) throws AdminException {
debug("Deleting Connector Binding " + bindingName);
checkAdmin();
- currentContext().internalAdmin.deleteConnectorBinding(bindingName);
+ internalAdmin.deleteConnectorBinding(bindingName);
}
/**
* Export a {@link ConnectorBinding} to character Array in XML format
- *
- * @param connectorBindingIdentifier
- * @param fileName
- * name of the file to export to.
+ *
+ * @param deployedName the unique identifier for a {@link ConnectorBinding}.
+ * @return character Array in XML format
* @throws AdminException
* if there's a system error.
- * @since 4.3
*/
void exportConnectorBinding(String bindingName, String fileName){
debug("Exporting Connector Binding " + bindingName + " to file " + fileName);
checkAdmin();
- contents = currentContext().internalAdmin.exportConnectorBinding(bindingName);
+ contents = internalAdmin.exportConnectorBinding(bindingName);
if (contents != null) {
ObjectConverterUtil.write(contents, fileName);
}
@@ -287,204 +100,89 @@
/**
* Assign a {@link ConnectorBinding} to a {@link VDB}'s Model
*
- * @param connectorBindingName
- * Name of the ConnectorBinding
* @param vdbName
* Name of the VDB
* @param vdbVersion
* Version of the VDB
* @param modelName
* Name of the Model to map Connector Binding
+ * @param connectorBindingName
+ * Name of the ConnectorBinding
* @throws AdminException
* if there's a system error or if there's a user input error.
* @since 4.3
*/
-void assignBindingToModel(String connectorBindingName, String vdbName, String vdbVersion, String modelName) {
+void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String connectorBindingName) {
debug("Assigning Connector Binding " + connectorBindingName + " to Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
checkAdmin();
- currentContext().internalAdmin.assignBindingToModel(connectorBindingName, vdbName, vdbVersion, modelName);
+ internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, connectorBindingName);
}
-
-//** extension module methods ******************************************************
-
-
-/**
- * Adds an {@link ExtensionModule} of type "Jar File" to the end of the list of modules.
- * <br><i>All caches (of Class objects) are cleared.</i></br>
- *
- * @param jarfile
- * Name of the file to import.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void addExtensionModule(String jarfile) {
- f = new File(jarfile);
- debug("Adding extension module: "+f.getName());
- checkAdmin();
- currentContext().internalAdmin.addExtensionModule("JAR File", f.getName(), readBinaryFile(jarfile), "JAR File");
+void assignBindingToModel(String vdbName, int vdbVersion, String modelName, String[] connectorBindingNames) {
+ debug("Assigning Connector Bindings " + connectorBindingNames + " to Model " + modelName + " in VDB " + vdbName + " version " + vdbVersion);
+ checkAdmin();
+ internalAdmin.assignBindingToModel(vdbName, vdbVersion, modelName, connectorBindingNames);
}
/**
- * Adds an {@link ExtensionModule} to the end of the list of modules.
- * <br><i>All caches (of Class objects) are cleared.</i></br>
- *
- * @param type
- * one of the known types of extension file
- * @param sourceName
- * name (e.g. filename) of extension module
- * @param sourceFileName
- * Name of the file to import.
- * @param description
- * (optional) description of the extension module - may be null
+ * Adds JDBC XA Data Source in the container.
+ * @param dsName - name of the source
+ * @param properties - properties
* @throws AdminException
- * if there's a system error.
- * @since 4.3
*/
-void addExtensionModule(String type, String sourceName, String sourceFileName, String description) {
- f = new File(sourceFileName);
- debug("Adding extension module: "+f.getName());
+void addDataSource(String deploymentName, Properties properties) {
+ debug("Adding Datasource " + deploymentName);
checkAdmin();
- currentContext().internalAdmin.addExtensionModule(type, sourceName, readBinaryFile(sourceFileName), description);
+ return internalAdmin.addDataSource(deploymentName, properties);
}
-
-
/**
- * Deletes an {@link ExtensionModule} from the list of modules.
- * <br><i>All caches (of Class objects) are cleared.</i></br>
- *
- * @param sourceName
- * name of extension module
+ * Delete data source.
+ * @param dsName
* @throws AdminException
- * if there's a system error.
*/
-void deleteExtensionModule(String sourceName) {
- debug("deleteing extension module: "+sourceName);
+void deleteDataSource(String deploymentName) {
+ debug("Deleting Datasource " + deploymentName);
checkAdmin();
- currentContext().internalAdmin.deleteExtensionModule(sourceName);
+ return internalAdmin.deleteDataSource(deploymentName);
}
-
-/**
- * Export an {@link ExtensionModule} to byte array
- *
- * @param sourceName
- * Name of the extension module to export.
- * @param fileName
- * Name of the file to export to.
- * @throws AdminException
- * @since 4.3
- */
-void exportExtensionModule(String sourceName, String fileName) {
- debug("exporting extension module: "+sourceName);
- checkAdmin();
- contents = currentContext().internalAdmin.exportExtensionModule(sourceName);
- if (contents != null) {
- ObjectConverterUtil.write(contents, fileName);
- }
- else {
- throw new AdminProcessingException("Extension Module "+ sourceName + " not found for exporting");
- }
-
-}
-
/**
- * Add User Defined Function model to the system. If one is already deployed before this
- * will replace the previous, otherwise add this as the new UDF model. Once the UDF is added
- * the new UDF model is loaded.
- * @param modelFile - UDF File
- * @param classpath - classpath for the UDF
+ * Get the property definitions for creating the JDBC data source.
+ * @return
* @throws AdminException
*/
-void addUDF(File udfFile, String classpath) throws AdminException{
- debug("Adding UDF " + udfFile.getName() + " with classpath " + classpath);
+Collection getDataSourcePropertyDefinitions(){
+ debug("Datasource properties");
checkAdmin();
- return currentContext().internalAdmin.addUDF(readBinaryFile(udfFile), classpath);
-
+ return internalAdmin.getDataSourcePropertyDefinitions();
}
/**
- * Delete the User Defined Function model. Note that this will not delete any supporting
- * extension jar files added, those need to be deleted separately.
- * @throws AdminException
- */
-void deleteUDF() throws AdminException{
- debug("deleting UDF Model");
- checkAdmin();
- return currentContext().internalAdmin.deleteUDF();
-}
-
-//** Connector Type Methods ************************************************************
-
-
-/**
* Add Connector Type, will import Connector Type from a file
*
- * @param name
- * of the Connector Type to add
- * @param cdkFile
- * Name of file to import.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
+ * @param name of the Connector Type to add
+ * @param URL URL to RAR file
+ * @throws AdminException if there's a system error.
*/
-void addConnectorType(String name, String cdkFile){
- debug("Adding Connector Type " + name + " from " + cdkFile);
+void addConnectorType(String name, String rarFile) {
+ debug("Adding Connector Type " + name + " from " + rarFile);
checkAdmin();
- currentContext().internalAdmin.addConnectorType(name, readTextFile(cdkFile));
+ internalAdmin.addConnectorType(name, new File(rarFile).toURI().toURL());
}
-/**
- * Add Connector Type and all the required extension modules required by the this connector type into the system from the given
- * file byte stream which is encoded inthe Connector Archive format.
- *
- * @param archiveFile
- * Name of the file to import
- * @throws AdminException
- * if there's a system error.
- * @since 4.3.2
- */
-void addConnectorArchive(String archiveFile){
- debug("Adding Connector Archive from " + archiveFile);
- checkAdmin();
- currentContext().internalAdmin.addConnectorArchive(readBinaryFile(archiveFile), new AdminOptions(AdminOptions.OnConflict.IGNORE));
-}
/**
- * Add Connector Type and all the required extension modules required by the this connector type into the system from the given
- * file byte stream which is encoded inthe Connector Archive format.
- *
- * @param typeName
- * name of the Connector Type to add
- * @param archiveFile
- * Name of the file to import
- * @param option
- * Code of the AdminOptions to use in case of conflict in the connector type. See {@link AdminOptions}.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3.2
- */
-void addConnectorArchive(String archiveFile, int option){
- debug("Adding Connector Archive from " + archiveFile);
- checkAdmin();
- currentContext().internalAdmin.addConnectorArchive(readBinaryFile(archiveFile), new AdminOptions(option));
-}
-
-/**
* Delete Connector Type from Next Configuration
*
* @param name String name of the Connector Type to delete
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
+ * @throws AdminException if there's a system error.
*/
void deleteConnectorType(String name){
debug("Deleting Connector Type " + name);
checkAdmin();
- currentContext().internalAdmin.deleteConnectorType(name);
+ internalAdmin.deleteConnectorType(name);
}
/**
@@ -502,7 +200,7 @@
debug("Exporting Connector Type " + connectorTypeIdentifier + " to file " + fileName);
checkAdmin();
- contents = currentContext().internalAdmin.exportConnectorType(connectorTypeIdentifier);
+ contents = internalAdmin.exportConnectorType(connectorTypeIdentifier);
if (contents != null) {
ObjectConverterUtil.write(contents, fileName);
}
@@ -511,33 +209,30 @@
}
}
+
/**
- * Export Connector Archive, which is bundled connector type with its xml properties file and all the extension modules required
- * by the this connector type
- *
- * @param connectorTypeIdentifier
- * the unique identifier for for a {@link ConnectorType}
- * @param fileName
- * Name of the file to export to.
+ * Get all transaction matching the identifier.
+ * @return
* @throws AdminException
- * if there's a system error.
- * @since 4.3.2
*/
-void exportConnectorArchive(String connectorTypeIdentifier, String fileName) {
- debug("Exporting Connector Archive " + connectorTypeIdentifier + " to file " + fileName);
+Collection getTransactions() {
checkAdmin();
-
- contents = currentContext().internalAdmin.exportConnectorArchive(connectorTypeIdentifier);
-
- if (contents != null) {
- ObjectConverterUtil.write(contents, fileName);
- }
- else {
- throw new AdminProcessingException("Connector type with name "+ connectorTypeIdentifier + " is not found to export");
- }
-
+ result = internalAdmin.getTransactions();
+ debug(result);
+ return result;
}
+/**
+ * Mark the given global transaction as rollback only.
+ * @param transactionId
+ * @throws AdminException
+ */
+void terminateTransaction(String transactionId) {
+ debug("Terminating transaction = " + transactionId);
+ checkAdmin();
+ internalAdmin.terminateTransaction(transactionId);
+}
+
//** property methods******************************************************************
@@ -551,63 +246,10 @@
void setConnectorBindingProperty(String deployedName, String propertyName, String propertyValue) {
debug("Setting property for Connector Binding: "+deployedName+" with property="+propertyName+" value="+propertyValue);
checkAdmin();
- currentContext().internalAdmin.setConnectorBindingProperty(deployedName, propertyName, propertyValue);
+ internalAdmin.setConnectorBindingProperty(deployedName, propertyName, propertyValue);
}
/**
- * Export Configuration to character Array in XML format
- *
- * @param fileName
- * Name of the file to export to.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void exportConfiguration(String fileName) {
- debug("Exporting System configuration to file " + fileName);
- checkAdmin();
- contents = currentContext().internalAdmin.exportConfiguration();
- if (contents != null) {
- ObjectConverterUtil.write(contents, fileName);
- }
- else {
- throw new AdminProcessingException("Configuration is not found for export");
- }
-
-}
-
-/**
- * Get the {@link LogConfiguration}
- *
- * @return LogConfiguration object
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-LogConfiguration getLogConfiguration() {
- debug("get log configuration");
- checkAdmin();
- result = currentContext().internalAdmin.getLogConfiguration();
- debug(result);
- return result;
-}
-
-/**
- * Set the {@link LogConfiguration} in the MetaMatrix Server
- *
- * @param config
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void setLogConfiguration(LogConfiguration config) {
- debug("Setting new log configuration");
- checkAdmin();
- currentContext().internalAdmin.setLogConfiguration(config);
-}
-
-
-/**
* Assign {@link ConnectorBinding}s to a {@link VDB}'s Model. If the supplied model does not
* support MultiSource bindings, then only the first binding in the supplied array is assigned and
* the remainder are ignored.
@@ -626,7 +268,7 @@
void assignBindingsToModel(String[] connectorBindingNames, String vdbName, String vdbVersion, String modelName) {
debug("Assigning the bindings to model");
checkAdmin();
- currentContext().internalAdmin.assignBindingsToModel(connectorBindingNames, vdbName, vdbVersion, modelName);
+ internalAdmin.assignBindingsToModel(connectorBindingNames, vdbName, vdbVersion, modelName);
}
// *********************************************************************************************
@@ -635,47 +277,47 @@
// *********************************************************************************************
/**
- * Get the Connector Types that correspond to the specified identifer pattern.
+ * Get the Connector Types available in the configuration.
*
- * @param connectorTypeIdentifier the unique identifier for for a {@link ConnectorType}
- * <ul>
- * <li> <code>"*"</code> - for all connector types in the system
- * <li> <code>"name*"</code> - for all the connector types that begin with given name
- * <li> <code>"name"</code> - for the single connector type identified by name
- * </ul>
- * @return Collection of {@link ConnectorType}
+ * @return Set of connector types.
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getConnectorTypes(String connectorTypeIdentifier) {
+Set getConnectorTypes() {
checkAdmin();
- result = currentContext().internalAdmin.getConnectorTypes(connectorTypeIdentifier);
+ result = internalAdmin.getConnectorTypes();
debug(result);
return result;
}
/**
- * Get the VDBs that correspond to the specifed identifer pattern.
+ * Get the VDBs that currently deployed in the system
*
- * @param vdbIdentifier the unique identifier for for a {@link VDB} in the system
- * <ul>
- * <li> <code>"*"</code> - for all VDBs in the system
- * <li> <code>"name"</code> or <code>"name*"</code> - for all the VDBs that begin with given name
- * <li><code>"name<{@link AdminObject#DELIMITER_CHAR}>version"</code> - for single VDB
- * </ul>
* @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 if there's a system error.
- * @since 4.3
*/
-Collection getVDBs(String vdbIdentifier) {
+Set getVDBs() {
checkAdmin();
- result = currentContext().internalAdmin.getVDBs(vdbIdentifier);
+ result = internalAdmin.getVDBs();
debug(result);
return result;
}
/**
+ * Get the VDB
+ * @param vdbName
+ * @param vbdVersion
+ * @throws AdminException if there's a system error.
+ * @return
+ */
+VDB getVDB(String vdbName, int version) {
+ checkAdmin();
+ result = internalAdmin.getVDB(vdbName, version);
+ debug(result);
+ return result;
+}
+
+/**
* Get all the Connector Bindings for the given VDB identifier pattern
* @param vdbName - Name of the VDB
* @param vdbVersion - version of the VDB
@@ -683,164 +325,117 @@
* @throws AdminException if there's a system error.
* @since 4.3
*/
-Collection getConnectorBindingsInVDB(String vdbName, String vdbVersion) {
+Collection getConnectorBindingsInVDB(String vdbName, int vdbVersion) {
checkAdmin();
- result = currentContext().internalAdmin.getConnectorBindingsInVDB(vdbName, vdbVersion);
+ result = internalAdmin.getConnectorBindingsInVDB(vdbName, vdbVersion);
debug(result);
return result;
}
/**
- * Get all of the Connector Bindings in the system.
+ * Get the Connector Bindings that are available in the configuration
*
* @return Collection of {@link ConnectorBinding}
* @throws AdminException if there's a system error.
- * @since 4.3
*/
Collection getConnectorBindings() {
checkAdmin();
- result = getConnectorBindings("*");
+ result = internalAdmin.getConnectorBindings();
debug(result);
return result;
}
+
/**
- * Get the Connector Bindings that correspond to the specifed identifer pattern.
- *
- * @param connectorBindingIdentifier the unique identifier pattern of {@link ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector bindings in the system
- * <li> <code>"name*"</code> - for all connector bindings that begin with given name
- * <li><code>"name"</code> - for single connector binding by the given name
- * </ul>
- * @return Collection of {@link ConnectorBinding}
+ * Get the connector binding by the given the deployed name.
+ * @param deployedName - name of the deployed connector binding
+ * @return null if not found a connector binding by the given name
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getConnectorBindings(String connectorBindingIdentifier) {
+ConnectorBinding getConnectorBinding(String deployedName) {
checkAdmin();
- result = currentContext().internalAdmin.getConnectorBindings(connectorBindingIdentifier);
+ result = internalAdmin.getConnectorBinding(deployedName);
debug(result);
- return result;
+ return result;
}
/**
- * Get the Extension Modules that correspond to the specified identifer pattern
- * @param extensionModuleIdentifier - the unique identifier for {@link ExtensionModule}
- * <ul>
- * <li> <code>"*"</code> - for all extension modules in the system
- * <li> <code>"name*"</code> - for all the extension modules in that begin with given name
- * <li><code>"name"</code> - for a single extension module identified by given name
- * </ul>
- * @return Collection of {@link ExtensionModule}
+ * Get the Work Manager stats that correspond to the specified identifier pattern.
+ *
+ * @param identifier - an identifier for the queues {@link QueueWorkerPool}. "runtime" will return the stats for Query
+ * runtime Worker Pool. Also any Connector Binding name will return the stats for that connector binding.
+ * @return Collection of {@link QueueWorkerPool}
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getExtensionModules(String extensionModuleIdentifier) {
+WorkerPoolStatistics getWorkManagerStats(String identifier) {
checkAdmin();
- result =currentContext().internalAdmin.getExtensionModules(extensionModuleIdentifier);
+ result =internalAdmin.getWorkManagerStats(identifier);
debug(result);
return result;
}
/**
- * Get the Queue Worker Pools that correspond to the specified identifer pattern.
+ * Get the Connection Pool Stats that correspond to the specified identifier pattern.
+ * If the {@link ConnectionPoolStatistics ConnectionPool} represents an XA connection, there
+ * will be 2 {@link ConnectionPoolStatistics ConnectionPool}s.
*
- * @param identifier - an identfier for the queues {@link QueueWorkerPool}
- * <ul>
- * <li> <code>"*"</code> - for all Queue workers in the system
- * <li> <code>"name*"</code> - for all the Queue workers in that begin with given name
- * <li><code>"name"</code> - for a single queue in the system
- * </ul>
- * for example, In DQP - "dqp" will return the Stats for DQP Worker Pool. Also any Connector Binding
- * name will return the stats for that connector binding.
- * @return Collection of {@link QueueWorkerPool}
+ * @param deployedName - an identifier that corresponds to the ConnectorBinding Name
+ * @return {@link ConnectionPoolStatistics}
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getQueueWorkerPools(String identifier) {
+ConnectionPoolStatistics getConnectorConnectionPoolStats(String deployedName) {
checkAdmin();
- result =currentContext().internalAdmin.getQueueWorkerPools(identifier);
+ result =internalAdmin.getConnectorConnectionPoolStats(deployedName);
debug(result);
- return result;
+ return result;
}
/**
- * Get the Caches that correspond to the specified identifer pattern
- * @param identifier - an identifier for the cache in {@link Cache}
- * <ul>
- * <li> <code>"*"</code> - for all different caches in the system
- * <li> <code>"name*"</code> - for all the caches that begin with given name
- * <li><code>"name"</code> - for a single cache in the system
- * </ul>
- * @return Collection of {@link Cache}
+ * Get the Caches that correspond to the specified identifier pattern
+ * @return Collection of {@link String}
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getCaches(String identifier) {
+Collection getCacheTypes() {
checkAdmin();
- result =currentContext().internalAdmin.getCaches(identifier);
+ result =internalAdmin.getCacheTypes();
debug(result);
return result;
}
/**
- * Get the Sessions that correspond to the specified identifer pattern
- * @param identifier - an unique identifier for {@link Session}
- * <ul>
- * <li> <code>"*"</code> - for all current sessions of the system
- * <li> <code>"number*"</code> - for all the sessions that begin with given number
- * <li><code>"number"</code> - for a single current session in the system
- * </ul>
+ * Get all the current Sessions.
* @return Collection of {@link Session}
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getSessions(String identifier) {
+Collection getSessions() {
checkAdmin();
- result =currentContext().internalAdmin.getSessions(identifier);
+ result =internalAdmin.getSessions();
debug(result);
return result;
}
/**
- * Get the Requests that correspond to the specified identifer pattern
- * @param identifier - An Identifier for {@link Request}
- * <ul>
- * <li> <code>"*"</code> - for all current in process requests of the system
- * <li> <code>"number* or number<{@link AdminObject#DELIMITER_CHAR}>*"</code> - for all the sessions
- * that begin with given number, or all the requests for perticular session etc.
- * <li><code>"number<{@link AdminObject#DELIMITER_CHAR}>number"</code> - for a single request in the system
- * </ul>
+ * Get the all Requests that are currently in process
* @return Collection of {@link Request}
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getRequests(String identifier) {
+Collection getRequests() {
checkAdmin();
- result =currentContext().internalAdmin.getRequests(identifier);
+ result =internalAdmin.getRequests();
debug(result);
return result;
}
/**
- * Get the Source Request that correspond to the specified identifer pattern
- * @param identifier An Identifier for {@link Request}
- * <ul>
- * <li> <code>"*"</code> - for all current in process requests of the system
- * <li> <code>"number* or number<{@link AdminObject#DELIMITER_CHAR}>* or number.number.*"</code> - for all the sessions
- * that begin with given number, or all the requests for perticular session etc.
- * <li><code>"number<{@link AdminObject#DELIMITER_CHAR}>number<{@link AdminObject#DELIMITER_CHAR}>number"</code> - for a single source request in the system
- * </ul>
- * @return Collection of {@link SourceRequest}
+ * Get the Requests for the given session
+ * @return Collection of {@link Request}
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-Collection getSourceRequests(String identifier) {
+Collection getRequestsForSession(long sessionId){
checkAdmin();
- result =currentContext().internalAdmin.getSourceRequests(identifier);
+ result =internalAdmin.getRequestsForSession(sessionId);
debug(result);
- return result;
+ return result;
}
/**
@@ -851,7 +446,7 @@
*/
Collection getConnectorTypePropertyDefinitions(String identifier){
checkAdmin();
- result = currentContext().internalAdmin.getConnectorTypePropertyDefinitions(identifier);
+ result = internalAdmin.getConnectorTypePropertyDefinitions(identifier);
debug(result);
return result;
}
@@ -868,7 +463,7 @@
*/
Collection getProcesses(String processIdentifier) {
checkAdmin();
- result =currentContext().internalAdmin.getProcesses(processIdentifier);
+ result =internalAdmin.getProcesses(processIdentifier);
debug(result);
return result;
}
@@ -884,372 +479,89 @@
/**
* Start Connector Binding
*
- * @param connectorBindingIdentifier identifier for {@link org.teiid.adminapi.ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector bindings in the system
- * <li> <code>"name*"</code> - for all connector bindings that begin with given name
- * <li><code>"name"</code> - for single connector binding by the given name
- * </ul>
+ * @param deployedName
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-void startConnectorBinding(String connectorBindingIdentifier) {
- debug("Starting Connector Binding " + connectorBindingIdentifier);
+void startConnectorBinding(String deployedName) {
+ debug("Starting Connector Binding " + deployedName);
checkAdmin();
- currentContext().internalAdmin.startConnectorBinding(connectorBindingIdentifier);
+ internalAdmin.startConnectorBinding(deployedName);
}
/**
* Stop Connector Binding
*
- * @param connectorBindingIdentifier identifier for {@link org.teiid.adminapi.ConnectorBinding}
- * <ul>
- * <li> <code>"*"</code> - for all connector bindings in the system
- * <li> <code>"name*"</code> - for all connector bindings that begin with given name
- * <li><code>"name"</code> - for single connector binding by the given name
- * </ul>
- * @throws AdminException - if there's a system error.
- * @since 4.3
+ * @param deployedName identifier for {@link org.teiid.adminapi.ConnectorBinding}
*/
-void stopConnectorBinding(String connectorBindingIdentifier) {
- debug("Stoping Connector Binding " + connectorBindingIdentifier);
+void stopConnectorBinding(String deployedName) {
+ debug("Stoping Connector Binding " + deployedName);
checkAdmin();
- currentContext().internalAdmin.stopConnectorBinding(connectorBindingIdentifier, true);
+ internalAdmin.stopConnectorBinding(deployedName, true);
}
/**
* Clear the cache or caches specified by the cacheIdentifier.
- * @param cacheIdentifier Cache name identifier {@link org.teiid.adminapi.Cache}.
+ * @param cacheType Cache Type
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-void clearCache(String cacheIdentifier) {
+void clearCache(String cacheType) {
+ debug("Clearing cache type " + cacheType);
checkAdmin();
- currentContext().internalAdmin.clearCache(cacheIdentifier);
+ internalAdmin.clearCache(cacheType);
}
/**
* Terminate the Session
*
- * @param identifier Session Idenitfier {@link org.teiid.adminapi.Session}.
+ * @param identifier Session Identifier {@link org.teiid.adminapi.Session}.
* No wild cards currently supported, must be explicit
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-void terminateSession(String identifier) {
- debug("Terminating Session " + identifier);
+void terminateSession(long sessionId) {
+ debug("Terminating Session " + sessionId);
checkAdmin();
- currentContext().internalAdmin.terminateSession(identifier);
+ internalAdmin.terminateSession(sessionId);
}
/**
* Cancel Request
*
- * @param identifier The request identifer defined by {@link org.teiid.adminapi.Request}
- * No wild cards currently supported, must be explicit
+ * @param sessionId session Identifier for the request.
+ * @param requestId request Identifier
+ *
* @throws AdminException if there's a system error.
- * @since 4.3
*/
-void cancelRequest(String identifier) {
- debug("Canceling Request " + identifier);
+void cancelRequest(long sessionId, long requestId) {
+ debug("Canceling Request Session=" + sessionId + " request id = "+requestId);
checkAdmin();
- currentContext().internalAdmin.cancelRequest(identifier);
+ internalAdmin.cancelRequest(sessionId, requestId);
}
/**
- * Cancel Source Request
- *
- * @param identifier The request identifer defined by {@link org.teiid.adminapi.Request}
- * No wild cards currently supported, must be explicit
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void cancelSourceRequest(String identifier) {
- debug("Canceling Source Request " + identifier);
- checkAdmin();
- currentContext().internalAdmin.cancelSourceRequest(identifier);
-}
-
-/**
- * Change the status of a Deployed VDB
- *
- * @param name Name of the Virtial Database
- * @param version Version of the Virtial Database
- * @param status Active, InActive, Delete. See {@link VDB}
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void changeVDBStatus(String name, String version, int status) {
- debug("Changing VDB " + name + " version " + version + " to Status " + status);
- checkAdmin();
- currentContext().internalAdmin.changeVDBStatus(name, version, status);
-}
-
-/**
- * Change the status of a Deployed VDB to DELETED.
- *
- * @param name Name of the Virtial Database
- * @param version Version of the Virtial Database
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void deleteVDB(String name, String version) {
- checkAdmin();
- currentContext().internalAdmin.changeVDBStatus(name, version, VDB.DELETED);
-}
-
-/**
- * Delete a Deployed VDB and its Connector Bindings.
- *
- * @param name Name of the Virtial Database
- * @param version Version of the Virtial Database
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void deleteVDBAndConnectorBindings(String name, String version) {
- checkAdmin();
-
- Collection connectorBindings = currentContext().internalAdmin.getConnectorBindingsInVDB(name , version);
-
- currentContext().internalAdmin.changeVDBStatus(name, version, VDB.DELETED);
- for ( Iterator itr = connectorBindings.iterator(); itr.hasNext();) {
- String bindingName = ((ConnectorBinding)itr.next()).getName();
- if (hasBinding(bindingName)) {
- currentContext().internalAdmin.deleteConnectorBinding(bindingName);
- }
- }
-}
-
-/**
- * Set the log listener to install into MM Query. This log listener will receive all log messages
- * written by the MM Query at it's current log level and log contexts.
- *
- * @param listener The listener component
- * @throws AdminException if there's a system error.
- * @since 4.3
- */
-void setLogListener(EmbeddedLogger listener) {
- checkAdmin();
- currentContext().internalAdmin.setLogListener(listener);
-}
-
-/**
- * Stop the MM Query. If millisToWait is >0, then close to incoming queries, wait the time period
+ * Stop the Teiid. If millisToWait is >0, then close to incoming queries, wait the time period
* for work to stop, then stop the MM Query. Otherwise, stop immediately, aborting all running queries.
- * the current connection will be disconnected.
* @param millisToWait Milliseconds to wait (if >0) or <=0 for no wait before stopping
* @throws AdminException
- * @since 4.3
*/
void shutdown(int millisToWait) {
checkAdmin();
- currentContext().internalAdmin.shutdown(millisToWait);
+ internalAdmin.shutdown(millisToWait);
disconnect();
}
/**
- * Restart System; the current connection will be disconnected.
+ * Restart System
* @throws AdminException if there's a system error.
- * @since 4.3
*/
void restart() {
checkAdmin();
- currentContext().internalAdmin.restart();
+ internalAdmin.restart();
disconnect();
}
-//*********************************************************************************************
-// Security Methods
-//
-//*********************************************************************************************
-/**
- * Get the Collection of administrative role names possessed by the given group, if any.
- *
- * @param groupIdentifier
- * The unique identifier for the {@link Group}. This is group name. A user is a {@link Principal} and a
- * Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains.
- * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @return The Collection of {@link Role}s.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-Collection getRolesForGroup(String groupIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getRolesForGroup(groupIdentifier);
- debug(result);
- return result;
-}
-/**
- * Get the group memberships for the given user.
- *
- * @param userIdentifier
- * The unique identifier for the {@link User}. This is generally a user name. A user is a {@link Principal} and a
- * Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains.
- * The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @return The collection of groups in which the given user has membership.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-Collection getGroupsForUser(String userIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getGroupsForUser(userIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Get the group denoted by the given <code>groupIdentifier</code>.
- *
- * @param groupIdentifier
- * The unique identifier for the {@link Group}. This is generally a group name. A group is a {@link Principal} and
- * a Principal name is considered to be unique throughout the MetaMatrix system across all Membership domains. <br>
- * Note that by supplying the {@link AdminObject#WILDCARD WILDCARD} identifier, all all users in the system will
- * retrieved.</br>
- * @return The Collection of users.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-Collection getGroups(String groupIdentifier) {
- checkAdmin();
- result = currentContext().internalAdmin.getGroups(groupIdentifier);
- debug(result);
- return result;
-}
-
-/**
- * Assign to the given {@link Group} the given Administrative Role.
- *
- * @param roleIdentifier
- * one of {@link AdminRoles}.
- * @param groupIdentifier
- * the unique identifier for the Principal. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void assignRoleToGroup(String roleIdentifier, String groupIdentifier) {
- checkAdmin();
- currentContext().internalAdmin.assignRoleToGroup(roleIdentifier, groupIdentifier);
-}
-
-/**
- * Remove an administrative role from the given {@link Group}.
- *
- * @param roleIdentifier
- * one of {@link AdminRoles}
- * @param groupIdentifier
- * the unique identifier for the Principal. The {@link AdminObject#WILDCARD WILDCARD} cannot be used here.
- * @throws AdminException
- * if there's a system error.
- * @since 4.3
- */
-void removeRoleFromGroup(String roleIdentifier, String groupIdentifier) {
- checkAdmin();
- currentContext().internalAdmin.removeRoleFromGroup(roleIdentifier, groupIdentifier);
-}
-
-
-/**
- * Import the data Roles for given vdb and version into the connected server
- * @param vdbName - target name of the VDB, the roles to be imported under
- * @param vdbVersion - target version of the vdb, the roles to be imported under
- * @param filename - character data array containing the XML file which defines the roles
- * @param options - options to overwrite in case the matching roles already exist.
- * @throws AdminException
- */
-void importDataRoles(String vdbName, String vdbVersion, String filename, int options) {
- checkAdmin();
- currentContext().internalAdmin.importDataRoles(vdbName, vdbVersion, readTextFile(filename), new AdminOptions(options));
-}
-
-/**
- * Import the data Roles for given vdb and version into the connected server
- * @param vdbName - target name of the VDB, the roles to be imported under
- * @param vdbVersion - target version of the vdb, the roles to be imported under
- * @param filename - character data array containing the XML file which defines the roles
- * @throws AdminException
- */
-void importDataRoles(String vdbName, String vdbVersion, String filename) {
- checkAdmin();
- currentContext().internalAdmin.importDataRoles(vdbName, vdbVersion, readTextFile(filename), null);
-}
-
-
-/**
- * Export the data roles defined for the given vdb fromthe current system
- * @param vdbName - Name of the vdb
- * @param vdbVersion - version of the vdb
- * @param filename - name of the file to export the contents under.
- * @return - char[] stream containing the XML contents of the roles.
- * @throws AdminException
- */
-void exportDataRoles(String vdbName, String vdbVersion, String fileName) {
- checkAdmin();
- contents = currentContext().internalAdmin.exportDataRoles(vdbName, vdbVersion);
- if (contents != null) {
- ObjectConverterUtil.write(contents, fileName);
- }
- else {
- throw new AdminProcessingException("Data roles not found for VDB "+ vdbName + " with version "+ vdbVersion);
- }
-}
-
-
-/**
- * @param domainprovidername is the name to be assigned to the newly created {@link AuthenticationProvider}
- * @param providertypename is the type of provider to create.
- * There are 3 installed provider types and they are:
- * <ul>
- * <li> <code>File Membership Domain Provider</code>
- * <li> <code>LDAP Membership Domain Provider</code>
- * <li><code>Custom Membership Domain Provider</code>
- * </ul>
- * @param properties are the settings specified by the providertype to be used
- * @throws AdminException
- * if there's a system error.
- * @since 5.5.2
-
-void addAuthorizationProvider(String domainprovidername, String providertypename, Properties properties) {
- checkAdmin();
- currentContext().internalAdmin.addAuthorizationProvider(domainprovidername, providertypename, properties);
-}
- */
-
-/**
- * Returns the active authorization provider domain names, in authentication order.
- * @return List<String>
- * @throws AdminException
- */
-List getDomainNames() {
- checkAdmin();
- result = currentContext().internalAdmin.getDomainNames();
- debug(result);
- return result;
-}
-
-
-
-/**
- * Return the {@link Group}s for a given domain. The domain name must be an specified
- * exactly. See {@link #getActiveDomainNames()} for possible domain names.
- * @param domainName
- * @return
- * @throws AdminException
- */
-Collection getGroupsForDomain(String domainName){
- checkAdmin();
- result = currentContext().internalAdmin.getGroupsForDomain(domainName);
- debug(result);
- return result;
-}
-
-
//*********************************************************************************************
// Utility Methods
//
@@ -1263,7 +575,7 @@
*/
boolean hasVDB(String vdbName) {
checkAdmin();
- Collection vdbs = currentContext().internalAdmin.getVDBs(vdbName);
+ Collection vdbs = internalAdmin.getVDBs();
for (VDB vdb:vdbs) {
if (vdb.getName().equals(vdbName)) {
debug(true);
@@ -1280,9 +592,9 @@
* @param version - version of the VDB
* @return boolean - true if exists; false otherwise
*/
-boolean hasVDB(String vdbName, String version) {
+boolean hasVDB(String vdbName, int version) {
checkAdmin();
- Collection vdbs = currentContext().internalAdmin.getVDBs(vdbName);
+ Collection vdbs = internalAdmin.getVDBs();
for (VDB vdb:vdbs) {
if (vdb.getName().equals(vdbName) && vdb.getVDBVersion().equals(version)) {
debug(true);
@@ -1300,7 +612,7 @@
*/
boolean hasBinding(String bindingName) {
checkAdmin();
- Collection bindings = currentContext().internalAdmin.getConnectorBindings(AdminObject.WILDCARD + AdminObject.DELIMITER + bindingName);
+ Collection bindings = internalAdmin.getConnectorBindings();
for (ConnectorBinding binding:bindings) {
if (binding.getName().equals(bindingName)) {
@@ -1319,7 +631,7 @@
*/
boolean hasConnectorType(String typeName) {
checkAdmin();
- Collection types = currentContext().internalAdmin.getConnectorTypes(typeName);
+ Collection types = internalAdmin.getConnectorTypes();
for (ConnectorType type:types) {
if (type.getName().equals(typeName)) {
@@ -1330,27 +642,3 @@
debug(false);
return false;
}
-
-/**
- * Checks if given Extension Module exists in system
- * @param name - Extension Module name
- * @return boolean - true if exists; false otherwise
- */
-boolean hasExtensionModule(String name) {
- checkAdmin();
- Collection modules = null;
-
- try {
- modules = currentContext().internalAdmin.getExtensionModules(name);
-
- for(ExtensionModule module:modules) {
- if (module.getName().equals(name)) {
- debug(true);
- return true;
- }
- }
- }catch(e) {}
- debug(false);
- return false;
-}
-
Modified: trunk/adminshell/src/main/resources/scripts/context.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/context.bsh 2010-03-04 17:57:09 UTC (rev 1901)
+++ trunk/adminshell/src/main/resources/scripts/context.bsh 2010-03-04 18:01:33 UTC (rev 1902)
@@ -1,6 +1,7 @@
import bsh.This;
//TODO: deprecate the stacking nature of the context and only allow flat?
+internalAdmin=null;
if(global.scriptContext == void) {
global.contextMap = new HashMap();
Modified: trunk/adminshell/src/main/resources/scripts/server.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/server.bsh 2010-03-04 17:57:09 UTC (rev 1901)
+++ trunk/adminshell/src/main/resources/scripts/server.bsh 2010-03-04 18:01:33 UTC (rev 1902)
@@ -8,23 +8,25 @@
import java.sql.*;
import com.metamatrix.common.api.MMURL;
-import com.metamatrix.common.comm.platform.client.ServerAdminFactory;
+import org.teiid.adminapi.*;
// These values are default values, a user can supply a property file called
// "connection.properties" those values will replace one below
String auto_jdbc_url="jdbc:teiid:admin@mm://localhost:31000";
-String auto_user="admin";
-String auto_password="teiid";
-String auto_admin_url="mm://localhost:31000";
-
+String auto_jdbc_user="admin";
+String auto_jdbc_password="teiid";
+String auto_admin_user="admin";
+String auto_admin_password="admin";
+String auto_admin_url="jnp://localhost:1099";
String connection_prefix="conn";
+
/**
* Connect to the server using the properties specified in the connection.properties file.
* use currentConnectionName() to get connection name
*/
Connection connect () {
- return connect(auto_jdbc_url+";user="+auto_user+";password="+auto_password);
+ return connect(auto_jdbc_url+";user="+auto_jdbc_user+";password="+auto_jdbc_password);
}
/**
@@ -43,7 +45,6 @@
try {
com.metamatrix.jdbc.api.Connection mmConn = connectDriver(driver, url);
currentContext().internalPrompt = contextName+"["+extractVDBName(url)+"@"+extractHost(url)+"] $ ";
- currentContext().internalAdmin = createExceptionHandlingProxy(mmConn.getAdminAPI());
return mmConn;
} catch(e) {
parentContext();
@@ -62,7 +63,7 @@
* Current Connection Name.
*/
String currentConnectionName() {
- if ((getConnection() != null || currentContext().internalAdmin != null) && currentContext().name != void && currentContext().name != null) {
+ if (getConnection() != null && currentContext().name != void && currentContext().name != null) {
return currentContext().name;
}
throw new Exception("No Connection exists; or it is not a named connection");
@@ -77,25 +78,20 @@
*
* @param username
* @param password
-* @param url - URL in the format "mm://servername:port" or "jdbc:metamatrix:VDB@mm://servername:port".
+* @param url - URL in the format "mms://localhost:31443"
*/
void connectAsAdmin(String username, String password, String url) {
if (MMURL.isValidServerURL(url)) {
- String contextName = genConnectionName();
- newContext(contextName);
try {
//url is in "server URL format": connect via ServerAdminFactory
- currentContext().internalAdmin = createExceptionHandlingProxy(ServerAdminFactory.getInstance().createAdmin(username, password.toCharArray(), url));
- currentContext().internalPrompt = currentConnectionName()+"["+url+"] $ ";
+ internalAdmin = createExceptionHandlingProxy(AdminFactory.getInstance().createAdmin(username, password.toCharArray(), url));
} catch(e) {
- parentContext();
print("Failed to connect: {"+e.getMessage()+"}");
debug(e);
- return null;
}
} else {
- print("Wrong syntax for the URL.. connection failed.");
+ print("Wrong syntax for the URL.. connection failed. ex: \"jnp://localhost:1099\"");
}
}
@@ -103,22 +99,25 @@
* Connect as Admin using the defaults from connection.properties
*/
void connectAsAdmin() {
- connectAsAdmin(auto_user, auto_password, auto_admin_url);
+ connectAsAdmin(auto_admin_user, auto_admin_password, auto_admin_url);
}
+void closeAdmin() {
+ try {
+ if (internalAdmin != void && internalAdmin != null) {
+ internalAdmin.close();
+ internalAdmin = null;
+ }
+ }catch(e) {
+ //ignore..
+ }
+}
/**
* Disconnect the connection from the server
*/
void disconnect() {
closeConnection();
-
- try {
- if (currentContext().internalAdmin != void && currentContext().internalAdmin != null) {
- currentContext().internalAdmin=null;
- }
- }catch(e) {
- //ignore..
- }
+ closeAdmin();
currentContext().internalPrompt = null;
}
@@ -138,13 +137,21 @@
auto_admin_url = p.getProperty("admin.url");
}
- if (p.getProperty("user") != null) {
- auto_user = p.getProperty("user");
+ if (p.getProperty("jdbc.user") != null) {
+ auto_jdbc_user = p.getProperty("jdbc.user");
}
- if (p.getProperty("password") != null) {
- auto_password = p.getProperty("password");
- }
+ if (p.getProperty("jdbc.password") != null) {
+ auto_jdbc_password = p.getProperty("jdbc.password");
+ }
+
+ if (p.getProperty("admin.user") != null) {
+ auto_admin_user = p.getProperty("admin.user");
+ }
+
+ if (p.getProperty("admin.password") != null) {
+ auto_admin_password = p.getProperty("admin.password");
+ }
}
//help methods
Modified: trunk/adminshell/src/main/resources/scripts/util.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/util.bsh 2010-03-04 17:57:09 UTC (rev 1901)
+++ trunk/adminshell/src/main/resources/scripts/util.bsh 2010-03-04 18:01:33 UTC (rev 1902)
@@ -17,13 +17,8 @@
}
void checkAdmin() {
- context = currentContext();
- if (context == void || context == null) {
- throw new Exception("Not connected. You must call a \"connect\" method");
- }
-
- if (context.internalAdmin == void || context.internalAdmin == null) {
- throw new Exception("Not connected. You must call a \"connect\" method");
+ if (internalAdmin == void || internalAdmin == null) {
+ throw new Exception("Not connected. You must call a \"connectAsAdmin\" method");
}
}
@@ -89,7 +84,7 @@
}
Object createExceptionHandlingProxy(Object obj) {
- return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new ExceptionHandler(obj));
+ return Proxy.newProxyInstance(obj.getClass().getClassLoader(), new Class[] {Admin.class}, new ExceptionHandler(obj));
}
boolean interactive() {
14 years, 2 months
teiid SVN: r1901 - in trunk/build: assembly and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-04 12:57:09 -0500 (Thu, 04 Mar 2010)
New Revision: 1901
Added:
trunk/build/assembly/jboss-container/
trunk/build/kit-jboss-container/
Modified:
trunk/build/assembly/adminshell/adminshell-dependencies.xml
trunk/build/kit-adminshell/connection.properties
trunk/build/pom.xml
Log:
TEIID-833 committing merge
Modified: trunk/build/assembly/adminshell/adminshell-dependencies.xml
===================================================================
--- trunk/build/assembly/adminshell/adminshell-dependencies.xml 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/build/assembly/adminshell/adminshell-dependencies.xml 2010-03-04 17:57:09 UTC (rev 1901)
@@ -28,11 +28,6 @@
<unpack>false</unpack>
<useTransitiveDependencies>true</useTransitiveDependencies>
<useDefaultExcludes>true</useDefaultExcludes>
- <excludes>
- <exclude>org.jboss.teiid:teiid-client</exclude>
- <exclude>org.jboss.teiid:teiid-client-jdbc</exclude>
- <exclude>org.jboss.teiid:teiid-common-core</exclude>
- </excludes>
</dependencySet>
</dependencySets>
Copied: trunk/build/assembly/jboss-container (from rev 1900, branches/JCA/build/assembly/jboss-container)
Modified: trunk/build/kit-adminshell/connection.properties
===================================================================
--- trunk/build/kit-adminshell/connection.properties 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/build/kit-adminshell/connection.properties 2010-03-04 17:57:09 UTC (rev 1901)
@@ -1,4 +1,7 @@
-user=admin
-password=teiid
+jdbc.user=admin
+jdbc.password=teiid
jdbc.url=jdbc:teiid:admin@mm://localhost:31000;
-admin.url=mm://localhost:31000
\ No newline at end of file
+
+admin.url=mm://localhost:31443
+admin.user=admin
+admin.password=admin
Copied: trunk/build/kit-jboss-container (from rev 1900, branches/JCA/build/kit-jboss-container)
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2010-03-04 15:18:19 UTC (rev 1900)
+++ trunk/build/pom.xml 2010-03-04 17:57:09 UTC (rev 1901)
@@ -7,112 +7,25 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>build</artifactId>
- <packaging>pom</packaging>
<name>Build</name>
<description>Teiid Build</description>
<build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy</id>
- <phase>package</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <!-- addition of a new connector goes here as an bundle -->
- <artifactItem>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-connector-api</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>connector-xml</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>connector-xml-common</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>connector-jdbc</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>connector-text</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>connector-ldap</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>connector-loopback</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- <artifactItem>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>connector-salesforce</artifactId>
- <version>${pom.version}</version>
- <classifier>bundle</classifier>
- <type>zip</type>
- <overWrite>true</overWrite>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>assemble-artifacts</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <ant antfile="assembly/runtime/build-configuration.xml" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
+ <outputDirectory>target/kit-jboss-container</outputDirectory>
+ <resources>
+ <resource>
+ <directory>kit-jboss-container</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>kit-jboss-container</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
</build>
</project>
\ No newline at end of file
14 years, 2 months
teiid SVN: r1900 - branches/JCA/client/src/main/java/org/teiid/adminapi/impl.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-04 10:18:19 -0500 (Thu, 04 Mar 2010)
New Revision: 1900
Modified:
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
Log:
TEIID-998: fixing compilation issue
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java 2010-03-04 05:02:09 UTC (rev 1899)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java 2010-03-04 15:18:19 UTC (rev 1900)
@@ -59,7 +59,7 @@
"allowCreate",
"allowRead",
"allowUpdate",
- "allowDelete",
+ "allowDelete"
})
@ManagementObject
public class DataRoleMetadata implements Serializable {
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-04 05:02:09 UTC (rev 1899)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-04 15:18:19 UTC (rev 1900)
@@ -51,7 +51,7 @@
"description",
"JAXBProperties",
"JAXBModels",
- "securityRoleMappings",
+ "securityRoleMappings"
})
@XmlRootElement(name = "vdb")
public class VDBMetaData extends AdminObjectImpl implements VDB {
14 years, 2 months