/** * 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); }
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); }