@Override
public void start(final StartContext startContext) throws StartException {
LOGGER.info("Activating Gravia Subsystem");
Runtime runtime = injectedRuntime.getValue();
ModuleContext syscontext = runtime.getModuleContext();
// Install and start this as a {@link Module}
ModuleClassLoader classLoader = (ModuleClassLoader) getClass().getClassLoader();
try {
URL extensionURL = null;
Enumeration<URL> resources = classLoader.getResources(JarFile.MANIFEST_NAME);
while (resources.hasMoreElements()) {
URL nextURL = resources.nextElement();
if (nextURL.getPath().contains("wildfly-extension")) {
extensionURL = nextURL;
break;
}
}
Manifest manifest = new Manifest(extensionURL.openStream());
Dictionary<String, String> headers = new ManifestHeadersProvider(manifest).getHeaders();
module = runtime.installModule(classLoader, headers);
// Attach the {@link ModuleEntriesProvider} so
ModuleEntriesProvider entriesProvider = new ClassLoaderEntriesProvider(module);
Attachable attachable = AbstractModule.assertAbstractModule(module);
attachable.putAttachment(AbstractModule.MODULE_ENTRIES_PROVIDER_KEY, entriesProvider);