Loads cluster default values from the meta master.

@param address the master address
426414
public static synchronized void loadClusterDefaults(InetSocketAddress address)
      throws AlluxioStatusException {
    AlluxioConfiguration conf = ConfigurationUtils.loadClusterDefaults(address, global());
    sConf = new InstancedConfiguration(conf.copyProperties(), conf.clusterDefaultsLoaded());
  }
462652
public void setClusterNodes(java.util.Collection<ClusterNode> clusterNodes) {
        if (clusterNodes == null) {
            this.clusterNodes = null;
            return;
        }

        this.clusterNodes = new com.amazonaws.internal.SdkInternalList<ClusterNode>(clusterNodes);
    }
493410
public void setAddresses(java.util.Collection<Address> addresses) {
        if (addresses == null) {
            this.addresses = null;
            return;
        }

        this.addresses = new java.util.ArrayList<Address>(addresses);
    }
328902
public DistributedWorkManagerStatisticsValues localGetDistributedStatistics(Address address)
   {
      if (trace)
         log.tracef("LOCAL_GET_DISTRIBUTED_STATISTICS(%s)", address);

      DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(address);

      if (dwm != null)
      {
         DistributedWorkManagerStatisticsValues values =
            new DistributedWorkManagerStatisticsValues(dwm.getDistributedStatistics().getWorkSuccessful(),
                                                       dwm.getDistributedStatistics().getWorkFailed(),
                                                       dwm.getDistributedStatistics().getDoWorkAccepted(),
                                                       dwm.getDistributedStatistics().getDoWorkRejected(),
                                                       dwm.getDistributedStatistics().getScheduleWorkAccepted(),
                                                       dwm.getDistributedStatistics().getScheduleWorkRejected(),
                                                       dwm.getDistributedStatistics().getStartWorkAccepted(),
                                                       dwm.getDistributedStatistics().getStartWorkRejected());

         return values;
      }

      return null;
   }
1341114
private void loadEndpointComponentProperties() {
        try {
            endpointComponentProperties = PropertiesLoaderUtils.loadProperties(new ClassPathResource("com/consol/citrus/endpoint/endpoint.components"));
        } catch (IOException e) {
            log.warn("Unable to laod default endpoint components from resource '%s'", e);
        }
    }
289930
public void updateMetadataVersions() {
        Properties versionProps = MetadataVersionStoreUtils.getProperties(this.systemStoreRepository.getMetadataVersionStore());
        Long newVersion = fetchNewVersion(SystemStoreConstants.CLUSTER_VERSION_KEY,
                                          null,
                                          versionProps);
        if(newVersion != null) {
            this.currentClusterVersion = newVersion;
        }
    }
74240
public void init(Cluster cluster, Map<String, Node> nodeIdToNode) {
        _cluster = cluster;
        _nodeIdToNode = nodeIdToNode;
    }
428870
@Override
  protected ServiceRefAmp lookupService(String address)
  {
    String prefix = "cluster://";

    if (address.startsWith(prefix)) {
      int p = address.indexOf('/', prefix.length() + 1);
      
      if (p > 0) {
        String cluster = address.substring(prefix.length(), p);
        String path = address.substring(p);
    
        return lookupService(cluster, path);
      }
    }
    
    ServiceRefAmp serviceRef = services().service(address);
    
    return serviceRef;
  }
665032
public void bind(InetSocketAddress address) throws IOException {
        if (listener != null) {
            listener.close();
            listener = null;
        }
        listener = ServerSocketChannel.open();
        listener.socket().bind(address);
    }
594540
private void loadProfiles() {
    URL convention_default = resources.getGlobal();
    if (null == convention_default) { throw new RuntimeException("cannot find convention-default.properties!"); }
    List<Profile> defaultProfiles = buildProfiles(convention_default, true);
    if (!defaultProfiles.isEmpty()) {
      defaultProfile = defaultProfiles.get(0);
    }
    for (URL url : resources.getLocals()) {
      profiles.addAll(buildProfiles(url, false));
    }
  }
775513
public void setClusters(java.util.Collection<ClusterSummary> clusters) {
        if (clusters == null) {
            this.clusters = null;
            return;
        }

        this.clusters = new com.amazonaws.internal.SdkInternalList<ClusterSummary>(clusters);
    }
