Check if this is a fedrated cluster and set the service name.
@throws ConfigurationException
779094
private void checkAndSetServiceName(Configuration conf, StartupInfo info) 
              throws ConfigurationException {
    String fedrationMode = conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES);
    String serviceName = info.serviceName;
    
    if (fedrationMode != null && !fedrationMode.trim().isEmpty()) {
      if (serviceName == null || serviceName.trim().isEmpty()) {
        throw new ConfigurationException("This is a fedrated DFS cluster, nameservice id is required.");
      }
      this.serviceName = serviceName;
    }
  }
989588
public static void checkHealth() throws ConfigurationException
    {
        Keyspace keyspace;
        try
        {
            keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
        }
        catch (AssertionError err)
        {
            // this happens when a user switches from OPP to RP.
            ConfigurationException ex = new ConfigurationException("Could not read system keyspace!");
            ex.initCause(err);
            throw ex;
        }
        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(LOCAL_CF);

        String req = "SELECT cluster_name FROM system.%s WHERE key='%s'";
        UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));

        if (result.isEmpty() || !result.one().has("cluster_name"))
        {
            // this is a brand new node
            if (!cfs.getSSTables().isEmpty())
                throw new ConfigurationException("Found system keyspace files, but they couldn't be loaded!");

            // no system files.  this is a new node.
            req = "INSERT INTO system.%s (key, cluster_name) VALUES ('%s', ?)";
            executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), DatabaseDescriptor.getClusterName());
            return;
        }

        String savedClusterName = result.one().getString("cluster_name");
        if (!DatabaseDescriptor.getClusterName().equals(savedClusterName))
            throw new ConfigurationException("Saved cluster name " + savedClusterName + " != configured name " + DatabaseDescriptor.getClusterName());
    }
46995
public void init(Configuration configuration)
			throws Exception
	{
		String baseName = configuration.getBootstrapPropertyResolver().getProperty("ResourceBundleFactory.Bundle");
		if (baseName != null)
		{
			this.baseName = baseName;
		}
	}
51643
private void setUp() throws Exception {
    try {
      fileSystem = (DistributedFileSystem) FileSystem.get(
          StorageServiceConfigKeys.translateToOldSchema(conf, nameserviceId), conf);
      InetSocketAddress nameNodeAddr = fileSystem.getClient().getNameNodeAddr();
      metaInfo = new RequestMetaInfo(clusterId, nameserviceId, RequestMetaInfo.NO_NAMESPACE_ID,
          RequestMetaInfo.NO_APPLICATION_ID, (UnixUserGroupInformation) UserGroupInformation.getUGI(
          this.conf));

      directClientProtocol = RPC.getProxy(ClientProtocol.class, ClientProtocol.versionID,
          nameNodeAddr, conf);

      directClientProxyProtocol = RPC.getProxy(ClientProxyProtocol.class,
          ClientProxyProtocol.versionID, nameNodeAddr, conf);

      clientManager = new ThriftClientManager();
      FramedClientConnector connector = new FramedClientConnector(HostAndPort.fromParts(
          proxyHostname, proxyPortThrift));
      proxyTClientProxyProtocol = clientManager.createClient(connector, TClientProxyProtocol.class)
          .get();

      proxyClientProxyProtocol = RPC.getProxy(ClientProxyProtocol.class,
          ClientProxyProtocol.versionID, new InetSocketAddress(proxyHostname, proxyPortRPC), conf);

      fileSystem.mkdirs(new Path(ROOT));
    } catch (Exception e) {
      tearDown();
      throw e;
    }
  }
1252483
public void initialize(URI name, Configuration conf) throws IOException {
    // if an underlying fs has not already been specified,
    // create and initialize one
    if (this.fs == null) {
      Class<?> clazz = conf.getClass("fs.apitrace.underlyingfs.impl",
                                     DistributedFileSystem.class);
      if (clazz == null) {
        throw new IOException("No FileSystem for fs.apitrace.underlyingfs.impl.");
      }

      this.fs = (FileSystem)ReflectionUtils.newInstance(clazz, null);
      super.initialize(name, conf);
    }

    // trace conf options
    for (String opt : traceConfOpts) {
      APITrace.CallEvent ce = new APITrace.CallEvent();
      ce.logCall(APITrace.COMMENT_msg, null,
                 new Object[] {opt, conf.get(opt, "")});
    }
  }
920066
private Configuration generateClusterConfiguration(Configuration configuration) {
		final Configuration resultConfiguration = new Configuration(Preconditions.checkNotNull(configuration));

		final String webTmpDir = configuration.getString(WebOptions.TMP_DIR);
		final File uniqueWebTmpDir = new File(webTmpDir, "flink-web-" + UUID.randomUUID());

		resultConfiguration.setString(WebOptions.TMP_DIR, uniqueWebTmpDir.getAbsolutePath());

		return resultConfiguration;
	}
815159
private void configureEPServiceProvider() throws EPException, IOException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Configuring the Esper Service Provider with name: " + name);
        }
        if (this.configuration != null && this.configuration.exists()) {
            Configuration esperConfiguration = new Configuration();
            esperConfiguration = esperConfiguration.configure(this.configuration.getFile());
            epServiceProvider = EPServiceProviderManager.getProvider(name, esperConfiguration);
            LOG.info("Esper configured with a user-provided configuration", esperConfiguration);
        } else {
            epServiceProvider = EPServiceProviderManager.getProvider(name);
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Completed configuring the Esper Service Provider with name: " + name);
        }
    }
