Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dirty hack for a minimal SADI plugin (see http://chem-bla-ics.blogspo…
- Loading branch information
Showing
13 changed files
with
410 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="lib" path="libs/sadi-client-0.3.0-SNAPSHOT-jar-with-dependencies.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>net.bioclipse.sadi</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: SADI Client Plugin | ||
Bundle-SymbolicName: net.bioclipse.sadi; singleton:=true | ||
Bundle-Version: 2.5.0.qualifier | ||
Bundle-Activator: net.bioclipse.sadi.Activator | ||
Export-Package: net.bioclipse.sadi, net.bioclipse.sadi.business | ||
Require-Bundle: org.eclipse.ui, | ||
org.eclipse.core.runtime, | ||
net.bioclipse.core, | ||
net.bioclipse.scripting, | ||
org.springframework.bundle.spring.aop, | ||
net.sf.cglib, | ||
org.springframework.osgi.aopalliance.osgi | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
Import-Package: org.apache.log4j | ||
Bundle-ActivationPolicy: lazy | ||
Bundle-ClassPath: libs/sadi-client-0.3.0-SNAPSHOT-jar-with-dependencies.jar, | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?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.xsd | ||
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> | ||
|
||
<osgi:service id="javaSadiManagerOSGI" | ||
ref="javaSadiManager" | ||
interface="net.bioclipse.sadi.business.IJavaSadiManager" /> | ||
|
||
<osgi:service id="javaScriptSadiManagerOSGI" | ||
ref="javaScriptSadiManager" | ||
interface="net.bioclipse.sadi.business.IJavaScriptSadiManager" /> | ||
|
||
<osgi:reference id="recordingAdvice" | ||
interface="net.bioclipse.recording.IRecordingAdvice" /> | ||
|
||
<osgi:reference id="javaManagerDispatcherAdvisor" | ||
interface="net.bioclipse.managers.business.IJavaManagerDispatcherAdvisor" /> | ||
|
||
<osgi:reference id="javaScriptManagerDispatcherAdvisor" | ||
interface="net.bioclipse.managers.business.IJavaScriptManagerDispatcherAdvisor" /> | ||
|
||
<osgi:reference id="wrapInProxyAdvice" | ||
interface="net.bioclipse.recording.IWrapInProxyAdvice" /> | ||
|
||
<bean id="recordingAdvisor" | ||
class="org.springframework.aop.support.RegexpMethodPointcutAdvisor"> | ||
<property name="advice" ref="recordingAdvice" /> | ||
<property name="pattern" value=".*" /> <!-- See also class implementation --> | ||
</bean> | ||
|
||
<bean id="SadiManagerTarget" | ||
class="net.bioclipse.sadi.business.SadiManager"> | ||
</bean> | ||
|
||
<bean id="javaScriptSadiManager" | ||
class="org.springframework.aop.framework.ProxyFactoryBean"> | ||
<property name="target" | ||
ref="SadiManagerTarget" /> | ||
<property name="proxyInterfaces" | ||
value="net.bioclipse.sadi.business.IJavaScriptSadiManager" /> | ||
<property name="interceptorNames" > | ||
<list> | ||
<value>recordingAdvisor</value> | ||
<value>wrapInProxyAdvice</value> | ||
<value>javaScriptManagerDispatcherAdvisor</value> | ||
</list> | ||
</property> | ||
</bean> | ||
|
||
<bean id="javaSadiManager" | ||
class="org.springframework.aop.framework.ProxyFactoryBean"> | ||
<property name="target" | ||
ref="SadiManagerTarget" /> | ||
<property name="proxyInterfaces" | ||
value="net.bioclipse.sadi.business.IJavaSadiManager" /> | ||
<property name="interceptorNames" > | ||
<list> | ||
<value>recordingAdvisor</value> | ||
<value>wrapInProxyAdvice</value> | ||
<value>javaManagerDispatcherAdvisor</value> | ||
</list> | ||
</property> | ||
</bean> | ||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = plugin.xml,\ | ||
META-INF/,\ | ||
.,\ | ||
libs/sadi-client-0.3.0-SNAPSHOT-jar-with-dependencies.jar | ||
source.. = src/ |
Binary file added
BIN
+17.8 MB
plugins/net.bioclipse.sadi/libs/sadi-client-0.3.0-SNAPSHOT-jar-with-dependencies.jar
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
|
||
<extension | ||
point="net.bioclipse.scripting.contribution"> | ||
<scriptContribution | ||
service="net.bioclipse.sadi.business.SadiManagerFactory" | ||
id="net.bioclipse.sadi.business.SadiManager"> | ||
</scriptContribution> | ||
</extension> | ||
|
||
</plugin> |
105 changes: 105 additions & 0 deletions
105
plugins/net.bioclipse.sadi/src/net/bioclipse/sadi/Activator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012 Egon Willighagen <egon.willighagen@gmail.com> | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contact: http://www.bioclipse.net/ | ||
******************************************************************************/ | ||
package net.bioclipse.sadi; | ||
|
||
import net.bioclipse.sadi.business.ISadiManager; | ||
import net.bioclipse.sadi.business.IJavaSadiManager; | ||
import net.bioclipse.sadi.business.IJavaScriptSadiManager; | ||
|
||
import org.apache.log4j.Logger; | ||
import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
import org.osgi.framework.BundleContext; | ||
import org.osgi.util.tracker.ServiceTracker; | ||
|
||
/** | ||
* The Activator class controls the plug-in life cycle | ||
*/ | ||
public class Activator extends AbstractUIPlugin { | ||
|
||
private static final Logger logger = Logger.getLogger(Activator.class); | ||
|
||
// The shared instance | ||
private static Activator plugin; | ||
|
||
// Trackers for getting the managers | ||
private ServiceTracker javaFinderTracker; | ||
private ServiceTracker jsFinderTracker; | ||
|
||
public Activator() { | ||
} | ||
|
||
public void start(BundleContext context) throws Exception { | ||
super.start(context); | ||
plugin = this; | ||
javaFinderTracker | ||
= new ServiceTracker( context, | ||
IJavaSadiManager.class.getName(), | ||
null ); | ||
|
||
javaFinderTracker.open(); | ||
jsFinderTracker | ||
= new ServiceTracker( context, | ||
IJavaScriptSadiManager.class.getName(), | ||
null ); | ||
|
||
jsFinderTracker.open(); | ||
} | ||
|
||
public void stop(BundleContext context) throws Exception { | ||
plugin = null; | ||
super.stop(context); | ||
} | ||
|
||
/** | ||
* Returns the shared instance | ||
* | ||
* @return the shared instance | ||
*/ | ||
public static Activator getDefault() { | ||
return plugin; | ||
} | ||
|
||
public ISadiManager getJavaSadiManager() { | ||
ISadiManager manager = null; | ||
try { | ||
manager = (ISadiManager) | ||
javaFinderTracker.waitForService(1000*10); | ||
} | ||
catch (InterruptedException e) { | ||
throw new IllegalStateException( | ||
"Could not get the Java SadiManager", | ||
e ); | ||
} | ||
if (manager == null) { | ||
throw new IllegalStateException( | ||
"Could not get the Java SadiManager"); | ||
} | ||
return manager; | ||
} | ||
|
||
public IJavaScriptSadiManager getJavaScriptSadiManager() { | ||
IJavaScriptSadiManager manager = null; | ||
try { | ||
manager = (IJavaScriptSadiManager) | ||
jsFinderTracker.waitForService(1000*10); | ||
} | ||
catch (InterruptedException e) { | ||
throw new IllegalStateException( | ||
"Could not get the JavaScript SadiManager", | ||
e ); | ||
} | ||
if (manager == null) { | ||
throw new IllegalStateException( | ||
"Could not get the JavaScript SadiManager"); | ||
} | ||
return manager; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
plugins/net.bioclipse.sadi/src/net/bioclipse/sadi/business/IJavaSadiManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012 Egon Willighagen <egon.willighagen@gmail.com> | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contact: Bioclipse Project <http://www.bioclipse.net> | ||
******************************************************************************/ | ||
package net.bioclipse.sadi.business; | ||
|
||
public interface IJavaSadiManager extends ISadiManager { | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
plugins/net.bioclipse.sadi/src/net/bioclipse/sadi/business/IJavaScriptSadiManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012 Egon Willighagen <egon.willighagen@gmail.com> | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contact: Bioclipse Project <http://www.bioclipse.net> | ||
******************************************************************************/ | ||
package net.bioclipse.sadi.business; | ||
|
||
import net.bioclipse.managers.business.IBioclipseJSManager; | ||
|
||
public interface IJavaScriptSadiManager | ||
extends ISadiManager, IBioclipseJSManager { | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
plugins/net.bioclipse.sadi/src/net/bioclipse/sadi/business/ISadiManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012 Egon Willighagen <egon.willighagen@gmail.com> | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contact: http://www.bioclipse.net/ | ||
******************************************************************************/ | ||
package net.bioclipse.sadi.business; | ||
|
||
import java.util.List; | ||
|
||
import net.bioclipse.core.PublishedClass; | ||
import net.bioclipse.core.PublishedMethod; | ||
import net.bioclipse.core.business.BioclipseException; | ||
import net.bioclipse.managers.business.IBioclipseManager; | ||
|
||
@PublishedClass( | ||
value="TODO: Describe the manager here." | ||
) | ||
public interface ISadiManager extends IBioclipseManager { | ||
|
||
@PublishedMethod( | ||
methodSummary="List all registered SADI services" | ||
) | ||
public List<String> listServices() throws BioclipseException; | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
plugins/net.bioclipse.sadi/src/net/bioclipse/sadi/business/SadiManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012 Egon Willighagen <egon.willighagen@gmail.com> | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contact: http://www.bioclipse.net/ | ||
******************************************************************************/ | ||
package net.bioclipse.sadi.business; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import net.bioclipse.core.business.BioclipseException; | ||
import net.bioclipse.managers.business.IBioclipseManager; | ||
import ca.wilkinsonlab.sadi.SADIException; | ||
import ca.wilkinsonlab.sadi.client.Config; | ||
import ca.wilkinsonlab.sadi.client.Registry; | ||
import ca.wilkinsonlab.sadi.client.Service; | ||
|
||
public class SadiManager implements IBioclipseManager { | ||
|
||
/** | ||
* Gives a short one word name of the manager used as variable name when | ||
* scripting. | ||
*/ | ||
public String getManagerName() { | ||
return "sadi"; | ||
} | ||
|
||
public List<String> listServices() throws BioclipseException { | ||
Registry registry = Config.getConfiguration().getMasterRegistry(); | ||
try { | ||
List<String> serviceURIs = new ArrayList<String>(); | ||
Collection<? extends Service> services = registry.getAllServices(); | ||
for (Service service : services) { | ||
serviceURIs.add(service.getURI()); | ||
} | ||
return serviceURIs; | ||
} catch (SADIException sadiException) { | ||
throw new BioclipseException( | ||
"Error contacting the SADI registry...", sadiException | ||
); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.