本文整理汇总了Java中io.fabric8.utils.Strings.join方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.join方法的具体用法?Java Strings.join怎么用?Java Strings.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.utils.Strings
的用法示例。
在下文中一共展示了Strings.join方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printServices
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
private void printServices(ServiceList services, PrintStream out) {
TablePrinter table = new TablePrinter();
table.columns("id", "labels", "selector", "port");
List<Service> items = services.getItems();
if (items == null) {
items = Collections.EMPTY_LIST;
}
Filter<Service> filter = KubernetesHelper.createServiceFilter(filterText.getValue());
for (Service service : items) {
if (filter.matches(service)) {
String labels = KubernetesHelper.toLabelsString(service.getMetadata().getLabels());
String selector = KubernetesHelper.toLabelsString(getSelector(service));
Set<Integer> ports = getPorts(service);
List<Integer> portList = new ArrayList<>(ports);
String portText;
if (portList.size() == 1) {
portText = portList.get(0).toString();
} else {
portText = Strings.join(portList, ", ");
}
table.row(KubernetesHelper.getName(service), labels, selector, portText);
}
}
table.print();
}
示例2: stageProfilesCommand
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
default String stageProfilesCommand(DeploymentDetails details, GenerateService.ResolvedConfiguration resolvedConfiguration) {
Map<String, Profile> profiles = resolvedConfiguration.getProfilesForService(getService().getType());
List<String> allCommands = new ArrayList<>();
for (Map.Entry<String, Profile> entry : profiles.entrySet()) {
Profile profile = entry.getValue();
String source = profile.getStagedFile(getSpinnakerStagingPath(details.getDeploymentName()));
String dest = profile.getOutputFile();
allCommands.add(String.format("mkdir -p $(dirname %s)", dest));
allCommands.add(String.format("cp -p %s %s", source, dest));
if (profile.isExecutable()) {
allCommands.add(String.format("chmod +x %s", dest));
}
}
return Strings.join(allCommands, "\n");
}
示例3: installArtifactCommand
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
default String installArtifactCommand(DeploymentDetails deploymentDetails) {
Map<String, String> bindings = new HashMap<>();
String artifactName = getArtifact().getName();
bindings.put("artifact", artifactName);
bindings.put("version", deploymentDetails.getArtifactVersion(artifactName));
// pin as well as install at a particular version to ensure `apt-get uprade` doesn't accidentally upgrade to `nightly`
TemplatedResource pinResource = new JarResource("/debian/pin.sh");
TemplatedResource installResource = new JarResource("/debian/install-component.sh");
String upstartServiceName = getUpstartServiceName();
String ensureStopped = StringUtils.isEmpty(upstartServiceName) ? "" :
String.join("\n",
"set +e", String.join(" ", "service", upstartServiceName, "stop"), "set -e");
pinResource.setBindings(bindings);
installResource.setBindings(bindings);
return Strings.join("\n", pinResource, installResource, ensureStopped);
}
示例4: stageStartupScripts
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
default String stageStartupScripts(DeploymentDetails details, GenerateService.ResolvedConfiguration resolvedConfiguration) {
Map<String, Profile> profiles = resolvedConfiguration.getProfilesForService(getService().getType());
List<String> allCommands = new ArrayList<>();
for (Map.Entry<String, Profile> entry : profiles.entrySet()) {
Profile profile = entry.getValue();
String source = profile.getStagedFile(getSpinnakerStagingPath(details.getDeploymentName()));
String dest = profile.getOutputFile();
allCommands.add(String.format("mkdir -p $(dirname %s)", dest));
allCommands.add(String.format("cp -p %s %s", source, dest));
if (profile.isExecutable()) {
allCommands.add(String.format("chmod +x %s", dest));
}
}
return Strings.join(allCommands, "\n");
}
示例5: installArtifactCommand
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
default String installArtifactCommand(DeploymentDetails deploymentDetails) {
Map<String, String> bindings = new HashMap<>();
String artifactName = getArtifact().getName();
bindings.put("artifact", artifactName);
bindings.put("version", deploymentDetails.getArtifactVersion(artifactName));
// pin as well as install at a particular version to ensure `apt-get uprade` doesn't accidentally upgrade to `nightly`
TemplatedResource pinResource = new JarResource("/debian/pin.sh");
TemplatedResource installResource = new JarResource("/debian/install-component.sh");
String ensureStopped = String.join("\n", "set +e", "service " + getUpstartServiceName() + " stop", "set -e");
pinResource.setBindings(bindings);
installResource.setBindings(bindings);
return Strings.join("\n", pinResource, installResource, ensureStopped);
}
示例6: connectCommand
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
default String connectCommand(AccountDeploymentDetails<KubernetesAccount> details, SpinnakerRuntimeSettings runtimeSettings, int localPort) {
ServiceSettings settings = runtimeSettings.getServiceSettings(getService());
RunningServiceDetails runningServiceDetails = getRunningServiceDetails(details, runtimeSettings);
Map<Integer, List<Instance>> instances = runningServiceDetails.getInstances();
Integer latest = runningServiceDetails.getLatestEnabledVersion();
String namespace = getNamespace(settings);
List<Instance> latestInstances = instances.get(latest);
if (latestInstances.isEmpty()) {
throw new HalException(Problem.Severity.FATAL, "No instances running in latest server group for service " + getServiceName() + " in namespace " + namespace);
}
return Strings.join(KubernetesProviderUtils.kubectlPortForwardCommand(details,
namespace,
latestInstances.get(0).getId(),
settings.getPort(),
localPort), " ");
}
示例7: getNodeText
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
public static String getNodeText(NodeDtoSupport node) {
String pattern = Strings2.getOrElse(node.getPattern());
String label = Strings2.getOrElse(node.getLabel());
// lets output the pattern for a few kinds of nodes....
if (patternsToPrefix.contains(pattern)) {
return Strings.join(" ", pattern, label);
}
return label;
}
示例8: stageProfilesCommand
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
default String stageProfilesCommand(DeploymentDetails details, GenerateService.ResolvedConfiguration resolvedConfiguration) {
Map<String, Profile> profiles = resolvedConfiguration.getProfilesForService(getService().getType());
List<String> allCommands = new ArrayList<>();
for (Map.Entry<String, Profile> entry : profiles.entrySet()) {
Profile profile = entry.getValue();
String source = profile.getStagedFile(getSpinnakerStagingPath(details.getDeploymentName()));
String dest = profile.getOutputFile();
String user = profile.getUser();
String group = profile.getGroup();
allCommands.add(String.format("mkdir -p $(dirname %s)", dest));
allCommands.add(String.format("cp -p %s %s", source, dest));
allCommands.add(String.format("chown %s:%s %s", user, group, dest));
allCommands.add(String.format("chmod 640 %s", dest));
for (String requiredFile : profile.getRequiredFiles()) {
allCommands.add(String.format("chown %s:%s %s", user, group, requiredFile));
allCommands.add(String.format("chmod 640 %s", requiredFile));
}
if (profile.isExecutable()) {
allCommands.add(String.format("chmod +x %s", dest));
}
}
return Strings.join(allCommands, "\n");
}
示例9: invokeMaven
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
protected static int invokeMaven(String[] args, String outDir, File logFile) {
List<String> goals = Arrays.asList(args);
String commandLine = Strings.join(goals, " ");
InvocationResult result = null;
try {
File dir = new File(outDir);
InvocationRequest request = new DefaultInvocationRequest();
request.setGoals(goals);
InvocationOutputHandler outputHandler = new SystemOutAndFileHandler(logFile);
outputHandler.consumeLine("");
outputHandler.consumeLine("");
outputHandler.consumeLine(dir.getName() + " : starting: mvn " + commandLine);
outputHandler.consumeLine("");
request.setOutputHandler(outputHandler);
request.setErrorHandler(outputHandler);
DefaultInvoker invoker = new DefaultInvoker();
request.setPomFile(new File(dir, "pom.xml"));
result = invoker.execute(request);
CommandLineException executionException = result.getExecutionException();
if (executionException != null) {
LOG.error("Failed to invoke maven with: mvn " + commandLine + ". " + executionException, executionException);
}
} catch (Exception e) {
LOG.error("Failed to invoke maven with: mvn " + commandLine + ". " + e, e);
}
return result == null ? 1 : result.getExitCode();
}
示例10: getOrBlank
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
private static String getOrBlank(List<String> values) {
if (values != null && values.size() > 0) {
return Strings.join(values, ", ");
}
return "";
}
示例11: installArtifactCommand
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
@Override
public String installArtifactCommand(DeploymentDetails deploymentDetails) {
String install = LocalDebianService.super.installArtifactCommand(deploymentDetails);
String ssl = deploymentDetails.getDeploymentConfiguration().getSecurity().getUiSecurity().getSsl().isEnabled() ? "a2enmod ssl" : "";
return Strings.join("\n", install, ssl);
}
示例12: stageProfilesCommand
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
@Override
public String stageProfilesCommand(DeploymentDetails details, GenerateService.ResolvedConfiguration resolvedConfiguration) {
String stage = LocalDebianService.super.stageProfilesCommand(details, resolvedConfiguration);
return Strings.join("\n", stage, "a2ensite spinnaker", "a2dissite 000-default");
}
示例13: buildAddress
import io.fabric8.utils.Strings; //导入方法依赖的package包/类
default String buildAddress(String namespace) {
return Strings.join(".", getServiceName(), namespace);
}