Constructs or gets the kubernetes client implementation.
@return
493730
public io.fabric8.kubernetes.client.KubernetesClient getKubernetesClient() {
        if (kubernetesClient == null) {
            kubernetesClient = createKubernetesClient();
        }

        return kubernetesClient;
    }
83032
@Override
    protected Client instantiateClient(String persistenceUnit)
    {
        return new KuduDBClient(kunderaMetadata, indexManager, reader, externalProperties, persistenceUnit,
                this.kuduClient, this.clientMetadata);
    }
272817
protected function sdkClient(): Client
    {
        $app = Container::getInstance();

        if ($app->bound('katsana')) {
            return $app->make('katsana');
        }

        return Client::make($this->clientId, $this->clientSecret);
    }
1019483
protected com.sun.jersey.api.client.Client getJerseyClient() {
    final ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    com.sun.jersey.api.client.Client client = com.sun.jersey.api.client.Client.create(clientConfig);
    if(this.debug) {
      client.addFilter(new LoggingFilter(System.out));
    }
    return client;
  }
539732
public HazelcastInstance getHazelcastInstance() {
		if (StringUtils.hasText(this.clientConfig.getInstanceName())) {
			return HazelcastClient
					.getHazelcastClientByName(this.clientConfig.getInstanceName());
		}
		return HazelcastClient.newHazelcastClient(this.clientConfig);
	}
