Exemplo n.º 1
0
  private ComponentItemImpl loadComponent(ComponentItemConfig config)
      throws ComponentCreationException {
    final ComponentItemImpl component = ComponentItemImpl.newInstance(this, config);
    try {
      component.setBehavior(
          componentRegistry.loadBehavior(config.getType(), component.getContext()));
      componentList.addItem(
          component,
          new Runnable() {
            @Override
            public void run() {
              component.addEventListener(BaseEvent.class, componentListener);
              if (counterSupport instanceof AggregatedCounterSupport)
                ((AggregatedCounterSupport) counterSupport).addChild(component);
            }
          });
    } catch (ComponentCreationException e) {
      log.error("Unable to load component: " + component, e);
      badComponents.add(config);
      component.release();
      throw e;
    }

    return component;
  }
Exemplo n.º 2
0
 private void createConnections() {
   for (ConnectionConfig connectionConfig : getConfig().getConnectionList()) {
     try {
       Connection connection = new ConnectionImpl(connectionConfig);
       connection
           .getOutputTerminal()
           .addEventListener(TerminalConnectionEvent.class, connectionListener);
       connectionList.addItem(connection);
     } catch (Exception e) {
       badConnections.add(connectionConfig);
       log.error(
           "Unable to create connection between terminals "
               + connectionConfig.getInputTerminalId()
               + " and "
               + connectionConfig.getOutputTerminalId(),
           e);
     }
   }
 }