Package edu.stanford.ejalbert.exception

Examples of edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException


            Constructor constructor = linker.getConstructor(new Class[] {Class.class});
            Object linkage = constructor.newInstance(new Object[] {
                    BrowserLauncher.class});
        }
        catch (Exception e) {
            throw new BrowserLaunchingInitializingException(e);
        }
    }
View Full Code Here


            Field anyTransactionIDField = appleEventClass.getDeclaredField(
                    "kAnyTransactionID");
            kAnyTransactionID = (Integer) anyTransactionIDField.get(null);
        }
        catch (Exception cnfe) {
            throw new BrowserLaunchingInitializingException(cnfe);
        }
    }
View Full Code Here

            // There's probably a way to do this better; if any has any ideas, please let
            // me know.
            return appleEvent;
        }
        catch (Exception e) {
            throw new BrowserLaunchingInitializingException(e);
        }
    }
View Full Code Here

                    "getFileCreator", new Class[] {File.class});
            getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType",
                    new Class[] {File.class});
        }
        catch (Exception e) {
            throw new BrowserLaunchingInitializingException(e);
        }
    }
View Full Code Here

        try {
            systemFolder = (File) findFolder.invoke(null,
                    new Object[] {kSystemFolderType});
        }
        catch (Exception e) {
            throw new BrowserLaunchingInitializingException(e);
        }
        String[] systemFolderFiles = systemFolder.list();
        // Avoid a FilenameFilter because that can't be stopped mid-list
        for (int i = 0; i < systemFolderFiles.length; i++) {
            try {
                File file = new File(systemFolder, systemFolderFiles[i]);
                if (!file.isFile()) {
                    continue;
                }
                // We're looking for a file with a creator code of 'MACS' and
                // a type of 'FNDR'.  Only requiring the type results in non-Finder
                // applications being picked up on certain Mac OS 9 systems,
                // especially German ones, and sending a GURL event to those
                // applications results in a logout under Multiple Users.
                Object fileType = getFileType.invoke(null, new Object[] {file});
                if (FINDER_TYPE.equals(fileType.toString())) {
                    Object fileCreator = getFileCreator.invoke(null,
                            new Object[] {file});
                    if (FINDER_CREATOR.equals(fileCreator.toString())) {
                        browser = file.toString(); // Actually the Finder, but that's OK
                        return browser;
                    }
                }
            }
            catch (Exception e) {
                throw new BrowserLaunchingInitializingException(e);
            }
        }
        throw new BrowserLaunchingInitializingException("Unable to find finder");
    }
View Full Code Here

    public void initialize()
            throws BrowserLaunchingInitializingException {
        try {
            URL configUrl = getClass().getResource(configFileName);
            if (configUrl == null) {
                throw new BrowserLaunchingInitializingException(
                        "unable to find config file: " + configFileName);
            }
            StringBuffer potentialBrowserNames = new StringBuffer();
            Properties configProps = new Properties();
            configProps.load(configUrl.openStream());
            String sepChar = configProps.getProperty(PROP_KEY_DELIMITER);
            Iterator keysIter = configProps.keySet().iterator();
            while (keysIter.hasNext()) {
                String key = (String) keysIter.next();
                if (key.startsWith(PROP_KEY_BROWSER_PREFIX)) {
                    StandardUnixBrowser browser = new StandardUnixBrowser(
                            sepChar,
                            configProps.getProperty(key));
                    if (browser.isBrowserAvailable(logger)) {
                        unixBrowsers.put(browser.getBrowserDisplayName(),
                                         browser);
                    }
                    else {
                        if (potentialBrowserNames.length() > 0) {
                            potentialBrowserNames.append("; ");
                        }
                        potentialBrowserNames.append(
                                browser.getBrowserDisplayName());
                    }
                }
            }
            if (unixBrowsers.size() == 0) {
                // no browser installed
                throw new BrowserLaunchingInitializingException(
                        "one of the supported browsers must be installed: "
                        + potentialBrowserNames);
            }
            logger.info(unixBrowsers.keySet().toString());
            unixBrowsers = Collections.unmodifiableMap(unixBrowsers);
        }
        catch (IOException ioex) {
            throw new BrowserLaunchingInitializingException(ioex);
        }
    }