1342631
public CloudantClient build() {

        logger.config("Building client using URL: " + url);

        //Build properties and couchdb client
        CouchDbProperties props = new CouchDbProperties(url);

        props.addRequestInterceptors(USER_AGENT_INTERCEPTOR);

        if (this.iamApiKey != null) {

            // Create IAM cookie interceptor and set in HttpConnection interceptors
            IamCookieInterceptor cookieInterceptor = new IamCookieInterceptor(this.iamApiKey,
                    this.url.toString());

            props.addRequestInterceptors(cookieInterceptor);
            props.addResponseInterceptors(cookieInterceptor);
            logger.config("Added IAM cookie interceptor");

            if (this.iamServerClientId != null && this.iamServerClientSecret != null) {
                props.addRequestInterceptors(new IamServerBasicAuthInterceptor(
                        cookieInterceptor.getIamServerUrl(), iamServerClientId, iamServerClientSecret));
            }

        }
        //Create cookie interceptor
        else if (this.username != null && this.password != null) {
            //make interceptor if both username and password are not null

            //Create cookie interceptor and set in HttpConnection interceptors
            CookieInterceptor cookieInterceptor = new CookieInterceptor(username, password, this.url.toString());

            props.addRequestInterceptors(cookieInterceptor);
            props.addResponseInterceptors(cookieInterceptor);
            logger.config("Added cookie interceptor");
        } else {
            //If username or password is null, throw an exception
            if (username != null || password != null) {
                //Username and password both have to contain values
                throw new CouchDbException("Either a username and password must be provided, or " +
                        "both values must be null. Please check the credentials and try again.");
            }
        }

        //If setter methods for read and connection timeout are not called, default values
        // are used.
        logger.config(String.format("Connect timeout: %s %s", connectTimeout,
                connectTimeoutUnit));
        logger.config(String.format("Read timeout: %s %s", readTimeout, readTimeoutUnit));

        // Log a warning if the DNS cache time is too long
        try {
            boolean shouldLogValueWarning = false;
            boolean isUsingDefaultTTLValue = true;
            String ttlString = Security.getProperty("networkaddress.cache.ttl");
            // Was able to access the property
            if (ttlString != null) {
                try {
                    int ttl = Integer.parseInt(ttlString);
                    isUsingDefaultTTLValue = false;
                    logger.finest("networkaddress.cache.ttl was " + ttl);
                    if (ttl > 30 || ttl < 0) {
                        shouldLogValueWarning = true;
                    }
                } catch (NumberFormatException nfe) {
                    // Suppress the exception, this will result in the default being used
                    logger.finest("networkaddress.cache.ttl was not an int.");
                }
            }

            if (isUsingDefaultTTLValue && System.getSecurityManager() != null) {
                //If we're using a default value and there is a SecurityManager we need to warn
                shouldLogValueWarning = true;
            }

            if (shouldLogValueWarning) {
                logger.warning("DNS cache lifetime may be too long. DNS cache lifetimes in excess" +
                        " of 30 seconds may impede client operation during cluster failover.");
            }
        } catch (SecurityException e) {
            // Couldn't access the property; log a warning
            logger.warning("Permission denied to check Java DNS cache TTL. If the cache " +
                    "lifetime is too long cluster failover will be impeded.");
        }

        props.addRequestInterceptors(new TimeoutCustomizationInterceptor(connectTimeout,
                connectTimeoutUnit, readTimeout, readTimeoutUnit));

        //Set connect options
        props.setMaxConnections(maxConnections);
        props.setProxyURL(proxyURL);
        if (proxyUser != null) {
            //if there was proxy auth information set up proxy auth
            if ("http".equals(url.getProtocol())) {
                // If we are using http, create an interceptor to add the Proxy-Authorization header
                props.addRequestInterceptors(new ProxyAuthInterceptor(proxyUser,
                        proxyPassword));
                logger.config("Added proxy auth interceptor");
            } else {
                // Set up an authenticator
                props.setProxyAuthentication(new PasswordAuthentication(proxyUser,
                        proxyPassword.toCharArray()));
            }
        }
        if (isSSLAuthenticationDisabled) {
            props.addRequestInterceptors(SSLCustomizerInterceptor
                    .SSL_AUTH_DISABLED_INTERCEPTOR);
            logger.config("SSL authentication is disabled");
        }
        if (authenticatedModeSSLSocketFactory != null) {
            props.addRequestInterceptors(new SSLCustomizerInterceptor(
                    authenticatedModeSSLSocketFactory
            ));
            logger.config("Added custom SSL socket factory");
        }

        //Set http connection interceptors
        if (requestInterceptors != null) {
            for (HttpConnectionRequestInterceptor requestInterceptor : requestInterceptors) {
                props.addRequestInterceptors(requestInterceptor);
                logger.config("Added request interceptor: " + requestInterceptor.getClass()
                        .getName());
            }
        }
        if (responseInterceptors != null) {
            for (HttpConnectionResponseInterceptor responseInterceptor : responseInterceptors) {
                props.addResponseInterceptors(responseInterceptor);
                logger.config("Added response interceptor: " + responseInterceptor.getClass()
                        .getName());
            }
        }

        //if no gsonBuilder has been provided, create a new one
        if (gsonBuilder == null) {
            gsonBuilder = new GsonBuilder();
            logger.config("Using default GSON builder");
        } else {
            logger.config("Using custom GSON builder");
        }
        //always register additional TypeAdapaters for derserializing some Cloudant specific
        // types before constructing the CloudantClient
        gsonBuilder.registerTypeAdapter(DeserializationTypes.SHARDS, new ShardDeserializer())
                .registerTypeAdapter(DeserializationTypes.INDICES, new IndexDeserializer())
                .registerTypeAdapter(DeserializationTypes.PERMISSIONS_MAP, new
                        SecurityDeserializer())
                .registerTypeAdapter(Key.ComplexKey.class, new Key.ComplexKeyDeserializer());

        return new CloudantClient(props, gsonBuilder);
    }
10652
public Client build(final Client client) {
    client.register(TracingClientFilter.create(tracing));
    return client;
  }
892557
public JwkProvider build() {
        JwkProvider urlProvider = new UrlJwkProvider(url);
        if (this.rateLimited) {
            urlProvider = new RateLimitedJwkProvider(urlProvider, bucket);
        }
        if (this.cached) {
            urlProvider = new GuavaCachedJwkProvider(urlProvider, cacheSize, expiresIn, expiresUnit);
        }
        return urlProvider;
    }
98541
public static Resource detectResource() {
    List<Resource> resourceList = new ArrayList<Resource>();
    resourceList.add(Resource.createFromEnvironmentVariables());
    if (System.getenv("KUBERNETES_SERVICE_HOST") != null) {
      resourceList.add(ContainerResource.detect());
      resourceList.add(K8sResource.detect());
    }
    resourceList.add(HostResource.detect());
    resourceList.add(CloudResource.detect());
    return firstNonNull(Resource.mergeResources(resourceList), EMPTY_RESOURCE);
  }
