Modifier and Type | Field and Description |
---|---|
static String |
JBOSSMODULE
Jboss module binding method.
|
Constructor and Description |
---|
ConfigBindingsMethods() |
public static final String JBOSSMODULE
package extension1;
public class MyExtension implements Extension {
private void doInit(ExtMap input, ExtMap output) {
input.<ExtMap> get(Base.InvokeKeys.CONTEXT).mput(
Base.ContextKeys.AUTHOR,
"The oVirt Project"
).mput(
Base.ContextKeys.EXTENSION_NAME,
"Extension Java Example"
).mput(
Base.ContextKeys.LICENSE,
"ASL 2.0"
).mput(
Base.ContextKeys.HOME_URL,
"http://www.ovirt.org"
).mput(
Base.ContextKeys.VERSION,
"0.0.0"
);
}
\@Override
public void invoke(ExtMap input, ExtMap output) {
try {
if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.LOAD)) {
doLoad(input, output);
} else if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.INITIALIZE)) {
doInit(input, output);
} else {
output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.UNSUPPORTED);
}
output.putIfAbsent(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS);
} catch (Exception e) {
output.mput(
Base.InvokeKeys.RESULT,
Base.InvokeResult.FAILED
).mput(
Base.InvokeKeys.MESSAGE,
e.getMessage()
);
}
}
}
To publish the extension within the module, the
META-INF/services/org.ovirt.engine.api.extensions.Extension resource with
list of implementations must be added to module jar. For example:
extension1.MyExtension
Example of module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="extension1">
<resources>
<resource-root path="extension1.jar"/>
</resources>
<dependencies>
<module name="org.ovirt.engine.api.ovirt-engine-extensions-api"/>
</dependencies>
</module>
Copyright © 2016. All Rights Reserved.