commons-invoke-1.1.0+cvs20090227.orig/0000775000175000017500000000000011152062103016314 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/project.properties0000664000175000017500000000045610113405774022120 0ustar gregoagregoa#repository maven.repo.central= maven.repo.central.directory= maven.repo.remote=http://www.ibiblio.org/maven,http://onemind-commons.sf.net/maven maven.license.licenseFile=docs/License.txt #maven.repo.remote.enabled=true #site generation maven.docs.src=xdocs maven.xdoc.includeProjectDocumentation=yes commons-invoke-1.1.0+cvs20090227.orig/maven.xml0000664000175000017500000000202110113405774020152 0ustar gregoagregoa commons-invoke-1.1.0+cvs20090227.orig/.checkstyle0000664000175000017500000000040610113406061020454 0ustar gregoagregoa commons-invoke-1.1.0+cvs20090227.orig/xdocs/0000775000175000017500000000000011152062103017434 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/xdocs/documentation.xml0000664000175000017500000001021310113531322023024 0ustar gregoagregoa commons-invoke

1. The invocation framework
2. Usage

The invocation framework defines the Invocable interface which represent an object that has InvocableFunctions that can be invoked. There are a few uses for the framework:

  1. As a wrapper framework for reflection for optimizing method invocation. For example, the AbstractInvocable uses the reflection for method invocation by default, but can optionally take implemented InvocableFunction for doing the compiled method invocation
  2. As a wrapper framework for reflection for proxying method invocation. For example, the AbstractInvocable uses the reflection for method invocation but optionally take implemented InvocableFunction to proxy the reflection call
  3. As arbitrary invocation framework for application independant of reflection (e.g. defines a set of functions on an object independant of what java methods the object really provides)

Let supposed that you have a method callMeALot in an class MyObject that is called frequently in your application, but as the requirement of the design you are allowed to call it using java reflection api Supposed that method callMeALot is called a lot (10000 per seconds) and the reflection call the slowing down the application. The following code shows how to replace the java reflection api with the common-invoke The last line in the source above still uses the java reflection api to make the action method call the callMeALot. But now, the method can be optimize by doing the following While the java reflection api is in general fast, the benchmark shows that the optimization uses half the time required by the java reflection api.

