Returns the default implementation of the {@link Router} to find a {@link ServiceConfig}.
It consists of several router implementations which use one of Trie and List. It also includes
cache mechanism to improve its performance.
339591
public static Router<ServiceConfig> ofVirtualHost(VirtualHost virtualHost, Iterable<ServiceConfig> configs,
                                                      RejectedPathMappingHandler rejectionHandler) {
        requireNonNull(virtualHost, "virtualHost");
        requireNonNull(configs, "configs");
        requireNonNull(rejectionHandler, "rejectionHandler");

        final BiConsumer<PathMapping, PathMapping> rejectionConsumer = (mapping, existingMapping) -> {
            try {
                rejectionHandler.handleDuplicatePathMapping(virtualHost, mapping, existingMapping);
            } catch (Exception e) {
                logger.warn("Unexpected exception from a {}:",
                            RejectedPathMappingHandler.class.getSimpleName(), e);
            }
        };

        return wrapVirtualHostRouter(defaultRouter(configs, ServiceConfig::pathMapping, rejectionConsumer));
    }
656971
public ProteusApplication addDefaultRoutes(RoutingHandler router)
    {

        if (config.hasPath("health.statusPath")) {
            try {
                final String statusPath = config.getString("health.statusPath");

                router.add(Methods.GET, statusPath, (final HttpServerExchange exchange) ->
                {
                    exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, MediaType.TEXT_PLAIN);
                    exchange.getResponseSender().send("OK");
                });

                this.registeredEndpoints.add(EndpointInfo.builder().withConsumes("*/*").withProduces("text/plain").withPathTemplate(statusPath).withControllerName("Internal").withMethod(Methods.GET).build());

            } catch (Exception e) {
                log.error("Error adding health status route.", e.getMessage());
            }
        }

        if (config.hasPath("application.favicon")) {
            try {

                final ByteBuffer faviconImageBuffer;

                final File faviconFile = new File(config.getString("application.favicon"));

                if (!faviconFile.exists()) {
                    try (final InputStream stream = this.getClass().getResourceAsStream(config.getString("application.favicon"))) {
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();

                        byte[] buffer = new byte[4096];
                        int read = 0;
                        while (read != -1) {
                            read = stream.read(buffer);
                            if (read > 0) {
                                baos.write(buffer, 0, read);
                            }
                        }

                        faviconImageBuffer = ByteBuffer.wrap(baos.toByteArray());
                    }

                } else {
                    try (final InputStream stream = Files.newInputStream(Paths.get(config.getString("application.favicon")))) {
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();

                        byte[] buffer = new byte[4096];
                        int read = 0;
                        while (read != -1) {
                            read = stream.read(buffer);
                            if (read > 0) {
                                baos.write(buffer, 0, read);
                            }
                        }

                        faviconImageBuffer = ByteBuffer.wrap(baos.toByteArray());
                    }
                }

                router.add(Methods.GET, "favicon.ico", (final HttpServerExchange exchange) ->
                {
                    exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, io.sinistral.proteus.server.MediaType.IMAGE_X_ICON.toString());
                    exchange.getResponseSender().send(faviconImageBuffer);
                });

            } catch (Exception e) {
                log.error("Error adding favicon route.", e.getMessage());
            }
        }

        return this;
    }
694790
@SuppressWarnings("unchecked")
   private <T> T loadService(Class<T> spiType, Class<?> defaultImpl, ClassLoader loader)
   {
      final String defaultImplName = defaultImpl != null ? defaultImpl.getName() : null;
      return (T)ServiceLoader.loadService(spiType.getName(), defaultImplName, loader);
   }
717672
public static Configuration defaultConfiguration() {
        Defaults defaults = getEffectiveDefaults();
        return Configuration.builder().jsonProvider(defaults.jsonProvider()).options(defaults.options()).build();
    }
1007583
public ServiceRefHandlerType<ServiceRefType<T>> getOrCreateHandler()
   {
      List<Node> nodeList = childNode.get("handler");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ServiceRefHandlerTypeImpl<ServiceRefType<T>>(this, "handler", childNode, nodeList.get(0));
      }
      return createHandler();
   }
710160
public static javax.net.SocketFactory getDefault() {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "getDefault");

        if (thisClass == null) {
            try {
                thisClass = new com.ibm.ws.ssl.protocol.LibertySSLSocketFactory();
            } catch (Exception e) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "SSLSocketFactory exception getting default socket factory.", new Object[] { e });
                FFDCFilter.processException(e, "SSLSocketFactory", "getDefault", thisClass);
            }
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "getDefault");
        return thisClass;
    }
