Author: mes
Date: 2010-11-15 15:30:05 -0800 (Mon, 15 Nov 2010)
New Revision: 22861

Added:
   csplugins/trunk/ucsd/mes/genomespace-plugin/
   csplugins/trunk/ucsd/mes/genomespace-plugin/pom.xml
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/
   
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/
   
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/GenomeSpacePlugin.java
   
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/UploadFileToGenomeSpace.java
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/resources/
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/resources/cytoscape/
   
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/resources/cytoscape/genomespace/
   
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/resources/cytoscape/genomespace/plugin.props
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/test/
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/test/java/
   csplugins/trunk/ucsd/mes/genomespace-plugin/src/test/java/cytoscape/
   
csplugins/trunk/ucsd/mes/genomespace-plugin/src/test/java/cytoscape/genomespace/
   
csplugins/trunk/ucsd/mes/genomespace-plugin/src/test/java/cytoscape/genomespace/UploadFileToGenomeSpaceTest.java
Log:
initial checking

Added: csplugins/trunk/ucsd/mes/genomespace-plugin/pom.xml
===================================================================
--- csplugins/trunk/ucsd/mes/genomespace-plugin/pom.xml                         
(rev 0)
+++ csplugins/trunk/ucsd/mes/genomespace-plugin/pom.xml 2010-11-15 23:30:05 UTC 
(rev 22861)
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>cytoscape</groupId>
+  <artifactId>genomespace-plugin</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>sample-plugin</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+          <optimize>true</optimize>
+          <showWarnings>true</showWarnings>
+          <showDeprecation>true</showDeprecation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              
<Cytoscape-Plugin>cytoscape.genomespace.GenomeSpacePlugin</Cytoscape-Plugin>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.2-beta-5</version>
+        <configuration>
+          <descriptorRefs>
+            <descriptorRef>jar-with-dependencies</descriptorRef>
+          </descriptorRefs>
+        </configuration>
+        <executions>
+          <execution>
+            <id>make-assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>cytoscape</groupId>
+      <artifactId>application</artifactId>
+      <version>2.8.0-beta3</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-httpclient</groupId>
+      <artifactId>commons-httpclient</artifactId>
+      <version>3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.5</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.16</version>
+    </dependency>
+    <dependency>
+      <groupId>net.java.dev.jets3t</groupId>
+      <artifactId>jets3t</artifactId>
+      <version>0.7.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.jettison</groupId>
+      <artifactId>jettison</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-core</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-client</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-json</artifactId>
+      <version>1.3</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>jsr311-api</artifactId>
+      <version>1.1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>cytoscape-temp</groupId>
+      <artifactId>genomespace-cdk</artifactId>
+      <version>1.0-beta1</version>
+    </dependency>
+    <dependency>
+      <groupId>cytoscape-temp</groupId>
+      <artifactId>gs-common-util</artifactId>
+      <version>1.0-beta1</version>
+    </dependency>
+  </dependencies>
+
+  <repositories>
+    <repository>
+      <id>java.net</id>
+      <name>Java.net</name>
+      <url>http://download.java.net/maven/2/</url>
+    </repository>
+    <repository>
+      <id>cytoscape_snapshots</id>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <name>Cytoscape Snapshots</name>
+      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
+    </repository>
+    <repository>
+      <id>cytoscape_releases</id>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+      <name>Cytoscape Releases</name>
+      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url>
+    </repository>
+    <repository>
+      <id>cytoscape_thirdparty</id>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>            
+        <enabled>true</enabled>
+      </releases>
+      <name>Cytoscape Third Party</name>
+      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/thirdparty/</url>
+    </repository>
+  </repositories>
+
+</project>

Added: 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/GenomeSpacePlugin.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/GenomeSpacePlugin.java
                              (rev 0)
+++ 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/GenomeSpacePlugin.java
      2010-11-15 23:30:05 UTC (rev 22861)
@@ -0,0 +1,23 @@
+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();
+
+               // This action represents the actual behavior of the plugin.
+               UploadFileToGenomeSpace action = new UploadFileToGenomeSpace();
+               Cytoscape.getDesktop().getCyMenus().addAction(action);
+       }
+}      

Added: 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/UploadFileToGenomeSpace.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/UploadFileToGenomeSpace.java
                                (rev 0)
+++ 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/java/cytoscape/genomespace/UploadFileToGenomeSpace.java
        2010-11-15 23:30:05 UTC (rev 22861)
@@ -0,0 +1,99 @@
+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;
+
+               // login to GenomeSpace
+               GsSession client = new GsSession();
+               String username = "test";
+               String password = "password";
+               User user = client.login(username, password);
+               System.out.println("Logged in to GenomeSpace: " + 
client.isLoggedIn() + " as " + user.getUsername());
+
+       
+       
+
+               GsFile gsf = new GsFile(f); 
+               client.uploadFile(gsf);
+       
+               // list the files present for this user
+               List<GsFile> myFiles = client.list();
+               System.out.println("Files on GenomeSpace for " + 
user.getUsername());
+               for (GsFile aFile: myFiles){
+                       System.out.println("\t" + aFile.getFilename());
+               }
+       
+               // Download the file back from GenomeSpace
+               myFiles = client.list();
+               if (myFiles.size() > 0){
+                       System.out.println("Downloading " + 
myFiles.get(0).getFilename());
+                       GsFile localCopy = client.downloadFile(myFiles.get(0));
+                       System.out.println("\t saved to: " + 
localCopy.getFile().getAbsolutePath());
+               }
+       
+
+               // Delete a file from GenomeSpace
+               myFiles = client.list();
+               if (myFiles.size() > 0){
+                       System.out.println("Deleting " + 
myFiles.get(0).getFilename());
+                       client.delete(myFiles.get(0));
+               }
+               myFiles = client.list();
+               System.out.println("After deletion, files on GenomeSpace for " 
+ user.getUsername());
+               for (GsFile aFile: myFiles){
+                       System.out.println("\t" + aFile.getFilename());
+               }
+       
+       
+               // register a new user account
+               // (note this will fail for a duplicate username since there 
can only be one account for each name)
+               String newUsername = "test_cdk_" + System.currentTimeMillis();
+               GsSession newClient = new GsSession();
+
+               User newUser = newClient.registerUser(newUsername, "password", 
"[email protected]");
+               System.out.println("Logged in to GenomeSpace: " + 
newClient.isLoggedIn() +" as " + newUser.getUsername());
+               } catch (Exception ex) {
+                       logger.error("GenomeSpace failed",ex);
+               }
+       }
+
+}

Added: 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/resources/cytoscape/genomespace/plugin.props
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/resources/cytoscape/genomespace/plugin.props
                           (rev 0)
+++ 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/main/resources/cytoscape/genomespace/plugin.props
   2010-11-15 23:30:05 UTC (rev 22861)
@@ -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/src/test/java/cytoscape/genomespace/UploadFileToGenomeSpaceTest.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/test/java/cytoscape/genomespace/UploadFileToGenomeSpaceTest.java
                            (rev 0)
+++ 
csplugins/trunk/ucsd/mes/genomespace-plugin/src/test/java/cytoscape/genomespace/UploadFileToGenomeSpaceTest.java
    2010-11-15 23:30:05 UTC (rev 22861)
@@ -0,0 +1,17 @@
+package cytoscape.genomespace;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+/**
+ * Unit test for MyAction.
+ */
+public class UploadFileToGenomeSpaceTest extends TestCase {
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testMyAction() {
+        assertTrue( true );
+    }
+}

-- 
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.

Reply via email to