Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2014 Red Hat, Inc. Red Hat licenses this file to you under the Apache License, version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package io.fabric8.commands;
import  org.apache.felix.gogo.commands.Argument;
import  org.apache.felix.gogo.commands.Command;
import  org.apache.felix.gogo.commands.Option;
@Command(name = ., scope = ., description = ., detailedDescription = "classpath:containerResolverSet.txt")
public class ContainerResolverSetAction extends AbstractAction {
    @Option(name = "--all", description = "Apply the resolver policy to all containers in the fabric.")
    private boolean all;
    @Option(name = "--container", required = false, multiValued = true, description = "Apply the resolver policy to the specified container.")
    private List<StringcontainerIds;
    @Argument(index = 0, required = true, multiValued = false, name = "resolver", description = "The resolver policy to set on the specified container(s). Possible values are: localip, localhostname, publicip, publichostname, manualip.")
    private String resolver;
    private final FabricService fabricService;
    ContainerResolverSetAction(FabricService fabricService) {
        this. = fabricService;
    protected Object doExecute() throws Exception {
        if ( == null || .isEmpty()) {
            if () {
                 = new ArrayList<String>();
                for (Container container : .getContainers()) {
            } else {
                ..println("No container has been specified. Assuming the current container.");
                 = Arrays.asList(.getCurrentContainer().getId());
        } else {
            if () {
                throw new IllegalArgumentException("Can not use --all with a list of containers simultaneously.");
        for (String containerId : ) {
            Container container = .getContainer(containerId);
        return null;
New to GrepCode? Check out our FAQ X