@@ -0,0 +1,2034 @@
+/*%0A * #%25L%0A * ImageJ server for RESTful access to ImageJ.%0A * %25%25%0A * Copyright (C) 2013 - 2016 Board of Regents of the University of%0A * Wisconsin-Madison.%0A * %25%25%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A *      http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * #L%25%0A */%0A%0Apackage net.imagej.server.console;%0A%0Aimport java.util.LinkedList;%0A%0Aimport net.imagej.server.ImageJServer;%0Aimport net.imagej.server.ImageJServerService;%0A%0Aimport org.scijava.console.AbstractConsoleArgument;%0Aimport org.scijava.console.ConsoleArgument;%0Aimport org.scijava.object.ObjectService;%0Aimport org.scijava.plugin.Parameter;%0Aimport org.scijava.plugin.Plugin;%0A%0A/**%0A * Handles the %7B@code --server%7D argument to signal that an ImageJ Server%0A * should be started immediately when ImageJ launches.%0A *%0A * @author Curtis Rueden%0A */%0A@Plugin(type = ConsoleArgument.class)%0Apublic class ServerArgument extends AbstractConsoleArgument %7B%0A%0A%09@Parameter(required = false)%0A%09private ImageJServerService imagejServerService;%0A%0A%09@Parameter(required = false)%0A%09private ObjectService objectService;%0A%0A%09// -- Constructor --%0A%0A%09public ServerArgument() %7B%0A%09%09super(1, %22--server%22);%0A%09%7D%0A%0A%09// -- ConsoleArgument methods --%0A%0A%09@Override%0A%09public void handle(final LinkedList%3CString%3E args) %7B%0A%09%09if (!supports(args)) return;%0A%0A%09%09args.removeFirst(); // --server%0A%0A%09%09final ImageJServer server = imagejServerService.start();%0A%09%09objectService.addObject(server);%0A%09%7D%0A%09// -- Typed methods --%0A%0A%09@Override%0A%09public boolean supports(final LinkedList%3CString%3E args) %7B%0A%09%09return imagejServerService != null && objectService != null &&%0A%09%09%09super.supports(args);%0A%09%7D%0A%7D%0A

Add --server command line flag