Package javax.naming

Examples of javax.naming.ConfigurationException


        String value = (String) params.get("scripts.timeout");
        _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;

        _modifyVlanPath = Script.findScript(networkScriptsDir, "modifyvlan.sh");
        if (_modifyVlanPath == null) {
            throw new ConfigurationException("Unable to find modifyvlan.sh");
        }

        try {
            createControlNetwork();
        } catch (LibvirtException e) {
            throw new ConfigurationException(e.getMessage());
        }
    }
View Full Code Here


            storageScriptsDir = getDefaultStorageScriptsDir();
        }

        _createTmplPath = Script.findScript(storageScriptsDir, "createtmplt.sh");
        if (_createTmplPath == null) {
            throw new ConfigurationException("Unable to find the createtmplt.sh");
        }

        _manageSnapshotPath = Script.findScript(storageScriptsDir, "managesnapshot.sh");
        if (_manageSnapshotPath == null) {
            throw new ConfigurationException("Unable to find the managesnapshot.sh");
        }

        String value = (String) params.get("cmds.timeout");
        _cmdsTimeout = NumbersUtil.parseInt(value, 7200) * 1000;
        return true;
View Full Code Here

            if ("guest".equalsIgnoreCase(traffType)) {
                _frontendTrafficType = TrafficType.Guest;
            } else if ("public".equalsIgnoreCase(traffType)){
                _frontendTrafficType = TrafficType.Public;
            } else
                throw new ConfigurationException("ELB: Traffic type for front end of load balancer has to be guest or public; found : " + traffType);
            s_logger.info("ELB: Elastic Load Balancer: will balance on " + traffType );
            int gcIntervalMinutes =  NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmGcInterval.key()), 5);
            if (gcIntervalMinutes < 5)
                gcIntervalMinutes = 5;
            s_logger.info("ELB: Elastic Load Balancer: scheduling GC to run every " + gcIntervalMinutes + " minutes" );
View Full Code Here

  @Override
    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
      try {               
        _name = (String) params.get("name");
        if (_name == null) {
          throw new ConfigurationException("Unable to find name");
        }
       
        _zoneId = (String) params.get("zoneId");
        if (_zoneId == null) {
          throw new ConfigurationException("Unable to find zone");
        }
       
        _ip = (String) params.get("ip");
        if (_ip == null) {
          throw new ConfigurationException("Unable to find IP");
        }
       
        _username = (String) params.get("username");
        if (_username == null) {
          throw new ConfigurationException("Unable to find username");
        }
       
        _password = (String) params.get("password");
        if (_password == null) {
          throw new ConfigurationException("Unable to find password");
        }               
       
        _publicInterface = (String) params.get("publicinterface");
        if (_publicInterface == null) {
          throw new ConfigurationException("Unable to find public interface");
        }
       
        _privateInterface = (String) params.get("privateinterface");
        if (_privateInterface == null) {
          throw new ConfigurationException("Unable to find private interface");
        }
       
        _numRetries = NumbersUtil.parseInt((String) params.get("numretries"), 1);
             
        _guid = (String)params.get("guid");
            if (_guid == null) {
                throw new ConfigurationException("Unable to find the guid");
            }
           
            login();
   
        return true;
      } catch (Exception e) {
        throw new ConfigurationException(e.getMessage());
      }
     
    }
View Full Code Here

    @Override
    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {

        try {
            if (amqpHost == null || amqpHost.isEmpty()) {
                throw new ConfigurationException("Unable to get the AMQP server details");
            }

            if (username == null || username.isEmpty()) {
                throw new ConfigurationException("Unable to get the username details");
            }

            if (password == null || password.isEmpty()) {
                throw new ConfigurationException("Unable to get the password details");
            }

            if (amqpExchangeName == null || amqpExchangeName.isEmpty()) {
                throw new ConfigurationException("Unable to get the _exchange details on the AMQP server");
            }

            if (port == null) {
                throw new ConfigurationException("Unable to get the port details of AMQP server");
            }

            if (retryInterval == null) {
                retryInterval = 10000;// default to 10s to try out reconnect
            }

        } catch (NumberFormatException e) {
            throw new ConfigurationException("Invalid port number/retry interval");
        }

        _subscribers = new ConcurrentHashMap<String, Ternary<String, Channel, EventSubscriber>>();
        executorService = Executors.newCachedThreadPool();
        disconnectHandler = new DisconnectHandler();
View Full Code Here

            _kvmGuestNic = _kvmPrivateNic;
        }

        _hostIp = _configDao.getValue("host");
        if (_hostIp == null) {
            throw new ConfigurationException("Can't get host IP");
        }
        _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
        return true;
    }
