Package com.cloud.bridge.service.exception

Examples of com.cloud.bridge.service.exception.ConfigurationException


            --numIPs;
        } catch (NumberFormatException nfe) {
            // okay, it's an ip address, not a port number
        }
        if (numIPs <= 0) {
            throw new ConfigurationException("No CAStor nodes specified in '" + mountedRoot + "'");
        }
        HashSet<String> ips = new HashSet<String>();
        String clusterName = null;
        for ( int i = 0; i < numIPs; ++i ) {
            String option = cfg[i+1]; // ip address or zeroconf=mycluster.example.com or domain=mydomain.example.com
            if (option.toLowerCase().startsWith("zeroconf=")) {
                String[] confStr = option.split("=");
                if (confStr.length != 2) {
                    throw new ConfigurationException("Could not parse cluster name from '" + option + "'");
                }
                clusterName = confStr[1];
            } else if (option.toLowerCase().startsWith("domain=")) {
                String[] confStr = option.split("=");
                if (confStr.length != 2) {
                    throw new ConfigurationException("Could not parse domain name from '" + option + "'");
                }
                _domain = confStr[1];
            } else {
                ips.add(option);
            }
        }
        if (clusterName == null && ips.isEmpty()) {
            throw new ConfigurationException("No CAStor nodes specified in '" + mountedRoot + "'");
        }
        String[] castorNodes = ips.toArray(new String[0])// list of configured nodes
        if (clusterName == null) {
            try {
                _locator = new StaticLocator(castorNodes, castorPort, LOCATOR_RETRY_TIMEOUT);
                _locator.start();
            } catch (IOException e) {
                throw new ConfigurationException("Could not create CAStor static locator for '" +
                                                 Arrays.toString(castorNodes) + "'");
            }
        } else {
            try {
                clusterName = clusterName.replace(".", "_"); // workaround needed for CAStorSDK 1.3.1
                _locator = new ZeroconfLocator(clusterName);
                _locator.start();
            } catch (IOException e) {
                throw new ConfigurationException("Could not create CAStor zeroconf locator for '" + clusterName + "'");
            }
        }
        try {
            s_logger.info("CAStor client starting: " + (_domain==null ? "default domain" : "domain " + _domain) + " " + (clusterName==null ? Arrays.toString(castorNodes) : clusterName) + " :" + castorPort);
            _scspClient = new ScspClient(_locator, castorPort, DEFAULT_MAX_POOL_SIZE, DEFAULT_MAX_RETRIES, CONNECTION_TIMEOUT, CM_IDLE_TIMEOUT);
            _scspClient.start();
        } catch (Exception e) {
            s_logger.error("Unable to create CAStor client for '" + mountedRoot + "': " + e.getMessage(), e);
            throw new ConfigurationException("Unable to create CAStor client for '" + mountedRoot + "': " + e);
        }
        return _scspClient;
    }
View Full Code Here


        // InputStream for use by loadObject() and loadObjectRange().

        myClient(mountedRoot); // make sure castorNodes and castorPort initialized
        InetSocketAddress nodeAddr = _locator.locate();
        if (nodeAddr == null) {
            throw new ConfigurationException("Unable to locate CAStor node with locator " + _locator);
        }
        InetAddress nodeInetAddr = nodeAddr.getAddress();
        if (nodeInetAddr == null) {
            _locator.foundDead(nodeAddr);
            throw new ConfigurationException("Unable to resolve CAStor node name '" + nodeAddr.getHostName() +
                                             "' to IP address");
        }
        return "http://" + nodeInetAddr.getHostAddress() + ":" + nodeAddr.getPort() + "/" + bucket + "/" + fileName +
            (_domain==null ? "" : "?domain=" + _domain);
    }
