You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by Jakob Heidebrecht <Ja...@gmx.de> on 2005/06/15 10:11:21 UTC

Import classes from plugins

Hi,

I have written a special urlfilter,it imports net.nutch.net.PrefixURLFilter
and net.nutch.net.RegexURLFilter. 

Since nutch is at apache this two classes are plugins, so i wrote my
urlfilter as a plugin too.

I tried to import this two filters like: org.apache.nutch.net.RegexURLFilter
but I get a error at building with ant:

*** Semantic Error: The import "org/apache/nutch/net/RegexURLFilter" is not
valid, since it does not name a type in a package.

My question is: 
Can I import a class from a plugin? And how would I do that?

Regards
Jakob

-- 
Weitersagen: GMX DSL-Flatrates mit Tempo-Garantie!
Ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

Re: Import classes from plugins

Posted by Stefan Groschupf <sg...@media-style.com>.
You guys just need to define that the jars as exported in the one  
plugin.xml and then make your new plugins depending form the first  
plugin:

from the javadoc:

This class loader use all exported
    * libraries from the dependend plugins and all plugin libraries.

If it doesn't work like this than this is a bug.

Stefan

m 15.06.2005 um 17:20 schrieb Andy Liu:

> I've had this problem before.  What you can do is copy the regex url
> filter and prefix url filter jars over to the lib directory of your
> new plugin, and reference them in plugin.xml.
>
> It's kind of a hack, but it works.  I haven't been able to think of
> any other way to subclass plugin classes within this dynamic
> classloading plugin architecture.  Anybody else have any ideas?
>
> On 6/15/05, Jakob Heidebrecht <Ja...@gmx.de> wrote:
>
>>
>> Hi,
>>
>> I have written a special urlfilter,it imports  
>> net.nutch.net.PrefixURLFilter
>> and net.nutch.net.RegexURLFilter.
>>
>> Since nutch is at apache this two classes are plugins, so i wrote my
>> urlfilter as a plugin too.
>>
>> I tried to import this two filters like:  
>> org.apache.nutch.net.RegexURLFilter
>> but I get a error at building with ant:
>>
>> *** Semantic Error: The import "org/apache/nutch/net/ 
>> RegexURLFilter" is not
>> valid, since it does not name a type in a package.
>>
>> My question is:
>> Can I import a class from a plugin? And how would I do that?
>>
>> Regards
>> Jakob
>>
>> --
>> Weitersagen: GMX DSL-Flatrates mit Tempo-Garantie!
>> Ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl
>>
>>
>
>


Re: Import classes from plugins

Posted by Andy Liu <an...@gmail.com>.
I've had this problem before.  What you can do is copy the regex url
filter and prefix url filter jars over to the lib directory of your
new plugin, and reference them in plugin.xml.

It's kind of a hack, but it works.  I haven't been able to think of
any other way to subclass plugin classes within this dynamic
classloading plugin architecture.  Anybody else have any ideas?

On 6/15/05, Jakob Heidebrecht <Ja...@gmx.de> wrote:
> 
> Hi,
> 
> I have written a special urlfilter,it imports net.nutch.net.PrefixURLFilter
> and net.nutch.net.RegexURLFilter.
> 
> Since nutch is at apache this two classes are plugins, so i wrote my
> urlfilter as a plugin too.
> 
> I tried to import this two filters like: org.apache.nutch.net.RegexURLFilter
> but I get a error at building with ant:
> 
> *** Semantic Error: The import "org/apache/nutch/net/RegexURLFilter" is not
> valid, since it does not name a type in a package.
> 
> My question is:
> Can I import a class from a plugin? And how would I do that?
> 
> Regards
> Jakob
> 
> --
> Weitersagen: GMX DSL-Flatrates mit Tempo-Garantie!
> Ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl
>