io.fabric8.common.util.Strings.isNullOrBlank()方法的使用及代码示例

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

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

Strings.isNullOrBlank介绍

暂无

代码示例

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

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

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

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

代码示例来源: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: 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: io.fabric8/fabric-redirect

protected void doRedirect(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  String requestURI = req.getRequestURI();
  if (Strings.isNullOrBlank(requestURI) || getValidRedirectRequestSet().contains(requestURI)) {
    String url = getRedirect();
    LOGGER.debug("Redirect: {} to: {}", requestURI, url);
    resp.sendRedirect(url);
  } else {
    LOGGER.debug("Resource not found: {} returning status code: 404", requestURI);
    // must response with status and flush as Jetty may report org.eclipse.jetty.server.Response Committed before 404 null
    resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
    resp.setContentLength(0);
    resp.flushBuffer();
  }
}

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

protected void doRedirect(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  String requestURI = req.getRequestURI();
  if (Strings.isNullOrBlank(requestURI) || getValidRedirectRequestSet().contains(requestURI)) {
    String url = getRedirect();
    LOGGER.debug("Redirect: {} to: {}", requestURI, url);
    resp.sendRedirect(url);
  } else {
    LOGGER.debug("Resource not found: {} returning status code: 404", requestURI);
    // must response with status and flush as Jetty may report org.eclipse.jetty.server.Response Committed before 404 null
    resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
    resp.setContentLength(0);
    resp.flushBuffer();
  }
}

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

protected String validateProperty(Map<String, ?> properties, String name, String propertyName, String envVarName, String defaultValue) {
  String answer = Maps.stringValue(properties, propertyName, Systems.getEnvVar(envVarName, defaultValue));
  if (Strings.isNullOrBlank(answer)) {
    LOG.warn("No configured value for " + name + " in property " + propertyName + " or environment variable $" + envVarName);
  }
  return answer;
}

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

@Override
public List<Archetype> listArchetypes(String filter, boolean artifactIdOnly) {
  List<Archetype> answer = new ArrayList<Archetype>();
  if (Strings.isNullOrBlank(filter)) {
    answer.addAll(listArchetypes());
    return answer;
  }
  filter = filter.toLowerCase();
  for (Archetype archetype : archetypes.values()) {
    if (artifactIdOnly && archetype.artifactId.toLowerCase().contains(filter)) {
      answer.add(archetype);
    } else {
      if (archetype.groupId.toLowerCase().contains(filter)
        || archetype.artifactId.toLowerCase().contains(filter)
        || archetype.version.toLowerCase().contains(filter)) {
        answer.add(archetype);
      }
    }
  }
  return answer;
}

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

