@Override
  public Connector create(String connectorId, Map<String, String> config) {
    try {
      Bootstrap app =
          new Bootstrap(
              new MBeanModule(),
              binder -> {
                CurrentNodeId currentNodeId =
                    new CurrentNodeId(nodeManager.getCurrentNode().getNodeIdentifier());
                MBeanServer mbeanServer = new RebindSafeMBeanServer(getPlatformMBeanServer());

                binder.bind(MBeanServer.class).toInstance(mbeanServer);
                binder.bind(CurrentNodeId.class).toInstance(currentNodeId);
                binder.bind(NodeManager.class).toInstance(nodeManager);
                binder.bind(PageSorter.class).toInstance(pageSorter);
                binder.bind(BlockEncodingSerde.class).toInstance(blockEncodingSerde);
                binder.bind(TypeManager.class).toInstance(typeManager);
              },
              module,
              new StorageModule(),
              new RaptorModule(connectorId));

      Injector injector =
          app.strictConfig()
              .doNotInitializeLogging()
              .setRequiredConfigurationProperties(config)
              .setOptionalConfigurationProperties(optionalConfig)
              .initialize();

      return injector.getInstance(RaptorConnector.class);
    } catch (Exception e) {
      throw Throwables.propagate(e);
    }
  }
示例#2
0
 @Override
 public URI createLocalTaskLocation(TaskId taskId) {
   return createTaskLocation(nodeManager.getCurrentNode(), taskId);
 }