618310
public static Map resetZKConfig(Map conf, String clusterName) {
        ClusterConfig nimbus = clusterConfig.get(clusterName);
        if (nimbus == null) return conf;
        conf.put(Config.STORM_ZOOKEEPER_ROOT, nimbus.getZkRoot());
        conf.put(Config.STORM_ZOOKEEPER_SERVERS, nimbus.getZkServers());
        conf.put(Config.STORM_ZOOKEEPER_PORT, nimbus.getZkPort());
        return conf;
    }
521465
private void configureClientProperties() throws IOException {
        Map<String, String> serviceRefProps = wsrInfo.getProperties();
        Iterator<QName> iterator = this.getPorts();//wsrInfo.getBindingPortComponentRefInfoList();

        while (null != iterator && iterator.hasNext()) {
            QName portQName = iterator.next();
            PortComponentRefInfo portInfo = wsrInfo.getPortComponentRefInfo(portQName);
            Map<String, String> portProps = (null != portInfo) ? portInfo.getProperties() : null;

            if ((null != serviceRefProps || null != portProps)) {
                prepareProperties(portQName, serviceRefProps, portProps);
            }
        }
    }
1190607
public function setName($name)
    {
        if (empty((string) $name)) {
            throw new ConfigurationException(
                'The configuration must specify a non-empty name for the Tool Provider.',
                ConfigurationException::TOOL_PROVIDER
            );
        } else {
            $this->name = (string) $name;
        }
    }
495036
static void setDefaultCloudStorageConfiguration(CloudStorageConfiguration config) {
    if (null == config) {
      userSpecifiedDefault = CloudStorageConfiguration.DEFAULT;
    } else {
      userSpecifiedDefault = config;
    }
  }
81655
public static void ensurePropertyNotConfigured(HazelcastProperties properties, HazelcastProperty hazelcastProperty)
            throws ConfigurationException {
        if (properties.containsKey(hazelcastProperty)) {
            throw new ConfigurationException("Service start failed. The legacy property " + hazelcastProperty.getName()
                    + " is provided together with new Config object. "
                    + "Remove the property from your configuration to fix this issue.");
        }
    }
346799
public static boolean isServiceExported(Configuration configuration, int port, String serviceName) {
        if (serviceName == null)
            return false;
        try {
            final Registry registry = RegistryFinder.getInstance().getRegistry(configuration, port);
            String[] list = registry.list();

            if (list != null) {
                for (int i = 0; i < list.length; i++) {
                    if (serviceName.equals(list[i]))
                        return true;
                }
            }
        } catch (RemoteException ex) {
            return false;
        } catch (Exception e) {
            return false;
        }
        return false;
    }
1253356
public function initConfigs()
    {
        // Check configurations
        if (empty($this->configurations)) {
            return;
        }

        // Get available configurations
        $available = $this->getConfigurations();

        // Iterate
        foreach ($this->configurations as $component => $file) {
            // Check if configuration asked exists
            if (!array_key_exists($component, $available)) {
                continue;
            }

            $service = $this->get($component);

            // Check service integrity
            if (!$service) {
                continue;
            }

            // Initialize service
            $service->setPath($file);
            $service->init();
        }
    }
949212
public void configure(Configuration config) throws ConfigurationException
    {
        LoggingConfiguration lc = (LoggingConfiguration) config;
        String levelName = lc.getLogLevel(name);
        setLevel(levelName);
    }
55998
private static void initWebClientConfig(WebClientConfiguration wconf) {
        if (CONFIG == null) {
            logger.warn("Web client config was null; cannot configure web client for {}", ServerUtility.class);
            logger.info("FEDORA_HOME is used to configure web client; was set to {}", Constants.FEDORA_HOME);
            return;
        }
        if (CONFIG.getParameter("httpClientTimeoutSecs") != null)
            wconf.setTimeoutSecs(Integer.parseInt(CONFIG.getParameter("httpClientTimeoutSecs")));

        if (CONFIG.getParameter("httpClientSocketTimeoutSecs") != null)
            wconf.setSockTimeoutSecs(Integer.parseInt(CONFIG.getParameter("httpClientSocketTimeoutSecs")));

        if (CONFIG.getParameter("httpClientMaxConnectionsPerHost") != null)
            wconf.setMaxConnPerHost(Integer.parseInt(CONFIG.getParameter("httpClientMaxConnectionsPerHost")));

        if (CONFIG.getParameter("httpClientMaxTotalConnections") != null)
            wconf.setMaxTotalConn(Integer.parseInt(CONFIG.getParameter("httpClientMaxTotalConnections")));

        if (CONFIG.getParameter("httpClientFollowRedirects") != null)
            wconf.setFollowRedirects(Boolean.parseBoolean(CONFIG.getParameter("httpClientFollowRedirects")));

        if (CONFIG.getParameter("httpClientMaxFollowRedirects") != null)
            wconf.setMaxRedirects(Integer.parseInt(CONFIG.getParameter("httpClientMaxFollowRedirects")));

        if (CONFIG.getParameter("httpClientUserAgent") != null)
            wconf.setUserAgent(CONFIG.getParameter("httpClientUserAgent"));
    }
1114824
public final synchronized void initialize(Map<String,String> configuration)
    {
        if(this.initialized)
        {
            throw new FaxException("Service already initialized.");
        }
        
        //set flag
        this.initialized=true;

        //get configuration
        this.serviceConfiguration=new ConfigurationHolderImpl(configuration,this.propertyPart);

        //get logger
        LoggerManager loggerManager=LoggerManager.getInstance();
        this.serviceLogger=loggerManager.getLogger();
        
        //initialize
        this.initializeImpl();
    }