LOGGER.warn("Failed to get CxfServlet attribute on " + oName + ". " + e, e);
if (Strings.isNullOrBlank(cxfBus)) {
if (Strings.isNullOrBlank(cxfBus)) {
  cxfBus = "/cxf";
  LOGGER.warn("Could not find the CXF servlet path in config admin so using a default value: " + cxfBus);

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

public String getType() {
  String answer = null;
  CreateContainerMetadata<?> containerMetadata = getMetadata();
  if (containerMetadata != null) {
    answer = containerMetadata.getContainerType();
  }
  if (Strings.isNullOrBlank(answer)) {
    answer = "karaf";
  }
  return answer;
}

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

LOGGER.warn("Failed to get CxfServlet attribute on " + oName + ". " + e, e);
if (Strings.isNullOrBlank(cxfBus)) {
if (Strings.isNullOrBlank(cxfBus)) {
  cxfBus = "/cxf";
  LOGGER.warn("Could not find the CXF servlet path in config admin so using a default value: " + cxfBus);

代码示例来源: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: 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-rest

Objects.notNull(profileService, "profileService");
String id = profileDTO.getId();
if (Strings.isNullOrBlank(id)) {
  return Response.status(Response.Status.BAD_REQUEST).entity("No id specified for the profile to be created").build();

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

Objects.notNull(profileService, "profileService");
String id = profileDTO.getId();
if (Strings.isNullOrBlank(id)) {
  return Response.status(Response.Status.BAD_REQUEST).entity("No id specified for the profile to be created").build();

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

void configureInternal(Map<String, ?> conf) throws Exception {
  configuration = configurer.configure(conf, this);
  if (Strings.isNullOrBlank(runtimeId)) {
    throw new IllegalArgumentException("Runtime id must not be null or empty.");
  if (Strings.isNullOrBlank(localResolver)) {
    localResolver = globalResolver;
  if(!Strings.isNullOrBlank(minimumPort)){
    this.minport = Integer.valueOf(minimumPort);
  if(!Strings.isNullOrBlank(maximumPort)){
    this.maxport = Integer.valueOf(maximumPort);

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

@Override
  protected Object doExecute() throws Exception {
    if (exists(getCurator(), ZkPath.AUTHENTICATION_CRYPT_ALGORITHM.getPath()) == null) {
      System.out.println("No encryption algorithm found in the registry.");
      return null;
    } else if (exists(getCurator(), ZkPath.AUTHENTICATION_CRYPT_PASSWORD.getPath()) == null) {
      System.out.println("No encryption master password found in the registry.");
      return null;
    } else {
      algorithm = !Strings.isNullOrBlank(algorithm) ? algorithm : getStringData(getCurator(), ZkPath.AUTHENTICATION_CRYPT_ALGORITHM.getPath());
      String rawZookeeperPassword = getStringData(getCurator(), ZkPath.AUTHENTICATION_CRYPT_PASSWORD.getPath());
      if (rawZookeeperPassword != null) {
        rawZookeeperPassword = PasswordEncoder.decode(rawZookeeperPassword);
      }
      password = password != null ? password : rawZookeeperPassword;
      StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
      encryptor.setAlgorithm(algorithm);
      encryptor.setPassword(password);
      System.out.println(String.format(FORMAT, message, algorithm, password, encryptor.encrypt(message)));
    }
    return null;
  }
}

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

void configureInternal(Map<String, ?> conf) throws Exception {
  configuration = configurer.configure(conf, this);
  if (Strings.isNullOrBlank(runtimeId)) {
    throw new IllegalArgumentException("Runtime id must not be null or empty.");
  }
  if (Strings.isNullOrBlank(localResolver)) {
    localResolver = globalResolver;
  }
  String decodedZookeeperPassword = null;
  Properties userProps = new Properties();
  try {
    userProps.load(new File(confDir , "users.properties"));
  } catch (IOException e) {
    LOGGER.warn("Failed to load users from etc/users.properties. No users will be imported.", e);
  }
  if (Strings.isNotBlank(zookeeperPassword)) {
    decodedZookeeperPassword = PasswordEncoder.decode(zookeeperPassword);
  } else if (userProps.containsKey(DEFAULT_ADMIN_USER)) {
    String passwordAndRole = userProps.getProperty(DEFAULT_ADMIN_USER).trim();
    decodedZookeeperPassword = passwordAndRole.substring(0, passwordAndRole.indexOf(ROLE_DELIMITER));
  } else {
    decodedZookeeperPassword = PasswordEncoder.encode(CreateEnsembleOptions.generatePassword());
  }
  if (userProps.isEmpty()) {
    userProps.put(DEFAULT_ADMIN_USER, decodedZookeeperPassword+ ROLE_DELIMITER + DEFAULT_ADMIN_ROLE);
  }
  options = CreateEnsembleOptions.builder().bindAddress(bindAddress).agentEnabled(agentAutoStart).ensembleStart(ensembleAutoStart).zookeeperPassword(decodedZookeeperPassword)
      .zooKeeperServerPort(zookeeperServerPort).zooKeeperServerConnectionPort(zookeeperServerConnectionPort).autoImportEnabled(profilesAutoImport)
      .importPath(profilesAutoImportPath).resolver(localResolver).globalResolver(globalResolver).users(userProps).profiles(profiles).version(version).build();
}

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

private MQBrokerConfigDTO createDTO() {
  if (Strings.isNullOrBlank(username)) {
    username = ShellUtils.retrieveFabricUser(session);
  if (Strings.isNullOrBlank(password)) {
    password = ShellUtils.retrieveFabricUserPassword(session);

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

if (Strings.isNullOrBlank(login)) {
  login = (String) session.get(OPENSHIFT_USER);
if (Strings.isNullOrBlank(password)) {
  password = (String) session.get(OPENSHIFT_USER_PASSWORD);

相关文章