Author: mes
Date: 2010-11-17 16:40:23 -0800 (Wed, 17 Nov 2010)
New Revision: 22892
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/build.xml
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-codec-1.4.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-httpclient-3.1.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-io-1.4.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-lang-2.5.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-logging-1.1.1.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/genomespace-cdk.bar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/genomespace-cdk.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/gs-common-util.bar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/gs-common-util.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-client-1.2.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-core-1.2.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-json-1.3.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jets3t-0.7.4.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jettison.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jsr311-api-1.1.1.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/junit-4.5-src.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/junit-4.5.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/log4j-1.2.16.jar
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/mime.types
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/plugin.props
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DeleteFileInGenomeSpace.java
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DownloadFileFromGenomeSpace.java
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/GenomeSpacePlugin.java
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/ListFilesInGenomeSpace.java
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/UploadFileToGenomeSpace.java
Modified:
csplugins/trunk/ucsd/mes/LayoutSaver/src/layout/LayoutSaverPlugin.java
csplugins/trunk/ucsd/mes/mikes_BiNGO/build.xml
Log:
added a genomespace ant proj
Modified: csplugins/trunk/ucsd/mes/LayoutSaver/src/layout/LayoutSaverPlugin.java
===================================================================
--- csplugins/trunk/ucsd/mes/LayoutSaver/src/layout/LayoutSaverPlugin.java
2010-11-18 00:29:43 UTC (rev 22891)
+++ csplugins/trunk/ucsd/mes/LayoutSaver/src/layout/LayoutSaverPlugin.java
2010-11-18 00:40:23 UTC (rev 22892)
@@ -53,6 +53,7 @@
public LayoutSaverPlugin() {
Cytoscape.getDesktop().getCyMenus().getOperationsMenu().add(new
LayoutSaverAction());
CyLayouts.addLayout(new ApplySavedLayout(), "Cytoscape
Layouts");
+ throw new Error("hello broken system");
}
/**
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/build.xml
===================================================================
--- csplugins/trunk/ucsd/mes/genomespace-plugin-ant/build.xml
(rev 0)
+++ csplugins/trunk/ucsd/mes/genomespace-plugin-ant/build.xml 2010-11-18
00:40:23 UTC (rev 22892)
@@ -0,0 +1,239 @@
+
+<project name="genomespace-plugin-ant" default="all" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <!-- =================================================================== -->
+ <!-- Initialization target -->
+ <!-- =================================================================== -->
+ <target name="init">
+ <tstamp/>
+ <property name="name" value="GenomeSpacePlugin"/>
+
+ <!-- to support plugin.props, make sure the version is only two
digits!-->
+ <property name="version" value="1.0"/>
+
+ <echo message="Building ${name} version ${version} ..."/>
+
+ <!-- Inheritable properties -->
+ <property name="debug" value="on"/>
+ <property name="optimize" value="off"/>
+ <property name="deprecation" value="on"/>
+ <property name="fork" value="false"/>
+
+ <!-- Define the directories -->
+ <property name="root.dir" value="."/>
+ <property name="resources.dir" value="${root.dir}/resources"/>
+ <property name="src.dir" value="${root.dir}/src"/>
+ <property name="tests.dir" value="${root.dir}/tests"/>
+ <property name="build.dir" value="${root.dir}/build"/>
+ <property name="lib.dir" value="${root.dir}/lib"/>
+ <property name="javadoc.dir" value="${root.dir}/API"/>
+ <property name="log.dir" value="${build.dir}/logs" />
+ <property name="junit.report.dir" value="${log.dir}/junit-reports" />
+
+ <!-- Define the relevant files -->
+ <property name="project.jar" value="${name}.jar"/>
+ <property name="test.jar" value="${name}-tests.jar"/>
+
+ <!-- Make sure tests is in the right place -->
+ <condition property="tests.ok">
+ <and>
+ <available file="${tests.dir}" />
+ </and>
+ </condition>
+ </target>
+
+ <target name="build-classpath"
+ depends="init" >
+ <artifact:remoteRepository
+ id="cytoscape_releases"
+
url="http://cytoscape.wodaklab.org/nexus/content/repositories/releases/" />
+ <artifact:remoteRepository
+ id="cytoscape_snapshots"
+
url="http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/" />
+ <artifact:dependencies pathId="dependency.classpath">
+ <dependency groupId="cytoscape"
+ artifactId="application"
+ version="2.8.0-beta4-SNAPSHOT"/>
+ </artifact:dependencies>
+
+ <!-- Define the class path -->
+ <path id="project.class.path">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <path refid="dependency.classpath"/>
+ </path>
+
+ <!-- Define the junit class path - It needs to find what we just built -->
+ <path id="junit.class.path" >
+ <fileset dir="${root.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <path refid="dependency.classpath"/>
+ </path>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the project -->
+ <!-- =================================================================== -->
+ <target name="compile"
+ depends="build-classpath" >
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${log.dir}"/>
+ <javac srcdir="${src.dir}"
+ classpathref="project.class.path"
+ destdir="${build.dir}"
+ debug="${debug}"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ fork="${fork}">
+<!--
+ <compilerarg line="-Xlint:all -Xlint:-path"/>
+-->
+ </javac>
+ <echo message="Successfully ran compile task!"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- Creates the project jar file -->
+ <!-- =================================================================== -->
+ <target name="jar"
+ depends="compile" >
+ <filter token="version" value="${version}"/>
+ <copy file="${resources.dir}/mime.types"
+ todir="${build.dir}"/>
+ <copy file="${resources.dir}/plugin.props"
+ todir="${build.dir}/cytoscape/genomespace"
+ filtering="true"
+ overwrite="true"/>
+ <unjar dest="${build.dir}">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ </unjar>
+
+ <jar destfile="${project.jar}" >
+ <fileset dir="${build.dir}"
+ includes="**"/>
+ <manifest>
+ <attribute name="Cytoscape-Plugin"
+ value="cytoscape.genomespace.GenomeSpacePlugin"/>
+ </manifest>
+ </jar>
+ <echo message="Successfully ran jar task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the tests -->
+ <!-- Note that this compilation occurs AFTER the distribution jar has -->
+ <!-- been created, so that the tests aren't distributed. -->
+ <!-- =================================================================== -->
+ <target name="compile-tests"
+ depends="jar"
+ if="tests.ok">
+ <javac srcdir="${tests.dir}"
+ classpathref="project.class.path"
+ destdir="${build.dir}"
+ debug="${debug}"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ source="1.5"
+ target="1.5"
+ fork="${fork}">
+ <compilerarg line="-Xlint:all -Xlint:-path"/>
+ </javac>
+ <echo message="Successfully ran compile-tests task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Creates the project-tests.jar file -->
+ <!-- =================================================================== -->
+ <target name="jar-tests"
+ depends="compile-tests"
+ if="tests.ok">
+ <jar jarfile="${test.jar}"
+ basedir="${build.dir}" >
+ </jar>
+ <echo message="Successfully ran jar-tests task!"/>
+ </target>
+
+
+
+ <!-- =================================================================== -->
+ <!-- Runs the unit tests. -->
+ <!-- =================================================================== -->
+ <target name="test"
+ depends="jar-tests"
+ if="tests.ok">
+ <junit printsummary="yes"
+ haltonfailure="no"
+ maxmemory="256m" >
+ <classpath refid="junit.class.path"/>
+ <formatter type="plain"
+ usefile="true" />
+ <formatter type="xml"
+ usefile="true" />
+ <batchtest fork="yes"
+ todir="${log.dir}"
+ failureProperty="junit.test.failure"
+ errorProperty="junit.test.failure">
+ <fileset dir="${tests.dir}"
+ includes="**/*Test.java"
+ excludes="**/AllTests.java" />
+ </batchtest>
+ </junit>
+ <mkdir dir="${junit.report.dir}"/>
+ <junitreport todir="${junit.report.dir}">
+ <fileset dir="${log.dir}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${junit.report.dir}"/>
+ </junitreport>
+ <fail message="TEST FAILURE!!! Details: ${junit.report.dir}/index.html"
+ if="junit.test.failure"/>
+ <echo message="Successfully ran test task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Creates the API documentation -->
+ <!-- =================================================================== -->
+ <target name="docs"
+ depends="init" >
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc sourcepath="${src.dir}"
+ destdir="${javadoc.dir}"
+ packagenames="*"
+ classpathref="project.class.path"
+ author="true"
+ version="true"
+ use="true"
+ splitindex="true"
+ noindex="false"
+ windowtitle="${name} API"
+ doctitle="${name}" />
+ <echo message="Successfully ran docs task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Do everything -->
+ <!-- =================================================================== -->
+ <target name="all" depends="jar,docs,test" />
+
+ <!-- =================================================================== -->
+ <!-- Clean up, get back to original state -->
+ <!-- =================================================================== -->
+ <target name="clean"
+ depends="init">
+ <delete dir="${build.dir}"/>
+ <delete dir="${javadoc.dir}"/>
+ <delete file="${project.jar}"/>
+ <delete file="${test.jar}"/>
+ <echo message="Successfully ran clean task!"/>
+ </target>
+
+</project>
+
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-codec-1.4.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-codec-1.4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-httpclient-3.1.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-httpclient-3.1.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-io-1.4.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-io-1.4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-lang-2.5.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-lang-2.5.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-logging-1.1.1.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/commons-logging-1.1.1.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/genomespace-cdk.bar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/genomespace-cdk.bar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/genomespace-cdk.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/genomespace-cdk.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/gs-common-util.bar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/gs-common-util.bar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/gs-common-util.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/gs-common-util.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-client-1.2.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-client-1.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-core-1.2.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-core-1.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-json-1.3.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jersey-json-1.3.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jets3t-0.7.4.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jets3t-0.7.4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jettison.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jettison.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jsr311-api-1.1.1.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/jsr311-api-1.1.1.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/junit-4.5-src.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/junit-4.5-src.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/junit-4.5.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/junit-4.5.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/log4j-1.2.16.jar
===================================================================
(Binary files differ)
Property changes on:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/lib/log4j-1.2.16.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/mime.types
===================================================================
--- csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/mime.types
(rev 0)
+++ csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/mime.types
2010-11-18 00:40:23 UTC (rev 22892)
@@ -0,0 +1,26 @@
+#
+# A simple, old format, mime.types file
+#
+text/html html htm HTML HTM
+text/plain txt text TXT TEXT
+image/gif gif GIF
+image/ief ief
+image/jpeg jpeg jpg jpe JPG
+image/tiff tiff tif
+image/png png PNG
+image/x-xwindowdump xwd
+application/postscript ai eps ps
+application/rtf rtf
+application/x-tex tex
+application/x-texinfo texinfo texi
+application/x-troff t tr roff
+audio/basic au
+audio/midi midi mid
+audio/x-aifc aifc
+audio/x-aiff aif aiff
+audio/x-mpeg mpeg mpg
+audio/x-wav wav
+video/mpeg mpeg mpg mpe
+video/quicktime qt mov
+video/x-msvideo avi
+application/json json
Added: csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/plugin.props
===================================================================
--- csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/plugin.props
(rev 0)
+++ csplugins/trunk/ucsd/mes/genomespace-plugin-ant/resources/plugin.props
2010-11-18 00:40:23 UTC (rev 22892)
@@ -0,0 +1,26 @@
+# This props file would be filled out and included in the plugin jar file.
+# This props file will be used to put information into the Plugin Manager
+# about the plugin
+
+# -- The following properties are REQUIRED -- #
+
+# The plugin name that will be displayed to users
+pluginName=GenomeSpacePlugin
+
+# Description used to give users information about the plugin such as what it
does.
+# Html tags are encouraged for formatting purposes.
+pluginDescription=GenomeSpace Plugin
+
+# Plugin version number, this must be two numbers separated by a decimlal.
Ex. 0.2, 14.03
+pluginVersion=0.1
+
+# Compatible Cytoscape version
+cytoscapeVersion=2.8
+
+# Category, use one of the categories listed on the website or create your own
+pluginCategory=Other
+
+# List of authors. Note each author and institution pair are separated by a :
(colon)
+# each additional author institution pair must be separated from other pairs
bye a ; (semicolon)
+pluginAuthorsIntsitutions=Mike Smoot:UCSD
+
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DeleteFileInGenomeSpace.java
===================================================================
---
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DeleteFileInGenomeSpace.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DeleteFileInGenomeSpace.java
2010-11-18 00:40:23 UTC (rev 22892)
@@ -0,0 +1,61 @@
+package cytoscape.genomespace;
+
+import cytoscape.Cytoscape;
+import cytoscape.util.CytoscapeAction;
+import cytoscape.util.FileUtil;
+import cytoscape.logger.CyLogger;
+import java.awt.event.ActionEvent;
+import javax.swing.JOptionPane;
+
+import java.io.File;
+import java.awt.FileDialog;
+import java.util.List;
+
+import org.genomespace.client.GsFile;
+import org.genomespace.client.GsSession;
+import org.genomespace.client.User;
+
+/**
+ * A simple action. Change the names as appropriate and
+ * then fill in your expected behavior in the actionPerformed()
+ * method.
+ */
+public class DeleteFileInGenomeSpace extends CytoscapeAction {
+
+ private static final long serialVersionUID = 4234432889999989L;
+ private static final CyLogger logger =
CyLogger.getLogger(DeleteFileInGenomeSpace.class);
+
+ public DeleteFileInGenomeSpace() {
+ // Give your action a name here
+ super("Delete File");
+
+ // Set the menu you'd like here. Plugins don't need
+ // to live in the Plugins menu, so choose whatever
+ // is appropriate!
+ setPreferredMenu("Plugins.GenomeSpace");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ try {
+
+ // login to GenomeSpace
+ GsSession client = new GsSession();
+ String username = "test";
+ String password = "password";
+ User user = client.login(username, password);
+ logger.info("Logged in to GenomeSpace: " + client.isLoggedIn()
+ " as " + user.getUsername());
+
+ // list the files present for this user
+ List<GsFile> myFiles = client.list();
+ if (myFiles.size() > 0){
+ logger.info("Deleting " + myFiles.get(0).getFilename());
+ client.delete(myFiles.get(0));
+ }
+
+ } catch (Exception ex) {
+ logger.error("GenomeSpace failed",ex);
+ }
+ }
+
+}
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DownloadFileFromGenomeSpace.java
===================================================================
---
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DownloadFileFromGenomeSpace.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/DownloadFileFromGenomeSpace.java
2010-11-18 00:40:23 UTC (rev 22892)
@@ -0,0 +1,64 @@
+package cytoscape.genomespace;
+
+import cytoscape.Cytoscape;
+import cytoscape.util.CytoscapeAction;
+import cytoscape.util.FileUtil;
+import cytoscape.logger.CyLogger;
+import java.awt.event.ActionEvent;
+import javax.swing.JOptionPane;
+
+import java.io.File;
+import java.awt.FileDialog;
+import java.util.List;
+
+import org.genomespace.client.GsFile;
+import org.genomespace.client.GsSession;
+import org.genomespace.client.User;
+
+/**
+ * A simple action. Change the names as appropriate and
+ * then fill in your expected behavior in the actionPerformed()
+ * method.
+ */
+public class DownloadFileFromGenomeSpace extends CytoscapeAction {
+
+ private static final long serialVersionUID = 7777788473487659L;
+ private static final CyLogger logger =
CyLogger.getLogger(DownloadFileFromGenomeSpace.class);
+
+ public DownloadFileFromGenomeSpace() {
+ // Give your action a name here
+ super("Download File");
+
+ // Set the menu you'd like here. Plugins don't need
+ // to live in the Plugins menu, so choose whatever
+ // is appropriate!
+ setPreferredMenu("Plugins.GenomeSpace");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ try {
+
+ // login to GenomeSpace
+ GsSession client = new GsSession();
+ String username = "test";
+ String password = "password";
+ User user = client.login(username, password);
+ logger.info("Logged in to GenomeSpace: " + client.isLoggedIn()
+ " as " + user.getUsername());
+
+ // list the files present for this user
+ List<GsFile> myFiles = client.list();
+
+ // Download the file back from GenomeSpace
+ myFiles = client.list();
+ if (myFiles.size() > 0){
+ logger.info("Downloading " +
myFiles.get(0).getFilename());
+ GsFile localCopy = client.downloadFile(myFiles.get(0));
+ logger.info("\t saved to: " +
localCopy.getFile().getAbsolutePath());
+ }
+
+ } catch (Exception ex) {
+ logger.error("GenomeSpace failed",ex);
+ }
+ }
+}
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/GenomeSpacePlugin.java
===================================================================
---
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/GenomeSpacePlugin.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/GenomeSpacePlugin.java
2010-11-18 00:40:23 UTC (rev 22892)
@@ -0,0 +1,35 @@
+package cytoscape.genomespace;
+
+import cytoscape.Cytoscape;
+import cytoscape.plugin.CytoscapePlugin;
+
+
+/**
+ * This class is used to instantiate your plugin. Put whatever initialization
code
+ * you need into the no argument constructor (the only one that will be
called).
+ * The actual functionality of your plugin can be in this class, but should
+ * probably be separated into separted classes that get instantiated here.
+ */
+public class GenomeSpacePlugin extends CytoscapePlugin {
+
+ public GenomeSpacePlugin() {
+ // Properly initializes things.
+ super();
+
+ new org.codehaus.jettison.json.JSONArray();
+
+ // This action represents the actual behavior of the plugin.
+ UploadFileToGenomeSpace uploadAction = new
UploadFileToGenomeSpace();
+ Cytoscape.getDesktop().getCyMenus().addAction(uploadAction);
+
+ DeleteFileInGenomeSpace deleteAction = new
DeleteFileInGenomeSpace();
+ Cytoscape.getDesktop().getCyMenus().addAction(deleteAction);
+
+ DownloadFileFromGenomeSpace downloadAction = new
DownloadFileFromGenomeSpace();
+ Cytoscape.getDesktop().getCyMenus().addAction(downloadAction);
+
+ ListFilesInGenomeSpace listAction = new
ListFilesInGenomeSpace();
+ Cytoscape.getDesktop().getCyMenus().addAction(listAction);
+
+ }
+}
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/ListFilesInGenomeSpace.java
===================================================================
---
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/ListFilesInGenomeSpace.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/ListFilesInGenomeSpace.java
2010-11-18 00:40:23 UTC (rev 22892)
@@ -0,0 +1,79 @@
+package cytoscape.genomespace;
+
+import cytoscape.Cytoscape;
+import cytoscape.util.CytoscapeAction;
+import cytoscape.util.FileUtil;
+import cytoscape.logger.CyLogger;
+import java.awt.event.ActionEvent;
+import javax.swing.JOptionPane;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.JPanel;
+import javax.swing.ListSelectionModel;
+
+import java.io.File;
+import java.awt.FileDialog;
+import java.awt.Dimension;
+import java.util.List;
+import java.util.Vector;
+
+import org.genomespace.client.GsFile;
+import org.genomespace.client.GsSession;
+import org.genomespace.client.User;
+
+/**
+ * A simple action. Change the names as appropriate and
+ * then fill in your expected behavior in the actionPerformed()
+ * method.
+ */
+public class ListFilesInGenomeSpace extends CytoscapeAction {
+
+ private static final long serialVersionUID = 1234487711999989L;
+ private static final CyLogger logger =
CyLogger.getLogger(ListFilesInGenomeSpace.class);
+
+ public ListFilesInGenomeSpace() {
+ // Give your action a name here
+ super("List Available Files");
+
+ // Set the menu you'd like here. Plugins don't need
+ // to live in the Plugins menu, so choose whatever
+ // is appropriate!
+ setPreferredMenu("Plugins.GenomeSpace");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ try {
+
+ // login to GenomeSpace
+ GsSession client = new GsSession();
+ String username = "test";
+ String password = "password";
+ User user = client.login(username, password);
+ logger.info("Logged in to GenomeSpace: " + client.isLoggedIn()
+ " as " + user.getUsername());
+
+ // list the files present for this user
+ List<GsFile> myFiles = client.list();
+ logger.info("Files on GenomeSpace for " + user.getUsername());
+ Vector<String> fileNames = new Vector<String>();
+ for (GsFile aFile: myFiles) {
+ fileNames.add(aFile.getFilename());
+ }
+
+ displayFiles(fileNames);
+
+ } catch (Exception ex) {
+ logger.error("GenomeSpace failed",ex);
+ }
+ }
+
+ private void displayFiles(Vector<String> fileNames) {
+ JList jl = new JList( fileNames );
+ jl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ JScrollPane scrollPane = new JScrollPane(jl);
+ scrollPane.setPreferredSize(new Dimension(250, 80));
+ JPanel jp = new JPanel();
+ jp.add(scrollPane);
+ JOptionPane.showMessageDialog(Cytoscape.getDesktop(),jp);
+ }
+}
Added:
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/UploadFileToGenomeSpace.java
===================================================================
---
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/UploadFileToGenomeSpace.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/genomespace-plugin-ant/src/cytoscape/genomespace/UploadFileToGenomeSpace.java
2010-11-18 00:40:23 UTC (rev 22892)
@@ -0,0 +1,59 @@
+package cytoscape.genomespace;
+
+import cytoscape.Cytoscape;
+import cytoscape.util.CytoscapeAction;
+import cytoscape.util.FileUtil;
+import cytoscape.logger.CyLogger;
+import java.awt.event.ActionEvent;
+import javax.swing.JOptionPane;
+
+import java.io.File;
+import java.awt.FileDialog;
+import java.util.List;
+
+import org.genomespace.client.GsFile;
+import org.genomespace.client.GsSession;
+import org.genomespace.client.User;
+
+/**
+ * A simple action. Change the names as appropriate and
+ * then fill in your expected behavior in the actionPerformed()
+ * method.
+ */
+public class UploadFileToGenomeSpace extends CytoscapeAction {
+
+ private static final long serialVersionUID = 9988760123456789L;
+ private static final CyLogger logger =
CyLogger.getLogger(UploadFileToGenomeSpace.class);
+
+ public UploadFileToGenomeSpace() {
+ // Give your action a name here
+ super("Upload File");
+
+ // Set the menu you'd like here. Plugins don't need
+ // to live in the Plugins menu, so choose whatever
+ // is appropriate!
+ setPreferredMenu("Plugins.GenomeSpace");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ try {
+ File f = FileUtil.getFile("",FileDialog.LOAD);
+ if ( f == null )
+ return;
+
+ GsSession client = new GsSession();
+ String username = "test";
+ String password = "password";
+ User user = client.login(username, password);
+ logger.info("Logged in to GenomeSpace: " + client.isLoggedIn()
+ " as " + user.getUsername());
+
+ GsFile gsf = new GsFile(f);
+ client.uploadFile(gsf);
+
+ } catch (Exception ex) {
+ logger.error("GenomeSpace failed",ex);
+ }
+ }
+
+}
Modified: csplugins/trunk/ucsd/mes/mikes_BiNGO/build.xml
===================================================================
--- csplugins/trunk/ucsd/mes/mikes_BiNGO/build.xml 2010-11-18 00:29:43 UTC
(rev 22891)
+++ csplugins/trunk/ucsd/mes/mikes_BiNGO/build.xml 2010-11-18 00:40:23 UTC
(rev 22892)
@@ -14,7 +14,7 @@
<!-- Inheritable properties -->
<property name="debug" value="on"/>
<property name="optimize" value="off"/>
- <property name="deprecation" value="off"/>
+ <property name="deprecation" value="on"/>
<property name="fork" value="false"/>
<!-- Define the directories -->
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.