View Full Code Here

            InetAddress inetAddr = NetHelper.getFirstNonLoopbackLocalInetAddress();
            if(inetAddr != null)
                hostKey = NetHelper.getMacAddress(inetAddr);
        }
        if(hostKey == null)
            throw new ConfigurationException("Please configure host.key property in cloud-bridge.properites");
        String host = properties.getProperty("host");
        if(host == null)
            host = NetHelper.getHostName();

        if(properties.get("bucket.dns") != null &&
View Full Code Here

            InetAddress inetAddr = NetHelper.getFirstNonLoopbackLocalInetAddress();
            if (inetAddr != null)
                hostKey = NetHelper.getMacAddress(inetAddr);
        }
        if (hostKey == null)
            throw new ConfigurationException("Please configure host.key property in cloud-bridge.properites");
        String host = properties.getProperty("host");
        if (host == null)
            host = NetHelper.getHostName();

        if (properties.get("bucket.dns") != null && ((String)properties.get("bucket.dns")).equalsIgnoreCase("true")) {
View Full Code Here

            --numIPs;
        } catch (NumberFormatException nfe) {
            // okay, it's an ip address, not a port number
        }
        if (numIPs <= 0) {
            throw new ConfigurationException("No CAStor nodes specified in '" + mountedRoot + "'");
        }
        HashSet<String> ips = new HashSet<String>();
        String clusterName = null;
        for (int i = 0; i < numIPs; ++i) {
            String option = cfg[i + 1]; // ip address or zeroconf=mycluster.example.com or domain=mydomain.example.com
            if (option.toLowerCase().startsWith("zeroconf=")) {
                String[] confStr = option.split("=");
                if (confStr.length != 2) {
                    throw new ConfigurationException("Could not parse cluster name from '" + option + "'");
                }
                clusterName = confStr[1];
            } else if (option.toLowerCase().startsWith("domain=")) {
                String[] confStr = option.split("=");
                if (confStr.length != 2) {
                    throw new ConfigurationException("Could not parse domain name from '" + option + "'");
                }
                _domain = confStr[1];
            } else {
                ips.add(option);
            }
        }
        if (clusterName == null && ips.isEmpty()) {
            throw new ConfigurationException("No CAStor nodes specified in '" + mountedRoot + "'");
        }
        String[] castorNodes = ips.toArray(new String[0])// list of configured nodes
        if (clusterName == null) {
            try {
                _locator = new StaticLocator(castorNodes, castorPort, LOCATOR_RETRY_TIMEOUT);
                _locator.start();
            } catch (IOException e) {
                throw new ConfigurationException("Could not create CAStor static locator for '" + Arrays.toString(castorNodes) + "'");
            }
        } else {
            try {
                clusterName = clusterName.replace(".", "_"); // workaround needed for CAStorSDK 1.3.1
                _locator = new ZeroconfLocator(clusterName);
                _locator.start();
            } catch (IOException e) {
                throw new ConfigurationException("Could not create CAStor zeroconf locator for '" + clusterName + "'");
            }
        }
        try {
            s_logger.info("CAStor client starting: " + (_domain == null ? "default domain" : "domain " + _domain) + " " +
                (clusterName == null ? Arrays.toString(castorNodes) : clusterName) + " :" + castorPort);
            _scspClient = new ScspClient(_locator, castorPort, DEFAULT_MAX_POOL_SIZE, DEFAULT_MAX_RETRIES, CONNECTION_TIMEOUT, CM_IDLE_TIMEOUT);
            _scspClient.start();
        } catch (Exception e) {
            s_logger.error("Unable to create CAStor client for '" + mountedRoot + "': " + e.getMessage(), e);
            throw new ConfigurationException("Unable to create CAStor client for '" + mountedRoot + "': " + e);
        }
        return _scspClient;
    }
View Full Code Here

        // InputStream for use by loadObject() and loadObjectRange().

        myClient(mountedRoot); // make sure castorNodes and castorPort initialized
        InetSocketAddress nodeAddr = _locator.locate();
        if (nodeAddr == null) {
            throw new ConfigurationException("Unable to locate CAStor node with locator " + _locator);
        }
        InetAddress nodeInetAddr = nodeAddr.getAddress();
        if (nodeInetAddr == null) {
            _locator.foundDead(nodeAddr);
            throw new ConfigurationException("Unable to resolve CAStor node name '" + nodeAddr.getHostName() + "' to IP address");
        }
        return "http://" + nodeInetAddr.getHostAddress() + ":" + nodeAddr.getPort() + "/" + bucket + "/" + fileName + (_domain == null ? "" : "?domain=" + _domain);
    }
