Search in sources :

Example 1 with AS400ConnectionPool

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;
}
Also used : AS400ConnectionPool(com.ibm.as400.access.AS400ConnectionPool)

Example 2 with AS400ConnectionPool

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());
}
Also used : Jt400Endpoint(org.apache.camel.component.jt400.Jt400Endpoint) AS400ConnectionPool(com.ibm.as400.access.AS400ConnectionPool) RouteBuilder(org.apache.camel.builder.RouteBuilder) WildFlyCamelContext(org.wildfly.extension.camel.WildFlyCamelContext) Test(org.junit.Test)

Example 3 with AS400ConnectionPool

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;
}
Also used : AS400ConnectionPool(com.ibm.as400.access.AS400ConnectionPool)

Aggregations

AS400ConnectionPool (com.ibm.as400.access.AS400ConnectionPool)3 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 Jt400Endpoint (org.apache.camel.component.jt400.Jt400Endpoint)1 Test (org.junit.Test)1 WildFlyCamelContext (org.wildfly.extension.camel.WildFlyCamelContext)1