727751
@Nullable
  public static InetSocketAddress parseInetSocketAddress(String address) throws IOException {
    if (address == null) {
      return null;
    }
    String[] strArr = address.split(":");
    if (strArr.length != 2) {
      throw new IOException("Invalid InetSocketAddress " + address);
    }
    return new InetSocketAddress(strArr[0], Integer.parseInt(strArr[1]));
  }
1014739
private void parseDefaultContent(JsonObject root) {
    Streams.stream(root.getAsJsonArray("defaultContent"))
      .forEach(e -> defaultContent.add(LocaleID.parse(e.getAsString())));
  }
1364628
@Override
    @Synchronized
    public void registerHost(Host host) {
        Preconditions.checkNotNull(host, "host");
        Exceptions.checkArgument(!entryMap.containsKey(host), "host", "host is already registered to cluster.");

        String hostPath = ZKPaths.makePath(getPathPrefix(), host.toString());
        PersistentNode node = new PersistentNode(client, CreateMode.EPHEMERAL, false, hostPath,
                host.toBytes());

        node.start(); //start creation of ephemeral node in background.
        entryMap.put(host, node);
    }
277503
void loadHandlers(ControllerAddress address) throws CommandLineException, CommandLineParserException {

        ModelControllerClient client = ctx.getModelControllerClient();
        assert client != null : "client is null";

        if(moduleLoader == null) {
            ctx.printLine("Warning! The CLI is running in a non-modular environment and cannot load commands from management extensions.");
            return;
        }

        if(address != null && currentAddress != null && address.equals(currentAddress)) {
            return;
        }

        // remove previously loaded commands
        resetHandlers();
        currentAddress = address;

        final ModelNode req = new ModelNode();
        req.get(Util.ADDRESS).setEmptyList();
        req.get(Util.OPERATION).set(Util.READ_CHILDREN_RESOURCES);
        req.get(Util.CHILD_TYPE).set(Util.EXTENSION);

        final ModelNode response;
        try {
            response = client.execute(req);
        } catch (IOException e) {
            throw new CommandLineException("Extensions loader failed to read extensions", e);
        }

        if(!Util.isSuccess(response)) {
            throw new CommandLineException("Extensions loader failed to read extensions: " + Util.getFailureDescription(response));
        }

        final ModelNode result = response.get(Util.RESULT);
        if(!result.isDefined()) {
            throw new CommandLineException("Extensions loader failed to read extensions: " + result.asString());
        }

        for(Property ext : result.asPropertyList()) {
            ModelNode module = ext.getValue().get(Util.MODULE);
            if(!module.isDefined()) {
                addError("Extension " + ext.getName() + " is missing module attribute");
            } else {
                final ModuleIdentifier moduleId = ModuleIdentifier.fromString(module.asString());
                ModuleClassLoader cl;
                try {
                    cl = moduleLoader.loadModule(moduleId).getClassLoader();
                    ServiceLoader<CommandHandlerProvider> loader = ServiceLoader.load(CommandHandlerProvider.class, cl);
                    for (CommandHandlerProvider provider : loader) {
                        try {
                            registry.registerHandler(provider.createCommandHandler(ctx), provider.isTabComplete(), provider.getNames());
                            addHandlers(Arrays.asList(provider.getNames()));
                        } catch(CommandRegistry.RegisterHandlerException e) {
                            addError(e.getLocalizedMessage());
                            final List<String> addedCommands = new ArrayList<String>(Arrays.asList(provider.getNames()));
                            addedCommands.removeAll(e.getNotAddedNames());
                            addHandlers(addedCommands);
                        }
                    }
                    ServiceLoader<Command> loader2 = ServiceLoader.load(Command.class, cl);
                    for (Command provider : loader2) {
                        try {
                            CommandContainer container = aeshRegistry.addCommand(provider);
                            addCommand(container.getParser().getProcessedCommand().name());
                        } catch (CommandLineException e) {
                            addError(e.getLocalizedMessage());
                        }
                    }
                } catch (ModuleLoadException e) {
                    addError("Module " + module.asString() + " from extension " + ext.getName() +
                            " available on the server couldn't be loaded locally: " + e.getLocalizedMessage());
                }
            }
        }

        if(!errors.isEmpty()) {
            ctx.printLine("Warning! There were errors trying to load extensions. For more details, please, execute 'extension-commands --errors'");
        }
    }