245341
public ClientConfiguration createClientConfiguration() {
        return ClientConfiguration.builder(buildTimeSeriesUrl(), username, password)
                .connectTimeoutMillis(connectTimeoutMillis)
                .readTimeoutMillis(readTimeoutMillis)
                .pingTimeoutMillis(pingTimeoutMillis)
                .ignoreSSLErrors(ignoreSSLErrors)
                .skipStreamingControl(skipStreamingControl)
                .enableBatchCompression(enableGzipCompression)
                .userAgent(userAgent)
                .build();
    }
158113
protected CuratorFramework createZKClient() {
        val serviceConfig = getServiceConfig();
        CuratorFramework zkClient = CuratorFrameworkFactory
                .builder()
                .connectString(serviceConfig.getZkURL())
                .namespace("pravega/" + serviceConfig.getClusterName())
                .retryPolicy(new ExponentialBackoffRetry(serviceConfig.getZkRetrySleepMs(), serviceConfig.getZkRetryCount()))
                .sessionTimeoutMs(serviceConfig.getZkSessionTimeoutMs())
                .build();
        zkClient.start();
        return zkClient;
    }
832557
public synchronized BigtableInstanceClient getInstanceAdminClient() throws IOException {
    if (instanceAdminClient == null) {
      ManagedChannel channel = createManagedPool(options.getAdminHost(), 1);
      instanceAdminClient = new BigtableInstanceGrpcClient(channel);
    }
    return instanceAdminClient;
  }
1262168
public Channel build() {
        Channel channel = null;
        if (_channelClass != null) {
            channel = Construction.construct(_channelClass);
            if (channel instanceof SwitchYardServiceChannel) {
                SwitchYardServiceChannel sysc = (SwitchYardServiceChannel)channel;
                sysc.setServiceName(_serviceName);
                sysc.setOperationName(_operationName);
                sysc.setInvoker(new SwitchYardServiceInvoker(getServiceDomain(), _targetNamespace));
            }
        }
        return channel;
    }
433427
public HttpClient get() {
    final ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
    cm.setMaxTotal(nrOfThreads);
    cm.setDefaultMaxPerRoute(maxToRoute);
    final DefaultHttpClient client = HTTPSFaker.getClientThatAllowAnyHTTPS(cm);

    client.getParams().setParameter("http.socket.timeout", socketTimeout);
    client.getParams().setParameter("http.connection.timeout", connectionTimeout);

    client.addRequestInterceptor(new RequestAcceptEncoding());
    client.addResponseInterceptor(new ResponseContentEncoding());
    
    CookieSpecFactory csf = new CookieSpecFactory() {
      public CookieSpec newInstance(HttpParams params) {
        return new BestMatchSpecWithURLErrorLog();
      }
    };

    client.getCookieSpecs().register("bestmatchwithurl", csf);
    client.getParams().setParameter(ClientPNames.COOKIE_POLICY, "bestmatchwithurl");

    if (!"".equals(proxy)) {
      StringTokenizer token = new StringTokenizer(proxy, ":");

      if (token.countTokens() == 3) {
        String proxyProtocol = token.nextToken();
        String proxyHost = token.nextToken();
        int proxyPort = Integer.parseInt(token.nextToken());

        HttpHost proxy = new HttpHost(proxyHost, proxyPort, proxyProtocol);
        client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
      } else
        System.err.println("Invalid proxy configuration: " + proxy);
    }

    if (auths.size() > 0) {

      for (Auth authObject : auths) {
        client.getCredentialsProvider().setCredentials(
            new AuthScope(authObject.getScope(), authObject.getPort()),
            new UsernamePasswordCredentials(authObject.getUserName(), authObject.getPassword()));
      }
    }

    return client;
  }
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;
  }
288165
public HttpServer build() {
        checkNotNull(baseUri);
        StandaloneWebConverterConfiguration configuration = makeConfiguration();
        // The configuration has to be configured both by a binder to make it injectable
        // and directly in order to trigger life cycle methods on the deployment container.
        ResourceConfig resourceConfig = ResourceConfig
                .forApplication(new WebConverterApplication(configuration))
                .register(configuration);
        if (sslContext == null) {
            return GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig);
        } else {
            return GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig, true, new SSLEngineConfigurator(sslContext));
        }
    }
