Package org.springframework.xd.module

Examples of org.springframework.xd.module.ModuleDescriptor$Key


    validateQuery(query);
    validateSplitSize(numSplits);

    List<Query> splits = new ArrayList<Query>(numSplits);
    List<Key> scatterKeys = getScatterKeys(numSplits, query, datastore);
    Key lastKey = null;
    for (Key nextKey : getSplitKey(scatterKeys, numSplits)) {
      splits.add(createSplit(lastKey, nextKey, query));
      lastKey = nextKey;
    }
    splits.add(createSplit(lastKey, null, query));
View Full Code Here


      List<String> proposals) {
    String safe = exception.getExpressionStringUntilCheckpoint();
    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
    // the user *may* want to override them anyways. So pretend they're not there
    for (String optionName : lastModule.getParameters().keySet()) {
      if (!optionName.contains(CompositeModule.OPTION_SEPARATOR)) {
        alreadyPresentOptions.add(optionName);
      }
    }
    for (ModuleOption option : moduleOptionsMetadataResolver.resolve(lastModuleDefinition)) {
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

  @Override
  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())) {
        proposals.add(String.format("%s%s--%s=", text, text.endsWith(" ") ? "" : " ", 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())
          && option.getName().startsWith(prefix.toString())) {
        proposals.add(String.format("%s --%s=", safe, option.getName()));
      }
View Full Code Here

            .forPath(Paths.build(path, Paths.METADATA), ZooKeeperUtils.mapToBytes(mapMetadata));
      }
      catch (KeeperException.NodeExistsException ne) {
        // This is likely to happen when the container disconnects and reconnects but the admin leader
        // was not available to handle the container leaving event.
        ModuleDescriptor descriptor = module.getDescriptor();
        logger.info("The module metadata path for the module {} of type {} for {}" + "already exists.",
            descriptor.getModuleLabel(), descriptor.getType().toString(), descriptor.getGroup());
      }
    }
  }
View Full Code Here

        .setModuleSequence(properties.getSequenceAsString()).setContainer(containerAttributes.getId()).build();

    Module module = null;
    Job job = DeploymentLoader.loadJob(client, jobName, jobFactory);
    if (job != null) {
      ModuleDescriptor moduleDescriptor = job.getJobModuleDescriptor();
      module = deployModule(moduleDescriptor, properties);

      try {
        // this indicates that the container has deployed the module
        client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(jobDeploymentPath);
View Full Code Here

        .setContainer(this.containerAttributes.getId()).build();

    Module module = null;
    Stream stream = DeploymentLoader.loadStream(client, streamName, streamFactory);
    if (stream != null) {
      ModuleDescriptor descriptor = stream.getModuleDescriptor(moduleLabel);
      module = deployModule(descriptor, properties);

      try {
        // this indicates that the container has deployed the module
        client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(streamDeploymentPath);
View Full Code Here

   * @param moduleType module type
   * @param moduleLabel module label
   */
  protected void undeployModule(String streamName, String moduleType, String moduleLabel) {
    ModuleDescriptor.Key key = new ModuleDescriptor.Key(streamName, ModuleType.valueOf(moduleType), moduleLabel);
    ModuleDescriptor descriptor = mapDeployedModules.get(key);
    if (descriptor == null) {
      // This is logged at trace level because every module undeployment
      // will cause this to be logged. This is because there is a listener
      // on both streams and modules, and the listener implementation for
      // each will remove the module from the other, thus causing
View Full Code Here

    List<ModuleDescriptor> streamModules = stream.getModuleDescriptors();
    RuntimeModuleDeploymentProperties properties = super.propertiesForDescriptor(moduleDescriptor);
    int moduleSequence = properties.getSequence();
    int moduleIndex = moduleDescriptor.getIndex();
    if (moduleIndex > 0) {
      ModuleDescriptor previous = streamModules.get(moduleIndex - 1);
      ModuleDeploymentProperties previousProperties = deploymentPropertiesProvider.propertiesForDescriptor(previous);
      if (hasPartitionKeyProperty(previousProperties)) {
        properties.put("consumer.partitionIndex", String.valueOf(moduleSequence - 1));
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.xd.module.ModuleDescriptor$Key

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.