Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9BBAA18D8B for ; Fri, 3 Jul 2015 19:22:00 +0000 (UTC) Received: (qmail 23712 invoked by uid 500); 3 Jul 2015 19:22:00 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 23675 invoked by uid 500); 3 Jul 2015 19:22:00 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 23666 invoked by uid 99); 3 Jul 2015 19:22:00 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jul 2015 19:22:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C03D81A6628 for ; Fri, 3 Jul 2015 19:21:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.791 X-Spam-Level: * X-Spam-Status: No, score=1.791 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id gqfhj-LKesyG for ; Fri, 3 Jul 2015 19:21:30 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id E9E682D8FF for ; Fri, 3 Jul 2015 19:21:07 +0000 (UTC) Received: (qmail 18417 invoked by uid 99); 3 Jul 2015 19:21:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jul 2015 19:21:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C408AE33C9; Fri, 3 Jul 2015 19:21:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rvs@apache.org To: commits@geode.incubator.apache.org Date: Fri, 03 Jul 2015 19:21:48 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [47/51] [partial] incubator-geode git commit: SGA #2 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/release/installer/INSTALL.txt ---------------------------------------------------------------------- diff --git a/databrowser/release/installer/INSTALL.txt b/databrowser/release/installer/INSTALL.txt new file mode 100644 index 0000000..6aca98f --- /dev/null +++ b/databrowser/release/installer/INSTALL.txt @@ -0,0 +1,60 @@ + INSTALLATION OF vFabric GFDataBrowser + ------------------------------------- + + This document describes installation of DataBrowser __VERSION__ + + To install GFDataBrowser, you will need: + + * Java Runtime Environment 1.5.0 or higher. + * vFabric GemFire (required at runtime) + + Minimum System Requirements + * Windows XP SP2 on Intel 2 GHz Pentium 4 (or equivalent) 1 GB RAM + * Linux Intel 2GHz Pentium 4 (or equivalent) 1 GB RAM + + Running the Installer + --------------------- + + Invoke the installer with this command line: + + Windows: + %JAVA_HOME%\bin\java.exe -jar __JAR_NAME__ + + UNIX and Linux: + ${JAVA_HOME}/bin/java -jar __JAR_NAME__ + + 1) A License Agreement (EULA) will be displayed + 2) You will then be prompted to choose an installation directory. + The product will be expanded into the directory specified. + The total disk space required is approximately __SIZE__ Megabytes. + + If you have difficulties getting the installer to work correctly + you have the option of unzipping the jar file directly using + any common zip extraction tool. + + Optional Installer System Properties + ------------------------------------ + + -Dgemstone.installer.directory= + + Specifies the directory to install GFDataBrowser into and causes the + installer to run in an unattended mode suitable for automation. The + directory /__PRODUCT_DIR__ will be created. The installation + will fail rather than overwrite preexisting files. + + Uninstalling GFDataBrowser + -------------------- + + To uninstall GFDataBrowser delete the product tree. + No additional registry entries or system modifications are needed. + + Contacting Support + --------------------------- + VMware Support Services can be accessed from the VMware Web site + or via the phone. Access varies by license type, support offering + (contract or per-incident) and product. For instructions on how to + file a Support Request, please see the VMware web page below on + "How to File a Support Request". + + https://www.vmware.com/support/policies/howto.html + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/release/installer/ZipSelfExtractor.java ---------------------------------------------------------------------- diff --git a/databrowser/release/installer/ZipSelfExtractor.java b/databrowser/release/installer/ZipSelfExtractor.java new file mode 100644 index 0000000..cce4504 --- /dev/null +++ b/databrowser/release/installer/ZipSelfExtractor.java @@ -0,0 +1,627 @@ +/* ZipSelfExtractor.java */ + +import java.io.*; +import java.net.*; +import java.util.zip.*; +import java.util.*; +import java.util.jar.*; + +/** + * The abstract base for GemFire like products. This class + * needs to be extend to provide product specific + * names/functionality. + * @see {@link createJars} + * @see {@link getInstallDirProperty} + * @see {@link getInstallOpenSource} + * @see {@link getProductJarName} + * + * The following support files may also need to be customized. + * @see i18n.properties + * @see EULA.txt + * @author kbanks + */ +public abstract class ZipSelfExtractor +{ + private boolean isInteractive; + + /** This must match the name used in build.xml#build-installer */ + private final static String OSS_JAR = "oss.jar"; + private final static String OSS_PATTERN = ".*/opensource/.*"; + + private static int FILES_PER_DOT = 5; + private static final int YES = 1; + private static final int YES_TO_ALL = 2; + private static final int NO = 3; + private static final int CANCEL = 4; + protected File installDir; + private PropertyResourceBundle rb; + private Throwable error; + + private static final String MANIFEST = "META-INF/MANIFEST.MF"; + private static final String EULA = "EULA.txt"; + private static final String I18N = "i18n"; + + /** A series of calls to {@link createJar} */ + protected abstract void createJars() throws IOException; + /** @return the name of the property that specifies the + * installation directory for an unattended installation */ + protected abstract String getInstallDirProperty(); + /** @return the name of the boolean property that controls + * opensource installation */ + protected abstract String getInstallOpenSourceProperty(); + + /** @return the name of the jar that contains the product */ + protected abstract String getProductJarName(); + + private void setError(Throwable t) { + if(error == null) { + error = t; + } + } + + private void handleFailure() throws Throwable { + if (error != null) { + if ( error instanceof InstallationCancelled ) { + System.out.println(""); + Throwable cause = error.getCause(); + if (cause != null) { + //intentionally not getLocalizedMessage() + System.out.println(cause.getMessage()); + } + //intentionally not getLocalizedMessage() + System.out.println(error.getMessage()); + System.exit(1); + } + System.out.println(""); + System.out.println(rb.getString("INSTALLATION_FAILED")); + System.out.println(error.getLocalizedMessage()); + throw error; + } + } + + protected ZipSelfExtractor() { + String directory = System.getProperty( getInstallDirProperty(), "."); + if (System.getProperty(getInstallDirProperty(), null) == null) { + isInteractive = true; + } else { + // User specified an install directory as a system Property + // Assuming unattended installation. + isInteractive = false; + } + installDir = new File(directory); + rb = (PropertyResourceBundle) ResourceBundle.getBundle(I18N, Locale.getDefault()); + } + + private String getJarFileName() { + String myClassName = this.getClass().getName() + ".class"; + URL urlJar = ClassLoader.getSystemResource(myClassName); + String urlStr = null; + try { + urlStr = URLDecoder.decode(urlJar.toString(), "UTF-8"); + } catch ( UnsupportedEncodingException uee ) { + //This should never happen because UTF-8 is required to be implemented + throw new RuntimeException(uee); + } + int from = "jar:file:".length(); + int to = urlStr.indexOf("!/"); + String jarName = urlStr.substring(from, to); + return jarName; + } + + private boolean getInstallOpenSource() { + return Boolean.getBoolean(getInstallOpenSourceProperty()); + } + + private void extract(String zipfile) { + System.out.println(rb.getString("BEGIN")); + File currentArchive = new File(zipfile); + displayEULA(); + queryInstallDir(); + byte[] buf = new byte[1024]; + boolean overwrite = false; + + ZipFile zf = null; + FileOutputStream out = null; + InputStream in = null; + + try { + zf = new ZipFile(currentArchive); + int size = zf.size(); + int extracted = 0; + System.out.print(""); + System.out.print(rb.getString("UNZIPPING_FILES")); + Enumeration entries = zf.entries(); + + String innerClassName = + InstallationCancelled.class.getName() + ".class"; + for (int i=0; i 0) { + out.write(buf, 0, nRead); + } else { + break; + } + } + + out.close(); + outFile.setLastModified(archiveTime.getTime()); + } + + zf.close(); + + File productDir = getProductDir(); + File binDir = new File(productDir, "bin"); + setPermissions(binDir.getAbsolutePath()); + + if ( getInstallOpenSource() ) { + System.out.println(); + System.out.println(rb.getString("INSTALLING_OPENSOURCE")); + + File libDir = new File(productDir, "lib"); + File productArchive = new File(libDir, getProductJarName()); + installOpenSource(productArchive); + + File ossArchive = new File(getOpenSourceDir(), OSS_JAR); + installOpenSource(ossArchive); + createJars(); + cleanUpOpenSourceDir(); + } + } catch (IOException ioe) { + setError(ioe); + if(zf!=null) { try { zf.close(); } catch(IOException ignore) {;} } + if(out!=null) { try {out.close();} catch(IOException ignore) {;} } + if(in!=null) { try { in.close(); } catch(IOException ignore) {;} } + throw new RuntimeException(rb.getString("INPUT_ERROR"), ioe); + } + System.out.println(""); + System.out.println(rb.getString("INSTALLATION_COMPLETE")); + } + + private void displayEULA() { + if (isInteractive) { + ClassLoader loader = this.getClass().getClassLoader(); + BufferedReader stream = null; + stream = new BufferedReader(new InputStreamReader(loader.getResourceAsStream(EULA))); + String line = null; + int count = 20; + try { + while (true) { + if ( count <= 0 ) { + System.out.println(""); + System.out.println(rb.getString("CONTINUE")); + System.out.flush(); + System.in.read(); + count = 20; + } + line = stream.readLine(); + count--; + if (line != null) { + System.out.println(line); + } else { + break; + } + } + stream.close(); + } catch (IOException ioe) { + setError(ioe); + throw new RuntimeException(rb.getString("EULA_ERROR"), ioe); + } + String response = ""; + final String agree = rb.getString("AGREE").toUpperCase(); + final String disagree = rb.getString("DISAGREE").toUpperCase(); + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + boolean flag = false; + while(! response.trim().toUpperCase().startsWith(agree)) { + if ( flag ) { + System.out.println(rb.getString("BE_LITERAL")); + } + flag = true; + if ( response.trim().toUpperCase().startsWith(disagree) ) { + throw new InstallationCancelled(rb.getString("CANCEL_INSTALL")); + } + System.out.println(""); + System.out.println(rb.getString("AGREE_TO_EULA")); + try { + response = br.readLine(); + } catch (IOException ioe) { + setError(ioe); + throw new RuntimeException(rb.getString("INPUT_ERROR"), ioe); + } + } + } + } + + private void queryInstallDir() { + boolean directoryIsChoosen = false; + if (! isInteractive) { + directoryIsChoosen = true; + validateInstallDir(); + } + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String response = ""; + while (! directoryIsChoosen) { + System.out.println(""); + System.out.println(rb.getString("CHOOSE_AN_INSTALL_DIRECTORY")); + String path; + try { + path = installDir.getCanonicalPath(); + } catch (IOException ioe) { + path = installDir.getPath(); + } + System.out.println("[" + path + "]"); + try { + response = br.readLine(); + if(! response.trim().equals("")) { + installDir = new File(response.trim()); + } + } catch (IOException ioe) { + setError(ioe); + throw new RuntimeException(rb.getString("INPUT_ERROR"), ioe); + } + directoryIsChoosen = validateInstallDir(); + } + } + + private boolean validateInstallDir() { + String path; + try { + path = installDir.getCanonicalPath(); + } catch (IOException ioe) { + path = installDir.getAbsolutePath(); + } + if (installDir.exists()) { + System.out.print(rb.getString("ACCEPT_INSTALL_DIRECTORY") + " "); + System.out.println(path + " [" + rb.getString("YES") + "]"); + } else { + System.out.println(rb.getString("DIRECTORY_DOES_NOT_EXIST_ACCEPT") + + " [" + rb.getString("YES") + "]"); + } + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String response = ""; + try { + if (isInteractive) { + response = br.readLine(); + } + response = response.trim().toUpperCase(); + final String yes = rb.getString("YES").toUpperCase(); + if( response.equals("") + || response.startsWith(yes)) { + if (! installDir.exists()) { + if (! installDir.mkdirs()) { + if (isInteractive) { + System.out.println(rb.getString("FAILED_TO_CREATE_DIRECTORY")); + return false; + } else { + IOException ioe = new IOException( + rb.getString("FAILED_TO_CREATE_DIRECTORY")); + throw new InstallationCancelled( + rb.getString("CANCEL_INSTALL"), ioe); + } + } + } + if (! installDir.canWrite()) { + if (isInteractive) { + System.out.println(rb.getString("DIRECTORY_LACKS_PERMISSIONS")); + return false; + } else { + IOException ioe = new IOException(rb.getString("DIRECTORY_LACKS_PERMISSIONS")); + throw new InstallationCancelled(rb.getString("CANCEL_INSTALL"), ioe); + } + } + return true; + } + } catch (IOException ioe) { + setError(ioe); + throw new RuntimeException(rb.getString("INPUT_ERROR"), ioe); + } + return false; + } + + private int overwrite(File outFile) { + if (! isInteractive) { + String msg = outFile.getPath() + ": " + rb.getString("FILE_CONFLICT"); + IOException ioe = new IOException(msg); + throw new InstallationCancelled(rb.getString("CANCEL_INSTALL"), ioe); + //play it safe and exit if the files exist + } + + System.out.println("\n"); + System.out.println(rb.getString("FILE_CONFLICT")); + + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String response; + while(true) { + System.out.println(outFile.getPath() + ":\n" + + rb.getString("OVERRWRITE")); + try { + response = br.readLine(); + } catch (IOException ioe) { + setError(ioe); + throw new RuntimeException(rb.getString("INPUT_ERROR"), ioe); + } + try { + int choice = Integer.parseInt(response); + if ( choice == YES + || choice == YES_TO_ALL + || choice == NO + || choice == CANCEL) { + return choice; + } + } catch( NumberFormatException ignore ) { + } + } + } + + private void cleanUpOpenSourceDir() throws IOException { + File openSourceDir = getOpenSourceDir(); + File[] files = openSourceDir.listFiles(); + // files should never be null because of the lib directory + for(int i=0; i < files.length; i++) { + String name = files[i].getName(); + if( files[i].isDirectory() + && (! (name.equals("lib") || name.equals("source")))) { + deleteDirectory(files[i]); + } else if( name.equals(OSS_JAR)) { + files[i].delete(); + } + } + } + + protected void createJar(String jarName, String pattern) + throws IOException + { + File openSourceDir = getOpenSourceDir(); + File openSourceLibDir = new File(getOpenSourceDir(), "lib"); + openSourceLibDir.mkdir(); + File jarFile = new File(openSourceLibDir.getPath(), jarName); + JarOutputStream jar = new JarOutputStream ( + new FileOutputStream(jarFile), new Manifest()); + jarFileTree(jar, openSourceDir, openSourceDir, pattern); + jar.close(); + } + + private void jarFileTree ( + JarOutputStream jar, + File file, + File openSourceDir, + String pattern ) throws FileNotFoundException, IOException + { + if ( file.isDirectory() ) { + File[] search = file.listFiles(); + if ( search == null ) { + return; //empty directory + } + for( int i=0; i < search.length; i++) { + jarFileTree(jar, search[i], openSourceDir, pattern); + } + } else { + String path = file.getPath(); + if (! path.matches(pattern)) { + return; //Not in our package of interest + } + byte[] buffer = new byte[1024]; + int count; + //File sourceFile = new File(openSourceDir, file.getPath()); + InputStream is = new BufferedInputStream(new FileInputStream(file)); + int index = openSourceDir.getPath().length() + 1; + String entryName = file.getPath().substring(index); + JarEntry entry = new JarEntry(entryName); + jar.putNextEntry(entry); + + // Read the file the file and write it to the jar. + while((count = is.read(buffer)) != -1) { + jar.write ( buffer, 0, count ) ; + } + } + } + + private File getProductDir() throws FileNotFoundException { + File productDir = new File(installDir, rb.getString("PRODUCT_DIR")); + if ( ! productDir.exists() || ! productDir.isDirectory() ) { + throw new FileNotFoundException(rb.getString("PRODUCT_DIR_NOT_FOUND")); + } + return productDir; + } + + private File getOpenSourceDir() throws FileNotFoundException { + return new File(getProductDir(), "opensource"); + } + + private void installOpenSource(File currentArchive) throws IOException { + File openSourceDir = getOpenSourceDir(); + byte[] buf = new byte[1024]; + + ZipFile zf = null; + FileOutputStream out = null; + InputStream in = null; + + try { + zf = new ZipFile(currentArchive); + int size = zf.size(); + int extracted = 0; + System.out.println(""); + System.out.print(rb.getString("UNZIPPING_FILES")); + Enumeration entries = zf.entries(); + + for (int i=0; i 0) { + out.write(buf, 0, nRead); + } else { + break; + } + } + + out.close(); + outFile.setLastModified(archiveTime.getTime()); + } + + zf.close(); + } catch (IOException ioe) { + setError(ioe); + if(zf!=null) { try { zf.close(); } catch(IOException ignore) {;} } + if(out!=null) { try {out.close();} catch(IOException ignore) {;} } + if(in!=null) { try { in.close(); } catch(IOException ignore) {;} } + throw new RuntimeException(rb.getString("INPUT_ERROR"), ioe); + } + } + + static private boolean deleteDirectory(File path) { + if( path.exists() ) { + File[] files = path.listFiles(); + if ( files == null ) { + return( path.delete() ); //empty directory + } + for(int i=0; i +UNZIPPING_FILES=Unzipping files +CHOOSE_AN_INSTALL_DIRECTORY=Please specify the installation directory. +DIRECTORY_DOES_NOT_EXIST_ACCEPT=This directory does not exist. \nDo you want to create it? +ACCEPT_INSTALL_DIRECTORY=Verify this directory is correct: +YES=yes +FAILED_TO_CREATE_DIRECTORY=Unable to create this directory. Please choose another one. +DIRECTORY_LACKS_PERMISSIONS=Insufficient permissions for this directory. Please choose another one. +FILE_CONFLICT=File name conflict. There is already a file with that name on the disk. +OVERRWRITE=Should this file be overwritten? Enter selection as number. \n1 Yes\n2 Yes to all\n3 No\n4 Cancel Installation +INPUT_ERROR=Error reading input during installation. +INSTALLATION_COMPLETE=\nInstallation has finished. +INSTALLATION_FAILED=Installation failed. \nThere is likely a partial install from the failed attempt that should be deleted. +CANCEL_INSTALL=The installation has been cancelled. \nThere is likely a partial install from the aborted attempt that should be deleted. +PRODUCT_DIR=__PRODUCT_DIR__ +PRODUCT_DIR_NOT_FOUND=Unable to locate the product directory, "__PRODUCT_DIR__". +INSTALLING_OPENSOURCE=\nBeginning installation of the open source code. +FAIL_TO_SET_PERMISSIONS=The installer failed to set execute permissions in the bin directory, please do this manually. http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/release/installer/vFabric_GFDataBrowserZipSelfExtractor.java ---------------------------------------------------------------------- diff --git a/databrowser/release/installer/vFabric_GFDataBrowserZipSelfExtractor.java b/databrowser/release/installer/vFabric_GFDataBrowserZipSelfExtractor.java new file mode 100644 index 0000000..213674b --- /dev/null +++ b/databrowser/release/installer/vFabric_GFDataBrowserZipSelfExtractor.java @@ -0,0 +1,32 @@ +import java.io.IOException; + +public class vFabric_GFDataBrowserZipSelfExtractor extends ZipSelfExtractor { + + protected void createJars() throws IOException { + //blank for now + } + + protected String getProductJarName() { + throw new IllegalStateException(); + } + + protected String getInstallDirProperty() { + return "gemstone.installer.directory"; + } + + protected String getInstallOpenSourceProperty() { + return "gemstone.installer.opensource"; + } + + vFabric_GFDataBrowserZipSelfExtractor() { + super(); + //Do not allow open source to be installed for tools at present + System.setProperty(getInstallOpenSourceProperty(), "false"); + } + + public static void main(String[] args) throws Throwable + { + ZipSelfExtractor zse = new vFabric_GFDataBrowserZipSelfExtractor(); + zse.installProduct(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/release/scripts/databrowser ---------------------------------------------------------------------- diff --git a/databrowser/release/scripts/databrowser b/databrowser/release/scripts/databrowser new file mode 100644 index 0000000..178e564 --- /dev/null +++ b/databrowser/release/scripts/databrowser @@ -0,0 +1,61 @@ +#!/bin/bash +databrowser=`dirname $0` +OLD=${PWD} +cd ${databrowser} +databrowser=`dirname ${PWD}` +cd ${databrowser} +databrowser=${PWD} +cd ${OLD} + +if [ "x${WINDIR}" != "x" ]; then + echo "ERROR: The variable WINDIR is set, indicating this script is running in a Windows OS, please use the .bat file version instead." + exit 1 +fi + +if [ "x${GEMFIRE}" = "x" ]; then + echo "ERROR: GEMFIRE environment variable is not set." + exit 1 +fi +if [ ! -f ${GEMFIRE}/lib/gemfire.jar ]; then + echo "ERROR: Could not locate gemfire.jar, expected it at \$GEMFIRE/lib/gemfire.jar" + exit 1 +fi + +MX4J_JARS=${GEMFIRE}/lib/commons-logging.jar:${GEMFIRE}/lib/commons-modeler-2.0.jar:${GEMFIRE}/lib/mx4j.jar:${GEMFIRE}/lib/mx4j-remote.jar:${GEMFIRE}/lib/mx4j-tools.jar +TOOL_JARS=${GEMFIRE}/lib/gemfire.jar:${GEMFIRE}/lib/antlr.jar:${MX4J_JARS}:${databrowser}/lib/__UNIX_JARS__:${databrowser}/lib/__JAR_NAME__ +if [ "x${CLASSPATH}" != "x" ]; then + TOOL_JARS=${TOOL_JARS}:${CLASSPATH} +fi + +# Detect OS & JVM Data/Architecture Model +UNAME=`uname` +GF_JAVA_ARCH=`${GF_JAVA:-java} -classpath ${TOOL_JARS} -Duser.language=us __JVMARCH_CLASS__` +if [ "x${UNAME}" = "xLinux" ]; then + if [ "y${GF_JAVA_ARCH}" = "yx86_64" ]; then + TOOL_JARS=${TOOL_JARS}:${databrowser}/lib/__SWT_x86_64.linux__ + else + TOOL_JARS=${TOOL_JARS}:${databrowser}/lib/__SWT_x86.linux__ + fi +fi + +# "mkdir -p" the temp directory that will be used by SWT for native libraries +TEMP_DIR=${PWD}/temp +TEMP_DIR_ARCH=$TEMP_DIR/$UNAME-$GF_JAVA_ARCH +mkdir -p ${TEMP_DIR_ARCH} 2>/dev/null +if [ ! -d ${TEMP_DIR_ARCH} ]; then + echo "ERROR: Could not find/create the required temporary directory ${TEMP_DIR_ARCH}. Please check for write permissions in ${PWD}." + exit 1 +fi +${GF_JAVA:-java} ${JAVA_ARGS} -classpath ${TOOL_JARS} -Duser.language=us -Djava.io.tmpdir=${TEMP_DIR_ARCH} __MAIN_CLASS__ $@ + +if [ $? -ne 0 ]; then + echo "ERROR: trouble starting DataBrowser." + echo "This is likely a swt graphics library issue while loading the gtk libraries " + echo "or you forgot to set your DISPLAY environment variable." + exit 1 +fi + +# Try deleting parent temp directory without -f so that libraries remain for other instances +# Not checking the exit status after 'rm' as 'rm' could fail if the files are in use by other instance running from the same directory +rm -r --interactive=never ${TEMP_DIR} 2>/dev/null + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/release/scripts/databrowser.bat ---------------------------------------------------------------------- diff --git a/databrowser/release/scripts/databrowser.bat b/databrowser/release/scripts/databrowser.bat new file mode 100644 index 0000000..b04bfaa --- /dev/null +++ b/databrowser/release/scripts/databrowser.bat @@ -0,0 +1,66 @@ +@setlocal enableextensions +@set scriptdir=%~dp0 +@set databrowser=%scriptdir:\bin\=% +@if exist "%databrowser%\lib\__JAR_NAME__" @goto databrowserok +@echo Could not determine the DataBrowser's location +@verify other 2>nul +@goto done + +:databrowserok +@if defined GEMFIRE @goto gemfirevariableok +@echo ERROR: GEMFIRE environment variable is not set. +@verify other 2>nul +@goto done +:gemfirevariableok + +@if exist "%GEMFIRE%/lib/gemfire.jar" @goto gemfireok +@echo Could not determine locate gemfire.jar, expected it at %%GEMFIRE%%\lib\gemfire.jar +@verify other 2>nul +@goto done +:gemfireok + +@if not defined GF_JAVA ( +@REM %GF_JAVA% is not defined, assume it is on the PATH +@set GF_JAVA=java +) + +@set TOOL_JARS=%databrowser%\lib\__JAR_NAME__ +@echo off + +@rem Detect JVM Data/Architecture Model +for /f "tokens=*" %%a in ( +'@"%GF_JAVA%" -classpath "%TOOL_JARS%" "-Duser.language=us" __JVMARCH_CLASS__' +) do ( +@set GF_JAVA_ARCH=%%a +) +@set ARCH_JAR=__SWT_x86.Windows_NT__ +@if %GF_JAVA_ARCH%==x86_64 ( +@set ARCH_JAR=__SWT_x86_64.Windows_NT__ +) + +@rem try "mkdir" for the temp directory that will be used by SWT for native libraries +@set TEMP_DIR=%scriptdir%\temp +@set TEMP_DIR_ARCH=%TEMP_DIR%\Win-%GF_JAVA_ARCH% +mkdir %TEMP_DIR_ARCH% 2>nul + +@if exist "%TEMP_DIR_ARCH%" @goto tempdirok +@echo ERROR: Could not find/create the required temporary directory %TEMP_DIR_ARCH%. Please check for write permissions in %scriptdir%. +@verify other 2>nul +@goto done +:tempdirok + +@set MX4J_JARS=%GEMFIRE%/lib/commons-logging.jar;%GEMFIRE%/lib/commons-modeler-2.0.jar;%GEMFIRE%/lib/mx4j.jar;%GEMFIRE%/lib/mx4j-remote.jar;%GEMFIRE%/lib/mx4j-tools.jar +@set TOOL_JARS=%TOOL_JARS%;%GEMFIRE%\lib\gemfire.jar;%GEMFIRE%\lib\antlr.jar;%MX4J_JARS%;%databrowser%\lib\__Windows_NT_JARS__;%databrowser%\lib\%ARCH_JAR% +@if defined CLASSPATH ( +@set TOOL_JARS=%TOOL_JARS%;%CLASSPATH% +) +@"%GF_JAVA%" %JAVA_ARGS% -classpath "%TOOL_JARS%" -Duser.language=us -Djava.io.tmpdir="%TEMP_DIR_ARCH%" __MAIN_CLASS__ %* + +@rem Try deleting parent temp directory so that libraries remain for other instances +rd /S /Q %TEMP_DIR% 2>nul +:done +@rem prevent subsequent invocations from appending repeatedly +@set TOOL_JARS= +@set MX4J_JARS= +@set TEMP_DIR= +@set TEMP_DIR_ARCH= http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/CacheServer.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/CacheServer.ico b/databrowser/resources/icons/CacheServer.ico new file mode 100644 index 0000000..73c078a Binary files /dev/null and b/databrowser/resources/icons/CacheServer.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/DSMember.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/DSMember.ico b/databrowser/resources/icons/DSMember.ico new file mode 100644 index 0000000..57b49e7 Binary files /dev/null and b/databrowser/resources/icons/DSMember.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/DSMember01.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/DSMember01.ico b/databrowser/resources/icons/DSMember01.ico new file mode 100644 index 0000000..6c36508 Binary files /dev/null and b/databrowser/resources/icons/DSMember01.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/DSMember02.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/DSMember02.ico b/databrowser/resources/icons/DSMember02.ico new file mode 100644 index 0000000..57b49e7 Binary files /dev/null and b/databrowser/resources/icons/DSMember02.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/DSMember03.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/DSMember03.ico b/databrowser/resources/icons/DSMember03.ico new file mode 100644 index 0000000..16ba975 Binary files /dev/null and b/databrowser/resources/icons/DSMember03.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/DSMember2.png ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/DSMember2.png b/databrowser/resources/icons/DSMember2.png new file mode 100644 index 0000000..642026e Binary files /dev/null and b/databrowser/resources/icons/DSMember2.png differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/ExecutionPlanTabIcon.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/ExecutionPlanTabIcon.ico b/databrowser/resources/icons/ExecutionPlanTabIcon.ico new file mode 100644 index 0000000..ff07a26 Binary files /dev/null and b/databrowser/resources/icons/ExecutionPlanTabIcon.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/Messages.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/Messages.ico b/databrowser/resources/icons/Messages.ico new file mode 100644 index 0000000..c2393ed Binary files /dev/null and b/databrowser/resources/icons/Messages.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/MiscellaneousPrefsPageIcon.png ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/MiscellaneousPrefsPageIcon.png b/databrowser/resources/icons/MiscellaneousPrefsPageIcon.png new file mode 100644 index 0000000..09da2e2 Binary files /dev/null and b/databrowser/resources/icons/MiscellaneousPrefsPageIcon.png differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/PartitionedRegion.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/PartitionedRegion.ico b/databrowser/resources/icons/PartitionedRegion.ico new file mode 100644 index 0000000..1b2f872 Binary files /dev/null and b/databrowser/resources/icons/PartitionedRegion.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/QueryPrefsPageIcon.png ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/QueryPrefsPageIcon.png b/databrowser/resources/icons/QueryPrefsPageIcon.png new file mode 100644 index 0000000..09da2e2 Binary files /dev/null and b/databrowser/resources/icons/QueryPrefsPageIcon.png differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/QueryResultsTablIcon.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/QueryResultsTablIcon.ico b/databrowser/resources/icons/QueryResultsTablIcon.ico new file mode 100644 index 0000000..813fafb Binary files /dev/null and b/databrowser/resources/icons/QueryResultsTablIcon.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/Region.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/Region.ico b/databrowser/resources/icons/Region.ico new file mode 100644 index 0000000..ca232e8 Binary files /dev/null and b/databrowser/resources/icons/Region.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/Results.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/Results.ico b/databrowser/resources/icons/Results.ico new file mode 100644 index 0000000..687fa88 Binary files /dev/null and b/databrowser/resources/icons/Results.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/SecurityPrefsPageIcon.png ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/SecurityPrefsPageIcon.png b/databrowser/resources/icons/SecurityPrefsPageIcon.png new file mode 100644 index 0000000..09da2e2 Binary files /dev/null and b/databrowser/resources/icons/SecurityPrefsPageIcon.png differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/ServerGroup01.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/ServerGroup01.ico b/databrowser/resources/icons/ServerGroup01.ico new file mode 100644 index 0000000..4c14cc1 Binary files /dev/null and b/databrowser/resources/icons/ServerGroup01.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/Statistics.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/Statistics.ico b/databrowser/resources/icons/Statistics.ico new file mode 100644 index 0000000..f4d5729 Binary files /dev/null and b/databrowser/resources/icons/Statistics.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/Trace.ico ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/Trace.ico b/databrowser/resources/icons/Trace.ico new file mode 100644 index 0000000..2363817 Binary files /dev/null and b/databrowser/resources/icons/Trace.ico differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/splash.bmp ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/splash.bmp b/databrowser/resources/icons/splash.bmp new file mode 100644 index 0000000..4a89361 Binary files /dev/null and b/databrowser/resources/icons/splash.bmp differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/resources/icons/text-document-16x16.png ---------------------------------------------------------------------- diff --git a/databrowser/resources/icons/text-document-16x16.png b/databrowser/resources/icons/text-document-16x16.png new file mode 100644 index 0000000..09da2e2 Binary files /dev/null and b/databrowser/resources/icons/text-document-16x16.png differ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/AboutAttributes.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/AboutAttributes.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/AboutAttributes.java new file mode 100644 index 0000000..718662c --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/AboutAttributes.java @@ -0,0 +1,65 @@ +/** + * + */ +package com.gemstone.gemfire.mgmt.DataBrowser.app; + +import java.util.Map; +import java.util.HashMap; + +/** + * @author mghosh + * + */ +public final class AboutAttributes { + + private Map attr_; + + static final AboutAttributes defAttr_; + static AboutAttributes instAboutAttr_; + + static { + defAttr_ = new AboutAttributes(); + AboutAttributes.defAttr_.attr_.put("Copyright", "Copyright_val"); + AboutAttributes.defAttr_.attr_.put("Name", "Name_val"); + AboutAttributes.instAboutAttr_ = new AboutAttributes(); + + // TODO Can we get a file name from the enivronment and read the values in + // it? - something akin to metaprogramming + } + + /** + * + */ + private AboutAttributes() { + attr_ = new HashMap(); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + // if attr_ is not empty, then is 'stringizes' that map, otherwise takes the + // default map. + Map mout = (true == attr_.isEmpty()) ? AboutAttributes.defAttr_.attr_ + : attr_; + return generateString(mout); + } + + private String generateString(Map mapAttr) { + + StringBuffer sOutBuf = new StringBuffer(); + for (Map.Entry e : mapAttr.entrySet()) { + sOutBuf.append(e.getKey() + "=" + e.getValue() + "\n"); + } + + return sOutBuf.toString(); + } + + static public AboutAttributes getInstance() { + return AboutAttributes.instAboutAttr_; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/DataBrowserApp.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/DataBrowserApp.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/DataBrowserApp.java new file mode 100644 index 0000000..70225e0 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/DataBrowserApp.java @@ -0,0 +1,107 @@ +/** + * + */ +package com.gemstone.gemfire.mgmt.DataBrowser.app; + +import java.util.prefs.BackingStoreException; + +import com.gemstone.gemfire.internal.util.PasswordUtil; +import com.gemstone.gemfire.mgmt.DataBrowser.connection.DSConfiguration; +import com.gemstone.gemfire.mgmt.DataBrowser.controller.DataBrowserController; +import com.gemstone.gemfire.mgmt.DataBrowser.controller.internal.SWTAppAdapter_Controller; +import com.gemstone.gemfire.mgmt.DataBrowser.model.member.GemFireMember; +import com.gemstone.gemfire.mgmt.DataBrowser.prefs.DataBrowserPreferences; +import com.gemstone.gemfire.mgmt.DataBrowser.ui.MainAppWindow; + +/** + * @author mghosh + * + */ +public class DataBrowserApp { + + private AboutAttributes aa_ = AboutAttributes.getInstance(); + private VersionInfo vi_ = VersionInfo.getInstance(); + private static DataBrowserApp appInstance_ = new DataBrowserApp(); + + private static MainAppWindow wndMain_ = new MainAppWindow(null); + private static DataBrowserController controller_ = new SWTAppAdapter_Controller(); + + + private static State state_ = new State.DummyState(5); // State.create(); + + /** + * + */ + private DataBrowserApp() { + } + + /** + * @param args + */ + public static void main(String[] args) { +/* + for (String strArg : args) { + if ("--version".equalsIgnoreCase(strArg)) { +// System.out +// .println("Version: " + "\n" + appInstance_.vi_.toString()); + } // --version + else if ("--about".equalsIgnoreCase(strArg)) { +// System.out +// .println("About: " + "\n" + appInstance_.aa_.toString()); + } // --about + } // for( String strArg : args ) +*/ + + if(args.length > 0){ + DSConfiguration dsConfig = new DSConfiguration(); + if(args.length == 2 || args.length == 4){ + dsConfig.setHost(args[0]); + dsConfig.setPort(Integer.parseInt(args[1])); + } + if(args.length == 4){ + dsConfig.setUserName(args[2]); + dsConfig.setPassword(PasswordUtil.decrypt(args[3])); + } + wndMain_.setDsConfig(dsConfig); + } + wndMain_.open(); + } // main + + + static public DataBrowserApp getInstance() { + return appInstance_; + } + + public State getState() { + return DataBrowserApp.state_; + } + + public final MainAppWindow getMainWindow() { + return wndMain_; + } + + public void exit() { + processShutdown(); + wndMain_.close(); + System.exit(0); + } + + public void openNewCqWindow(GemFireMember member){ + wndMain_.openNewCqWindow(member); + } + + public void processShutdown() { + getController().disconnect(); + try { + DataBrowserPreferences.save(); + } + catch (BackingStoreException e) { + // TODO do we need to log??? + } + } + + public final DataBrowserController getController() { + return controller_; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/Messages.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/Messages.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/Messages.java new file mode 100644 index 0000000..6a68bc6 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/Messages.java @@ -0,0 +1,25 @@ +package com.gemstone.gemfire.mgmt.DataBrowser.app; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "com.gemstone.gemfire.mgmt.DataBrowser.app.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + /* + * Empty ctor + */ + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/State.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/State.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/State.java new file mode 100644 index 0000000..8da09ec --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/State.java @@ -0,0 +1,177 @@ +/** + * + */ +package com.gemstone.gemfire.mgmt.DataBrowser.app; + +import java.util.ArrayList; +import java.util.Collection; + +import com.gemstone.gemfire.mgmt.DataBrowser.controller.DSSnapShot; +import com.gemstone.gemfire.mgmt.DataBrowser.controller.DataBrowserController; + +/** + * @author mghosh + * + */ +public class State { + + static private State stateInst_ = new State(); + + private Collection distribSystems_ = new ArrayList(); + + private DSSnapShot activeDS_ = null; + + /** + * + */ + private State() { + // TODO Auto-generated constructor stub + } + + static State create() { + return State.stateInst_; + } + + public final Collection getDSs() { + return distribSystems_; + } + + public void setDSs(Collection dss) { + distribSystems_ = dss; + } + + public void addDS(DSSnapShot ds) { + distribSystems_.add(ds); + } + + public boolean switchToDS(DSSnapShot ds) { + boolean fRet = false; + if (true == distribSystems_.contains(ds)) { + activeDS_ = ds; + fRet = true; + } + + return fRet; + } + + public boolean hasConnectionToSomeDS() { + /* + * boolean fRet = false; + * + * if (distribSystems_.isEmpty()) return fRet; + * + * for (DSSnapShot ds : distribSystems_) { if (ds.isConnected()) { fRet = + * true; } } + * + * return fRet; + */ + DataBrowserApp app = DataBrowserApp.getInstance(); + boolean fRet = false; + if (null != app) { + DataBrowserController ctrlr = app.getController(); + if (null != ctrlr) { + fRet = ctrlr.hasConnection(); + } + } + + return fRet; + } + + public void disconnect(DSSnapShot ds) { + /* + * ds.disconnect(); + */ + DataBrowserApp app = DataBrowserApp.getInstance(); + if (null != app) { + DataBrowserController ctrlr = app.getController(); + if (null != ctrlr) { + ctrlr.disconnect(); + } + } + + } + + public DSSnapShot disconnect() { + DataBrowserApp app = DataBrowserApp.getInstance(); + DSSnapShot dsss = null; + if (null != app) { + DataBrowserController ctrlr = app.getController(); + if (null != ctrlr) { + ctrlr.disconnect(); + + dsss = activeDS_; + if( null != activeDS_ ) { + ArrayList< DSSnapShot > lstDS = ( ArrayList< DSSnapShot > )this.distribSystems_; + int idxNextActiveDS = lstDS.indexOf( activeDS_); + if( idxNextActiveDS == ( lstDS.size() - 1 )) { + idxNextActiveDS = 0; + } + else { + idxNextActiveDS++; + } + + this.distribSystems_.remove( dsss ); + + try { + activeDS_ = lstDS.get( idxNextActiveDS ); + } + catch( IndexOutOfBoundsException xtpn ) { + if( lstDS.size() > 0 ) { + activeDS_ = lstDS.get( 0 ); + } + else { + activeDS_ = null; + } + } + + } + } + } + + return dsss; + } + + public DSSnapShot getCurrDS() { + return activeDS_; + } + + // ------------------------ + // for initial testing before we develop the back-end portions. + protected static class DummyState extends State { + int iCount = 0; + + DummyState(int iCnt) { + init(iCnt); + } + + private void init(int iCnt) { + // I am commenting this out, since I have removed setName operation from + // DistributedSystem, + // Application is not supposed to set any name here. We will pickup the + // name from GFE itself. + // - Hrishikesh Gadre. + /* + * iCount = iCnt; Collection colDss = new + * ArrayList(); for (int i = 0; i < iCnt; i++) { + * DistributedSystem ds = new DistributedSystem(); + * ds.setName("DummyData_DS_" + i); + * + * Collection collDSM = new ArrayList(); for (int j = + * 0; j < iCnt; j++) { DSMember dsm = new DSMember(); + * dsm.setName(ds.getName() + "_Mmbr_" + j); + * dsm.setDS(ds); Collection collRgns = new + * ArrayList(); for (int k = 0; k < iCnt; k++) { Region rgn = new + * Region(); rgn.setName(dsm.getName() + "_Rgn_" + + * k); rgn.setDsMember(dsm); collRgns.add(rgn); } + * + * dsm.setRegions(collRgns); + * + * collDSM.add(dsm); } + * + * ds.setMembers(collDSM); colDss.add(ds); } + * + * setDSs(colDss); + */ + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/VersionInfo.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/VersionInfo.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/VersionInfo.java new file mode 100644 index 0000000..42c9f80 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/VersionInfo.java @@ -0,0 +1,98 @@ +/** + * + */ +package com.gemstone.gemfire.mgmt.DataBrowser.app; + +/** + * @author mghosh + * + */ +public final class VersionInfo { + + private static String RESOURCE_NAME = null; // "DataBrowser.properties"; + private static boolean fReadFromResource_ = false; + + private int iMajor_; + private int iMinor_; + private int iDotRel_; + private int iPatchNum_; + + static final VersionInfo defVI_ = new VersionInfo(); + static VersionInfo viInstance_ = new VersionInfo(); + + /* + * Default (sane but nonsensical) value + * for later version, this information should be in a resource file + */ + static { + VersionInfo.defVI_.iPatchNum_ = 0; + VersionInfo.defVI_.iDotRel_ = 0; + VersionInfo.defVI_.iMinor_ = 0; + VersionInfo.defVI_.iMajor_ = 1; + + } + + /** + * Empty ctor + */ + private VersionInfo() { + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + iDotRel_; + result = prime * result + iMajor_; + result = prime * result + iMinor_; + result = prime * result + iPatchNum_; + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof VersionInfo)) + return false; + VersionInfo other = (VersionInfo) obj; + if (iDotRel_ != other.iDotRel_) + return false; + if (iMajor_ != other.iMajor_) + return false; + if (iMinor_ != other.iMinor_) + return false; + if (iPatchNum_ != other.iPatchNum_) + return false; + return true; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + VersionInfo vi = getInstance(); + return vi.iMajor_ + "." + vi.iMinor_; + } + + static public VersionInfo getInstance() { + VersionInfo viRet = ( false == fReadFromResource_ ) ? VersionInfo.defVI_ : VersionInfo.viInstance_; + return viRet; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/messages.properties ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/messages.properties b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/app/messages.properties new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ClientConfiguration.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ClientConfiguration.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ClientConfiguration.java new file mode 100644 index 0000000..2d2f843 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ClientConfiguration.java @@ -0,0 +1,85 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author hgadre + * + */ +public class ClientConfiguration implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private List locators; + private List cacheServers; + /** + * path of security plugin + */ + private String securityPluginPath; + /** + * Additional security properties + */ + private Map securityProperties; + + public ClientConfiguration() { + this.locators = new ArrayList(); + this.cacheServers = new ArrayList(); + this.securityProperties = new HashMap(); + } + + public List getCacheServers() { + return this.cacheServers; + } + + public List getLocators() { + return locators; + } + + public void setCacheServers(List cacheSvrs) { + cacheServers.clear(); + cacheServers.addAll(cacheSvrs); + } + + public void setLocators(List lctrs) { + locators.clear(); + locators.addAll(lctrs); + } + + public void addCacheServer(EndPoint pt) { + cacheServers.add(pt); + } + + public void addLocator(EndPoint pt) { + locators.add(pt); + } + + public String getSecurityPluginPath() { + return securityPluginPath; + } + + public void setSecurityPluginPath(String secPluginPath) { + securityPluginPath = secPluginPath; + } + + public Map getSecurityProperties() { + return securityProperties; + } + + public void setSecurityProperties(Map secProps) { + if(secProps != null) { + securityProperties.putAll(secProps); + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionClosedException.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionClosedException.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionClosedException.java new file mode 100644 index 0000000..15ef25d --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionClosedException.java @@ -0,0 +1,25 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +public class ConnectionClosedException extends Exception { + + public ConnectionClosedException() { + super(); + } + + public ConnectionClosedException(String message, Throwable cause) { + super(message, cause); + } + + public ConnectionClosedException(String message) { + super(message); + } + + public ConnectionClosedException(Throwable cause) { + super(cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFactory.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFactory.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFactory.java new file mode 100644 index 0000000..8918bd6 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFactory.java @@ -0,0 +1,122 @@ +/*========================================================================= + * (c)Copyright 2002-2011, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +import java.util.Map; +import java.util.Properties; + +import com.gemstone.gemfire.admin.DistributedSystemConfig; +import com.gemstone.gemfire.distributed.DistributedSystem; +import com.gemstone.gemfire.mgmt.DataBrowser.connection.internal.DummyMemberDiscoveryImpl; +import com.gemstone.gemfire.mgmt.DataBrowser.connection.internal.GemFireClientConnectionImpl; +import com.gemstone.gemfire.mgmt.DataBrowser.connection.internal.JMXDiscoveryImpl; +import com.gemstone.gemfire.mgmt.DataBrowser.prefs.DataBrowserPreferences; +import com.gemstone.gemfire.mgmt.DataBrowser.utils.LogUtil; +/** + * This class provides factory method to prepare a connection to a GemFire + * system. + * + * @author Hrishi/Manish + **/ +public class ConnectionFactory { + private static final String DATABROWSER_PROPS = "/com/gemstone/gemfire/mgmt/DataBrowser/resources/databrowser.properties"; + private static final String CLIENT_AUTHRIZATION = "security-client-auth-init"; + + public static GemFireConnection createGemFireConnection(DSConfiguration config) + throws ConnectionFailureException { + + GFMemberDiscovery disc = null; + try { + disc = new JMXDiscoveryImpl(config.getHost(), config.getPort(), "MySystem", config.getUserName(), config.getPassword()); + } catch (ConnectionFailureException e) { + throw e; + } + config.setVersion(disc.getGemFireSystemVersion()); + + DistributedSystem system = null; + try { + Properties props = getStandardProperties(); + addSecurityProperties(props, config.getSecAttributes()); + system = DistributedSystem.connect(props); + } catch (Exception e) { + throw new ConnectionFailureException( + "Failed to create local distributed system. Reason : "+e.getMessage(), e); + } + + try { + GemFireClientConnectionImpl connection = new GemFireClientConnectionImpl(system, disc); + return connection; + } catch (Exception e) { + throw new ConnectionFailureException( + "Failed to create local cache. Reason : "+e.getMessage(), e); + } + } + + //Used for DUnit testing... + public static GemFireConnection createGemFireConnection( + ClientConfiguration config) throws ConnectionFailureException { + + Properties props = getStandardProperties(); + + try { + DistributedSystem system = DistributedSystem.connect(props); + + GFMemberDiscovery disc = new DummyMemberDiscoveryImpl(config); + GemFireClientConnectionImpl connection = new GemFireClientConnectionImpl( + system, disc); + return connection; + } + catch (Exception e) { + LogUtil.error("Error while making connection", e); + throw new ConnectionFailureException( + "Failed to connect to the distributed system. Reason : "+e.getMessage(), e); + } + } + + + public static Properties getStandardProperties() { + String logDir = LogUtil.getLogDir(); + //TODO localize the file name + String logFile = logDir + "/" + "query-client_"+LogUtil.getProcessId()+".log"; + + String logLevel = DataBrowserPreferences.getLoggingLevel(); + logLevel = logLevel.equals("OFF") ? "NONE" : logLevel;//See #740 + int logFileSize = DataBrowserPreferences.getLogFileSize(); + int logFileCount = DataBrowserPreferences.getLogFileCount(); + int diskSpace = logFileSize * logFileCount; + + Properties props = new Properties(); + props.put(DistributedSystemConfig.NAME_NAME, "Data-Browser"); + props.put(DistributedSystemConfig.LOG_LEVEL_NAME, logLevel); + props.put(DistributedSystemConfig.LOG_FILE_NAME, logFile); + props.put(DistributedSystemConfig.LOG_FILE_SIZE_LIMIT_NAME, String.valueOf(logFileSize)); + props.put(DistributedSystemConfig.LOG_DISK_SPACE_LIMIT_NAME, String.valueOf(diskSpace)); + + //Setting cache-xml-file specification to empty string, to prevent DB reading any other cache.xml + //see #829 + props.put("cache-xml-file", ""); + + props.put(DistributedSystemConfig.MCAST_PORT_NAME, "0"); + props.put(DistributedSystemConfig.LOCATORS_NAME, ""); + + // setting default databrowser properties. It will not allow DB read out any other gemfire properties kept + // in current dir/ home dir/ classpath + // see #829 + System.setProperty("gemfirePropertyFile", DATABROWSER_PROPS); + return props; + } + + public static void addSecurityProperties(Properties props, SecurityAttributes secAttrs ) { + if(secAttrs == null || props == null) + return; + String authImpl = secAttrs.getAuthImplString(); + if(authImpl != null) + props.put(CLIENT_AUTHRIZATION, authImpl); + + Map securityProperties = secAttrs.getSecurityProperties(); + props.putAll(securityProperties); + } +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFailureException.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFailureException.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFailureException.java new file mode 100644 index 0000000..bac0c45 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionFailureException.java @@ -0,0 +1,56 @@ +/*========================================================================= + * (c)Copyright 2002-2011, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +public class ConnectionFailureException extends Exception { + private static final long serialVersionUID = -7476581939729817468L; + + protected boolean retryAllowed; + + public ConnectionFailureException() { + super(); + } + + public ConnectionFailureException(String arg0, Throwable arg1, boolean retryAllowed) { + super(arg0, arg1); + this.retryAllowed = retryAllowed; + } + + public ConnectionFailureException(String arg0, boolean retryAllowed) { + super(arg0); + this.retryAllowed = retryAllowed; + } + + public ConnectionFailureException(Throwable arg0, boolean retryAllowed) { + super(arg0); + this.retryAllowed = retryAllowed; + } + + public ConnectionFailureException(String arg0, Throwable arg1) { + this(arg0, arg1, false); + } + + public ConnectionFailureException(String arg0) { + this(arg0, false); + } + + public ConnectionFailureException(Throwable arg0) { + this(arg0, false); + } + + /** + * @return the retryAllowed + */ + public boolean isRetryAllowed() { + return retryAllowed; + } + + @Override + public String toString() { + return super.toString()+", isRetryAllowed : "+retryAllowed; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionTerminatedEvent.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionTerminatedEvent.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionTerminatedEvent.java new file mode 100644 index 0000000..16828c5 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/ConnectionTerminatedEvent.java @@ -0,0 +1,10 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +public class ConnectionTerminatedEvent implements IConnectionEvent { + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/DSConfiguration.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/DSConfiguration.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/DSConfiguration.java new file mode 100644 index 0000000..a88f608 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/DSConfiguration.java @@ -0,0 +1,91 @@ +/*========================================================================= + * (c)Copyright 2002-2011, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +/** + * Encapsulation the necessary parameter to establish connection with DS + * + * @author mjha + * + */ +public class DSConfiguration { + /** + * Jmx Agent Host + */ + private String host; + /** + * Jmx agent port + */ + private int port; + + private String version; + + private SecurityAttributes secAttributes; + + private String userName; + + private String password; + + public DSConfiguration() { + + } + + public String getHost() { + return host; + } + + public void setHost(String h) { + host = h; + } + + public int getPort() { + return port; + } + + public void setPort(int p) { + port = p; + } + + /** + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * @param version the version to set + */ + public void setVersion(String version) { + this.version = version; + } + + public SecurityAttributes getSecAttributes() { + return secAttributes; + } + + public void setSecAttributes(SecurityAttributes secAttr) { + secAttributes = secAttr; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/EndPoint.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/EndPoint.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/EndPoint.java new file mode 100644 index 0000000..ff98861 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/EndPoint.java @@ -0,0 +1,54 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +import java.io.Serializable; + +/** + * @author hgadre + * + */ +public class EndPoint implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String hostName; + private int port; + + + public EndPoint(String hostNm, int p) { + super(); + hostName = hostNm; + port = p; + } + + public EndPoint() { + } + + public String getHostName() { + return hostName; + } + + public void setHostName(String hostNm) { + hostName = hostNm; + } + + public int getPort() { + return port; + } + + public void setPort(int p) { + port = p; + } + + @Override + public String toString() { + return "["+getHostName()+":"+getPort()+"]"; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFMemberDiscovery.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFMemberDiscovery.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFMemberDiscovery.java new file mode 100644 index 0000000..470eeea --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFMemberDiscovery.java @@ -0,0 +1,65 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +import com.gemstone.gemfire.cache.query.QueryService; +import com.gemstone.gemfire.mgmt.DataBrowser.model.member.GemFireMember; + +/** + * @author Hrishi + * + */ +public interface GFMemberDiscovery { + + /** + * This method returns the list of members connected to a given GemFire system. + * @return List of GemFire members. + */ + public GemFireMember[] getMembers(); + + /** + * This method returns the information about a specified member. + * + * @param id The unique identifier of the member for which we need information. + * @return Member information. + */ + public GemFireMember getMember(String id); + + /** + * This method returns a QueryService instance corrosponding to a given GemFire member. + * + * @param member The GemFire member for which we want QueryService instance. + * @return Instance of QueryService. + */ + public QueryService getQueryService(GemFireMember member); + + /** + * This method adds a call-back listener for the GemFire member updates. + * @param listener The listener to be attached. + */ + public void addGemFireMemberListener(GemFireMemberListener listener); + + /** + * This method removes a call-back listener for the GemFire member updates. + * @param listener The listener to be removed. + */ + public void removeGemFireMemberListener(GemFireMemberListener listener); + + public void addConnectionNotificationListener(GemFireConnectionListener listener); + + public void removeConnectionNotificationListener(GemFireConnectionListener listener); + + /** + * This method closes the under-laying GemFire connection. + */ + public void close(); + + public String getGemFireSystemVersion(); + + public void setRefreshInterval(long time); + + public long getRefreshInterval(); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFQueryExecution.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFQueryExecution.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFQueryExecution.java new file mode 100644 index 0000000..f7774b4 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GFQueryExecution.java @@ -0,0 +1,69 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +import com.gemstone.gemfire.mgmt.DataBrowser.model.member.GemFireMember; +import com.gemstone.gemfire.mgmt.DataBrowser.query.QueryExecutionException; +import com.gemstone.gemfire.mgmt.DataBrowser.query.QueryResult; +import com.gemstone.gemfire.mgmt.DataBrowser.query.cq.CQException; +import com.gemstone.gemfire.mgmt.DataBrowser.query.cq.CQQuery; + +/** + * This interface is responsible to provide Query execution functionality to the application. + * + * @author Hrishi + **/ +public interface GFQueryExecution { + + /** + * This method executes a specified query on a given GemFire member. + * @param query The query to be executed. + * @param member The GemFire member on which we want to execute the query. + * @return Result of Query execution. + */ + public QueryResult executeQuery( String query, GemFireMember member) throws QueryExecutionException; + + + /** + * This method creates a new CQ on a given GemFire member. + * @param name Name of the query. + * @param query The query to be created. + * @param member The GemFire member on which we want to execute the query. + * @return The reference of the query. + */ + public CQQuery newCQ( String name, String query, GemFireMember member) throws QueryExecutionException; + + + /** + * This method retrieves a CQQuery with the required name. + * + * @param name Name of the CQ query to be retrieved. + * @return CQQuery + */ + public CQQuery getCQ( String name ); + + /** + * This method closes a CQQuery with the required name. + * + * @param name Name of the CQ query to be retrieved. + * @return CQQuery + */ + public void closeCQ( String name )throws CQException; + + /** + * This method stops a CQQuery with the required name. + * + * @param name Name of the CQ query to be retrieved. + * @return CQQuery + */ + public void stopCQ( String name )throws CQException; + + /** + * This method closes the under-laying GemFire connection. + */ + public void close(); + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnection.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnection.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnection.java new file mode 100644 index 0000000..5d9ba7d --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnection.java @@ -0,0 +1,24 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + + +/** + * This interface abstracts the GemFire connection related functionality including, + * 1. Ability to retrieve the information about GemFire members. + * 2. Ability to execute query on a specific GemFire member. + * 3. Ability to attach/detach call-back listeners for GemFire member/region related updates. + * + * @author Hrishi + **/ +public interface GemFireConnection extends GFMemberDiscovery, GFQueryExecution { + + /** + * This method closes the under-laying GemFire connection. + */ + public void close(); + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnectionListener.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnectionListener.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnectionListener.java new file mode 100644 index 0000000..74cb257 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireConnectionListener.java @@ -0,0 +1,12 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +public interface GemFireConnectionListener { + + public void connectionEventReceived(IConnectionEvent event); + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireMemberListener.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireMemberListener.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireMemberListener.java new file mode 100644 index 0000000..2e6fd99 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/GemFireMemberListener.java @@ -0,0 +1,25 @@ +/*========================================================================= + * (c) Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + *=========================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +import com.gemstone.gemfire.mgmt.DataBrowser.model.IMemberEvent; + +/** + * This interface provides call back functionality for listening GemFire member + * status changes. + * + * @author Hrishi + **/ +public interface GemFireMemberListener { + + /** + * This method is called when a member joins a given GemFire system. + * + * @param memEvent instance of {@link IMemberEvent}. + */ + public void memberEventReceived(IMemberEvent memEvent); + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/IConnectionEvent.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/IConnectionEvent.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/IConnectionEvent.java new file mode 100644 index 0000000..7c7d011 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/IConnectionEvent.java @@ -0,0 +1,10 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +public interface IConnectionEvent { + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/JMXOperationFailureException.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/JMXOperationFailureException.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/JMXOperationFailureException.java new file mode 100644 index 0000000..c5ac28c --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/JMXOperationFailureException.java @@ -0,0 +1,47 @@ +/*========================================================================= + * (c) Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + *=========================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +/** + * This is a base exception class used by the JMXCallExecutor. + * @see com.gemstone.gemfire.tools.jmx.JMXCallExecutor + * + * @author Hrishi + **/ +public class JMXOperationFailureException extends Exception { + + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * The constructor. + * @param message - the detail message. + * @param cause - the cause. + */ + public JMXOperationFailureException(String arg0, Throwable arg1) { + super(arg0, arg1); + } + + /** + * The constructor. + * @param message - the detail message. + */ + public JMXOperationFailureException(String message) { + super(message); + } + + /** + * The constructor. + * @param cause - the cause. + */ + public JMXOperationFailureException(Throwable arg0) { + super(arg0); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/SecurityAttributes.java ---------------------------------------------------------------------- diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/SecurityAttributes.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/SecurityAttributes.java new file mode 100644 index 0000000..49580e3 --- /dev/null +++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/connection/SecurityAttributes.java @@ -0,0 +1,69 @@ +/*========================================================================= + * (c)Copyright 2002-2009, GemStone Systems, Inc. All Rights Reserved. + * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 + * All Rights Reserved. + * =======================================================================*/ +package com.gemstone.gemfire.mgmt.DataBrowser.connection; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * @author mjha + * + */ +public class SecurityAttributes implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + /** + * path of security plugin + */ + private String securityPluginPath; + /** + * Additional security properties + */ + private Map securityProperties; + + private String authImplString; + + public SecurityAttributes() { + securityProperties = new HashMap(); + } + + public String getSecurityPluginPath() { + return securityPluginPath; + } + + public void setSecurityPluginPath(String secPluginPath) { + securityPluginPath = secPluginPath; + } + + public Map getSecurityProperties() { + return securityProperties; + } + + public void setSecurityProperties(Map secProps) { + if (secProps != null) { + // TODO MGH - For now just to be safe. Not sure if this is thread safe if + // concurrent queries are allowed. + // TODO MGH - Should the existing security properties be flushed and the only + // thos specified in secProps be stored? + synchronized( securityProperties ) { + securityProperties.putAll(secProps); + } + } + } + + public String getAuthImplString() { + return authImplString; + } + + public void setAuthImplString(String authImpl) { + authImplString = authImpl; + } + +}