commons-invoke-1.1.0+cvs20090227.orig/xdocs/images/0000775000175000017500000000000011152062103020701 5ustar gregoagregoacommons-invoke-1.1.0+cvs20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~p_Ha:_mtx[1)+FjrĄ<}7^JF^繩3 o*]rPkvfm]qTaT :&Fx)F8wz!ɥ7݋>D/ i + ^;yy8v'MAze@xxH؟K .W=(CBnj:yrF'iQϒ30`Fx% jgtz~@XK'{c6zAc{B^6 fJl{7{g^gW27\S{xq?FQw7#%lc#Z/23n>e|hw ځzO7^C%rHMqإ{0YWcn pYYgLjp 7L?3sF&EJhAe ws]S/u^WnStf?(epB>F~S{3hSFA:dHw]r7Sc*aZ(ՐԷ^a;/sRC@Z!8HR&JDTF0oW?4rae?s]1RvREksE2x8Rh6rGzD<ȁhnQ7\Bp$S 4H|m Y)XS :KGmT_jCUS) D"IKUXg;Pzr~XNQ4TE zy l2p_QaKjmG.gj_W9flԄPD/n=rJa?k1CKEL:وf}C}xUEt_7Hxyx E:4۵q io]僡T0G(R j Tf'gnrzd?9\V^Bh'usu~!7S4hV"BNJ20^FB*E2|$ q(%= 2;3%&|5cg d$1zRC8ZOxM.$HBZ$y4RDhF,2&MQ"\Y@5 RyjXzc^$ْאyr$IZ_zmNv*0@%|Bzj觢 $-:EFs/7 q" ' sz4ynh0P U}ZXnBZYΒ#u=s*҂:d SB(:VX*vGJE3Gr}( VvuiS)z'F5QBC%JsxzB1 *a-0(|} د"B[/Ckb=k22 a'b:r2%+k*"0hQK{G%$T3%r 8FxNK6;eeQ4 -b!q[ӷFu+zEK^+sk1s?zQ)6yKPC5s51Q"Keo{(G\05O#ˇۉzx/7|0KKë$ <';g EHvۇ9p܋:#9/TڋX&۪az ;h:21SӾkL+.@,%rjgClI@&,[6<9Le+غ;B3k2;HĿ»PM7{R|X #,^,`;commons-invoke-1.1.0+cvs20090227.orig/xdocs/stats.js0000664000175000017500000000247210175762001021145 0ustar gregoagregoa var success=0; cRef=""; cRefType=""; cPage=""; var L10qstr,L10pc,L10ref,L10a,L10pg; L10pg=document.URL.toString(); L10ref=document.referrer; if (top.document.location==document.referrer || (document.referrer == "" && top.document.location != "")) {L10ref=top.document.referrer;} L10qStr = "pg="+escape(L10pg)+ "&ref="+escape(L10ref)+ "&os="+escape(navigator.userAgent)+ "&nn="+escape(navigator.appName)+ "&nv="+escape(navigator.appVersion)+ "&nl="+escape(navigator.language)+ "&sl="+escape(navigator.systemLanguage)+ "&sa="+success+ "&cR="+escape(cRef)+ "&cRT="+escape(cRefType)+ "&cPg="+escape(cPage); if(navigator.appVersion.substring(0,1) > "3") { L10d = new Date(); L10qStr = L10qStr+ "&cd="+screen.colorDepth+ "&sx="+screen.width+ "&sy="+screen.height+ "&tz="+L10d.getTimezoneOffset(); } if((location.href.substr(0,6)=="https:") || (location.href.substr(0,6)=="HTTPS:")) { L10pc="https"; } else { L10pc="http"; } function statlink() { document.write(''); };commons-invoke-1.1.0+cvs20090227.orig/xdocs/changes.xml0000664000175000017500000000163410113531322021572 0ustar gregoagregoa Changes to commons-invoke TiongHiang Lee - refactor AbstractInvocableFunction.canInvoke to canInvokeOn
- add parameter type check in DefaultInvocable.getFunction
- add BenchmarkTest
- add unit test for parameter check in DefaultInvocable.getFunction
- Fix AbstractInvocable.addFunction() to not exclude name since name is built into the function now.
commons-invoke-1.1.0+cvs20090227.orig/xdocs/navigation.xml0000664000175000017500000000174210175762000022330 0ustar gregoagregoa onemind commons
commons-invoke-1.1.0+cvs20090227.orig/src/0000775000175000017500000000000011152062103017103 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/src/test/0000775000175000017500000000000011152062103020062 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/src/test/org/0000775000175000017500000000000011152062103020651 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/src/test/org/onemind/0000775000175000017500000000000011152062103022302 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/src/test/org/onemind/commons/0000775000175000017500000000000011152062103023755 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/src/test/org/onemind/commons/invoke/0000775000175000017500000000000011152062103025250 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/src/test/org/onemind/commons/invoke/BenchmarkTest.java0000664000175000017500000000741610113531043030655 0ustar gregoagregoa/* * Copyright (C) 2004 TiongHiang Lee * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Email: thlee@onemindsoft.org */ package org.onemind.commons.invoke; import java.lang.reflect.Method; import org.onemind.commons.java.lang.reflect.ReflectUtils; import junit.framework.TestCase; /** * TODO comment * @author TiongHiang Lee (thlee@onemindsoft.org) * @version $Id: BenchmarkTest.java,v 1.2 2004/08/27 04:01:39 thlee Exp $ $Name: $ */ public class BenchmarkTest extends TestCase { private final MyObject obj = new MyObject(); private final Class argTypes[] = {}; private final Object args[] = {}; private final ReflectionWrapperInvocable invocable = new ReflectionWrapperInvocable(obj); private final ReflectionWrapperInvocable optimizedInvocable = new ReflectionWrapperInvocable(obj); public class MyObject { public void callMeALot() { //do nothing } } public void setUp() throws Exception { //have it initialized first to avoid penalty in wrapper call ReflectUtils.getClass("java.lang.Object"); optimizedInvocable.addFunction(new AbstractInvocableFunction("callMeALot") { /** * {@inheritDoc} */ public Object invoke(Object target, Object[] args) throws Exception { // TODO Auto-generated method stub ((MyObject) target).callMeALot(); return null; } }); } private long _callReflect(long iteration) throws Exception { long start = System.currentTimeMillis(); Method m = obj.getClass().getMethod("callMeALot", argTypes); for (int i = 0; i < iteration; i++) { m.invoke(obj, args); } return System.currentTimeMillis() - start; } private long _callInvoke(long iteration) throws Exception { long start = System.currentTimeMillis(); for (int i = 0; i < iteration; i++) { invocable.invoke("callMeALot", args); } return System.currentTimeMillis() - start; } private long _callInvokeOptimized(long iteration) throws Exception { long start = System.currentTimeMillis(); for (int i = 0; i < iteration; i++) { optimizedInvocable.invoke("callMeALot", args); } return System.currentTimeMillis() - start; } public void testInvoke() throws Exception { int iterationCount = 10000; long t1 = 0, t2 = 0, t3 = 0; for (int i=0; i commons-invoke-1.1.0+cvs20090227.orig/project.xml0000664000175000017500000000465010435413575020531 0ustar gregoagregoa 1 commons-invoke onemind-commons commons-invoke 1.1.0 Onemind 2004 org.onemind.commons.invoke /images/logo.gif The commons-invoke framework is a complimentary framework to the reflection. While reflection allow discovery/invocation of the java object through JVM kernel, the invocation framework allows programmatic help for method lookup and invocation. The commons-invoke framewokr http://onemind-commons.sourceforge.net/commons-invoke http://sourceforge.net/tracker/?group_id=114901 onemind-commons.sf.net /onemind-invoke http://onemind-commons.sourceforge.net maven scm:cvs:pserver:anonmouns@cvs.sf.net:/cvsroot/onemind-commons:commons-invoke http://cvs.sf.net/viewcvs.py/onemind-commons ${pom.name} Dev List ${pom.name} User List TiongHiang Lee thlee thlee@onemindsoft.org onemind-commons commons-java 1.3.0 src/java src/test **/*Test.java commons-invoke-1.1.0+cvs20090227.orig/.project0000664000175000017500000000110710101000177017756 0ustar gregoagregoa commons-invoke com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature com.atlassw.tools.eclipse.checkstyle.CheckstyleNature commons-invoke-1.1.0+cvs20090227.orig/docs/0000775000175000017500000000000011152062103017244 5ustar gregoagregoacommons-invoke-1.1.0+cvs20090227.orig/docs/TODO.txt0000664000175000017500000000026110113531311020547 0ustar gregoagregoaMechanism - Add introspection mechanism similar to bean introspection - Allow multiple function of same name (different args) in DefaultInvocable Module management Bug fix commons-invoke-1.1.0+cvs20090227.orig/docs/Changes.txt0000664000175000017500000000046410175107126021372 0ustar gregoagregoacommons-invoke-1.1.0 Jan 23, 2005; TiongHiang Lee (thlee@onemindsoft.org) - Refactor DefaultInvocable to AbstractInvocable commons-invoke-1.0.0 Aug 01, 2004; TiongHiang Lee (thlee@onemindsoft.org) - Fix AbstractInvocable.addFunction() to not exclude name since name is built into the function now. commons-invoke-1.1.0+cvs20090227.orig/docs/License.txt0000664000175000017500000000133210113405502021366 0ustar gregoagregoaCopyright (C) 2004 TiongHiang Lee This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA