Ejemplo n.º 1
0
  /**
   * Initializes the connection and creates a {@link CDOSessionConfiguration} which is stored in a
   * member of this class.
   */
  protected void initialize() {
    OMPlatform.INSTANCE.setDebugging(true);
    OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
    OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);

    // Prepare container
    final IManagedContainer container = ContainerUtil.createContainer();
    Net4jUtil.prepareContainer(container); // Register Net4j factories
    TCPUtil.prepareContainer(container); // Register TCP factories
    CDONet4jUtil.prepareContainer(container); // Register CDO factories

    // LifecycleUtil.activate(container);
    container.activate();

    // Create connector
    final IConnector connector = TCPUtil.getConnector(container, CONNECTION_ADDRESS);

    // Create configuration
    sessionConfiguration = CDONet4jUtil.createSessionConfiguration();
    sessionConfiguration.setConnector(connector);
    sessionConfiguration.setRepositoryName(REPO_NAME);
  }
Ejemplo n.º 2
0
  protected IAcceptor getAcceptor() {
    if (acceptor == null) {
      if (useJVMTransport()) {
        acceptor = JVMUtil.getAcceptor(container, "default"); // $NON-NLS-1$
      } else {
        if (useSSLTransport()) {
          acceptor = SSLUtil.getAcceptor(container, null);
        } else {
          acceptor = TCPUtil.getAcceptor(container, null);
        }
      }
    }

    return acceptor;
  }
Ejemplo n.º 3
0
  protected IManagedContainer createContainer() {
    IManagedContainer container = ContainerUtil.createContainer();
    Net4jUtil.prepareContainer(container);
    if (useJVMTransport()) {
      JVMUtil.prepareContainer(container);
    } else {
      if (useSSLTransport()) {
        SSLUtil.prepareContainer(container);
      } else {
        TCPUtil.prepareContainer(container);
      }
    }

    return container;
  }
Ejemplo n.º 4
0
  private static Context init() throws Exception {
    OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
    OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
    OMPlatform.INSTANCE.setDebugging(true);

    IDBAdapter.REGISTRY.put(EmbeddedDerbyAdapter.NAME, new EmbeddedDerbyAdapter());
    IStore store = JDBCUtil.getStore();
    Server.INSTANCE.setStore(store);
    Server.INSTANCE.activate();

    IManagedContainer container = new ManagedContainer();
    Net4jUtil.prepareContainer(container);
    TCPUtil.prepareContainer(container);
    JMSServerUtil.prepareContainer(container);

    TCPUtil.getAcceptor(container, null);
    IConnector connector = TCPUtil.getConnector(container, "localhost"); // $NON-NLS-1$

    IJMSAdmin admin = JMSAdminUtil.createAdmin(connector);
    admin.createQueue("StockQueue"); // $NON-NLS-1$
    admin.createTopic("StockTopic"); // $NON-NLS-1$

    return new JMSInitialContext(container);
  }
Ejemplo n.º 5
0
  protected IConnector getConnector() {
    if (connector == null) {
      if (useJVMTransport()) {
        connector = JVMUtil.getConnector(container, "default"); // $NON-NLS-1$
      } else {
        if (useSSLTransport()) {
          // cannot use same container with the acceptor.
          connector = SSLUtil.getConnector(separateContainer, HOST);
        } else {
          connector = TCPUtil.getConnector(container, HOST);
        }
      }
    }

    return connector;
  }