View Full Code Here

    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
        try {
            _name = (String) params.get("name");
            if (_name == null) {
                throw new ConfigurationException("Unable to find name");
            }

            _zoneId = (String) params.get("zoneId");
            if (_zoneId == null) {
                throw new ConfigurationException("Unable to find zone");
            }

            _physicalNetworkId = (String) params.get("physicalNetworkId");
            if (_physicalNetworkId == null) {
                throw new ConfigurationException("Unable to find physical network id in the configuration parameters");
            }

            _ip = (String) params.get("ip");
            if (_ip == null) {
                throw new ConfigurationException("Unable to find IP");
            }

            _username = (String) params.get("username");
            if (_username == null) {
                throw new ConfigurationException("Unable to find username");
            }

            _password = (String) params.get("password");
            if (_password == null) {
                throw new ConfigurationException("Unable to find password");
            }

            _guid = (String)params.get("guid");
            if (_guid == null) {
                throw new ConfigurationException("Unable to find the guid");
            }

            _numRetries = NumbersUtil.parseInt((String) params.get("numretries"), 1);

            NumbersUtil.parseInt((String) params.get("timeout"), 300);

            // Open a socket and login
            _connection = new CiscoVnmcConnectionImpl(_ip, _username, _password);
            if (!refreshVnmcConnection()) {
                throw new ConfigurationException("Unable to connect to VNMC, check if ip/username/password is valid.");
            }

            return true;
        } catch (Exception e) {
            throw new ConfigurationException(e.getMessage());
        }

    }
View Full Code Here

    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
        super.configure(name, params);

        _guid = (String)params.get("guid");
        if (_guid == null) {
            throw new ConfigurationException("Unable to find the guid");
        }

        _dc = (String)params.get("zone");
        if (_dc == null) {
            throw new ConfigurationException("Unable to find the zone");
        }
        _pod = (String)params.get("pod");

        _instance = (String)params.get("instance");

        _parent = (String)params.get("mount.path");
        if (_parent == null) {
            throw new ConfigurationException("No directory specified.");
        }

        _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey);
        if (_storage == null) {
            String value = (String)params.get(StorageLayer.ClassConfigKey);
            if (value == null) {
                value = "com.cloud.storage.JavaStorageLayer";
            }

            try {
                Class<StorageLayer> clazz = (Class<StorageLayer>)Class.forName(value);
                _storage = ComponentContext.inject(clazz);
            } catch (ClassNotFoundException e) {
                throw new ConfigurationException("Unable to find class " + value);
            }
        }

        if (!_storage.mkdirs(_parent)) {
            s_logger.warn("Unable to create the directory " + _parent);
            throw new ConfigurationException("Unable to create the directory " + _parent);
        }

        s_logger.info("Mount point established at " + _parent);

        params.put("template.parent", _parent);
