Hello,
I want to check, wether FME is installed (works) and wether the FME-Licence is checked or not (does not work).
I did noh find an example in Java, but all other examples manage the problem
by casting IExtension to IExtensionConfig and using the method getState(UID).
In the ArcObjects Java SDK is also said "use QI from IExtension to IExtensionConfig".
QI means "casting" or am I wrong?
I allways get the error "IExtensionProxy can not be cast to IExtensionConfig".
Why do I have a proxy-object?! Causes the proxy the problem?
How can I avoid to have a proxy-object?
Has anybody an idea?
Greeetings,
Petra
private boolean FMELicense() {
boolean isActivated = false;
try {
IUID fmeUID = new UID();
fmeUID.setValue("{D5E016E9-171B-45CA-B4A2-6361DBC1E255}");
IExtensionManager extensionMgr = new ExtensionManager();
extensionMgr = (IExtensionManager) app;
IExtension fmeExtension = extensionMgr.findExtension(fmeUID);
if (fmeExtension == null) {
isActivated = false;
Util.addToLog("Fehler: FME-Lizenz ist nicht vorhanden...");
} else {
Util.addToLog("fmeExtension.getClass() = " + fmeExtension.getClass().getName());
Util.addToLog("FME-Lizenz vorhanden...");
Util.addToLog("vor extensionConf = ...");
IExtensionConfig extensionConf = (IExtensionConfig) app.findExtensionByCLSID(fmeUID); // does not work..
Util.addToLog("nach extensionConf = ...");
if (extensionConf.getState() == esriExtensionState.esriESEnabled) {
isActivated = true;
}
else {
isActivated = false;
Util.addToLog("Fehler: FME-Lizenz ist nicht aktiviert...");
}
}
} catch (IOException e) {
Util.printStackTraceToLog(e);
}
return isActivated;
}