Package org.springframework.xd.dirt.core

Examples of org.springframework.xd.dirt.core.StreamDeploymentsPath


    if (ModuleType.job.toString().equals(moduleType)) {
      path = new JobDeploymentsPath().setJobName(streamName).setModuleLabel(moduleLabel)
          .setContainer(containerAttributes.getId()).build();
    }
    else {
      path = new StreamDeploymentsPath().setStreamName(streamName).setModuleType(moduleType)
          .setModuleLabel(moduleLabel).setModuleSequence(moduleSequence)
          .setContainer(this.containerAttributes.getId()).build();
    }
    if (client.checkExists().forPath(path) != null) {
      logger.trace("Deleting path: {}", path);
View Full Code Here


   */
  private Module deployStreamModule(CuratorFramework client, String streamName, String moduleType, String moduleLabel,
      RuntimeModuleDeploymentProperties properties) throws Exception {
    logger.info("Deploying module '{}' for stream '{}'", moduleLabel, streamName);

    String streamDeploymentPath = new StreamDeploymentsPath().setStreamName(streamName).setModuleType(moduleType)
        .setModuleLabel(moduleLabel).setModuleSequence(properties.getSequenceAsString())
        .setContainer(this.containerAttributes.getId()).build();

    Module module = null;
    Stream stream = DeploymentLoader.loadStream(client, streamName, streamFactory);
View Full Code Here

    @Override
    public void process(WatchedEvent event) throws Exception {
      CuratorFramework client = zkConnection.getClient();

      if (event.getType() == Watcher.Event.EventType.NodeDeleted) {
        StreamDeploymentsPath streamDeploymentsPath = new StreamDeploymentsPath(event.getPath());

        String streamName = streamDeploymentsPath.getStreamName();
        String moduleType = streamDeploymentsPath.getModuleType();
        String moduleLabel = streamDeploymentsPath.getModuleLabel();
        String moduleSequence = streamDeploymentsPath.getModuleSequenceAsString();

        undeployModule(streamName, moduleType, moduleLabel);

        String deploymentPath = new ModuleDeploymentsPath().setContainer(containerAttributes.getId())
            .setDeploymentUnitName(streamName).setModuleType(moduleType).setModuleLabel(moduleLabel)
View Full Code Here

    String moduleLabel = descriptor.getModuleLabel();
    String moduleDeploymentPath = Paths.build(Paths.STREAM_DEPLOYMENTS, descriptor.getGroup(), Paths.MODULES);
    try {
      List<String> moduleDeployments = getClient().getChildren().forPath(moduleDeploymentPath);
      for (String moduleDeployment : moduleDeployments) {
        StreamDeploymentsPath path = new StreamDeploymentsPath(
            Paths.build(moduleDeploymentPath, moduleDeployment));
        if (path.getModuleType().equals(moduleType)
            && path.getModuleLabel().equals(moduleLabel)) {
          containers.add(path.getContainer());
        }
      }
    }
    catch (KeeperException.NoNodeException e) {
      // stream has not been (or is no longer) deployed
View Full Code Here

      String label;
      int moduleSequence;
      String container;

      if (deploymentUnit instanceof Stream) {
        StreamDeploymentsPath streamDeploymentsPath = new StreamDeploymentsPath(Paths.build(path, module));
        deploymentUnitName = streamDeploymentsPath.getStreamName();
        Assert.state(deploymentUnitName.equals(deploymentUnit.getName()));
        type = ModuleType.valueOf(streamDeploymentsPath.getModuleType());
        label = streamDeploymentsPath.getModuleLabel();
        moduleSequence = streamDeploymentsPath.getModuleSequence();
        container = streamDeploymentsPath.getContainer();
      }
      else {
        JobDeploymentsPath jobDeploymentsPath = new JobDeploymentsPath(Paths.build(path, module));
        deploymentUnitName = jobDeploymentsPath.getJobName();
        Assert.state(deploymentUnitName.equals(deploymentUnit.getName()));
View Full Code Here

        String streamModulesPath = Paths.build(definitionPath, Paths.MODULES);
        List<ModuleDeploymentStatus> statusList = new ArrayList<ModuleDeploymentStatus>();
        try {
          List<String> moduleDeployments = client.getChildren().forPath(streamModulesPath);
          for (String moduleDeployment : moduleDeployments) {
            StreamDeploymentsPath streamDeploymentsPath = new StreamDeploymentsPath(
                Paths.build(streamModulesPath, moduleDeployment));
            statusList.add(new ModuleDeploymentStatus(
                streamDeploymentsPath.getContainer(),
                streamDeploymentsPath.getModuleSequence(),
                new ModuleDescriptor.Key(streamName,
                    ModuleType.valueOf(streamDeploymentsPath.getModuleType()),
                    streamDeploymentsPath.getModuleLabel()),
                ModuleDeploymentStatus.State.deployed, null));
          }
        }
        catch (KeeperException.NoNodeException e) {
          // indicates there are no modules deployed for this stream;
View Full Code Here

        Set<String> previouslyDeployed = new HashSet<String>();

        for (String deployedModule : client.getChildren().forPath(
            Paths.build(data.getPath(), Paths.MODULES))) {
          previouslyDeployed.add(Paths.stripPath(
              new StreamDeploymentsPath(Paths.build(data.getPath(), Paths.MODULES, deployedModule))
                  .getModuleInstanceAsString()));
        }

        for (ModuleDeploymentRequestsPath path : requestedModules) {
          ModuleDescriptor moduleDescriptor = stream.getModuleDescriptor(path.getModuleLabel());
View Full Code Here

    // which they were deployed.
    Map<Long, String> txMap = new TreeMap<Long, String>();
    try {
      List<String> deployments = client.getChildren().forPath(streamModuleDeploymentPath);
      for (String deployment : deployments) {
        String path = new StreamDeploymentsPath(Paths.build(streamModuleDeploymentPath, deployment)).build();
        Stat stat = client.checkExists().forPath(path);
        Assert.notNull(stat);
        txMap.put(stat.getCzxid(), path);
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.xd.dirt.core.StreamDeploymentsPath

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.