Search code examples
javanetbeansmoduleencapsulationnetbeans-platform

make a module's xml layer visible to other modules


In Netbeans Platform I'm having one module watch the xml filesystem and respond when it's changed by other modules.

I've created a layer.xml in another module. The changes show up in the IDE when in the watching module I click on XML layer node and open up . However during runtime when the watching module is looking at the xml filesystem the changes from the other module aren't there. The other module can see its own changes during runtime.

Is there a setting somewhere for a module that lets other modules see its xml layer?

This is the code I'm using to inspect the xml filesystem during runtime - it prints the names of all nodes into a file, and I trigger it from a button when all modules are open and running.

private void btn1ActionPerformed(java.awt.event.ActionEvent evt)                                      
{                                       
    try {
        BufferedWriter writer = Files.newBufferedWriter(Paths.get("filesystemOut.txt"), Charset.forName("UTF-8"));
        exportFilesystem(FileUtil.getConfigRoot(), writer, 0);
        writer.close();
    } catch (IOException e) {
        System.err.println("couldn't write filesystem structure");
    }
}

void exportFilesystem(FileObject root, BufferedWriter writer, int depth) throws IOException
{
    for (int i = 0; i < depth * 4; ++i)
    {
        writer.write(' ');
    }
    writer.write(root.getName());
    writer.newLine();
    FileObject[] children = root.getChildren();
    for (FileObject child : children)
    {
        exportFilesystem(child, writer, depth + 1);
    }
}    

Solution

  • Open the properties dialog of the module with the xml layer that needs to be visible. Select API Versioning and under Public packages select the package that contains the xml file. Click OK.