@Override public <T> T getAttachment(AttachmentKey<T> key) { return attachments.getAttachment(key); }
@Override public <T> boolean hasAttachment(AttachmentKey<T> key) { return attachments.hasAttachment(key); }
@Override public <T> T putAttachment(AttachmentKey<T> key, T value) { return attachments.putAttachment(key, value); }
@Override public <T> T removeAttachment(AttachmentKey<T> key) { return attachments.removeAttachment(key); }
@Override public <T> T removeAttachment(AttachmentKey<T> key) { return getAttachmentsInternal().getAttachment(key); }
@Override public <T> boolean hasAttachment(AttachmentKey<T> key) { return getAttachmentsInternal().hasAttachment(key); }
@Override public <T> T putAttachment(AttachmentKey<T> key, T value) { return getAttachmentsInternal().putAttachment(key, value); }
@Override public <T> T getAttachment(AttachmentKey<T> key) { return getAttachmentsInternal().getAttachment(key); }
@Override public final Module installModule(ClassLoader classLoader, Resource resource, Dictionary<String, String> headers, Attachable context) throws ModuleException { assertNoShutdown(); context = context != null ? context : new AttachableSupport(); AbstractModule module = createModule(classLoader, resource, headers, context); // Attach the {@link ModuleEntriesProvider} ModuleEntriesProvider entriesProvider = context.getAttachment(AbstractModule.MODULE_ENTRIES_PROVIDER_KEY); entriesProvider = entriesProvider != null ? entriesProvider : getDefaultEntriesProvider(module, context); if (entriesProvider != null) { module.putAttachment(AbstractModule.MODULE_ENTRIES_PROVIDER_KEY, entriesProvider); } if (getModule(module.getIdentity()) != null) throw new ModuleException("Module already installed: " + module); modules.put(module.getModuleId(), module); // #1 The module's state is set to {@code INSTALLED}. module.setState(State.INSTALLED); // #2 A module event of type {@link ModuleEvent#INSTALLED} is fired. runtimeEvents.fireModuleEvent(module, ModuleEvent.INSTALLED); LOGGER.info("Installed: {}", module); return module; }