well .. if there would be a possibility to define a custom class loader 
this would enable an extension to load its own jars circumventing 
conflicts with possible existing other versions of a library used by 
jump or another extension. a nice feature from my point of view.

problem is: as far as i understand _all jars_ in 'ext' and its 
subfolders currently get included in the default classloaders classpath 
by the extension manager in order to find an initialize the plugins. 
anybody knows if this is still true? so to avoid conflicts currently 
have to be put outside of 'ext'. don't know any extension doing so by now.

in the end: custom classloaders really help to seperate 
plugins/extensions from each other, thus preventing problems. also it 
makes fiddling with the startup script (classloader var) obsolete, 
making extension installation more user friendly (why should users care 
about the classpath?).

anyway while writing the gt2readerwrite extension i experimented with a 
custom classloader to find all available gt2 io modules. see this

SNIP-->
    /**
     * This is thought of as a way to dynamically load the gt2 
readerwriter modules
     * from a directory of choice. this way they don't have reside in 
the general classpath
     * but can be put in separate directory.
     * <p>
     * The property "user.dir" works for windows, i doubt it'll do for 
linux/unix.
     * </p>
     *
     * @return a classloader object, containing all available jars in 
the specified directory
     */
    public static ClassLoader createLoader(){
            final String SEP = System.getProperty("file.separator");
            String mod_dir = SEP+"lib"+SEP+"ext"+SEP+"readwrite";
            File workingDir = new File(System.getProperty("user.dir"));
           
            System.out.println("Working Dir: "+workingDir.getPath());
           
           
            File extensionDir = new File(workingDir.getPath()+mod_dir);
            if (!extensionDir.exists())
                extensionDir = new 
File(workingDir.getPath()+SEP+".."+mod_dir);
           
            System.out.println("Extension Dir: 
"+extensionDir.getPath());           
           
            File[] entries = extensionDir.listFiles();
            Collection urls = new Vector();
            try {
                urls.add(extensionDir.toURL());
            } catch (MalformedURLException e1) {}
            for (int i = 0; entries != null && i < entries.length; i++) {
                try {
                    urls.add(entries[i].toURL());
                } catch (MalformedURLException e) { e.printStackTrace(); }
            }
           
            System.out.println("ExtDir contains: "+urls.toString());
       
            return new URLClassLoader((URL[])urls.toArray(new URL[]{}));   
    }
<--SNIP

regards ede
--

Paul Austin wrote:
> It's OK I found a work around, I agree if we don't have to mess with
> classloaders then we shouldn't
>
> Paul
>
> Paul Austin wrote:
>   
>> Right now the class loader used for loading extension classes does not
>> have a parent class loader set see
>> com.vividsolutions.jump.workbench.plugin.PlugInManager.
>>
>> I think that it should have a parent and it be set to the class loader
>> of the PlugInManager class (which is the system class path).
>>
>> Can anyone see any issues with doing this?
>>
>> Paul
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>   
>>     
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>   


-- 
public class WhoDidIt{ // A comment. I love comments 
  private static Person sender;

  public static void main (String[] foo){

  sender = new Person();
  sender.setName(new String[]{"Edgar", "Soldin"});

  Address address = new Address();
  address.setStreet("Stadtweg 119");
  address.setZip(39116);
  address.setCity("Magdeburg");
  address.setCountry("Germany");

  sender.setAddress(address);

  sender.setMobilePhone(" +49(0)171-2782880 ");
  sender.setWebSiteUrl(" http://www.soldin.de ");
  sender.setEmail(" [EMAIL PROTECTED] ");
  sender.setPGPPublicKey(" http://www.soldin.de/edgar_soldin.asc ");
  sender.setGender(true);

  System.out.println(sender.toString());
  }
}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to