View Full Code Here

    try {
      _memCapacity = Long.parseLong((String) params.get(ApiConstants.MEMORY)) * 1024L * 1024L;
      _cpuCapacity = Long.parseLong((String) params.get(ApiConstants.CPU_SPEED));
      _cpuNum = Long.parseLong((String) params.get(ApiConstants.CPU_NUMBER));
    } catch (NumberFormatException e) {
      throw new ConfigurationException(String.format("Unable to parse number of CPU or memory capacity "
              + "or cpu capacity(cpu number = %1$s memCapacity=%2$s, cpuCapacity=%3$s", (String) params.get(ApiConstants.CPU_NUMBER),
              (String) params.get(ApiConstants.MEMORY), (String) params.get(ApiConstants.CPU_SPEED)));
    }

    _zone = (String) params.get("zone");
    _pod = (String) params.get("pod");
    _cluster = (String) params.get("cluster");
    hostId = (Long) params.get("hostId");
    _ip = (String) params.get(ApiConstants.PRIVATE_IP);
    _mac = (String) params.get(ApiConstants.HOST_MAC);
    _username = (String) params.get(ApiConstants.USERNAME);
    _password = (String) params.get(ApiConstants.PASSWORD);
    _vmName = (String) params.get("vmName");
    String echoScAgent = (String) params.get(BaremetalManager.EchoSecurityGroupAgent);

    if (_pod == null) {
      throw new ConfigurationException("Unable to get the pod");
    }

    if (_cluster == null) {
      throw new ConfigurationException("Unable to get the pod");
    }
   
    if (_ip == null) {
      throw new ConfigurationException("Unable to get the host address");
    }

    if (_mac.equalsIgnoreCase("unknown")) {
      throw new ConfigurationException("Unable to get the host mac address");
    }

    if (_mac.split(":").length != 6) {
      throw new ConfigurationException("Wrong MAC format(" + _mac
              + "). It must be in format of for example 00:11:ba:33:aa:dd which is not case sensitive");
    }

    if (_uuid == null) {
      throw new ConfigurationException("Unable to get the uuid");
    }

    if (echoScAgent != null) {
        _isEchoScAgent = Boolean.valueOf(echoScAgent);
    }

    String injectScript = "scripts/util/ipmi.py";
    String scriptPath = Script.findScript("", injectScript);
    if (scriptPath == null) {
      throw new ConfigurationException("Cannot find ping script " + scriptPath);
    }
    String pythonPath = "/usr/bin/python";
    _pingCommand = new Script2(pythonPath, s_logger);
    _pingCommand.add(scriptPath);
    _pingCommand.add("ping");
View Full Code Here

    try {
      super.configure(name, params);
      s_logger.debug(String.format("Trying to connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s)", _ip, _username, "******"));
      sshConnection = SSHCmdHelper.acquireAuthorizedConnection(_ip, _username, _password);
      if (sshConnection == null) {
        throw new ConfigurationException(
            String.format("Cannot connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
      }

      if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "[ -f '/usr/sbin/dhcpd' ]")) {
        throw new ConfigurationException("Cannot find dhcpd.conf /etc/dhcpd.conf at  on " + _ip);
      }

      SCPClient scp = new SCPClient(sshConnection);

      String editHosts = "scripts/network/exdhcp/dhcpd_edithosts.py";
      String editHostsPath = Script.findScript("", editHosts);
      if (editHostsPath == null) {
        throw new ConfigurationException("Can not find script dnsmasq_edithosts.sh at " + editHosts);
      }
      scp.put(editHostsPath, "/usr/bin/", "0755");
     
      String prepareDhcpdScript = "scripts/network/exdhcp/prepare_dhcpd.sh";
      String prepareDhcpdScriptPath = Script.findScript("", prepareDhcpdScript);
      if (prepareDhcpdScriptPath == null) {
        throw new ConfigurationException("Can not find prepare_dhcpd.sh at " + prepareDhcpdScriptPath);
      }
      scp.put(prepareDhcpdScriptPath, "/usr/bin/", "0755");
     
      //TODO: tooooooooooooooo ugly here!!!
      String[] ips = _ip.split("\\.");
      ips[3] = "0";
      StringBuffer buf = new StringBuffer();
      int i;
      for (i=0;i<ips.length-1;i++) {
        buf.append(ips[i]).append(".");
      }
      buf.append(ips[i]);
      String subnet = buf.toString();
      String cmd = String.format("sh /usr/bin/prepare_dhcpd.sh %1$s", subnet);
      if (!SSHCmdHelper.sshExecuteCmd(sshConnection, cmd)) {
        throw new ConfigurationException("prepare Dhcpd at " + _ip + " failed, command:" + cmd);
     
     
      s_logger.debug("Dhcpd resource configure successfully");
      return true;
    } catch (Exception e) {
      s_logger.debug("Dhcpd resorce configure failed", e);
      throw new ConfigurationException(e.getMessage());
    } finally {
      SSHCmdHelper.releaseSshConnection(sshConnection);
    }
  }
View Full Code Here

TOP

Related Classes of javax.naming.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.