io.fabric8.common.util.Strings类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中io.fabric8.common.util.Strings类的一些代码示例,展示了Strings类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings类的具体详情如下:
包路径:io.fabric8.common.util.Strings
类名称:Strings

Strings介绍

暂无

代码示例

代码示例来源:origin: io.fabric8/fabric-openshift

private boolean isConfigurationValid(Map<String, String> properties) {
    return properties != null
        && properties.containsKey(SERVER_URL) && Strings.isNotBlank(properties.get(SERVER_URL))
        && properties.containsKey(LOGIN) && Strings.isNotBlank(properties.get(LOGIN))
        && properties.containsKey(PASSWORD) && Strings.isNotBlank(properties.get(PASSWORD));
  }
}

代码示例来源:origin: jboss-fuse/fabric8

public static boolean isNotBlank(String text) {
  return !isNullOrBlank(text);
}

代码示例来源:origin: io.fabric8/fabric-project-deployer

private String getVersionOrDefaultVersion(FabricService fabricService, String versionId) {
  if (Strings.isEmpty(versionId)) {
    versionId = fabricService.getDefaultVersionId();
    if (Strings.isEmpty(versionId)) {
      versionId = "1.0";
    }
  }
  return versionId;
}

代码示例来源:origin: jboss-fuse/fabric8

protected Map<String, String> createChildEnvironmentVariables() {
  Map<String, String> answer = new HashMap<>();
  Map<String, String> current = System.getenv();
  for (String variable : allowInheritedEnvironmentVariables) {
    String value = current.get(variable);
    if (Strings.isNotBlank(value)) {
      answer.put(variable, value);
    }
  }
  if (environmentVariables != null) {
    answer.putAll(environmentVariables);
  }
  answer.put(EnvironmentVariables.FABRIC8_PROFILES, join(getProfiles(), ","));
  if (answer.get(JAVA_OPTS) == null) {
    answer.put(JAVA_OPTS, DEFAULT_JAVA_OPTS);
  }
  return answer;
}

代码示例来源:origin: jboss-fuse/fabric8

