private static IManagedContainer createContainer() {
    IManagedContainer result = ContainerUtil.createPluginContainer();

    result.activate();

    return result;
  }
  public PapyrusRepositoryManager(IRepositoryModelStorage storage) {
    this.storage = storage;
    this.container = createContainer();
    this.repositoryRegistry = loadRepositories();
    this.repositories = initializeRepositories();

    activate();

    container.putElement(PRODUCT_GROUP, MANAGER_FACTORY, null, this);
  }
示例#3
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);
  }
  protected IConnector getConnector(IManagedContainer container, String description) {
    int pos = description.indexOf(SCHEME_SEPARATOR);
    if (pos == -1) {
      throw new IllegalArgumentException("Invalid URI: " + description);
    }

    String factoryType = description.substring(0, pos);
    if (StringUtil.isEmpty(factoryType)) {
      throw new IllegalArgumentException("Invalid URI: " + description);
    }

    String connectorDescription = description.substring(pos + SCHEME_SEPARATOR.length());
    if (StringUtil.isEmpty(connectorDescription)) {
      throw new IllegalArgumentException("Invalid URI: " + description);
    }

    pos = connectorDescription.indexOf('?');
    if (pos != -1) {
      connectorDescription = connectorDescription.substring(0, pos);
    }

    return (IConnector)
        container.getElement(ConnectorFactory.PRODUCT_GROUP, factoryType, connectorDescription);
  }
示例#5
0
 public FailoverMonitor getFailoverMonitor(String group) {
   return (FailoverMonitor) container.getElement(FailoverMonitor.PRODUCT_GROUP, "net4j", group);
 }
 @Override
 protected IManagedContainer createContainer() {
   IManagedContainer container = super.createContainer();
   container.addPostProcessor(new XORStreamWrapperInjector(TestSignalProtocol.PROTOCOL_NAME, KEY));
   return container;
 }
示例#7
0
 public Object getResultElement() {
   return container.getElement(productGroup, factoryType, resultDescription);
 }
示例#8
0
 public static IJVMConnector getConnector(IManagedContainer container, String description) {
   return (IJVMConnector)
       container.getElement(
           JVMConnectorFactory.PRODUCT_GROUP, JVMConnectorFactory.TYPE, description);
 }
示例#9
0
 public static void prepareContainer(IManagedContainer container) {
   container.registerFactory(new JVMAcceptorFactory());
   container.registerFactory(new JVMConnectorFactory());
 }
示例#10
0
 protected ExecutorService getExecutorService(IManagedContainer container) {
   return (ExecutorService)
       container.getElement(
           ExecutorServiceFactory.PRODUCT_GROUP, ExecutorServiceFactory.TYPE, null);
 }
示例#11
0
 /** @since 2.0 */
 protected IBufferProvider getBufferProvider(IManagedContainer container) {
   return (IBufferProvider)
       container.getElement(BufferProviderFactory.PRODUCT_GROUP, BufferProviderFactory.TYPE, null);
 }