199154
public alluxio.grpc.ServiceType getServiceType() {
    alluxio.grpc.ServiceType result = alluxio.grpc.ServiceType.valueOf(serviceType_);
    return result == null ? alluxio.grpc.ServiceType.UNKNOWN_SERVICE : result;
  }
799958
@Override
  public Configuration getServiceConfiguration() {

    final Configuration partialServiceConf = ServiceConfiguration.CONF
        .set(ServiceConfiguration.SERVICES, taskOutputStreamProvider.getClass())
        .set(ServiceConfiguration.ON_CONTEXT_STOP, ContextStopHandler.class)
        .set(ServiceConfiguration.ON_TASK_STARTED, TaskStartHandler.class)
        .build();

    return Tang.Factory.getTang()
        .newConfigurationBuilder(partialServiceConf)
        .bindImplementation(OutputStreamProvider.class, taskOutputStreamProvider.getClass())
        .bindImplementation(TaskOutputStreamProvider.class, taskOutputStreamProvider.getClass())
        .bindNamedParameter(OutputPath.class, outputPath)
        .build();
  }
132208
function defaultService (config) {
  const serviceConfig = _.merge({}, baseServiceConfig);

  // Apply MetaData
  serviceConfig.metadata = objectMetadata({
    name: config.projectName,
    namespace: config.namespace.name
  });

  serviceConfig.spec.selector = {
    project: config.projectName,
    provider: 'nodeshift'
  };

  serviceConfig.spec.ports = [
    {
      protocol: 'TCP',
      port: config.port,
      targetPort: config.port,
      name: 'http'
    }
  ];

  serviceConfig.spec.type = 'ClusterIP';

  return serviceConfig;
}
459357
public static HierarchicalConfiguration getCurrentConfig() {
        SiteContext siteContext = SiteContext.getCurrent();
        if (siteContext != null) {
            return siteContext.getConfig();
        } else {
            return null;
        }
    }
954538
public static Gateway createGateway() {
        Gateway gateway = null;
        for (GatewayCreator factory : loader) {
            gateway = factory.createGateway(gateway);
            factory.configureGateway(gateway);
        }

        if (gateway == null) {
            throw new RuntimeException("Failed to load GatewayCreator implementation class.");
        }

        return gateway;
    }
305847
private RaftServiceContext getOrInitializeService(PrimitiveId primitiveId, PrimitiveType primitiveType, String serviceName, byte[] config) {
    // Get the state machine executor or create one if it doesn't already exist.
    RaftServiceContext service = raft.getServices().getService(serviceName);
    if (service == null) {
      service = initializeService(primitiveId, primitiveType, serviceName, config);
    }
    return service;
  }
275192
function getDefaultConfiguration(){
    var CModule = require('cache-service-cache-module');
    var cacheModule = new CModule();
    cacheModule = addSettings(cacheModule);
    self.caches.push(cacheModule);
  }
153465
def get_default_config(self):
        
        config = super(NetscalerSNMPCollector, self).get_default_config()
        config.update({
            'path':     'netscaler',
            'timeout':  15,
            'exclude_service_type': [],
            'exclude_vserver_type': [],
            'exclude_service_state': [],
            'exclude_vserver_state': []
        })
        return config
1140967
def get_default_config(self):
        
        default_config = super(SNMPInterfaceCollector,
                               self).get_default_config()
        default_config['path'] = 'interface'
        default_config['byte_unit'] = ['bit', 'byte']
        return default_config
234313
public SimpleConfiguration getClientConfiguration() {
    SimpleConfiguration clientConfig = new SimpleConfiguration();
    Iterator<String> iter = getKeys();
    while (iter.hasNext()) {
      String key = iter.next();
      if (key.startsWith(CONNECTION_PREFIX) || key.startsWith(ACCUMULO_PREFIX)
          || key.startsWith(CLIENT_PREFIX)) {
        clientConfig.setProperty(key, getRawString(key));
      }
    }
    return clientConfig;
  }
259997
public static Connection getDefaultConnection(ServerConfiguration serverConfig) {
        ModuleConfiguration poolConfig =
                serverConfig
                        .getModuleConfiguration("org.fcrepo.server.storage.ConnectionPoolManager");
        String datastoreID =
                poolConfig.getParameter("defaultPoolName",Parameter.class).getValue();
        DatastoreConfiguration dbConfig =
                serverConfig.getDatastoreConfiguration(datastoreID);
        return getConnection(dbConfig.getParameter("jdbcDriverClass",Parameter.class)
                                     .getValue(),
                             dbConfig.getParameter("jdbcURL",Parameter.class).getValue(),
                             dbConfig.getParameter("dbUsername",Parameter.class).getValue(),
                             dbConfig.getParameter("dbPassword",Parameter.class).getValue());
    }