当前位置: 首页>>代码示例>>Java>>正文


Java ShellStatus类代码示例

本文整理汇总了Java中org.springframework.shell.event.ShellStatus的典型用法代码示例。如果您正苦于以下问题:Java ShellStatus类的具体用法?Java ShellStatus怎么用?Java ShellStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ShellStatus类属于org.springframework.shell.event包,在下文中一共展示了ShellStatus类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onShellStatusChange

import org.springframework.shell.event.ShellStatus; //导入依赖的package包/类
@Override
public void onShellStatusChange(ShellStatus oldStatus, ShellStatus newStatus) {
  if (newStatus.getStatus() == ShellStatus.Status.STARTED) {
    try {
      String cluster = client.getClusterName();
      boolean available = client.isBlueprintAvailable();
      if (cluster == null) {
        if (available) {
          context.setHint(Hints.BUILD_CLUSTER);
        } else {
          context.setHint(Hints.ADD_BLUEPRINT);
        }
      } else {
        context.setHint(Hints.PROGRESS);
      }
      context.setCluster(cluster);
      context.setBlueprintsAvailable(available);
    } catch (Exception e) {
      System.out.println(e.getMessage());
      shell.executeCommand("quit");
    }
  }
}
 
开发者ID:hortonworks,项目名称:ambari-shell,代码行数:24,代码来源:AmbariShell.java

示例2: run

import org.springframework.shell.event.ShellStatus; //导入依赖的package包/类
protected void run(String[] args)
{
  ServerConfigHelper.initConfig("env.properties");
  ServerConfigHelper.initLog4j("log4j-shell.xml");
  DomainMapperHelper.scanMapperRegistryClass();
  System.setProperty("jline.WindowsTerminal.directConsole", "false");
  String[] contextPath={ "gemlite-shell.xml" };
  bootstrap = new Bootstrap(args,contextPath);
  shell = (GShellComponent)bootstrap.getJLineShellComponent();
  shell.setDevelopmentMode(true);
  shell.addShellStatusListener(new ShellStatusListener()
  {
    @Override
    public void onShellStatusChange(ShellStatus oldStatus, ShellStatus newStatus)
    {
      if(newStatus.getStatus()==Status.STARTED)
      {
        DomainMapperHelper.scanMapperRegistryClass();
        shell.executeCommand("connect");
        shell.executeCommand("mn connect");
      }
        
    }
  });
  shell.start();
  shell.waitForComplete();
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:28,代码来源:GemliteShell.java

示例3: onShellStatusChange

import org.springframework.shell.event.ShellStatus; //导入依赖的package包/类
@Override
public void onShellStatusChange(ShellStatus oldStatus, ShellStatus newStatus) {
    if (newStatus.getStatus().equals(ShellStatus.Status.STARTED)) {
        Path rcFilePath = getRCFilePath();
        if (Files.exists(rcFilePath)) {
            Level logLevel = COMMAND_LOG.getLevel();
            COMMAND_LOG.setLevel(Level.OFF);
            LOG.info(String.format("Loading shell configuration from file %s", rcFilePath.toAbsolutePath()));
            try (
                    InputStream inputStream = Files.newInputStream(rcFilePath);
                    InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
                    BufferedReader bufferedReader = new BufferedReader(inputStreamReader)
            ) {
                String line;
                int lineNumber = 1;
                while ( (line = bufferedReader.readLine()) != null) {
                    if (!line.trim().isEmpty()) {
                        LOG.fine(String.format("Executing command %s", line));
                        boolean success = shell.executeCommand(line).isSuccess();
                        if (!success) {
                            LOG.severe(String.format("Failed to execute line %s: %s", lineNumber, line));
                            break;
                        }
                    }
                    lineNumber++;
                }

            } catch (Exception e) {
                LOG.severe(String.format("Failed to load shell configuration because of exception: %s", e));
            }
            COMMAND_LOG.setLevel(logLevel);
        } else {
            LOG.fine(String.format("Shell configuration file [%s] does not exist", rcFilePath.toAbsolutePath()));
        }
        eventBus.fireAsync(new ShellStartedEvent());
    }
}
 
开发者ID:meridor,项目名称:perspective-backend,代码行数:38,代码来源:RuntimeConfigurationProvider.java

示例4: getShellStatus

import org.springframework.shell.event.ShellStatus; //导入依赖的package包/类
@Override
public ShellStatus getShellStatus() {
    throw new UnsupportedOperationException();
}
 
开发者ID:meridor,项目名称:perspective-backend,代码行数:5,代码来源:MockShell.java


注:本文中的org.springframework.shell.event.ShellStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。