Author: mes
Date: 2010-07-21 12:26:43 -0700 (Wed, 21 Jul 2010)
New Revision: 20981
Added:
core3/plugin-impl/trunk/
core3/plugin-impl/trunk/osgi.bnd
core3/plugin-impl/trunk/pom.xml
core3/plugin-impl/trunk/src/
core3/plugin-impl/trunk/src/main/
core3/plugin-impl/trunk/src/main/java/
core3/plugin-impl/trunk/src/main/java/org/
core3/plugin-impl/trunk/src/main/java/org/cytoscape/
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/CyPluginAdapterImpl.java
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTask.java
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTaskFactory.java
core3/plugin-impl/trunk/src/main/resources/
core3/plugin-impl/trunk/src/main/resources/META-INF/
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
initial import
Added: core3/plugin-impl/trunk/osgi.bnd
===================================================================
--- core3/plugin-impl/trunk/osgi.bnd (rev 0)
+++ core3/plugin-impl/trunk/osgi.bnd 2010-07-21 19:26:43 UTC (rev 20981)
@@ -0,0 +1,7 @@
+#-----------------------------------------------------------------
+# Use this file to add customized Bnd instructions for the bundle
+#-----------------------------------------------------------------
+
+Spring-Context: META-INF/spring/*.xml
+Private-Package: ${bundle.namespace}.internal, ${bundle.namespace}.internal.*
+
Added: core3/plugin-impl/trunk/pom.xml
===================================================================
--- core3/plugin-impl/trunk/pom.xml (rev 0)
+++ core3/plugin-impl/trunk/pom.xml 2010-07-21 19:26:43 UTC (rev 20981)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <parent>
+ <artifactId>parent</artifactId>
+ <groupId>org.cytoscape</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <bundle.symbolicName>org.cytoscape.plugin-impl</bundle.symbolicName>
+ <bundle.namespace>org.cytoscape.plugin</bundle.namespace>
+ </properties>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>plugin-impl</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>${bundle.symbolicName}</name>
+
+ <packaging>bundle</packaging>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <!--
+ | example additional resource entries, useful when building Eclipse RCP
applications
+ -->
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>plugin.xml</include>
+ <include>plugin.properties</include>
+ <include>icons/**</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.ops4j</groupId>
+ <artifactId>maven-pax-plugin</artifactId>
+ <version>1.4</version>
+ <!--
+ | enable improved OSGi compilation support for the bundle
life-cycle.
+ | to switch back to the standard bundle life-cycle, move this
setting
+ | down to the maven-bundle-plugin section
+ -->
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.3</version>
+ <!--
+ | the following instructions build a simple set of public/private
classes into an OSGi bundle
+ -->
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <_include>-osgi.bnd</_include>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <!-- bootstrap for cytoscape dependencies, namely the parent POM
snapshots -->
+ <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>
+ <!-- bootstrap for cytoscape dependencies, namely the parent POM
releases -->
+ <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>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>model-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>plugin-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>work-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>viewmodel-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>core-task-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added:
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/CyPluginAdapterImpl.java
===================================================================
---
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/CyPluginAdapterImpl.java
(rev 0)
+++
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/CyPluginAdapterImpl.java
2010-07-21 19:26:43 UTC (rev 20981)
@@ -0,0 +1,44 @@
+
+package org.cytoscape.plugin.internal;
+
+import org.cytoscape.model.CyNetworkFactory;
+import org.cytoscape.model.CyDataTableFactory;
+import org.cytoscape.view.model.CyNetworkViewFactory;
+import org.cytoscape.work.TaskManager;
+import org.cytoscape.plugin.CyPluginAdapter;
+
+
+/**
+ * A Java-only api providing access to cytoscape functionality.
+ */
+public class CyPluginAdapterImpl implements CyPluginAdapter {
+
+ CyNetworkFactory netFac;
+ CyDataTableFactory tabFac;
+ CyNetworkViewFactory viewFac;
+ TaskManager tm;
+
+ CyPluginAdapterImpl(CyNetworkFactory netFac, CyDataTableFactory tabFac,
+ CyNetworkViewFactory viewFac, TaskManager tm ) {
+ this.netFac = netFac;
+ this.tabFac = tabFac;
+ this.viewFac = viewFac;
+ this.tm = tm;
+ }
+
+ public CyNetworkFactory getCyNetworkFactory() {
+ return netFac;
+ }
+
+ public CyDataTableFactory getCyDataTableFactory(){
+ return tabFac;
+ }
+
+ public CyNetworkViewFactory getCyNetworkViewFactory(){
+ return viewFac;
+ }
+
+ public TaskManager getTaskManager(){
+ return tm;
+ }
+}
Added:
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTask.java
===================================================================
---
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTask.java
(rev 0)
+++
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTask.java
2010-07-21 19:26:43 UTC (rev 20981)
@@ -0,0 +1,47 @@
+
+package org.cytoscape.plugin.internal;
+
+
+import org.cytoscape.plugin.CyPlugin;
+import org.cytoscape.plugin.CyPluginAdapter;
+import org.cytoscape.task.AbstractTask;
+import org.cytoscape.work.Tunable;
+import org.cytoscape.work.TaskMonitor;
+
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.lang.reflect.Constructor;
+import java.io.File;
+import java.net.URLClassLoader;
+import java.net.URL;
+
+
+public class PluginLoaderTask extends AbstractTask {
+
+ CyPluginAdapter adapter;
+
+ @Tunable(description="Select plugin JAR to load")
+ public File filename;
+
+ PluginLoaderTask(CyPluginAdapter adapter) {
+ this.adapter = adapter;
+ }
+
+ public void run(TaskMonitor tm) throws Exception {
+ Object o = null;
+ JarFile jar = null;
+ try {
+ jar = new JarFile(filename);
+ String name =
jar.getManifest().getMainAttributes().getValue("Cytoscape-Plugin");
+ URL jarurl = filename.toURI().toURL();
+ URLClassLoader ucl = URLClassLoader.newInstance( new
URL[]{jarurl},
+
PluginLoaderTask.class.getClassLoader() );
+ Class c = ucl.loadClass(name);
+ Constructor<CyPlugin> con =
c.getConstructor(CyPluginAdapter.class);
+ o = con.newInstance(adapter);
+ } finally {
+ if (jar != null)
+ jar.close();
+ }
+ }
+}
Added:
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTaskFactory.java
===================================================================
---
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTaskFactory.java
(rev 0)
+++
core3/plugin-impl/trunk/src/main/java/org/cytoscape/plugin/internal/PluginLoaderTaskFactory.java
2010-07-21 19:26:43 UTC (rev 20981)
@@ -0,0 +1,21 @@
+
+package org.cytoscape.plugin.internal;
+
+
+import org.cytoscape.plugin.CyPluginAdapter;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+
+
+public class PluginLoaderTaskFactory implements TaskFactory {
+
+ CyPluginAdapter adapter;
+
+ PluginLoaderTaskFactory(CyPluginAdapter adapter) {
+ this.adapter = adapter;
+ }
+
+ public Task getTask() {
+ return new PluginLoaderTask(adapter);
+ }
+}
Added:
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
(rev 0)
+++
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-07-21 19:26:43 UTC (rev 20981)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd"
+ default-lazy-init="false">
+
+ <!-- Individual Service -->
+ <osgi:reference id="cyNetworkFactoryRef"
+ interface="org.cytoscape.model.CyNetworkFactory">
+ </osgi:reference>
+
+ <osgi:reference id="cyDataTableFactoryRef"
+ interface="org.cytoscape.model.CyDataTableFactory">
+ </osgi:reference>
+
+ <osgi:reference id="cyNetworkViewFactoryRef"
+ interface="org.cytoscape.view.model.CyNetworkViewFactory">
+ </osgi:reference>
+
+ <osgi:reference id="taskManagerRef"
+ interface="org.cytoscape.work.TaskManager">
+ </osgi:reference>
+
+
+ <osgi:service id="pluginLoaderTaskFactoryService"
ref="pluginLoaderTaskFactory"
+ interface="org.cytoscape.work.TaskFactory">
+ <osgi:service-properties>
+ <entry key="title" value="Load Plugin..." />
+ <entry key="preferredMenu" value="File.Import" />
+ </osgi:service-properties>
+ </osgi:service>
+
+
+</beans>
Added:
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
(rev 0)
+++
core3/plugin-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-07-21 19:26:43 UTC (rev 20981)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <!-- regular spring configuration file defining the beans for this
+ bundle. We've kept the osgi definitions in a separate
+ configuration file so that this file can easily be used
+ for integration testing outside of an OSGi environment -->
+
+ <context:annotation-config/>
+
+
+ <bean id="cyPluginAdapter"
class="org.cytoscape.plugin.internal.CyPluginAdapterImpl">
+ <constructor-arg ref="cyNetworkFactoryRef" />
+ <constructor-arg ref="cyDataTableFactoryRef" />
+ <constructor-arg ref="cyNetworkViewFactoryRef" />
+ <constructor-arg ref="taskManagerRef" />
+ </bean>
+
+ <bean id="pluginLoaderTaskFactory"
class="org.cytoscape.plugin.internal.PluginLoaderTaskFactory">
+ <constructor-arg ref="cyPluginAdapter" />
+ </bean>
+</beans>
--
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.