You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by do...@apache.org on 2009/02/08 14:08:37 UTC
svn commit: r742086 - in /felix/sandbox/donsez/sosoc/src/site:
benchcmd.groovy component.benchcmd.groovy.xml component.waproducer.xml
index.html script.txt
Author: donsez
Date: Sun Feb 8 13:08:36 2009
New Revision: 742086
URL: http://svn.apache.org/viewvc?rev=742086&view=rev
Log:
add more examples
Added:
felix/sandbox/donsez/sosoc/src/site/benchcmd.groovy
felix/sandbox/donsez/sosoc/src/site/component.benchcmd.groovy.xml (with props)
felix/sandbox/donsez/sosoc/src/site/component.waproducer.xml (with props)
Modified:
felix/sandbox/donsez/sosoc/src/site/index.html
felix/sandbox/donsez/sosoc/src/site/script.txt
Added: felix/sandbox/donsez/sosoc/src/site/benchcmd.groovy
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/sosoc/src/site/benchcmd.groovy?rev=742086&view=auto
==============================================================================
--- felix/sandbox/donsez/sosoc/src/site/benchcmd.groovy (added)
+++ felix/sandbox/donsez/sosoc/src/site/benchcmd.groovy Sun Feb 8 13:08:36 2009
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import java.io.PrintWriter;
+import org.osgi.framework.ServiceReference;
+
+// the Java reference to the Runnable service
+Runnable service;
+
+// Command functions
+public String getName(){
+ return "bench2";
+}
+
+public String getUsage(){
+ return "bench2 <nbloop>";
+}
+
+public String getShortDescription(){
+ return "bench a Runnable service";
+}
+
+public void execute(String commandLine, PrintWriter out, PrintWriter err){
+ int nbcalls=100000;
+ long startTime=java.lang.System.currentTimeMillis();
+ for(int n = 0; n <nbcalls; n++){
+ service.run();
+ }
+ long endTime=java.lang.System.currentTimeMillis();
+ long time=endTime-startTime;
+ out.println(time+" millisec. for "+nbcalls+" calls ("+(time*1000.0)/nbcalls+" microsec. per call)");
+}
+
+// Binding/unbinding functions
+public void bindRunnable(ServiceReference svcref, Runnable svc){
+ service=svc;
+}
+
+public void unbindRunnable(ServiceReference svcref, Runnable svc){
+ service=null;
+}
+
+/*
+// Lifecycle functions
+function activate(){
+ // do something
+ java.lang.System.out.println("sosoc.bench.command: call activate() function");
+}
+
+function deactivate(){
+ java.lang.System.out.println("sosoc.bench.command: call deactivate() function");
+ // do something
+}
+*/
Added: felix/sandbox/donsez/sosoc/src/site/component.benchcmd.groovy.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/sosoc/src/site/component.benchcmd.groovy.xml?rev=742086&view=auto
==============================================================================
--- felix/sandbox/donsez/sosoc/src/site/component.benchcmd.groovy.xml (added)
+++ felix/sandbox/donsez/sosoc/src/site/component.benchcmd.groovy.xml Sun Feb 8 13:08:36 2009
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!-- Component Description used by SOSOC -->
+<!--
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+-->
+<!-- July 17 2005 -->
+
+<component name="sosoc.bench.command.groovy">
+ <implementation language="groovy">
+ <!-- <attribute name="compile" value="true"/> -->
+ <source url="benchcmd.groovy"/>
+ </implementation>
+
+ <service>
+ <provide interface="org.apache.felix.shell.Command"/>
+ </service>
+
+ <property value="category" name="command" type="string" />
+
+ <!-- Required services -->
+ <reference name="RUNNABLE"
+ interface="java.lang.Runnable"
+ cardinality="1..1"
+ policy="static"
+ bind="bindRunnable"
+ unbind="unbindRunnable"
+ />
+</component>
Propchange: felix/sandbox/donsez/sosoc/src/site/component.benchcmd.groovy.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: felix/sandbox/donsez/sosoc/src/site/component.waproducer.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/sosoc/src/site/component.waproducer.xml?rev=742086&view=auto
==============================================================================
--- felix/sandbox/donsez/sosoc/src/site/component.waproducer.xml (added)
+++ felix/sandbox/donsez/sosoc/src/site/component.waproducer.xml Sun Feb 8 13:08:36 2009
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Component Description used by SOSOC -->
+<!-- July 17 2005 -->
+<component name="sosoc.wireadmin.producer">
+
+ <implementation
+ class="org.apache.felix.sandbox.bundle.fictivemeasurementproducer.ProducerImpl"
+ />
+
+ <property name="producer.flavors"
+ value="org.osgi.util.measurement.Measurement,java.lang.Double,java.lang.String"
+ factory="org.apache.felix.sandbox.util.wireadmin.ClassArrayFactory"
+ factorymethod="create"
+ /> <!-- use static Class[] create(String) of ClassArrayFactory -->
+
+ <property name="sample.date"
+ value="Sep 19, 2005, ..."
+ type="java.lang.Date"
+ /> <!-- use the (deprecated) constructor public Date(String) -->
+
+ <service>
+ <provide interface="org.osgi.service.wireadmin.Producer"/>
+ </service>
+
+ <reference name="LOG"
+ interface="org.osgi.service.log.LogService"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+
+</component>
Propchange: felix/sandbox/donsez/sosoc/src/site/component.waproducer.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: felix/sandbox/donsez/sosoc/src/site/index.html
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/sosoc/src/site/index.html?rev=742086&r1=742085&r2=742086&view=diff
==============================================================================
--- felix/sandbox/donsez/sosoc/src/site/index.html (original)
+++ felix/sandbox/donsez/sosoc/src/site/index.html Sun Feb 8 13:08:36 2009
@@ -43,9 +43,8 @@
</p>
<p>
-<b>Contributors</b><br>
-<ul>
-</ul>
+<b>Author</b><br>
+<a href="mailto:dev@felix.apache.org">Felix Project Team</a>
</p>
<p>
@@ -53,22 +52,6 @@
ASL 2.0
</p>
-<p>
-<b>Services</b><br>
-org.apche.felix.shell.Command
-</p>
-
-<p>
-<b>Properties</b><br>
-<ul>
-<li>None</li>
-</ul>
-</p>
-
-<p><b>Requirements</b><br>
-TODO
-</p>
-
<!-- End of Felix Bundle Documentation -->
<hr width="100%" size="2">
@@ -90,7 +73,7 @@
<p id="rundemo">
<b>Run the demo</b><br>
-To run the demo of this bundle, enter in the Felix shell the following command lines contained in the <a href="http://people.apache.org/~donsez/dev/osgi/sosoc/script.txt">script.txt</a> from the <a href="http://people.apache.org/~donsez/dev/osgi/sosoc.cmd/readme.html">sosoc</a> command.</li>
+To run the demo of this bundle, enter in the Felix shell the following command lines contained in the <a href="http://people.apache.org/~donsez/dev/osgi/sosoc/script.txt">script.txt</a> from the <a href="script.txt">sosoc</a> command.</li>
</ul>
</p>
@@ -111,6 +94,7 @@
<p id="todo">
<b>TODO (contributions are welcome)</b><br>
<ul>
+<ul>TODO: use the SCR release 1.0 to refactor SOSOC</li>
<ul>TODO: deploy JSR223 engines (https://scripting.dev.java.net) and implementations as bundles (may be with Pax handlers wrap:mvn: )</li>
<li>TODO: apply the base url to the relative entries</li>
<li>TODO: unify the entry and the url parameter in the source element</li>
Modified: felix/sandbox/donsez/sosoc/src/site/script.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/sosoc/src/site/script.txt?rev=742086&r1=742085&r2=742086&view=diff
==============================================================================
--- felix/sandbox/donsez/sosoc/src/site/script.txt (original)
+++ felix/sandbox/donsez/sosoc/src/site/script.txt Sun Feb 8 13:08:36 2009
@@ -59,6 +59,9 @@
sosoc start component.runnable.bsh.xml
bench 1000000
+sosoc prop sosoc.showtrace true
+sosoc start component.benchcmd.groovy.xml
+
sosoc prop sosoc.showtrace false
sosoc start component.runnable.groovy.xml
bench 1000000