Examples of ConnectionFactory


Examples of org.objectweb.joram.client.jms.ConnectionFactory

      String password = specImpl.getPassword();
      String identityClass = specImpl.getIdentityClass();

      createUser(userName, password, identityClass);

      ConnectionFactory cf = null;

      if (isHa) {
        if (collocated) {
          if (haURL != null) {
            cf = HATcpConnectionFactory.create(haURL);
          } else {
            cf = HALocalConnectionFactory.create();
          }
        } else {
          cf = HATcpConnectionFactory.create("hajoram://" + hostName + ':' + serverPort);
        }
      }  else {
        if (collocated)
          cf = LocalConnectionFactory.create();
        else
          cf = TcpConnectionFactory.create(hostName, serverPort);
      }

      cf.getParameters().connectingTimer = connectingTimer;
      cf.getParameters().cnxPendingTimer = cnxPendingTimer;
      cf.getParameters().txPendingTimer = txPendingTimer;

      if (queueMessageReadMax > 0) {
        cf.getParameters().queueMessageReadMax = queueMessageReadMax;
      }

      if (topicAckBufferMax > 0) {
        cf.getParameters().topicAckBufferMax = topicAckBufferMax;
      }

      if (topicPassivationThreshold > 0) {
        cf.getParameters().topicPassivationThreshold = topicPassivationThreshold;
      }

      if (topicActivationThreshold > 0) {
        cf.getParameters().topicActivationThreshold = topicActivationThreshold;
      }

      // set identity class for this connectionFactory.
      cf.setIdentityClassName(identityClass);

      XAConnection cnx = cf.createXAConnection(userName, password);
     
      // set Exception listener
      cnx.setExceptionListener(this);
     
      if (logger.isLoggable(BasicLevel.DEBUG))
View Full Code Here

Examples of org.objectweb.joram.client.jms.ConnectionFactory

    if (stopped)
      throw new IllegalStateException("Stopped resource adapter.");

    ActivationSpecImpl specImpl;
    String userName;
    ConnectionFactory cf = null;
    XAConnection connection;
    Vector resources = new Vector();

    if (connections == null)
      connections = new Hashtable();

    try {
      for (int i = 0; i < specs.length; i++) {
        if (! (specs[i] instanceof ActivationSpecImpl))
          throw new ResourceException("Provided ActivationSpec instance is not a JORAM activation spec.");

        specImpl = (ActivationSpecImpl) specs[i];

        if (! specImpl.getResourceAdapter().equals(this))
          throw new ResourceException("Supplied ActivationSpec instance associated to an other ResourceAdapter.");

        userName = specImpl.getUserName();

        // The connection does not already exist: creating it.
        if (! connections.containsKey(userName)) {
          String password = specImpl.getPassword();
          String identityClass = specImpl.getIdentityClass();

          if (isHa) {
            if (collocated) {
              if (logger.isLoggable(BasicLevel.DEBUG))
                logger.log(BasicLevel.DEBUG, "haURL = " + haURL);
              if (haURL != null) {
                cf = HATcpConnectionFactory.create(haURL);
              } else {
                cf = HALocalConnectionFactory.create();
              }
            } else {
              String urlHa = "hajoram://" + hostName + ":" + serverPort;
              cf = HATcpConnectionFactory.create(urlHa);
            }
          }  else {
            if (collocated)
              cf = LocalConnectionFactory.create();
            else
              cf = TcpConnectionFactory.create(hostName, serverPort);
          }

          cf.getParameters().connectingTimer = connectingTimer;
          cf.getParameters().cnxPendingTimer = cnxPendingTimer;
          cf.getParameters().txPendingTimer = txPendingTimer;

          // set identity class for this connectionFactory.
          cf.setIdentityClassName(identityClass);

          connection = cf.createXAConnection(userName, password);

          connections.put(userName, connection);

          resources.add(connection.createXASession().getXAResource());
        }
View Full Code Here

Examples of org.osgi.service.io.ConnectionFactory

      throw new IllegalArgumentException("Not a valid URI");
    }

    String scheme = uri.substring(0, schemeSeparator);

    ConnectionFactory factory = getFactory(scheme);
    Connection retval = null;

    if (factory != null) {
      retval = factory.createConnection(uri, mode, timeouts);

    } else {

      // fall back to Connector.
      try {
View Full Code Here

Examples of org.postgresql.core.ConnectionFactory

    boolean passwordCorrect = false;
    try {
      Logger logger = new Logger();
      Properties info = new Properties();
      info.setProperty("password", password);
      ConnectionFactory connectionFactory = new ConnectionFactoryImpl();
      ProtocolConnection connection = connectionFactory.openConnectionImpl(
          host, port, getDataSource().getUser(), "template1", info, logger);
      connection.close();
      passwordCorrect = true;
    } catch (SQLException e) {
      // expected for wrong password
View Full Code Here

Examples of org.serviceconnector.net.connection.ConnectionFactory

   * Description: connect, send 50000 message and disconnect<br>
   * Expectation: passes
   */
  @Test
  public void t01_Send50000() throws Exception {
    ConnectionFactory connectionFactory = AppContext.getConnectionFactory();
    IConnection connection = connectionFactory.createConnection(ConnectionType.NETTY_HTTP.getValue());
    connection.setHost(TestConstants.HOST);
    connection.setPort(TestConstants.PORT_SC0_HTTP);
    connection.setIdleTimeoutSeconds(0); // idle timeout inactive
    IIdleConnectionCallback idleCallback = new IdleCallback();
    ConnectionContext connectionContext = new ConnectionContext(connection, idleCallback, 0);
View Full Code Here

Examples of org.skife.jdbi.v2.tweak.ConnectionFactory

        h.close();
    }

    public void testConnectionFactoryCtor() throws Exception
    {
        DBI dbi = new DBI(new ConnectionFactory()
        {
            public Connection openConnection()
            {
                try
                {
View Full Code Here

Examples of org.springframework.amqp.rabbit.connection.ConnectionFactory

      Assert.assertNotNull(endpoint.toString());
    }   
       
    @Override
    protected CamelContext createCamelContext() throws Exception {
        ConnectionFactory factory = new CachingConnectionFactory();
       
        CamelContext camelContext = super.createCamelContext();
        camelContext.addComponent("spring-amqp", new SpringAMQPComponent(factory));
        return camelContext;
    }
View Full Code Here

Examples of org.uengine.util.dao.ConnectionFactory

        try {
         
          InputStream is = null;
         
          String tableName = null;
          ConnectionFactory connectionFactory = null;
          if(activity!=null){
            tableName = ((DatabaseMappingActivity)activity).getTableName();
            connectionFactory = ((DatabaseMappingActivity)activity).getConnectionFactory();
          }
         
View Full Code Here

Examples of util.ConnectionFactory

public class UsuarioDao {

  private Connection connection;

  public UsuarioDao() {
     this.connection = new ConnectionFactory().getConnection();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.