150877
public void onPrepareAddChildResource(final ModelNode address, final boolean isSingleton) {

        _loadMetaData(address, new ResourceData(true), new Outcome<ResourceData>() {
                    @Override
                    public void onFailure(ResourceData context) {
                        Console.error("Failed to load metadata for " + address.asString());
                    }

                    @Override
                    public void onSuccess(ResourceData context) {
                        if (isSingleton && context.description.get(ATTRIBUTES).asList().isEmpty()
                                && context.description.get(OPERATIONS).get(ADD).get(REQUEST_PROPERTIES).asList().isEmpty()) {
                            // no attributes need to be assigned -> skip the next step
                            onAddChildResource(address, new ModelNode());
                        } else {
                            view.showAddDialog(address, isSingleton, context.securityContext, context.description);
                        }
                    }
                }
        );

    }
475738
protected void loadClientMetadata(Map<String, Object> puProperties)
    {
        clientMetadata = new ClientMetadata();
        String luceneDirectoryPath = puProperties != null ? (String) puProperties
                .get(PersistenceProperties.KUNDERA_INDEX_HOME_DIR) : null;

        String indexerClass = puProperties != null ? (String) puProperties
                .get(PersistenceProperties.KUNDERA_INDEXER_CLASS) : null;
                
        String autoGenClass = puProperties != null ? (String) puProperties
                        .get(PersistenceProperties.KUNDERA_AUTO_GENERATOR_CLASS) : null;


        if (indexerClass == null)
        {
            indexerClass = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit)
                    .getProperties().getProperty(PersistenceProperties.KUNDERA_INDEXER_CLASS);
        }
        if (autoGenClass == null)
        {
            autoGenClass = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit)
                    .getProperties().getProperty(PersistenceProperties.KUNDERA_AUTO_GENERATOR_CLASS);
        }

        if (luceneDirectoryPath == null)
        {
            luceneDirectoryPath = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit)
                    .getProperty(PersistenceProperties.KUNDERA_INDEX_HOME_DIR);
        }
        
        if (autoGenClass != null) 
        {
            clientMetadata.setAutoGenImplementor(autoGenClass);    
        }

        // in case set empty via external property, means want to avoid lucene
        // directory set up.
        if (luceneDirectoryPath != null && !StringUtils.isEmpty(luceneDirectoryPath))
        {
            // Add client metadata
            clientMetadata.setLuceneIndexDir(luceneDirectoryPath);

            // Set Index Manager

            try
            {
                Method method = Class.forName(IndexingConstants.LUCENE_INDEXER).getDeclaredMethod("getInstance",
                        String.class);

                Indexer indexer = (Indexer) method.invoke(null, luceneDirectoryPath);
                indexManager = new IndexManager(indexer, kunderaMetadata);
            }
            catch (Exception e)
            {
                logger.error(
                        "Missing lucene from classpath. Please make sure those are available to load lucene directory {}!",
                        luceneDirectoryPath);
                throw new InvalidConfigurationException(e);
            }

            // indexManager = new IndexManager(LuceneIndexer.getInstance(new
            // StandardAnalyzer(Version.LUCENE_CURRENT),
            // luceneDirectoryPath));
        }
        else if (indexerClass != null)
        {
            try
            {
                Class<?> indexerClazz = Class.forName(indexerClass);
                Indexer indexer = (Indexer) indexerClazz.newInstance();
                indexManager = new IndexManager(indexer, kunderaMetadata);
                clientMetadata.setIndexImplementor(indexerClass);
            }
            catch (Exception cnfex)
            {
                logger.error("Error while initialzing indexer:" + indexerClass, cnfex);
                throw new KunderaException(cnfex);
            }
        }
        else
        {
            indexManager = new IndexManager(null, kunderaMetadata);
        }
        // if
        // (kunderaMetadata.getClientMetadata(persistenceUnit)
        // ==
        // null)
        // {
        // kunderaMetadata.addClientMetadata(persistenceUnit,
        // clientMetadata);
        // }
    }