From: <bh...@us...> - 2006-07-27 16:40:10
|
Revision: 107 Author: bh2 Date: 2006-07-27 09:39:48 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/cishell/?rev=107&view=rev Log Message: ----------- * committing some sample bundles to see how an algorithm is integrated manually Added Paths: ----------- trunk/examples/org.cishell.tests.alg1/.classpath trunk/examples/org.cishell.tests.alg1/.project trunk/examples/org.cishell.tests.alg1/.settings/ trunk/examples/org.cishell.tests.alg1/.settings/org.eclipse.pde.core.prefs trunk/examples/org.cishell.tests.alg1/META-INF/ trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF trunk/examples/org.cishell.tests.alg1/OSGI-INF/ trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm1.properties trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm2.properties trunk/examples/org.cishell.tests.alg1/OSGI-INF/component1.xml trunk/examples/org.cishell.tests.alg1/OSGI-INF/component2.xml trunk/examples/org.cishell.tests.alg1/OSGI-INF/l10n/ trunk/examples/org.cishell.tests.alg1/OSGI-INF/l10n/bundle_en.properties trunk/examples/org.cishell.tests.alg1/OSGI-INF/metatype/ trunk/examples/org.cishell.tests.alg1/OSGI-INF/metatype/METADATA.XML trunk/examples/org.cishell.tests.alg1/build.properties trunk/examples/org.cishell.tests.alg1/src/ trunk/examples/org.cishell.tests.alg1/src/org/ trunk/examples/org.cishell.tests.alg1/src/org/cishell/ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg.java trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java Added: trunk/examples/org.cishell.tests.alg1/.classpath =================================================================== --- trunk/examples/org.cishell.tests.alg1/.classpath (rev 0) +++ trunk/examples/org.cishell.tests.alg1/.classpath 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/examples/org.cishell.tests.alg1/.project =================================================================== --- trunk/examples/org.cishell.tests.alg1/.project (rev 0) +++ trunk/examples/org.cishell.tests.alg1/.project 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.tests.alg1</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> Added: trunk/examples/org.cishell.tests.alg1/.settings/org.eclipse.pde.core.prefs =================================================================== --- trunk/examples/org.cishell.tests.alg1/.settings/org.eclipse.pde.core.prefs (rev 0) +++ trunk/examples/org.cishell.tests.alg1/.settings/org.eclipse.pde.core.prefs 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,4 @@ +#Fri Jun 16 15:07:20 EST 2006 +eclipse.preferences.version=1 +pluginProject.equinox=false +pluginProject.extensions=false Added: trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF =================================================================== --- trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF (rev 0) +++ trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Alg1 Plug-in +Bundle-SymbolicName: org.cishell.tests.alg1 +Bundle-Version: 0.0.1 +Bundle-Localization: plugin +Service-Component: OSGI-INF/component1.xml, OSGI-INF/component2.xml +X-AutoStart: true +Import-Package: org.cishell.framework, + org.cishell.framework.algorithm, + org.cishell.framework.datamodel, + org.osgi.framework;version="1.3.0", + org.osgi.service.component;version="1.0.0", + org.osgi.service.log;version="1.3.0", + org.osgi.service.metatype;version="1.1.0" + Added: trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm1.properties =================================================================== --- trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm1.properties (rev 0) +++ trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm1.properties 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,6 @@ +menu_path=file/CIShell/additions +label=Alg1 +description=My Algorithm! +in_data=edu.uci.ics.jung.graph.Graph +service.pid=org.cishell.tests.alg1.alg1 +remoteable=true Added: trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm2.properties =================================================================== --- trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm2.properties (rev 0) +++ trunk/examples/org.cishell.tests.alg1/OSGI-INF/algorithm2.properties 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,6 @@ +menu_path=file/CIShell/additions +label=Alg2 +description=Muh Algorithm! +in_data=java.lang.String +service.pid=org.cishell.tests.alg1.alg2 +remoteable=true Added: trunk/examples/org.cishell.tests.alg1/OSGI-INF/component1.xml =================================================================== --- trunk/examples/org.cishell.tests.alg1/OSGI-INF/component1.xml (rev 0) +++ trunk/examples/org.cishell.tests.alg1/OSGI-INF/component1.xml 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.tests.alg1.component" immediate="false"> + <implementation class="org.cishell.tests.alg1.Alg1Factory"/> + <properties entry="OSGI-INF/algorithm1.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: trunk/examples/org.cishell.tests.alg1/OSGI-INF/component2.xml =================================================================== --- trunk/examples/org.cishell.tests.alg1/OSGI-INF/component2.xml (rev 0) +++ trunk/examples/org.cishell.tests.alg1/OSGI-INF/component2.xml 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.tests.alg1.component2" immediate="false"> + <implementation class="org.cishell.tests.alg1.Alg2Factory"/> + <properties entry="OSGI-INF/algorithm2.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: trunk/examples/org.cishell.tests.alg1/OSGI-INF/l10n/bundle_en.properties =================================================================== --- trunk/examples/org.cishell.tests.alg1/OSGI-INF/l10n/bundle_en.properties (rev 0) +++ trunk/examples/org.cishell.tests.alg1/OSGI-INF/l10n/bundle_en.properties 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,9 @@ +person=Person +person_record=Person Record +cn=Name +sn=Sur Name +seeAlso=See Also +telNumber=Tel. +sex=Sex +male=Male +female=Female Added: trunk/examples/org.cishell.tests.alg1/OSGI-INF/metatype/METADATA.XML =================================================================== --- trunk/examples/org.cishell.tests.alg1/OSGI-INF/metatype/METADATA.XML (rev 0) +++ trunk/examples/org.cishell.tests.alg1/OSGI-INF/metatype/METADATA.XML 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="%person" id="2.5.6.6" + description="%person_record"> + <AD name="%sex" id="2.5.4.12" type="Integer" default="1"> + <Option label="%male" value="1" /> + <Option label="%Female" value="0" /> + </AD> + <AD name="%sn" id="2.5.4.4" type="String" default="" /> + <AD name="%cn" id="2.5.4.3" type="String" default="" /> + <AD name="%seeAlso" id="2.5.4.34" type="String" description="blah" + cardinality="8" default="http://www.google.com, + http://www.yahoo.com" /> + <AD name="%telNumber" id="2.5.4.20" type="String" default="" /> + </OCD> + <Designate pid="default.id"> + <Object ocdref="2.5.6.6" /> + </Designate> +</metatype:MetaData> Added: trunk/examples/org.cishell.tests.alg1/build.properties =================================================================== --- trunk/examples/org.cishell.tests.alg1/build.properties (rev 0) +++ trunk/examples/org.cishell.tests.alg1/build.properties 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ Added: trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg.java =================================================================== --- trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg.java (rev 0) +++ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg.java 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,50 @@ +/* **************************************************************************** + * CIShell: Cyberinfrastructure Shell, An Algorithm Integration Framework. + * + * All rights reserved. This program and the accompanying materials are made + * available under the terms of the Apache License v2.0 which accompanies + * this distribution, and is available at: + * http://www.apache.org/licenses/LICENSE-2.0.html + * + * Created on Jun 22, 2006 at Indiana University. + * + * Contributors: + * Indiana University - + * ***************************************************************************/ +package org.cishell.tests.alg1; + +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Hashtable; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.datamodel.BasicDataModel; +import org.cishell.framework.datamodel.DataModel; +import org.cishell.framework.datamodel.DataModelProperty; +import org.osgi.service.log.LogService; + +public class Alg implements Algorithm { + CIShellContext context; + Dictionary parameters; + + public Alg(CIShellContext context, Dictionary parameters) { + this.context = context; + this.parameters = parameters; + } + + public DataModel[] execute() { + LogService log = (LogService)context.getService(LogService.class.getName()); + + log.log(LogService.LOG_INFO, "My Parameters:"); + for(Enumeration keys = parameters.keys();keys.hasMoreElements();) { + String key = (String)keys.nextElement(); + log.log(LogService.LOG_INFO, key + "->" + parameters.get(key)); + } + + Dictionary dict = new Hashtable(); + dict.put(DataModelProperty.LABEL, "Weee!!!"); + + return new DataModel[] {new BasicDataModel(dict, "Weee!!!", String.class.getName())}; + } +} \ No newline at end of file Added: trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java =================================================================== --- trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java (rev 0) +++ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,30 @@ +package org.cishell.tests.alg1; + +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.datamodel.DataModel; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.MetaTypeService; + +public class Alg1Factory implements AlgorithmFactory { + private MetaTypeProvider provider; + + protected void activate(ComponentContext ctxt) { + MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); + provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); + } + protected void deactivate(ComponentContext ctxt) { + provider = null; + } + + public Algorithm createAlgorithm(DataModel[] dm, Dictionary parameters, CIShellContext context) { + return new Alg(context, parameters); + } + public MetaTypeProvider createParameters(DataModel[] dm) { + return provider; + } +} Added: trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java =================================================================== --- trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java (rev 0) +++ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java 2006-07-27 16:39:48 UTC (rev 107) @@ -0,0 +1,30 @@ +package org.cishell.tests.alg1; + +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.datamodel.DataModel; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.MetaTypeService; + +public class Alg2Factory implements AlgorithmFactory { + private MetaTypeProvider provider; + + protected void activate(ComponentContext ctxt) { + MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); + provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); + } + protected void deactivate(ComponentContext ctxt) { + provider = null; + } + + public Algorithm createAlgorithm(DataModel[] dm, Dictionary parameters, CIShellContext context) { + return new Alg(context, parameters); + } + public MetaTypeProvider createParameters(DataModel[] dm) { + return provider; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |