Author: mes
Date: 2012-02-09 14:05:45 -0800 (Thu, 09 Feb 2012)
New Revision: 28221

Modified:
   cytoscape/trunk/application/src/main/java/cytoscape/plugin/PluginManager.java
Log:
attempts to make the plugin manager work with webstart

Modified: 
cytoscape/trunk/application/src/main/java/cytoscape/plugin/PluginManager.java
===================================================================
--- 
cytoscape/trunk/application/src/main/java/cytoscape/plugin/PluginManager.java   
    2012-02-09 20:59:32 UTC (rev 28220)
+++ 
cytoscape/trunk/application/src/main/java/cytoscape/plugin/PluginManager.java   
    2012-02-09 22:05:45 UTC (rev 28221)
@@ -260,8 +260,7 @@
                                removeWebstartInstalls();
                                trackerFileName = "track_webstart_plugins.xml";
                        } else {
-                               tempDir = new 
File(CytoscapeInit.getConfigVersionDirectory(),
-                                               "plugins");
+                               tempDir = new 
File(CytoscapeInit.getConfigVersionDirectory(), "plugins");
                        }
                } else if (!tempDir.getAbsolutePath().endsWith("/plugins")) {
                        tempDir = new File(tempDir, "plugins");
@@ -831,6 +830,7 @@
                        // cause Cytoscape to crash, which plugins should 
definitely not do.  
                        } catch (Throwable t) {
                                loadingErrors.add(new PluginException("problem 
loading plugin: "+currentPlugin,t));
+                               t.printStackTrace();
                        }
                }
                // now load the plugins in the appropriate manner
@@ -873,16 +873,17 @@
                }
 
                // the creation of the class loader automatically loads the 
plugins
-               classLoader = (URLClassLoader) 
ClassLoader.getSystemClassLoader();
-
-
-               // Note: For the case of websatart, we should use the following 
statement to get classLoader
-               // The URLs will be a list of URLs pointed to the jars at 
source website. This may solve the 
-               //Class not found exception, because webstart does not have 
access to the local jar files
-               // in the class path.
-               //classLoader = 
(URLClassLoader)this.getClass().getClassLoader();
+               if ( usingWebstartManager() )
+                       // Note: For the case of websatart, we should use the 
following statement to get classLoader
+                       // The URLs will be a list of URLs pointed to the jars 
at source website. This may solve the 
+                       //Class not found exception, because webstart does not 
have access to the local jar files
+                       // in the class path.
+                       classLoader = 
(URLClassLoader)this.getClass().getClassLoader();
+                       //classLoader = (URLClassLoader) 
Thread.currentThread().getContextClassLoader(); 
+               else
+                       classLoader = (URLClassLoader) 
ClassLoader.getSystemClassLoader();
+       
                
-               
                // iterate through the given jar files and find classes that are
                // assignable from CytoscapePlugin
                for (int i = 0; i < urls.length; ++i) {
@@ -960,6 +961,7 @@
                        // cause Cytoscape to crash, which plugins should 
definitely not do.  
                        } catch (Throwable t) {
                                loadingErrors.add(new PluginException("problem 
loading plugin URL: " + urls[i], t));
+                               t.printStackTrace();
                        }
                }
        }
@@ -1011,7 +1013,12 @@
         */
        private Class getPluginClass(String name) throws ClassNotFoundException,
                        NoClassDefFoundError {
-               Class c = classLoader.loadClass(name);
+               Class c;
+               if ( usingWebstartManager() )
+                       c = Class.forName(name,false,classLoader);
+               else
+                       c = classLoader.loadClass(name);
+
                if (CytoscapePlugin.class.isAssignableFrom(c))
                        return c;
                else
@@ -1045,5 +1052,4 @@
                method.setAccessible(true);
                method.invoke(ClassLoader.getSystemClassLoader(), new Object[] 
{ url });
        }
-
 }

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