View Full Code Here

      InetAddress inetAddr = NetHelper.getFirstNonLoopbackLocalInetAddress();
      if(inetAddr != null)
        hostKey = NetHelper.getMacAddress(inetAddr);
    }
    if(hostKey == null)
      throw new ConfigurationException("Please configure host.key property in cloud-bridge.properites");
    String host = properties.getProperty("host");
    if(host == null)
      host = NetHelper.getHostName();

    if(properties.get("bucket.dns") != null &&
View Full Code Here

      InetAddress inetAddr = NetHelper.getFirstNonLoopbackLocalInetAddress();
      if(inetAddr != null)
        hostKey = NetHelper.getMacAddress(inetAddr);
    }
    if(hostKey == null)
      throw new ConfigurationException("Please configure host.key property in cloud-bridge.properites");
    String host = properties.getProperty("host");
    if(host == null)
      host = NetHelper.getHostName();

    if(properties.get("bucket.dns") != null &&
View Full Code Here

            --numIPs;
        } catch (NumberFormatException nfe) {
            // okay, it's an ip address, not a port number
        }
        if (numIPs <= 0) {
            throw new ConfigurationException("No CAStor nodes specified in '" + mountedRoot + "'");
        }
        HashSet<String> ips = new HashSet<String>();
        String clusterName = null;
        for ( int i = 0; i < numIPs; ++i ) {
            String option = cfg[i+1]; // ip address or zeroconf=mycluster.example.com or domain=mydomain.example.com
            if (option.toLowerCase().startsWith("zeroconf=")) {
                String[] confStr = option.split("=");
                if (confStr.length != 2) {
                    throw new ConfigurationException("Could not parse cluster name from '" + option + "'");
                }
                clusterName = confStr[1];
            } else if (option.toLowerCase().startsWith("domain=")) {
                String[] confStr = option.split("=");
                if (confStr.length != 2) {
                    throw new ConfigurationException("Could not parse domain name from '" + option + "'");
                }
                _domain = confStr[1];
            } else {
                ips.add(option);
            }
        }
        if (clusterName == null && ips.isEmpty()) {
            throw new ConfigurationException("No CAStor nodes specified in '" + mountedRoot + "'");
        }
        String[] castorNodes = ips.toArray(new String[0])// list of configured nodes
        if (clusterName == null) {
            try {
                _locator = new StaticLocator(castorNodes, castorPort, LOCATOR_RETRY_TIMEOUT);
                _locator.start();
            } catch (IOException e) {
                throw new ConfigurationException("Could not create CAStor static locator for '" +
                                                 Arrays.toString(castorNodes) + "'");
            }
        } else {
            try {
                clusterName = clusterName.replace(".", "_"); // workaround needed for CAStorSDK 1.3.1
                _locator = new ZeroconfLocator(clusterName);
                _locator.start();
            } catch (IOException e) {
                throw new ConfigurationException("Could not create CAStor zeroconf locator for '" + clusterName + "'");
            }
        }
        try {
            s_logger.info("CAStor client starting: " + (_domain==null ? "default domain" : "domain " + _domain) + " " + (clusterName==null ? Arrays.toString(castorNodes) : clusterName) + " :" + castorPort);
            _scspClient = new ScspClient(_locator, castorPort, DEFAULT_MAX_POOL_SIZE, DEFAULT_MAX_RETRIES, CONNECTION_TIMEOUT, CM_IDLE_TIMEOUT);
            _scspClient.start();
        } catch (Exception e) {
            s_logger.error("Unable to create CAStor client for '" + mountedRoot + "': " + e.getMessage(), e);
            throw new ConfigurationException("Unable to create CAStor client for '" + mountedRoot + "': " + e);
        }
        return _scspClient;
    }
View Full Code Here

        // InputStream for use by loadObject() and loadObjectRange().

        myClient(mountedRoot); // make sure castorNodes and castorPort initialized
        InetSocketAddress nodeAddr = _locator.locate();
        if (nodeAddr == null) {
            throw new ConfigurationException("Unable to locate CAStor node with locator " + _locator);
        }
        InetAddress nodeInetAddr = nodeAddr.getAddress();
        if (nodeInetAddr == null) {
            _locator.foundDead(nodeAddr);
            throw new ConfigurationException("Unable to resolve CAStor node name '" + nodeAddr.getHostName() +
                                             "' to IP address");
        }
        return "http://" + nodeInetAddr.getHostAddress() + ":" + nodeAddr.getPort() + "/" + bucket + "/" + fileName +
            (_domain==null ? "" : "?domain=" + _domain);
    }
View Full Code Here

TOP

Related Classes of com.cloud.bridge.service.exception.ConfigurationException

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.