use of com.ibm.as400.access.AS400ConnectionPool in project camel by apache.
the class Jt400Component method getConnectionPool.
/**
* Returns the default connection pool used by this component.
*
* @return the default connection pool used by this component
*/
public synchronized AS400ConnectionPool getConnectionPool() {
if (connectionPool == null) {
LOG.info("Instantiating the default connection pool ...");
connectionPool = new AS400ConnectionPool();
}
return connectionPool;
}
use of com.ibm.as400.access.AS400ConnectionPool in project wildfly-camel by wildfly-extras.
the class AS400IntegrationTest method testToString.
@Test
public void testToString() throws Exception {
String endpointUri = "jt400://user:password@host/qsys.lib/library.lib/queue.dtaq?ccsid=500&format=binary&connectionPool=#mockPool";
WildFlyCamelContext camelctx = new WildFlyCamelContext();
camelctx.getNamingContext().bind("mockPool", new AS400ConnectionPool());
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from(endpointUri).to("mock:end");
}
});
Jt400Endpoint endpoint = camelctx.getEndpoint(endpointUri, Jt400Endpoint.class);
Assert.assertEquals("host", endpoint.getSystemName());
}
use of com.ibm.as400.access.AS400ConnectionPool in project camel by apache.
the class Jt400Component method createEndpoint.
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> properties) throws Exception {
AS400ConnectionPool connectionPool;
if (properties.containsKey(CONNECTION_POOL)) {
LOG.trace("AS400ConnectionPool instance specified in the URI - will look it up.");
// We have chosen to handle the connectionPool option ourselves, so
// we must remove it from the given parameter list (see
// http://camel.apache.org/writing-components.html)
String poolId = properties.remove(CONNECTION_POOL).toString();
connectionPool = EndpointHelper.resolveReferenceParameter(getCamelContext(), poolId, AS400ConnectionPool.class, true);
} else {
LOG.trace("No AS400ConnectionPool instance specified in the URI - one will be provided.");
connectionPool = getConnectionPool();
}
String type = remaining.substring(remaining.lastIndexOf(".") + 1).toUpperCase();
Jt400Endpoint endpoint = new Jt400Endpoint(uri, this, connectionPool);
setProperties(endpoint, properties);
endpoint.setType(Jt400Type.valueOf(type));
return endpoint;
}
Aggregations