View Full Code Here

                    "com.apple.mrj.MRJFileUtils");
            openURL = mrjFileUtilsClass.getDeclaredMethod("openURL",
                    new Class[] {String.class});
        }
        catch (Exception e) {
            throw new BrowserLaunchingInitializingException(e);
        }
    }
View Full Code Here

    public void initialize()
            throws BrowserLaunchingInitializingException {
        try {
            URL configUrl = getClass().getResource(CONFIGFILE_WINDOWS);
            if (configUrl == null) {
                throw new BrowserLaunchingInitializingException(
                        "unable to find config file: " + CONFIGFILE_WINDOWS);
            }
            Properties configProps = new Properties();
            configProps.load(configUrl.openStream());
            // get sep char
            String sepChar = configProps.getProperty(PROP_KEY_DELIMITER);
            // load different types of browsers
            Iterator keysIter = configProps.keySet().iterator();
            while (keysIter.hasNext()) {
                String key = (String) keysIter.next();
                if (key.startsWith(PROP_KEY_BROWSER_PREFIX)) {
                    WindowsBrowser winBrowser = new WindowsBrowser(
                            sepChar,
                            configProps.getProperty(key));
                    browsersToCheck.add(winBrowser);
                }
            }
            // load the type of windows based on the windows key
            String windowsConfigStr = configProps.getProperty(
                    windowsKey,
                    null);
            if (windowsConfigStr == null) {
                throw new BrowserLaunchingInitializingException(
                        windowsKey + " is not a valid property");
            }
            String[] winConfigItems = windowsConfigStr.split(sepChar);
            commandsDefaultBrowser = winConfigItems[0];
            commandsTargettedBrowser = winConfigItems[1];
            Boolean boolVal = new Boolean(winConfigItems[2]);
            useRegistry = boolVal.booleanValue();
            // check for override of useRegistry from system prop
            // need to explicitly check BOTH values to filter out
            // invalid prop values
            String propValue = System.getProperty(
                    IBrowserLaunching.WINDOWS_BROWSER_DISC_POLICY_PROPERTY,
                    null);
            if (IBrowserLaunching.WINDOWS_BROWSER_DISC_POLICY_DISK.equals(
                    propValue)) {
                useRegistry = false;
            }
            else if (IBrowserLaunching.WINDOWS_BROWSER_DISC_POLICY_REGISTRY.
                     equals(propValue)) {
                useRegistry = true;
            }
            if (logger.isDebugEnabled()) {
                logger.debug("Browser discovery policy property value=" +
                             (propValue == null ? "null" : propValue));
                logger.debug("useRegistry=" + Boolean.toString(useRegistry));
            }
            // get info for checking Program Files folder
            programFilesFolderTemplate = configProps.getProperty(
                    "program.files.template",
                    null);
            driveLetters = configProps.getProperty(
                    "drive.letters",
                    null);
            // set brwosersToCheck to a non-modifiable list
            browsersToCheck = Collections.unmodifiableList(browsersToCheck);
        }
        catch (IOException ioex) {
            throw new BrowserLaunchingInitializingException(ioex);
        }
    }
