Esempio n. 1
0
  public boolean isStreamDefinitionValidForConfiguration(
      EventBuilderConfiguration eventBuilderConfiguration,
      StreamDefinition exportedStreamDefinition) {
    if (!(eventBuilderConfiguration.getToStreamName().equals(exportedStreamDefinition.getName())
        && eventBuilderConfiguration
            .getToStreamVersion()
            .equals(exportedStreamDefinition.getVersion()))) {
      return false;
    }
    if (eventBuilderConfiguration.getInputMapping() instanceof XMLInputMapping) {
      XMLInputMapping xmlInputMapping =
          (XMLInputMapping) eventBuilderConfiguration.getInputMapping();
      for (InputMappingAttribute inputMappingAttribute :
          xmlInputMapping.getInputMappingAttributes()) {
        Attribute attribute =
            new Attribute(
                inputMappingAttribute.getToElementKey(), inputMappingAttribute.getToElementType());
        if (!exportedStreamDefinition.getPayloadData().contains(attribute)) {
          return false;
        }
      }
    } else {
      return false;
    }

    return true;
  }
Esempio n. 2
0
  @Override
  public void loadEventBuilderConfiguration() {
    if (this.eventBuilderConfiguration != null) {
      String outputStreamName = eventBuilderConfiguration.getToStreamName();
      String outputStreamVersion = eventBuilderConfiguration.getToStreamVersion();
      try {
        this.exportedStreamDefinition = new StreamDefinition(outputStreamName, outputStreamVersion);
      } catch (MalformedStreamDefinitionException e) {
        throw new EventBuilderConfigurationException(
            "Could not create stream definition with "
                + outputStreamName
                + EventBuilderConstants.STREAM_NAME_VER_DELIMITER
                + outputStreamVersion);
      }

      subscribeToTransportAdaptor();
      createMapping(eventBuilderConfiguration, exportedStreamDefinition, attributeXpathList);
      this.eventBuilderConfiguration.setDeploymentStatus(DeploymentStatus.DEPLOYED);
    }
  }