package com.terradue.dsione;

/*
 *  Copyright 2012 Terradue srl
 *
 *  Licensed 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
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  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.
 */

import static java.lang.System.exit;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;

@Parameters( commandDescription = "Runs an instance of a particular image." )
public final class StartInstances
    extends BaseTool
{

    public static void main( String[] args )
    {
        exit( new StartInstances().execute( args ) );
    }

    @Parameter( names = { "--headers" }, description = "Display column headers" )
    private boolean headers = false;

    @Override
    public void execute()
        throws Exception
    {
        // TODO
    }

}

@@ -669,16 +669,69 @@
 .exit;%0A%0A
+import java.util.LinkedList;%0Aimport java.util.List;%0A%0A
 import c
@@ -800,16 +800,146 @@
 ameters;
+%0Aimport com.google.inject.Inject;%0Aimport com.google.inject.name.Named;%0Aimport com.sun.jersey.api.client.UniformInterfaceException;
 %0A%0A@Param
@@ -1200,198 +1200,1068 @@
 er( 
-names = %7B %22--headers%22 %7D, description = %22Display column headers%22 )%0A    private boolean headers = false;%0A%0A    @Override%0A    public void execute()%0A        throws Exception%0A    %7B%0A        // TODO
+description = %22The image identificator(s) as returned by the upload command%22 )%0A    protected List%3CString%3E ids = new LinkedList%3CString%3E();%0A%0A    @Inject%0A    @Override%0A    public void setServiceUrl( @Named( %22service.deployments%22 ) String serviceUrl )%0A    %7B%0A        super.setServiceUrl( serviceUrl );%0A    %7D%0A%0A    @Override%0A    public void execute()%0A        throws Exception%0A    %7B%0A        for ( String id : ids )%0A        %7B%0A            startInstance( id );%0A        %7D%0A    %7D%0A%0A    void startInstance( String id )%0A    %7B%0A        try%0A        %7B%0A            restClient.resource( new StringBuilder( serviceUrl )%0A                                .append( '/' )%0A                                .append( id )%0A                                .append( %22/start%22 )%0A                                .toString() )%0A                      .post();%0A        %7D%0A        catch ( UniformInterfaceException e )%0A        %7B%0A            logger.warn( %22An error occurred while starting instance %7B%7D, server replied: %7B%7D%22,%0A                         id, e.getResponse().getClientResponseStatus() );%0A        %7D
 %0A   

implement the start command