Package org.springframework.xd.module

Examples of org.springframework.xd.module.ModuleType


    this.validate();
  }
  //TODO: This is specific to XD stream composition. Eventually we may want to support more generic composite modules.
  private void validate() {
    Assert.isTrue(modules != null && modules.size() > 0, "at least one module required");
    ModuleType inferredType = null;
    if (modules.size() == 1) {
      inferredType = modules.get(0).getType();
    }
    else {
      ModuleType firstType = modules.get(0).getType();
      ModuleType lastType = modules.get(modules.size() - 1).getType();
      boolean hasInput = firstType != ModuleType.source;
      boolean hasOutput = lastType != ModuleType.sink;
      if (hasInput && hasOutput) {
        inferredType = ModuleType.processor;
      }
View Full Code Here


    List<ModuleDescriptor> parsed = parser.parse("__dummy", safe, toParsingContext(kind));

    // List is in reverse order
    ModuleDescriptor lastModule = parsed.get(0);
    String lastModuleName = lastModule.getModuleName();
    ModuleType lastModuleType = lastModule.getType();
    ModuleDefinition lastModuleDefinition = moduleRegistry.findDefinition(lastModuleName, lastModuleType);

    Set<String> alreadyPresentOptions = new HashSet<String>(lastModule.getParameters().keySet().size());
    // If we're providing completions for a composed module, some options
    // may already have a value appearing from the definition of the module itself, yet
View Full Code Here

  @Override
  public void addProposals(String start, List<ModuleDescriptor> parseResult, CompletionKind kind, int detailLevel,
      List<String> proposals) {
    // List is in reverse order
    ModuleDescriptor lastModule = parseResult.get(0);
    ModuleType lastModuleType = lastModule.getType();

    // For full streams, add processors and sinks
    if (kind == stream && lastModuleType != ModuleType.sink) {
      addAllModulesOfType(start.endsWith(" ") ? start + "| " : start + " | ", processor, proposals);
      addAllModulesOfType(start.endsWith(" ") ? start + "| " : start + " | ", sink, proposals);
    }

    // For composed modules, don't go up to sink if we started with a source
    ModuleDescriptor firstModule = parseResult.get(parseResult.size() - 1);
    ModuleType firstModuleType = firstModule.getType();
    if (kind == module && lastModuleType != ModuleType.sink) {
      addAllModulesOfType(start.endsWith(" ") ? start + "| " : start + " | ", processor, proposals);
      if (firstModuleType != source) {
        addAllModulesOfType(start.endsWith(" ") ? start + "| " : start + " | ", sink, proposals);
      }
View Full Code Here

  public void addProposals(String text, List<ModuleDescriptor> parseResult, CompletionKind kind, int detailLevel,
      List<String> proposals) {
    // List is in reverse order
    ModuleDescriptor lastModule = parseResult.get(0);
    String lastModuleName = lastModule.getModuleName();
    ModuleType lastModuleType = lastModule.getType();
    ModuleDefinition lastModuleDefinition = moduleRegistry.findDefinition(lastModuleName, lastModuleType);

    Set<String> alreadyPresentOptions = new HashSet<String>(lastModule.getParameters().keySet());
    for (ModuleOption option : moduleOptionsMetadataResolver.resolve(lastModuleDefinition)) {
      if (shouldShowOption(option, detailLevel) && !alreadyPresentOptions.contains(option.getName())) {
View Full Code Here

    List<ModuleDescriptor> parsed = parser.parse("__dummy", safe, toParsingContext(kind));

    // List is in reverse order
    ModuleDescriptor lastModule = parsed.get(0);
    String lastModuleName = lastModule.getModuleName();
    ModuleType lastModuleType = lastModule.getType();
    ModuleDefinition lastModuleDefinition = moduleRegistry.findDefinition(lastModuleName, lastModuleType);

    Set<String> alreadyPresentOptions = new HashSet<String>(lastModule.getParameters().keySet());
    for (ModuleOption option : moduleOptionsMetadataResolver.resolve(lastModuleDefinition)) {
      if (shouldShowOption(option, detailLevel) && !alreadyPresentOptions.contains(option.getName())
View Full Code Here

   * @param parsingContext   parsing context
   * @return module type
   * @throws NoSuchModuleException if the module type does not exist
   */
  private ModuleType determineType(ModuleDescriptor.Builder builder, int lastIndex, ParsingContext parsingContext) {
    ModuleType moduleType = determineTypeFromNamedChannels(builder, lastIndex, parsingContext);
    if (moduleType != null) {
      return moduleType;
    }
    String name = builder.getModuleName();
    int index = builder.getIndex();
View Full Code Here

    // Should this fail for composed module too?
    if (parsingContext == ParsingContext.job
        && (builder.getSourceChannelName() != null || builder.getSinkChannelName() != null)) {
      throw new RuntimeException("TODO");
    }
    ModuleType type = null;
    String moduleName = builder.getModuleName();
    int index = builder.getIndex();
    if (builder.getSourceChannelName() != null) { // preceded by >, so not a source
      if (index == lastIndex) { // this is the final module of the stream
        if (builder.getSinkChannelName() != null) { // but followed by >, so not a sink
View Full Code Here

        module.getName(), descriptor.getIndex());
  }

  @Override
  public boolean supports(Module module) {
    ModuleType moduleType = module.getType();
    return (moduleType == ModuleType.source || moduleType == ModuleType.processor || moduleType == ModuleType.sink);
  }
View Full Code Here

    try {
      byte[] data = zkConnection.getClient().getData().forPath(metadataPath);
      if (data != null) {
        Map<String, String> metadataMap = ZooKeeperUtils.bytesToMap(data);
        ModuleDeploymentsPath p = new ModuleDeploymentsPath(moduleDeploymentPath);
        ModuleType moduleType = id.getModuleType();

        DeploymentUnitStatus status = moduleType == ModuleType.job
            ? jobRepository.getDeploymentStatus(id.getUnitName())
            : streamRepository.getDeploymentStatus(id.getUnitName());
View Full Code Here

    }
    String name = isDir ? filename : filename.substring(0, filename.lastIndexOf(ARCHIVE_AS_FILE_EXTENSION));
    String canonicalPath = resource.getFile().getCanonicalPath();
    int lastSlash = canonicalPath.lastIndexOf('/');
    String typeAsString = canonicalPath.substring(canonicalPath.lastIndexOf('/', lastSlash - 1) + 1, lastSlash);
    ModuleType type = null;
    try {
      type = ModuleType.valueOf(typeAsString);
    }
    catch (IllegalArgumentException e) {
      // Not an actual type name, skip
View Full Code Here

TOP

Related Classes of org.springframework.xd.module.ModuleType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.