On 10/08/2012 04:53 PM, Rob Stryker wrote:
>> Rationalising the teiid jar dependencies, I have noticed that I can depend the
teiid_embedded_query
>> plugin on the following. This removes all jboss.as dependencies except for
jboss-as-cli.jar
>> * org.jboss.ide.eclipse.as.management.as71
> hmm - that sounds wrong - as.management.as71 are not guaranteed to be available/the
correct one to use.
>
This *IS* weird, and I suspect it is not the correct way to do things.
Almost no plugins should ever depend directly on as.management.as71, and
by almost, i mean exactly none.
They may require the feature (and plugin) be present, but they should
have no compile time dependencies against the plugin.
So the as.management.as71 plugin happens to export the jboss-as jar libraries, which teiid
8.2 was
compiled against. See teiid's pom.xml for details of version dependencies.
https://github.com/teiid/teiid/blob/master/pom.xml
The correct way to do this is to depend on
org.jboss.ide.eclipse.as.dmr.
This is a simple wrapper for the DMR jboss-as logic which allows you to
build remote management requests.
Unfortunately, due to classloading issues, we can't just give the caller
a ModelNode reference. Actually we can, right now, but if AS-8 or any
other version of AS ever requires a new management api (and I am QUITE
sure they will), this will break 100 different ways.
So, the expected thing you should be doing is to depend on
org.jboss.ide.eclipse.as.dmr, and do something like the following:
private String createResourceRequest() {
ModelNode request = new ModelNode();
request.get(OP).set(READ_RESOURCE_OPERATION);
// blah blah blah make more model node request
return request.toJSONString(true);
}
Once it's available as a JSON string, you should do the following:
String resultJSON = JBoss7ManagerUtil.executeWithService(new
JBoss7ManagerUtil.IServiceAware<String>() {
public String execute(IJBoss7ManagerService service) throws
Exception {
return service.execute(new
AS7ManagementDetails(getServer()), createResourceRequest());
}
}, getServer());
This will require you to have org.jboss.ide.eclipse.as.core on your
classpath. The as.core plugin will search for a service interface that
fits the given version of the server (ie for a while we had two
different implementers, one for as7 and one for as7.1. Appserver team
eventually fixed the broken backwards compatability and so the other was
removed.)
If you guys are doing something that doesn't involve wtp IServer objects
at all, and can't use the constructor for AS7ManagementDetails, you can
always fill out the interface in your own way via IAS7ManagementDetails
I'll try to get a wiki page up to demonstrate this, and maybe an example
plugin if possible.
So I have used this logic in TD for directly finding if a teiid server is installed. Once
we have
found that teiid server, we delegate to the teiid client Admin API for all our requests.
The teiid
admin api comes from the teiid jars that is that concern of this thread. If teiid requires
these
libraries then we just need them and delegate to teiid's admin interfaces.
PGR
--
Paul Richardson
* p.g.richardson(a)phantomjinx.co.uk
* p.g.richardson(a)redhat.com
* pgrichardson(a)linux.com
"I know exactly who reads the papers ...
* The Daily Mirror is read by people who think they run the country.
* The Guardian is read by people who think they ought to run the country.
* The Times is read by people who do actually run the country.
* The Daily Mail is read by the wives of the people who run the country.
* The Financial Times is read by the people who own the country.
* The Morning Star is read by the people who think the country ought to be run by
another country.
* The Daily Telegraph is read by the people who think it is."
Jim Hacker, Yes Minister