if (Strings.isNullOrBlank(name)) {
  name = "Unknown";
if (Strings.isNotBlank(endpointPath)) {
  String prefix = endpointPath.startsWith("/") ? "" : "/";
  fullName += prefix + endpointPath;

代码示例来源:origin: io.fabric8/fabric-maven

@Override
public String toString() {
  return "DependencyId(" + groupId + ":" + artifactId +
      (notEmpty(classifier) ?  ":" + classifier : "") +
      (notEmpty(extension) ? ":" + extension : "") +
      ")";
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
public void setJmxDomains(List<String> jmxDomains) {
  String text = Strings.join(jmxDomains, "\n");
  setAttribute(DataStore.ContainerAttribute.Domains, text);
}

代码示例来源:origin: io.fabric8/fabric-cxf-registry

if (Strings.isNullOrBlank(name)) {
  name = "Unknown";
if (Strings.isNotBlank(endpointPath)) {
  String prefix = endpointPath.startsWith("/") ? "" : "/";
  fullName += prefix + endpointPath;

代码示例来源:origin: io.fabric8/common-util

public static String defaultIfEmpty(String value, String defaultValue) {
  return notEmpty(value) ? value : defaultValue;
}

代码示例来源:origin: jboss-fuse/fabric8

protected String executeCommand(File workDir, String... commands) throws IOException {
  String errors = null;
  String answer = null;
  String message = join(asList(commands), " ");
  try {
    System.out.println("Executing " + message);
    ProcessBuilder builder = new ProcessBuilder().command(commands).directory(workDir);
    Map<String, String> env = builder.environment();
    Map<String, String> envVars = createChildEnvironmentVariables();
    env.putAll(envVars);
    logEnvironmentVariables(env);
    Process process = builder.start();
    answer = readProcessOutput(process.getInputStream(), message);
    errors = processErrors(process.getErrorStream(), message);
    int status = process.waitFor();
    assertEquals("Command " + message + "; " + answer + " Status", 0, status);
  } catch (Exception e) {
    fail("Failed to execute command " +
        message +
        ": " + e);
  }
  errors = errors.trim();
  if (errors.length() > 0) {
    fail("Command: " + message + " got errors: " + errors);
  }
  return answer;
}

代码示例来源:origin: io.fabric8/common-util

@Override
  public Void apply(String line) {
    if (Strings.isNotBlank(line)) {
      answer.add(line.trim());
    }
    return null;
  }
};

代码示例来源:origin: io.fabric8/fabric-git

protected static void configureBranch(Git git, String branch, String remote) {
  // lets update the merge config
  if (Strings.isNotBlank(branch)) {
    StoredConfig config = git.getRepository().getConfig();
    if (Strings.isNullOrBlank(config.getString("branch", branch, "remote")) || Strings.isNullOrBlank(
        config.getString("branch", branch, "merge"))) {
      config.setString("branch", branch, "remote", remote);
      config.setString("branch", branch, "merge", "refs/heads/" + branch);
      try {
        config.save();
      } catch (IOException e) {
        LOGGER.error("Failed to configure the branch configuration to " + getRootGitDirectory(git)
            + " with branch " + branch + " on remote repo: " + remote + ". " + e, e);
      }
    }
  }
}

代码示例来源:origin: io.fabric8/common-util

public static boolean isNotBlank(String text) {
  return !isNullOrBlank(text);
}

代码示例来源:origin: jboss-fuse/fabric8

public static String defaultIfEmpty(String value, String defaultValue) {
  return notEmpty(value) ? value : defaultValue;
}

代码示例来源:origin: io.fabric8/fabric-project-deployer

/**
 * Returns the maven URL for the artifact without the version
 */
public String toBundleUrlWithoutVersion() {
  String prefix = "mvn:";
  if ("war".equals(type)) {
    prefix = "war:" + prefix;
  } else if ("bundle".equals(type)) {
    // use bundles
  } else if (Strings.isEmpty(type) || "jar".equals(type)) {
    prefix = "fab:" + prefix;
  }
  return prefix + groupId + "/" + artifactId + "/";
}

代码示例来源:origin: io.fabric8/fabric-commands

protected void printProfiles(ProfileService profileService, List<Profile> profiles, PrintStream out) {
  TablePrinter table = new TablePrinter();
  table.columns("id", "# containers", "parents");
  for (Profile profile : profiles) {
    String versionId = profile.getVersion();
    String profileId = profile.getId();
    // skip profiles that do not exists (they may have been deleted)
    if (profileService.hasProfile(versionId, profileId) && (hidden || !profile.isHidden())) {
      int active = fabricService.getAssociatedContainers(versionId, profileId).length;
      String parents = Strings.join(profile.getParentIds(), " ");
      table.row(profileId, activeContainerCountText(active), parents);
    }
  }
  table.print();
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
  public Void apply(String line) {
    if (Strings.isNotBlank(line)) {
      answer.add(line.trim());
    }
    return null;
  }
};

代码示例来源:origin: jboss-fuse/fabric8

protected static void configureBranch(Git git, String branch, String remote) {
  // lets update the merge config
  if (Strings.isNotBlank(branch)) {
    StoredConfig config = git.getRepository().getConfig();
    if (Strings.isNullOrBlank(config.getString("branch", branch, "remote")) || Strings.isNullOrBlank(
        config.getString("branch", branch, "merge"))) {
      config.setString("branch", branch, "remote", remote);
      config.setString("branch", branch, "merge", "refs/heads/" + branch);
      try {
        config.save();
      } catch (IOException e) {
        LOGGER.error("Failed to configure the branch configuration to " + getRootGitDirectory(git)
            + " with branch " + branch + " on remote repo: " + remote + ". " + e, e);
      }
    }
  }
}

代码示例来源:origin: io.fabric8/fabric-commands

private void applyEnsembleConfiguration() throws Exception {
  Map<String, String> currentConfig = clusterService.getEnsembleConfiguration();
  int currentTickTime = Integer.parseInt(currentConfig.get("tickTime"));
  int currentInitLimit = Integer.parseInt(currentConfig.get("initLimit"));
  int currentSyncLimit = Integer.parseInt(currentConfig.get("syncLimit"));
  String currentDataDir = currentConfig.get("dataDir");
  currentDataDir = currentDataDir.substring(0, currentDataDir.lastIndexOf("/"));
  zooKeeperTickTime = zooKeeperTickTime != 0 ? zooKeeperTickTime : currentTickTime;
  zooKeeperInitLimit = zooKeeperInitLimit != 0 ? zooKeeperInitLimit : currentInitLimit;
  zooKeeperSyncLimit = zooKeeperSyncLimit != 0 ? zooKeeperSyncLimit : currentSyncLimit;
  zooKeeperDataDir = !Strings.isNullOrBlank(zooKeeperDataDir) ? zooKeeperDataDir : currentDataDir;
}

代码示例来源:origin: jboss-fuse/fabric8

@Override
public boolean isValidProvider() {
  // child provider isn't valid in OpenShift environment
  FabricService service = getFabricService();
  if (service != null) {
    // lets disable child if in docker or openshift environments
    String environment = service.getEnvironment();
    if (Objects.equal(environment, "docker") || Objects.equal(environment, "openshift") || Objects.equal(environment, "kubernetes")) {
      return false;
    }
  }
  boolean openshiftFuseEnv = Strings.notEmpty(System.getenv("OPENSHIFT_FUSE_DIR"));
  boolean openshiftAmqEnv = Strings.notEmpty(System.getenv("OPENSHIFT_AMQ_DIR"));
  return !(openshiftFuseEnv || openshiftAmqEnv);
}

相关文章