Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.fabric8.openshift.commands;
 
 import  org.apache.felix.gogo.commands.Argument;
 import  org.apache.felix.gogo.commands.Command;
 import  org.apache.felix.gogo.commands.Option;
@Command(name = "application-list", scope = "openshift", description = "Lists available openshift application")
    static final String FORMAT = "%-30s %s";
    @Option(name = "--domain", required = false, description = "Show only applications of that domain.")
    String domainId;
    @Argument(index = 0, name = "application", required = true, description = "The target application.")
    @Override
    protected Object doExecute() throws Exception {
        IOpenShiftConnection connection = getOrCreateConnection();
        for (IDomain domain : connection.getDomains()) {
            if ( == null || .equals(domain.getId())) {
                IApplication application = domain.getApplicationByName();
                ..println(String.format("Name:"application.getName()));
                ..println(String.format("UUID:"application.getUUID()));
                ..println(String.format("Application URL:"application.getApplicationUrl()));
                ..println(String.format("Git URL:"application.getGitUrl()));
                ..println(String.format("Cartridge:"application.getCartridge().getName()));
                ..println(String.format("Embedded Cartridges:"cartridgesToString(application.getEmbeddedCartridges())));
                ..println(String.format("Scale:"application.getApplicationScale().getValue()));
                ..println(String.format("Gear Profile:"application.getGearProfile().getName()));
            }
        }
        return null;
    }
    private static String cartridgesToString(List<IEmbeddedCartridgecartridges) {
        StringBuilder sb = new StringBuilder();
        for (IEmbeddedCartridge cartridge : cartridges) {
            sb.append(cartridge.getName()).append(" ");
        }
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X