View Full Code Here

    public void initialize()
            throws BrowserLaunchingInitializingException {
        try {
            URL configUrl = getClass().getResource(configFileName);
            if (configUrl == null) {
                throw new BrowserLaunchingInitializingException(
                        "unable to find config file: " + configFileName);
            }
            StringBuffer potentialBrowserNames = new StringBuffer();
            Properties configProps = new Properties();
            configProps.load(configUrl.openStream());
            String sepChar = configProps.getProperty(PROP_KEY_DELIMITER);
            Iterator keysIter = configProps.keySet().iterator();
            while (keysIter.hasNext()) {
                String key = (String) keysIter.next();
                if (key.startsWith(PROP_KEY_BROWSER_PREFIX)) {
                    StandardUnixBrowser browser = new StandardUnixBrowser(
                            sepChar,
                            configProps.getProperty(key));
                    if (browser.isBrowserAvailable(logger)) {
                        unixBrowsers.put(browser.getBrowserDisplayName(),
                                         browser);
                    }
                    else {
                        if (potentialBrowserNames.length() > 0) {
                            potentialBrowserNames.append("; ");
                        }
                        potentialBrowserNames.append(
                                browser.getBrowserDisplayName());
                    }
                }
            }
            if (unixBrowsers.size() == 0) {
                // no browser installed
                throw new BrowserLaunchingInitializingException(
                        "one of the supported browsers must be installed: "
                        + potentialBrowserNames);
            }
            logger.info(unixBrowsers.keySet().toString());
            unixBrowsers = Collections.unmodifiableMap(unixBrowsers);
        }
        catch (IOException ioex) {
            throw new BrowserLaunchingInitializingException(ioex);
        }
    }
View Full Code Here

    public void initialize()
            throws BrowserLaunchingInitializingException {
        try {
            URL configUrl = getClass().getResource(CONFIGFILE_WINDOWS);
            if (configUrl == null) {
                throw new BrowserLaunchingInitializingException(
                        "unable to find config file: " + CONFIGFILE_WINDOWS);
            }
            Properties configProps = new Properties();
            configProps.load(configUrl.openStream());
            // get sep char
            String sepChar = configProps.getProperty(PROP_KEY_DELIMITER);
            // load different types of browsers
            Iterator keysIter = configProps.keySet().iterator();
            while (keysIter.hasNext()) {
                String key = (String) keysIter.next();
                if (key.startsWith(PROP_KEY_BROWSER_PREFIX)) {
                    WindowsBrowser winBrowser = new WindowsBrowser(
                            sepChar,
                            configProps.getProperty(key));
                    browsersToCheck.add(winBrowser);
                }
            }
            // load the type of windows based on the windows key
            String windowsConfigStr = configProps.getProperty(
                    windowsKey,
                    null);
            if (windowsConfigStr == null) {
                throw new BrowserLaunchingInitializingException(
                        windowsKey + " is not a valid property");
            }
            String[] winConfigItems = windowsConfigStr.split(sepChar);
            commandsDefaultBrowser = winConfigItems[0];
            commandsTargettedBrowser = winConfigItems[1];
            Boolean boolVal = new Boolean(winConfigItems[2]);
            useRegistry = boolVal.booleanValue();
            // check for override of useRegistry from system prop
            // need to explicitly check BOTH values to filter out
            // invalid prop values
            String propValue = System.getProperty(
                    IBrowserLaunching.WINDOWS_BROWSER_DISC_POLICY_PROPERTY,
                    null);
            if (IBrowserLaunching.WINDOWS_BROWSER_DISC_POLICY_DISK.equals(
                    propValue)) {
                useRegistry = false;
            }
            else if (IBrowserLaunching.WINDOWS_BROWSER_DISC_POLICY_REGISTRY.
                     equals(propValue)) {
                useRegistry = true;
            }
            if (logger.isDebugEnabled()) {
                logger.debug("Browser discovery policy property value=" +
                             (propValue == null ? "null" : propValue));
                logger.debug("useRegistry=" + Boolean.toString(useRegistry));
            }
            // get info for checking Program Files folder
            programFilesFolderTemplate = configProps.getProperty(
                    "program.files.template",
                    null);
            driveLetters = configProps.getProperty(
                    "drive.letters",
                    null);
            // set brwosersToCheck to a non-modifiable list
            browsersToCheck = Collections.unmodifiableList(browsersToCheck);
        }
        catch (IOException ioex) {
            throw new BrowserLaunchingInitializingException(ioex);
        }
    }
View Full Code Here

TOP

Related Classes of edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.