Re: adding a new filter

Hello,

> The filter class just has to be in the classpath. Jigsaw keeps a list of 
> the installed filters in the 
> JIGSAW_HOME\Jigsaw\config\jigadmin.zip\frames.p file but it is used just 
> for creating the drop-down list when you add a filter. If you don't want 
> to edit this file every time you add/remove a filter you can simply 
> write down the name of your class (e.g. FiltersPackage.MyFilter) instead 
> of choosing one from the list.

Wonderful, thanks for your reply :).

> As far as the dynamic adding or removing of filter classes is concerned, 
> it is more a "java" issue than a "Jigsaw" issue. As far as I know (but 
> without being absolutely certain) java cannot load classes that did not 
> exist in its classpath when the JVM started. You will have to modify 
> (override, wrap) java?s class loader in order to achieve this. Even if 
> you succeed in this, you will have to pay big attention in whether the 
> JVM has already loaded in memory your class when you modify it.

It supports it via the Classloader interface. You can load a class
(providing a class name and it's bytecode) to the classloader. After you
load it, you can use it by using Class.forname and instantiating that
class. You can make a factory to take care of this for you.

> I can't see though, why would you ever need to do such a thing. You can 
> always add and remove already compiled filters through jigadmin. In a 
> production environment you don't change your software every now and 
> then, in a testing environment you don't care if the server restarts. 
> Where do you find this useful?

I'm doing a pet project of mine, where I try to prove, that "live"
content filtering is possible. I sit down behind a "content-filter"
(Jigsaw in this case) and I add and remove filters. But when playing
with jigsaw, I found that this would be more problematic, so I'll write
a generic filter implementing simple "networked" filtering api. This
way, I don't have to change or restart Jigsaw, I just have one simple
"wrapper" filter. And I can also change proxy server/content filter (for
example for Muffin), so my project does not depend on particular server. 

Of course, for general use (as a web or proxy server), this should not
be required. What would be wonderful, on the other side, is to have a
way to do a "graceful" restart (such as apache). I don't know if this
will be possible with current implementation. I mean a restart, in which
all "threads" restart themselves, when they are not serving any data.
But you would somehow have to restart the java core somehow, so this is
probably not possible with graceful restart.

BTW: I was playing with changing Jigadmin's GUI from Swing to SwingWT, has
anyone succeeded in this? I found, that there are some classes, that are
not implemented in SwingWT yet. SWT is much more responsive than Swing
implementations, at least on Mac OS X, when I do this.

 Have a nice day,

  Juraj.

P.S.: Please keep the Cc: to me when you reply :). Thanks.

Received on Sunday, 4 July 2004 05:38:25 UTC