Re: [xml-dev] module loader dependent on XMLDataObject

Petr Kuzel <[email protected]> Fri, 07 Mar 2003 20:58:28 +0100
Newsgroups gmane.comp.java.netbeans.modules.xml.devel
Organization CollabNet Hosting
Message-ID <[email protected]>
Hi Rich,

you need to update manifest to use implementation dependency:

  OpenIDE-Module-Module-Dependencies:  org.netbeans.modules.xml.tools/1
  > 0.8, org.netbeans.modules.xml.tree/1 > 0.8,
  org.netbeans.modules.xml.core/1 = YYMMDD

where YYMMDD is actual xml/core build number. Check public
packages declaration in xml/core manifest. It refers to
classes that are considered as API of the module with given
specification version (and higher). All other packages/classes
are accessible only by friend modules. A friend module can afford 
implementation dependency. You could create a list of classes what
you need and I'll consider to turn them into API.

That's fine to have separate data loader. XMLSchema and XSL
data objects use the same approach. I has two advantages
and one disadvantage:
  + user can change loaders order under options : object types
  + XML core module need not to contain secondary
    classifier (loader) subsystem and its UI (the options)
  - every new subtype requires extra classes (invalid
    once DataLoader would not be required to be a singleton)
  [Jesse could extend it :-)]  


  Hope it helps
  Cc.

PS: How are you getting on with the options CNFE in xml/tree?

Rich Unger wrote:

> I'm porting my modules to 3.5, and I've got a module with a data
> loader declared in the manifest:
> 
> OpenIDE-Module-Module-Dependencies:  org.netbeans.modules.xml.tools/1
>> 0.8, org.netbeans.modules.xml.tree/1 > 0.8,
> org.netbeans.modules.xml.core/1 > 0.8
> 
> Name: com/nuance/tools/grxml/GrXMLDataLoader.class
> OpenIDE-Module-Class: Loader
> Install-Before: org.netbeans.modules.xml.core.XMLDataObject
> 
> The GrXMLDataLoader looks like:
> 
> public class GrXMLDataLoader extends UniFileLoader
> {
>     public GrXMLDataLoader() {
>         this(org.netbeans.modules.xml.core.XMLDataObject.class);
>     }
>     protected MultiDataObject createMultiObject (FileObject
> primaryFile)
>         throws DataObjectExistsException
>     {
>         return new
> org.netbeans.modules.xml.core.XMLDataObject(primaryFile, this);
>     }
>     ...
> }
> 
> This works fine in 3.4.1, but when I load the module in the dev
> builds, I get:
> 
> [org.netbeans.core.modules] *********** Exception occurred
> ************ at Fri Mar 07 11:15:03 PST 2003
> 
> java.lang.ClassNotFoundException: java.lang.NoClassDefFoundError:
> org/netbeans/modules/xml/core/XMLDataObject
> at
> 
org.netbeans.core.modules.ManifestSection.getInstance(ManifestSection.java:197)
> at
> org.netbeans.core.LoaderPoolNode.add(LoaderPoolNode.java:144)
> at
> 
org.netbeans.core.modules.NbInstaller.loadLoaderSection(NbInstaller.java:515)
> at
> org.netbeans.core.modules.NbInstaller.loadSections(NbInstaller.java:411)
> at
> org.netbeans.core.modules.NbInstaller.load(NbInstaller.java:227)
> at
> org.netbeans.core.modules.ModuleManager.enable(ModuleManager.java:847)
> at
> 
org.netbeans.core.ui.ModuleBean$AllModulesBean.doEnable(ModuleBean.java:732)
> at
> 
org.netbeans.core.ui.ModuleBean$AllModulesBean.access$900(ModuleBean.java:294)
> at
> 
org.netbeans.core.ui.ModuleBean$AllModulesBean$Updater.run(ModuleBean.java:563)
> at org.openide.util.Mutex.writeAccess(Mutex.java:336)
> at
> 
org.netbeans.core.ui.ModuleBean$AllModulesBean$Updater.run(ModuleBean.java:492)
> at org.openide.util.Task.run(Task.java:136)
> at
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328)
> at
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:668)
> 
> Caused by: java.lang.NoClassDefFoundError:
> org/netbeans/modules/xml/core/XMLDataObject
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at
> java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
> at java.lang.Class.getConstructor0(Class.java:1762)
> at java.lang.Class.getDeclaredConstructor(Class.java:1268)
> at
> 
org.openide.util.SharedClassObject.createInstancePrivileged(SharedClassObject.java:524)
> at
> 
org.openide.util.SharedClassObject$SetAccessibleAction.run(SharedClassObject.java:907)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.openide.util.SharedClassObject.findObject(SharedClassObject.java:449)
> at
> 
org.netbeans.core.modules.ManifestSection.createInstance(ManifestSection.java:173)
> at
> 
org.netbeans.core.modules.ManifestSection.getInstance(ManifestSection.java:191)
> 
> [catch] ... 13 more
> 
> ==>
> Turning on modules:
> com.nuance.tools.grxml.edit/1 [0.9.0.5 200303071114]
> 
> By the way, the whole reason I have a separate DataLoader for my GrXML
> data type is to associate the .grxml file extension with the XML mime
> type, and to add some GrXML-specific node actions to the DataNode.
> 
> Thanks,
> Rich
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]