/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 * 
 * Please see distribution for license.
 */
package com.opengamma.integration.tool.portfolio;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.opengamma.component.factory.tool.RemoteComponentFactoryToolContextAdapter;
import com.opengamma.component.tool.AbstractComponentTool;
import com.opengamma.financial.tool.ToolContext;

/**
 * Tool to delete positions that are not currently in a portfolio
 */
public class OrphanedPositionDeleteTool extends AbstractComponentTool {
  
  private static final Logger s_logger = LoggerFactory.getLogger(OrphanedPositionDeleteTool.class);
  /**
   * Main method to run the tool.
   */
  public static void main(String[] args) { // CSIGNORE
    new OrphanedPositionDeleteTool().initAndRun(args);
    System.exit(0);
  }

  @Override
  protected void doRun() throws Exception {
    ToolContext toolContext = new RemoteComponentFactoryToolContextAdapter(getRemoteComponentFactory());
    OrphanedPositionRemover orphanedPositionRemover = new OrphanedPositionRemover(toolContext.getPortfolioMaster(), toolContext.getPositionMaster());
    s_logger.info("running orphanedPositionRemover");
    orphanedPositionRemover.run();
  }
  
}

@@ -434,16 +434,71 @@
 Context;
+%0Aimport com.opengamma.util.generate.scripts.Scriptable;
 %0A%0A/**%0A *
@@ -565,16 +565,28 @@
 lio%0A */%0A
+@Scriptable%0A
 public c

Make it scriptable.