From 52a455616e4077b5b61823cb4765c02fc6866f9a Mon Sep 17 00:00:00 2001 From: chiba Date: Wed, 11 Jan 2006 06:06:30 +0000 Subject: restructred sub packages git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@233 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- sample/duplicate/DuplicatedObject.java | 2 +- sample/duplicate/Main.java | 8 ++++---- sample/evolve/DemoServer.java | 2 +- sample/evolve/Evolution.java | 6 +++--- sample/evolve/VersionManager.java | 2 +- sample/hotswap/Test.java | 2 +- sample/reflect/Main.java | 6 +++--- sample/reflect/Person.java | 4 ++-- sample/reflect/VerboseMetaobj.java | 2 +- sample/rmi/CountApplet.java | 6 +++--- sample/rmi/Counter.java | 2 +- sample/rmi/start.html | 2 +- sample/rmi/webdemo.html | 8 ++++---- 13 files changed, 26 insertions(+), 26 deletions(-) (limited to 'sample') diff --git a/sample/duplicate/DuplicatedObject.java b/sample/duplicate/DuplicatedObject.java index 5995abcc..7161493c 100644 --- a/sample/duplicate/DuplicatedObject.java +++ b/sample/duplicate/DuplicatedObject.java @@ -1,6 +1,6 @@ package sample.duplicate; -import javassist.reflect.*; +import javassist.tools.reflect.*; public class DuplicatedObject extends Metaobject { private DuplicatedObject backup; diff --git a/sample/duplicate/Main.java b/sample/duplicate/Main.java index e152a23e..064f13cd 100644 --- a/sample/duplicate/Main.java +++ b/sample/duplicate/Main.java @@ -3,7 +3,7 @@ package sample.duplicate; /* Runtime metaobject (JDK 1.2 or later only). - With the javassist.reflect package, the users can attach a metaobject + With the javassist.tools.reflect package, the users can attach a metaobject to an object. The metaobject can control the behavior of the object. For example, you can implement fault tolerancy with this ability. One of the implementation techniques of fault tolernacy is to make a copy @@ -30,15 +30,15 @@ package sample.duplicate; % java sample.duplicate.Main You would see two balls in a window. This is because - sample.duplicate.Viewer is loaded by javassist.reflect.Loader so that + sample.duplicate.Viewer is loaded by javassist.tools.reflect.Loader so that a metaobject would be attached. */ public class Main { public static void main(String[] args) throws Throwable { - javassist.reflect.Loader cl = new javassist.reflect.Loader(); + javassist.tools.reflect.Loader cl = new javassist.tools.reflect.Loader(); cl.makeReflective("sample.duplicate.Ball", "sample.duplicate.DuplicatedObject", - "javassist.reflect.ClassMetaobject"); + "javassist.tools.reflect.ClassMetaobject"); cl.run("sample.duplicate.Viewer", args); } } diff --git a/sample/evolve/DemoServer.java b/sample/evolve/DemoServer.java index dd64c550..b334bccb 100644 --- a/sample/evolve/DemoServer.java +++ b/sample/evolve/DemoServer.java @@ -1,6 +1,6 @@ package sample.evolve; -import javassist.web.*; +import javassist.tools.web.*; import java.io.*; /** diff --git a/sample/evolve/Evolution.java b/sample/evolve/Evolution.java index ecae0921..e804ff46 100644 --- a/sample/evolve/Evolution.java +++ b/sample/evolve/Evolution.java @@ -60,9 +60,9 @@ public class Evolution implements Translator { private void onLoadUpdatable(String classname) throws NotFoundException, CannotCompileException { // if the class is a concrete class, - // classname is $. + // classname is $$. - int i = classname.lastIndexOf('$'); + int i = classname.lastIndexOf("$$"); if (i <= 0) return; @@ -72,7 +72,7 @@ public class Evolution implements Translator { int version; try { - version = Integer.parseInt(classname.substring(i + 1)); + version = Integer.parseInt(classname.substring(i + 2)); } catch (NumberFormatException e) { throw new NotFoundException(classname, e); diff --git a/sample/evolve/VersionManager.java b/sample/evolve/VersionManager.java index 184397fd..efecee19 100644 --- a/sample/evolve/VersionManager.java +++ b/sample/evolve/VersionManager.java @@ -41,7 +41,7 @@ public class VersionManager { else version = ((Integer)found).intValue() + 1; - Class c = Class.forName(qualifiedClassname + '$' + version); + Class c = Class.forName(qualifiedClassname + "$$" + version); versionNo.put(qualifiedClassname, new Integer(version)); return c; } diff --git a/sample/hotswap/Test.java b/sample/hotswap/Test.java index e15afc9a..651d2184 100644 --- a/sample/hotswap/Test.java +++ b/sample/hotswap/Test.java @@ -1,5 +1,5 @@ import java.io.*; -import javassist.tools.HotSwapper; +import javassist.util.HotSwapper; public class Test { public static void main(String[] args) throws Exception { diff --git a/sample/reflect/Main.java b/sample/reflect/Main.java index d9733abc..972e8964 100644 --- a/sample/reflect/Main.java +++ b/sample/reflect/Main.java @@ -1,6 +1,6 @@ package sample.reflect; -import javassist.reflect.Loader; +import javassist.tools.reflect.Loader; /* The "verbose metaobject" example (JDK 1.2 or later only). @@ -14,7 +14,7 @@ import javassist.reflect.Loader; To run, - % java javassist.reflect.Loader sample.reflect.Main Joe + % java javassist.tools.reflect.Loader sample.reflect.Main Joe Compare this result with that of the regular execution without reflection: @@ -25,7 +25,7 @@ public class Main { Loader cl = (Loader)Main.class.getClassLoader(); cl.makeReflective("sample.reflect.Person", "sample.reflect.VerboseMetaobj", - "javassist.reflect.ClassMetaobject"); + "javassist.tools.reflect.ClassMetaobject"); cl.run("sample.reflect.Person", args); } diff --git a/sample/reflect/Person.java b/sample/reflect/Person.java index 445d3807..90ccb18f 100644 --- a/sample/reflect/Person.java +++ b/sample/reflect/Person.java @@ -4,8 +4,8 @@ package sample.reflect; -import javassist.reflect.Metalevel; -import javassist.reflect.Metaobject; +import javassist.tools.reflect.Metalevel; +import javassist.tools.reflect.Metaobject; public class Person { public String name; diff --git a/sample/reflect/VerboseMetaobj.java b/sample/reflect/VerboseMetaobj.java index 91dba579..cc47999c 100644 --- a/sample/reflect/VerboseMetaobj.java +++ b/sample/reflect/VerboseMetaobj.java @@ -1,6 +1,6 @@ package sample.reflect; -import javassist.reflect.*; +import javassist.tools.reflect.*; public class VerboseMetaobj extends Metaobject { public VerboseMetaobj(Object self, Object[] args) { diff --git a/sample/rmi/CountApplet.java b/sample/rmi/CountApplet.java index 0bebdaf9..e4ee0ee2 100644 --- a/sample/rmi/CountApplet.java +++ b/sample/rmi/CountApplet.java @@ -3,9 +3,9 @@ package sample.rmi; import java.applet.*; import java.awt.*; import java.awt.event.*; -import javassist.rmi.ObjectImporter; -import javassist.rmi.ObjectNotFoundException; -import javassist.web.Viewer; +import javassist.tools.rmi.ObjectImporter; +import javassist.tools.rmi.ObjectNotFoundException; +import javassist.tools.web.Viewer; public class CountApplet extends Applet implements ActionListener { private Font font; diff --git a/sample/rmi/Counter.java b/sample/rmi/Counter.java index f8a0fcf5..0920ca73 100644 --- a/sample/rmi/Counter.java +++ b/sample/rmi/Counter.java @@ -1,6 +1,6 @@ package sample.rmi; -import javassist.rmi.AppletServer; +import javassist.tools.rmi.AppletServer; import java.io.IOException; import javassist.CannotCompileException; import javassist.NotFoundException; diff --git a/sample/rmi/start.html b/sample/rmi/start.html index 696b629c..33321ad1 100644 --- a/sample/rmi/start.html +++ b/sample/rmi/start.html @@ -12,4 +12,4 @@ Start!

If you don't want to use a web browser, do as follows: -

    % java javassist.web.Viewer localhost 5001 sample.rmi.CountApplet
+
    % java javassist.tools.web.Viewer localhost 5001 sample.rmi.CountApplet
diff --git a/sample/rmi/webdemo.html b/sample/rmi/webdemo.html index d313ec3c..a2b595ce 100644 --- a/sample/rmi/webdemo.html +++ b/sample/rmi/webdemo.html @@ -6,7 +6,7 @@ local object. The applet can communicate through a socket with the host that executes the web server distributing that applet. However, the applet cannot directly call a method on an object if the object is -on a remote host. The javassist.rmi package provides +on a remote host. The javassist.tools.rmi package provides a mechanism for the applet to transparently access the remote object. The rules that the applet must be subject to are simpler than the standard Java RMI. @@ -36,7 +36,7 @@ Look at the lines shown with red:

Figure 1: Applet

-import javassist.rmi.ObjectImporter;
+import javassist.tools.rmi.ObjectImporter;
 
 public class CountApplet extends Applet implements ActionListener {
   private Font font;
@@ -106,7 +106,7 @@ public class Counter {
 }
 
-

Note that the javassist.rmi package does not require +

Note that the javassist.tools.rmi package does not require the Counter class to be an interface unlike the Java RMI, with which Counter must be an interface and it must be implemented by another class. @@ -167,7 +167,7 @@ following features:

With the Java RMI or Voyager, the applet programmer must define an interface for every remote object class and access the remote object through that interface. -On the other hand, the javassist.rmi package does not +On the other hand, the javassist.tools.rmi package does not require the programmer to follow that programming convention. It is suitable for writing simple distributed programs like applets. -- cgit v1.2.3