Index: 3-extensions/pharos/trunk/src/PharosImageIS.java
===================================================================
--- /gs3-extensions/pharos/trunk/src/PharosImageIS.java	(revision 21250)
+++ 	(revision )
@@ -1,182 +1,0 @@
-
-
-import eu.pharos.kmi.videosegmentation.ContentBasedSearchWSProxyStub;
-import eu.pharos.kmi.videosegmentation.ContentBasedSearchWSProxyStub.QueryByID;
-import eu.pharos.kmi.videosegmentation.ContentBasedSearchWSProxyStub.QueryByIDResponse;
-import eu.pharos.kmi.videosegmentation.VSProcessor;
-import eu.pharos.kmi.videosegmentation.VSVideoBean;
-import eu.pharos.kmi.videosegmentation.VideoSegmentation;
-import java.io.File;
-import java.io.PrintStream;
-import mpegMpeg7Schema2001.MediaLocatorType;
-import mpegMpeg7Schema2001.Mpeg7Document;
-import mpegMpeg7Schema2001.Mpeg7Document.Factory;
-import org.apache.commons.io.FileUtils;
-import org.apache.xmlbeans.XmlObject;
-
-public class PharosImageIS
-{
-  private final String namespaceDeclaration = "declare namespace mpeg7='urn:mpeg:mpeg7:schema:2001';";
-  private final String query2 = "$this//mpeg7:MediaLocator";
-  private static ContentBasedSearchWSProxyStub cbsStub = null;
-  private static boolean proxy = false;
-  private static String proxyHost = null;
-  private static int proxyPort = 0;
-  private VSProcessor vsp = null;
-  
-  public PharosImageIS()
-  {
-    if (!(VideoSegmentation.instanceCreated())){
-      VideoSegmentation.getInstance();
-    }
-    String video_endpoint = VideoSegmentation.getCbseWSEndpoint();
-    try {
-      this.cbsStub = new ContentBasedSearchWSProxyStub(video_endpoint);
-    } catch (Exception e) {
-      System.err.println(e);
-    }
-  }
-
-  public String query(String collection, String id) throws Exception {
-    ContentBasedSearchWSProxyStub.QueryByID req = new ContentBasedSearchWSProxyStub.QueryByID();
-    String input = query_xml;
-    input.replace("**docid**", collection+":"+id+".jpg");
-    req.setQuery(input);
-    ContentBasedSearchWSProxyStub.QueryByIDResponse res = getCbsStub().queryByID(req);
-    return res.get_return();
-  }
-  
-  public static void main(String[] args)
-  {
-    try {
-      
-      if (args.length != 1) {
-        System.out.println("USAGE: java -jar PharosImageIS.jar xmlinput.xml");
-        System.exit(0);
-      }
-      String dir = System.getProperty("user.dir");
-
-      File inputFile = new File(dir + System.getProperty("file.separator") + args[0]);
-
-      String input = FileUtils.readFileToString(new File(args[0]));
-
-      PharosImageIS inst = new PharosImageIS();
-
-      if (input.contains("kmi image annotation segment to add")) {
-        String imageLocation = inst.getImageLocation(inst.processMpeg7Input(input));
-	
-	String video_endpoint = VideoSegmentation.getCbseWSEndpoint();
-
-	ContentBasedSearchWSProxyStub cbse_stub = new ContentBasedSearchWSProxyStub(video_endpoint);
-	inst.setCbsStub(cbse_stub);
-        //inst.setCbsStub(new ContentBasedSearchWSProxyStub(VideoSegmentation.getCbseWSEndpoint()));
-        inst.setVsp(new VSProcessor(VideoSegmentation.getWorkpath(), new VSVideoBean(imageLocation), inst.getCbsStub()));
-        inst.getVsp().processExistingKeyframes();
-        inst.getVsp().addLFImageDB();
-        System.out.println("TRUE");
-      }
-      else if (input.contains("kmi image annotation segment to remove")) {
-        String imageLocation = inst.getImageLocation(inst.processMpeg7Input(input));
-        inst.setCbsStub(new ContentBasedSearchWSProxyStub(VideoSegmentation.getCbseWSEndpoint()));
-        inst.setVsp(new VSProcessor(VideoSegmentation.getWorkpath(), new VSVideoBean(imageLocation), inst.getCbsStub()));
-
-        inst.getVsp().removeExistingKeyframes(input);
-        System.out.println("TRUE");
-      }
-      else if (input.contains("QueryByMedia")) {
-        inst.setCbsStub(new ContentBasedSearchWSProxyStub(VideoSegmentation.getCbseWSEndpoint()));
-        ContentBasedSearchWSProxyStub.QueryByID req = new ContentBasedSearchWSProxyStub.QueryByID();
-        req.setQuery(input);
-        ContentBasedSearchWSProxyStub.QueryByIDResponse res = inst.getCbsStub().queryByID(req);
-        FileUtils.writeStringToFile(new File(dir + System.getProperty("file.separator") + "image_cbs_result.xml"), res.get_return());
-      }
-      else {
-        throw new RuntimeException("Unsuported action" + input);
-      }
-    }
-    catch (Exception e) {
-      // System.out.println(e);
-      e.printStackTrace();
-    }
-  }
-  
-  public static boolean isProxy()
-  {
-    return proxy;
-  }
-  
-  public static void setProxy(boolean aProxy)
-  {
-    proxy = aProxy;
-  }
-
-  public static String getProxyHost()
-  {
-    return proxyHost;
-  }
-
-  public static void setProxyHost(String aProxyHost)
-  {
-    proxyHost = aProxyHost;
-  }
-
-  public static int getProxyPort()
-  {
-    return proxyPort;
-  }
-
-  public static void setProxyPort(int aProxyPort)
-  {
-    proxyPort = aProxyPort;
-  }
-
-  public ContentBasedSearchWSProxyStub getCbsStub()
-  {
-    return this.cbsStub;
-  }
-
-  public void setCbsStub(ContentBasedSearchWSProxyStub cbsStub)
-  {
-    this.cbsStub = cbsStub;
-  }
-
-  private String processMpeg7Input(String mpeg7) throws Exception
-  {
-    Mpeg7Document mpeg7doc = Mpeg7Document.Factory.parse(mpeg7);
-
-    if (!(mpeg7doc.validate())) {
-      System.out.println("Invalid instance!!!: " + mpeg7);
-    }
-
-    return getMediaURI(mpeg7doc);
-  }
-
-  private String getMediaURI(Mpeg7Document mpeg7doc)
-  {
-    XmlObject[] ml = mpeg7doc.selectPath("declare namespace mpeg7='urn:mpeg:mpeg7:schema:2001';$this//mpeg7:MediaLocator");
-    MediaLocatorType mlt = (MediaLocatorType)ml[0];
-    return mlt.getMediaUri().trim();
-  }
-
-  private String getImageLocation(String input) throws Exception {
-    if (input.startsWith("file://")) {
-      return input.substring("file://".length(), input.length());
-    }
-    return input;
-  }
-
-  public VSProcessor getVsp()
-  {
-    return this.vsp;
-  }
-
-  public void setVsp(VSProcessor vsp)
-  {
-    this.vsp = vsp;
-  }
-
-  private static String query_xml = "<MpegQuery mpqfID='TestId0012-36' xmlns='urn:mpeg:mpqf:schema:2008' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:mpeg7='urn:mpeg:mpeg7:schema:2004' xsi:schemaLocation='urn:mpeg:mpqf:schema:2008 mpqfv08.xsd urn:mpeg:mpeg7:schema:2004 M7v2schema.xsd'><Query><Input><!-- This is used to format the output /  Result set --><OutputDescription maxItemCount='10'  freeTextUse='true' mediaResourceUse='true' outputNameSpace='urn:mpeg:mpqf:schema:2008'></OutputDescription><QueryCondition><TargetMediaType>video/jpeg</TargetMediaType><Condition xsi:type='QueryByMedia' matchType='similar' thresholdValue='0.8' preferenceValue='1'><MediaResource resourceID='id001'><MediaResource><MediaUri>**docid**</MediaUri></MediaResource></MediaResource></Condition></QueryCondition><ServiceSelection><ServiceID>image-search-mediaid</ServiceID></ServiceSelection></Input></Query></MpegQuery>";
-  
-
-}
-
Index: /gs3-extensions/pharos/trunk/src/java/pharosimageis/PharosImageIS.java
===================================================================
--- /gs3-extensions/pharos/trunk/src/java/pharosimageis/PharosImageIS.java	(revision 21251)
+++ /gs3-extensions/pharos/trunk/src/java/pharosimageis/PharosImageIS.java	(revision 21251)
@@ -0,0 +1,182 @@
+
+
+import eu.pharos.kmi.videosegmentation.ContentBasedSearchWSProxyStub;
+import eu.pharos.kmi.videosegmentation.ContentBasedSearchWSProxyStub.QueryByID;
+import eu.pharos.kmi.videosegmentation.ContentBasedSearchWSProxyStub.QueryByIDResponse;
+import eu.pharos.kmi.videosegmentation.VSProcessor;
+import eu.pharos.kmi.videosegmentation.VSVideoBean;
+import eu.pharos.kmi.videosegmentation.VideoSegmentation;
+import java.io.File;
+import java.io.PrintStream;
+import mpegMpeg7Schema2001.MediaLocatorType;
+import mpegMpeg7Schema2001.Mpeg7Document;
+import mpegMpeg7Schema2001.Mpeg7Document.Factory;
+import org.apache.commons.io.FileUtils;
+import org.apache.xmlbeans.XmlObject;
+
+public class PharosImageIS
+{
+  private final String namespaceDeclaration = "declare namespace mpeg7='urn:mpeg:mpeg7:schema:2001';";
+  private final String query2 = "$this//mpeg7:MediaLocator";
+  private static ContentBasedSearchWSProxyStub cbsStub = null;
+  private static boolean proxy = false;
+  private static String proxyHost = null;
+  private static int proxyPort = 0;
+  private VSProcessor vsp = null;
+  
+  public PharosImageIS()
+  {
+    if (!(VideoSegmentation.instanceCreated())){
+      VideoSegmentation.getInstance();
+    }
+    String video_endpoint = VideoSegmentation.getCbseWSEndpoint();
+    try {
+      this.cbsStub = new ContentBasedSearchWSProxyStub(video_endpoint);
+    } catch (Exception e) {
+      System.err.println(e);
+    }
+  }
+
+  public String query(String collection, String id) throws Exception {
+    ContentBasedSearchWSProxyStub.QueryByID req = new ContentBasedSearchWSProxyStub.QueryByID();
+    String input = query_xml;
+    input.replace("**docid**", collection+":"+id+".jpg");
+    req.setQuery(input);
+    ContentBasedSearchWSProxyStub.QueryByIDResponse res = getCbsStub().queryByID(req);
+    return res.get_return();
+  }
+  
+  public static void main(String[] args)
+  {
+    try {
+      
+      if (args.length != 1) {
+        System.out.println("USAGE: java -jar PharosImageIS.jar xmlinput.xml");
+        System.exit(0);
+      }
+      String dir = System.getProperty("user.dir");
+
+      File inputFile = new File(dir + System.getProperty("file.separator") + args[0]);
+
+      String input = FileUtils.readFileToString(new File(args[0]));
+
+      PharosImageIS inst = new PharosImageIS();
+
+      if (input.contains("kmi image annotation segment to add")) {
+        String imageLocation = inst.getImageLocation(inst.processMpeg7Input(input));
+	
+	String video_endpoint = VideoSegmentation.getCbseWSEndpoint();
+
+	ContentBasedSearchWSProxyStub cbse_stub = new ContentBasedSearchWSProxyStub(video_endpoint);
+	inst.setCbsStub(cbse_stub);
+        //inst.setCbsStub(new ContentBasedSearchWSProxyStub(VideoSegmentation.getCbseWSEndpoint()));
+        inst.setVsp(new VSProcessor(VideoSegmentation.getWorkpath(), new VSVideoBean(imageLocation), inst.getCbsStub()));
+        inst.getVsp().processExistingKeyframes();
+        inst.getVsp().addLFImageDB();
+        System.out.println("TRUE");
+      }
+      else if (input.contains("kmi image annotation segment to remove")) {
+        String imageLocation = inst.getImageLocation(inst.processMpeg7Input(input));
+        inst.setCbsStub(new ContentBasedSearchWSProxyStub(VideoSegmentation.getCbseWSEndpoint()));
+        inst.setVsp(new VSProcessor(VideoSegmentation.getWorkpath(), new VSVideoBean(imageLocation), inst.getCbsStub()));
+
+        inst.getVsp().removeExistingKeyframes(input);
+        System.out.println("TRUE");
+      }
+      else if (input.contains("QueryByMedia")) {
+        inst.setCbsStub(new ContentBasedSearchWSProxyStub(VideoSegmentation.getCbseWSEndpoint()));
+        ContentBasedSearchWSProxyStub.QueryByID req = new ContentBasedSearchWSProxyStub.QueryByID();
+        req.setQuery(input);
+        ContentBasedSearchWSProxyStub.QueryByIDResponse res = inst.getCbsStub().queryByID(req);
+        FileUtils.writeStringToFile(new File(dir + System.getProperty("file.separator") + "image_cbs_result.xml"), res.get_return());
+      }
+      else {
+        throw new RuntimeException("Unsuported action" + input);
+      }
+    }
+    catch (Exception e) {
+      // System.out.println(e);
+      e.printStackTrace();
+    }
+  }
+  
+  public static boolean isProxy()
+  {
+    return proxy;
+  }
+  
+  public static void setProxy(boolean aProxy)
+  {
+    proxy = aProxy;
+  }
+
+  public static String getProxyHost()
+  {
+    return proxyHost;
+  }
+
+  public static void setProxyHost(String aProxyHost)
+  {
+    proxyHost = aProxyHost;
+  }
+
+  public static int getProxyPort()
+  {
+    return proxyPort;
+  }
+
+  public static void setProxyPort(int aProxyPort)
+  {
+    proxyPort = aProxyPort;
+  }
+
+  public ContentBasedSearchWSProxyStub getCbsStub()
+  {
+    return this.cbsStub;
+  }
+
+  public void setCbsStub(ContentBasedSearchWSProxyStub cbsStub)
+  {
+    this.cbsStub = cbsStub;
+  }
+
+  private String processMpeg7Input(String mpeg7) throws Exception
+  {
+    Mpeg7Document mpeg7doc = Mpeg7Document.Factory.parse(mpeg7);
+
+    if (!(mpeg7doc.validate())) {
+      System.out.println("Invalid instance!!!: " + mpeg7);
+    }
+
+    return getMediaURI(mpeg7doc);
+  }
+
+  private String getMediaURI(Mpeg7Document mpeg7doc)
+  {
+    XmlObject[] ml = mpeg7doc.selectPath("declare namespace mpeg7='urn:mpeg:mpeg7:schema:2001';$this//mpeg7:MediaLocator");
+    MediaLocatorType mlt = (MediaLocatorType)ml[0];
+    return mlt.getMediaUri().trim();
+  }
+
+  private String getImageLocation(String input) throws Exception {
+    if (input.startsWith("file://")) {
+      return input.substring("file://".length(), input.length());
+    }
+    return input;
+  }
+
+  public VSProcessor getVsp()
+  {
+    return this.vsp;
+  }
+
+  public void setVsp(VSProcessor vsp)
+  {
+    this.vsp = vsp;
+  }
+
+  private static String query_xml = "<MpegQuery mpqfID='TestId0012-36' xmlns='urn:mpeg:mpqf:schema:2008' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:mpeg7='urn:mpeg:mpeg7:schema:2004' xsi:schemaLocation='urn:mpeg:mpqf:schema:2008 mpqfv08.xsd urn:mpeg:mpeg7:schema:2004 M7v2schema.xsd'><Query><Input><!-- This is used to format the output /  Result set --><OutputDescription maxItemCount='10'  freeTextUse='true' mediaResourceUse='true' outputNameSpace='urn:mpeg:mpqf:schema:2008'></OutputDescription><QueryCondition><TargetMediaType>video/jpeg</TargetMediaType><Condition xsi:type='QueryByMedia' matchType='similar' thresholdValue='0.8' preferenceValue='1'><MediaResource resourceID='id001'><MediaResource><MediaUri>**docid**</MediaUri></MediaResource></MediaResource></Condition></QueryCondition><ServiceSelection><ServiceID>image-search-mediaid</ServiceID></ServiceSelection></Input></Query></MpegQuery>";
+  
+
+}
+
