/** * Opens a CDOSession, does not register an EPackage with the session. This should be done by the * caller. */ protected CDOSession openSession() { if (sessionConfiguration == null) { initialize(); } final CDOSession cdoSession = sessionConfiguration.openSession(); for (final EPackage ePackage : ePackages) { cdoSession.getPackageRegistry().putEPackage(ePackage); } return cdoSession; }
/** * 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); }