@Override public void unregisterContribution( Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception { if (GUARD_XP.equals(extensionPoint)) { GuardDescriptor gd = (GuardDescriptor) contribution; PermissionService.getInstance().unregisterGuard(gd.getId()); } else if (BINDING_XP.equals(extensionPoint)) { WebObjectBindingDescriptor binding = (WebObjectBindingDescriptor) contribution; engine.unregisterBinding(binding.type); } else if (APP_MAPPING_XP.equals(extensionPoint)) { engine.removeApplicationMapping((WebApplicationMapping) contribution); } else if (extensionPoint.equals(RENDERING_EXTENSION_XP)) { RenderingExtensionDescriptor fed = (RenderingExtensionDescriptor) contribution; engine.unregisterRenderingExtension(fed.name); } else if (extensionPoint.equals(INSTALL_XP)) { Installer installer = (Installer) contribution; installer.uninstall(contributor.getContext(), engine.getRootDirectory()); } else if (extensionPoint.equals(CONFIG_XP)) { ConfigurationFileDescriptor cfg = (ConfigurationFileDescriptor) contribution; if (cfg.path != null) { unloadConfiguration(new File(engine.getRootDirectory(), cfg.path)); } else if (cfg.entry != null) { throw new UnsupportedOperationException("Entry is not supported for now"); } else { log.error( "Neither path neither entry attribute was defined in the configuration extension. Ignoring"); } } }
@Override public void registerContribution( Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception { if (GUARD_XP.equals(extensionPoint)) { GuardDescriptor gd = (GuardDescriptor) contribution; PermissionService.getInstance().registerGuard(gd.getId(), gd.getGuard()); } else if (BINDING_XP.equals(extensionPoint)) { WebObjectBindingDescriptor binding = (WebObjectBindingDescriptor) contribution; engine.registerBinding(binding.type, binding.objectId); } else if (APP_MAPPING_XP.equals(extensionPoint)) { engine.addApplicationMapping((WebApplicationMapping) contribution); } else if (extensionPoint.equals(RENDERING_EXTENSION_XP)) { RenderingExtensionDescriptor fed = (RenderingExtensionDescriptor) contribution; try { engine.registerRenderingExtension(fed.name, fed.newInstance()); } catch (Exception e) { throw new RuntimeServiceException( "Deployment Error. Failed to contribute freemarker template extension: " + fed.name); } } else if (extensionPoint.equals(INSTALL_XP)) { Installer installer = (Installer) contribution; installer.install(contributor.getContext(), engine.getRootDirectory()); } else if (extensionPoint.equals(CONFIG_XP)) { ConfigurationFileDescriptor cfg = (ConfigurationFileDescriptor) contribution; if (cfg.path != null) { loadConfiguration( contributor.getContext(), new File(engine.getRootDirectory(), cfg.path), cfg.trackChanges); } else if (cfg.entry != null) { throw new UnsupportedOperationException("Entry is not supported for now"); } else { log.error( "Neither path neither entry attribute was defined in the configuration extension. Ignoring"); } } }