STSClient createSTSClient(final STSClientConfig config) throws ParsingException { STSClientPool pool = STSClientFactory.getInstance(); if (pool.configExists(config) == false) { pool.createPool(config); } return pool.getClient(config); }
public static STSClientPool instance(int maxPoolSize) { if (instance == null) { return new STSClientPool(maxPoolSize); } return instance; }
public STSClient create(int initialNumberOfClients, final STSClientConfig config) { if (POOL.isPoolingDisabled()) { return new STSClient(config); } POOL.initialize(initialNumberOfClients, config); return POOL.takeOut(config); }
public STSClient takeOut(STSClientConfig stsClientConfig) { String key = key(stsClientConfig); STSClient client = takeOutInternal(key); if (client == null) { initialize(initialClients, stsClientConfig); client = takeOutInternal(key); } return client; }
public STSClient takeOut(String key) { STSClient client = takeOutInternal(key); if (client == null) { if (configs.get(key).callBack != null) { internalInitialize(initialClients, null, configs.get(key).callBack); } client = takeOutInternal(key); } return client; }
protected STSClient createWSTrustClient(final STSClientConfig config) { try { STSClientPool pool = STSClientFactory.getInstance(); if (initialClientsInPool > 0) { pool.createPool(initialClientsInPool, config); } return pool.getClient(config); } catch (final Exception e) { throw logger.authCouldNotCreateWSTrustClient(e); } }
private synchronized STSClient takeOutInternal(String key) { ArrayList<STSClient> clients = free.get(key); if (clients != null) { int size = clients.size(); STSClient client; if (size > 0) { client = clients.remove(size - 1); } else { int allocateClients = numClientsToAllocate(key); if (allocateClients > 0) { addClients(key); } else { // Pool reached miximum number of clients within the pool throw logger.maximumNumberOfClientsReachedforPool(String.valueOf(this.maxPoolSize)); } client = clients.remove(clients.size() -1); } markInUse(key, client); return client; } return null; }
public void initialize(int numberOfSTSClients, STSClientConfig stsClientConfig) { internalInitialize(numberOfSTSClients, stsClientConfig, null); }
public static STSClientFactory getInstance(int maxClientsInPool) { if (INSTANCE == null) { INSTANCE = new STSClientFactory(); POOL = STSClientPool.instance(maxClientsInPool); } return INSTANCE; }
protected STSClient createWSTrustClient(final STSClientConfig config) { try { STSClientPool pool = STSClientFactory.getInstance(); if (initialClientsInPool > 0) { pool.createPool(initialClientsInPool, config); } return pool.getClient(config); } catch (final Exception e) { throw logger.authCouldNotCreateWSTrustClient(e); } }
public STSClient takeOut(String serviceName, String portName, String endPointAddress) { String key = key(serviceName, portName, endPointAddress); STSClient client = takeOutInternal(key); if (client == null) { initialize(initialClients, configs.get(key).config); client = takeOutInternal(key); } return client; }
public void initialize(STSClientConfig stsClientConfig) { internalInitialize(initialClients, stsClientConfig, null); }
@Override protected STSClient createWSTrustClient(final STSClientConfig config) { try { STSClientPool pool = STSClientPoolFactory.getPoolInstance(); pool.createPool(initialClientsInPool, new STSClientCreationCallBack() { @Override public STSClient createClient() { String binaryTokenKey = (String) options.get(MapBasedTokenHandler.SYS_PROP_TOKEN_KEY); if (binaryTokenKey == null) { binaryTokenKey = SecurityActions.getSystemProperty(MapBasedTokenHandler.SYS_PROP_TOKEN_KEY, MapBasedTokenHandler.DEFAULT_TOKEN_KEY); } Object binaryToken = sharedState.get(binaryTokenKey); Map<String, ? super Object> STSClientOptions = new HashMap<String, Object>(options); if (binaryToken != null) { STSClientOptions.put(binaryTokenKey, binaryToken); } return new JBWSTokenClient(config, STSClientOptions); } @Override public String getKey() { return STSClientConfig.computeSTSClientConfigKey(ModuleUtils.getCurrentModuleId(), config.getServiceName(), config.getPortName(), config.getEndPointAddress(), config.getUsername()); } }); return pool.getClient(config); } catch (final Exception e) { throw logger.authCouldNotCreateWSTrustClient(e); } }
STSClient createSTSClient(final STSClientConfig config) throws ParsingException { STSClientPool pool = STSClientFactory.getInstance(); if (pool.configExists(config) == false) { pool.createPool(config); } return pool.getClient(config); }
public STSClient create(int initialNumberOfClients, final STSClientCreationCallBack callBack) { if (POOL.isPoolingDisabled()) { return null; } POOL.initialize(initialNumberOfClients, callBack); return POOL.takeOut(callBack.getKey()); }
public void initialize(int numberOfSTSClients, STSClientCreationCallBack clientCreationCallBack) { internalInitialize(numberOfSTSClients, null, clientCreationCallBack); }
@Override protected STSClient createWSTrustClient(final STSClientConfig config) { try { STSClientPool pool = STSClientPoolFactory.getPoolInstance(); pool.createPool(initialClientsInPool, new STSClientCreationCallBack() { @Override public STSClient createClient() { String binaryTokenKey = (String) options.get(MapBasedTokenHandler.SYS_PROP_TOKEN_KEY); if (binaryTokenKey == null) { binaryTokenKey = SecurityActions.getSystemProperty(MapBasedTokenHandler.SYS_PROP_TOKEN_KEY, MapBasedTokenHandler.DEFAULT_TOKEN_KEY); } Object binaryToken = sharedState.get(binaryTokenKey); Map<String, ? super Object> STSClientOptions = new HashMap<String, Object>(options); if (binaryToken != null) { STSClientOptions.put(binaryTokenKey, binaryToken); } return new JBWSTokenClient(config, STSClientOptions); } @Override public String getKey() { return STSClientConfig.computeSTSClientConfigKey(ModuleUtils.getCurrentModuleId(), config.getServiceName(), config.getPortName(), config.getEndPointAddress(), config.getUsername()); } }); return pool.getClient(config); } catch (final Exception e) { throw logger.authCouldNotCreateWSTrustClient(e); } }
pool.createPool(initialClientsInPool, config); client = pool.getClient(config);
pool.createPool(initialClientsInPool, config); client = pool.getClient(config);
public WSTrustClient(String serviceName, String port, String[] endpointURIs, SecurityInfo secInfo) throws ParsingException { // basic input validation. if (serviceName == null || port == null || endpointURIs == null || secInfo == null) throw logger.nullArgumentError("The service name, port, endpoint URIs and security info parameters cannot be null"); if (endpointURIs.length == 0) throw logger.nullArgumentError("At least one endpoint URI must be provided"); // create an STSClient for each endpointURI. this.clients = new STSClient[endpointURIs.length]; Builder builder = new STSClientConfig.Builder(); builder.serviceName(serviceName).portName(port).username(secInfo.username).password(secInfo.passwd); STSClientPool pool = STSClientFactory.getInstance(); int index = 0; for (String endpointURI : endpointURIs) { builder.endpointAddress(endpointURI); STSClientConfig config = builder.build(); pool.createPool(config); this.clients[index++] = pool.getClient(config); } }