[jboss-user] [JBoss Tools] - Re: Extending JBoss Server

Rob Stryker do-not-reply at jboss.com
Thu Jan 26 06:18:45 EST 2012


Rob Stryker [https://community.jboss.org/people/rob.stryker] created the discussion

"Re: Extending JBoss Server"

To view the discussion, visit: https://community.jboss.org/message/648830#648830

--------------------------------------------------------------
Hi Kamesh:

Right now the XPath model is a (should be public) singleton model. The API is fairly stable but of course we make no guarantees on it's long-term stability. We're not really geared at this time to extension. But, if you're willing to work through the problems, we'd be glad to help you as much as we can and accept any patches you have. 

First of all, just not registering as as7 is not your only problem. Even if your server were recognized as as7, it would then check the specific server type id, (as7? as71? eap6? all based on the server type id) and get a customized list of properties and xpaths. Obviously jboss as changes quite often, many times without enough notice to us, and so we have to change port xpaths between minor versions.  So even if we got rid of that pesky isAS7 method, we're still storing properties as defaulted from a file hidden inside our bundle. 

I have made some changes to our codebase just now to try to allow you a bit of an easier time at it. If your server type is custom for as71, then I suggest at your bundle startup, you do something like this:

XPathModel.addServerTypeToURLMapping("org.your.server.type.id", XPathModel.get("org.jboss.ide.eclipse.as.runtime.71"))

If your server type is in fact meant to be one server type for ALL of as7, then I am not sure we can help you. The infrastructure is set up such that each specific version of jboss gets a different set of ports as default. If you'd like to hand-craft your own port customizations, you can also do that. You would then need to register your own IServerLifecycleListener, and, when a new server of your type has been added, you would need to check for / find / or add the Ports category, and then add the queries by hand. 

You can do this entirely via API and hand-crafting your categories and queries, or, you can use a properties file such as we use. An example of the file is here:
 https://source.jboss.org/browse/JBossTools/trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.70.default.ports.properties?r=32275 https://source.jboss.org/browse/JBossTools/trunk/as/plugins/org.jboss.ide.eclipse.as.core/properties/jboss.70.default.ports.properties?r=32275

AN example of how you'd use it is something like:

ServerCore.addServerLifecycleListener(new IServerLifecycleListener() { 
    public void serverAdded(IServer server) {
        // find the port category
        XPathCategory c = XPathModel.getDefault().getCategory(server, "ports");
        // your own properties file url
        URL url = you.find.it.however..... // you can do this part
        XPathModel.addQueriesToCategoryFromDefaultFile(server, c, "", url);
        XPathModel.getDefault().save(server);
    }
});

These changes are available in svn now. Not sure what you're building off of. As always, these classes are still officially internal, but if you're willing to play ball, have at it  ;)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/648830#648830]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120126/18fe7bde/attachment-0001.html 


More information about the jboss-user mailing list