704431
public RuntimeEnvironment build() {
        final org.kie.api.runtime.manager.RuntimeEnvironmentBuilder jbpmRuntimeEnvironmentBuilder;
        Manifest manifest = _manifestBuilder.build();
        if (manifest instanceof RemoteManifest) {
            RemoteManifest remoteManifest = (RemoteManifest)manifest;
            jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultInMemoryBuilder();
            remoteManifest.addToEnvironment(jbpmRuntimeEnvironmentBuilder);
            // we dont' do any other building for remote usage
            return jbpmRuntimeEnvironmentBuilder.get();
        } else if (manifest instanceof ContainerManifest) {
            ContainerManifest containerManifest = (ContainerManifest)manifest;
            String baseName = containerManifest.getBaseName();
            ReleaseId releaseId = containerManifest.getReleaseId();
            String sessionName = containerManifest.getSessionName();
            if (releaseId != null) {
                if (baseName != null || sessionName != null) {
                    jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultBuilder(releaseId, baseName, sessionName);
                } else {
                    jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultBuilder(releaseId);
                }
                // we can't update classpath containers, so no point adding it to environment below here
                containerManifest.addToEnvironment(jbpmRuntimeEnvironmentBuilder);
            } else if (baseName != null || sessionName != null) {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newClasspathKmoduleDefaultBuilder(baseName, sessionName);
            } else {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newClasspathKmoduleDefaultBuilder();
            }
        } else {
            if (_persistent) {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultBuilder();
            } else {
                jbpmRuntimeEnvironmentBuilder = _runtimeEnvironmentBuilderFactory.newDefaultInMemoryBuilder();
            }
            if (manifest instanceof ResourcesManifest) {
                ResourcesManifest resourcesManifest = (ResourcesManifest)manifest;
                for (Resource resource : resourcesManifest.buildResources()) {
                    jbpmRuntimeEnvironmentBuilder.addAsset(resource, resource.getResourceType());
                }
            }
        }
        jbpmRuntimeEnvironmentBuilder.classLoader(getClassLoader());
        jbpmRuntimeEnvironmentBuilder.persistence(_persistent);
        // provides a noop EntityManagerFactory if no persistence
        EntityManagerFactory entityManagerFactory = _entityManagerFactoryBuilder.build();
        jbpmRuntimeEnvironmentBuilder.entityManagerFactory(entityManagerFactory);
        jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(EnvironmentName.ENTITY_MANAGER_FACTORY, entityManagerFactory);
        // provides an ootb UserGroupCallback if fallen-back to
        UserGroupCallback userGroupCallback = _userGroupCallbackBuilder.build();
        jbpmRuntimeEnvironmentBuilder.userGroupCallback(userGroupCallback);
        if (_persistent) {
            UserTransaction ut = TransactionManagerLocator.INSTANCE.getUserTransaction();
            TransactionManager tm = TransactionManagerLocator.INSTANCE.getTransactionManager();
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(EnvironmentName.TRANSACTION, ut);
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(EnvironmentName.TRANSACTION_MANAGER, tm);
        } else {
            // TODO: why, when no persistence, do we have to do all this?
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry("IS_JTA_TRANSACTION", Boolean.FALSE);
            TaskEventSupport taskEventSupport = new TaskEventSupport();
            CommandService executor = new TaskCommandExecutorImpl(EnvironmentFactory.newEnvironment(), taskEventSupport);
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(TaskService.class.getName(), new CommandBasedTaskService(executor, taskEventSupport));
        }
        Properties properties = _propertiesBuilder.build();
        for (Object key : properties.keySet()) {
            String name = (String)key;
            String value = properties.getProperty(name);
            jbpmRuntimeEnvironmentBuilder.addConfiguration(name, value); // add to KieSessionConfiguration
            jbpmRuntimeEnvironmentBuilder.addEnvironmentEntry(name, value); // add to Environment (SWITCHYARD-2393)
        }
        // things that need to be done to the original RuntimeEnvironment before the jBPM RuntimeEnvironmentBuilder is built (get->init)
        /*
         * Access<SimpleRuntimeEnvironment> simpleREAccess = new FieldAccess<SimpleRuntimeEnvironment>(
         * org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.class, "runtimeEnvironment");
         * if (simpleREAccess.isReadable()) {
         * SimpleRuntimeEnvironment originalRE = simpleREAccess.read(jbpmRuntimeEnvironmentBuilder);
         */
        KieScanner scanner = null;
        SimpleRuntimeEnvironment originalRE = ((PatchedRuntimeEnvironmentBuilder)jbpmRuntimeEnvironmentBuilder).getRuntimeEnvironment();
        if (originalRE != null) {
            RegisterableItemsFactory originalRIF = originalRE.getRegisterableItemsFactory();
            if (originalRIF instanceof InternalRegisterableItemsFactory) {
                ExtendedRegisterableItemsFactory extendedRIF = _registerableItemsFactoryBuilder.build();
                CompoundRegisterableItemsFactory compoundRIF = new CompoundRegisterableItemsFactory((InternalRegisterableItemsFactory)originalRIF, extendedRIF);
                jbpmRuntimeEnvironmentBuilder.registerableItemsFactory(compoundRIF);
                ExtendedRegisterableItemsFactory.Env.addToEnvironment(jbpmRuntimeEnvironmentBuilder, compoundRIF);
                if (manifest instanceof ContainerManifest && originalRIF instanceof KModuleRegisterableItemsFactory) {
                    Access<KieContainer> kieContainerAccess = new FieldAccess<KieContainer>(KModuleRegisterableItemsFactory.class, "kieContainer");
                    if (kieContainerAccess.isReadable()) {
                        KieContainer kieContainer = kieContainerAccess.read(originalRIF);
                        ((ContainerManifest)manifest).setKieContainer(kieContainer);
                        if (((ContainerManifest)manifest).isScan()) {
                            scanner = _kieServices.newKieScanner(kieContainer);
                            scanner.start(((ContainerManifest)manifest).getScanInterval().longValue());
                        }
                    }
                }
            }
            Mapper mapper;
            AuditMode auditMode;
            if (_persistent) {
                mapper = new JPAMapper(entityManagerFactory);
                auditMode = AuditMode.JPA;
            } else {
                mapper = new InMemoryMapper();
                auditMode = AuditMode.NONE;
            }
            originalRE.setMapper(mapper);
            Environment environmentTemplate = originalRE.getEnvironmentTemplate();
            // set the patched LocalTaskServiceFactory
            originalRE.addToEnvironment(TaskServiceFactory.class.getName(), new PatchedLocalTaskServiceFactory(originalRE));
            // TODO: why, when no persistence, do we have to do all this?
            DeploymentDescriptor deploymentDescriptor = (DeploymentDescriptor)environmentTemplate.get("KieDeploymentDescriptor");
            if (deploymentDescriptor == null) {
                deploymentDescriptor = new DeploymentDescriptorManager().getDefaultDescriptor();
                originalRE.addToEnvironment("KieDeploymentDescriptor", deploymentDescriptor);
            }
            originalRE.addToEnvironment(manifest.getClass().getName(), manifest);
            ((DeploymentDescriptorImpl)deploymentDescriptor).setAuditMode(auditMode);
            if (scanner != null) {
                originalRE.addToEnvironment("KieScanner", scanner);
            }
        }

        /*
         * }
         */
        RuntimeEnvironment runtimeEnvironment = jbpmRuntimeEnvironmentBuilder.get();
        Environment environment = originalRE.getEnvironmentTemplate();
        // our ObjectMarshallingStrategy can be added to the Environment after the jBPM RuntimeEnvironmentBuilder is built (get->init)
        List<ObjectMarshallingStrategy> new_oms = new ArrayList<ObjectMarshallingStrategy>();
        new_oms.add(new SerializerObjectMarshallingStrategy(SerializerFactory.create(FormatType.JSON, null, true)));
        ObjectMarshallingStrategy[] old_oms = (ObjectMarshallingStrategy[])environment.get(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES);
        if (old_oms != null) {
            for (int i = 0; i < old_oms.length; i++) {
                if (old_oms[i] != null) {
                    new_oms.add(old_oms[i]);
                }
            }
        }
        originalRE.addToEnvironment(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new_oms.toArray(new ObjectMarshallingStrategy[new_oms.size()]));
        return runtimeEnvironment;
    }