public void unregisterExtension(String pluginName, Element extensionElement) { String epName = extractEPName(extensionElement); if (!myExtensionElement2extension.containsKey(extensionElement)) { XMLOutputter xmlOutputter = new XMLOutputter(); Format format = Format.getCompactFormat().setIndent(" ").setTextMode(Format.TextMode.NORMALIZE); xmlOutputter.setFormat(format); StringWriter stringWriter = new StringWriter(); try { xmlOutputter.output(extensionElement, stringWriter); } catch (IOException e) { throw new RuntimeException(e); } myLogger.warn(stringWriter.toString()); throw new IllegalArgumentException( "Trying to unregister extension element that was never registered"); } ExtensionComponentAdapter adapter = myExtensionElement2extension.remove(extensionElement); if (adapter == null) return; if (getExtensionPoint(epName).unregisterComponentAdapter(adapter)) { MutablePicoContainer pluginContainer = internalGetPluginContainer(); pluginContainer.unregisterComponent(adapter.getComponentKey()); if (pluginContainer.getComponentAdapters().isEmpty()) { disposePluginContainer(pluginName); } } }
public Set keySet() { Set<Object> set = new HashSet<Object>(); Collection<ComponentAdapter<?>> adapters = mutablePicoContainer.getComponentAdapters(); for (final ComponentAdapter<?> adapter : adapters) { set.add(adapter.getComponentKey()); } return Collections.unmodifiableSet(set); }
/** * {@inheritDoc} * * @param componentType * @return List of ComponentAdapters * @see org.picocontainer.PicoContainer#getComponentAdapters(java.lang.Class) */ public <T> List<ComponentAdapter<T>> getComponentAdapters(final Class<T> componentType) { if (logger.isDebugEnabled()) { logger.debug( "Grabbing all component adapters for container: " + delegate + " of type: " + componentType.getName()); } return delegate.getComponentAdapters(componentType); }
public <T> List<ComponentAdapter<T>> getComponentAdapters( final Class<T> componentType, final Class<? extends Annotation> binding) { if (logger.isDebugEnabled()) { logger.debug( "Grabbing all component adapters for container: " + delegate + " of type: " + componentType.getName() + ", binding:" + binding.getName()); } return delegate.getComponentAdapters(componentType, binding); }
public Set entrySet() { Set<Entry> set = new HashSet<Entry>(); Collection<ComponentAdapter<?>> adapters = mutablePicoContainer.getComponentAdapters(); for (ComponentAdapter<?> adapter : adapters) { final Object key = adapter.getComponentKey(); final Object component = mutablePicoContainer.getComponent(key); set.add( new Entry() { public Object getKey() { return key; } public Object getValue() { return component; } public Object setValue(final Object value) { throw new UnsupportedOperationException("Cannot set addComponent"); } }); } return Collections.unmodifiableSet(set); }
/** * {@inheritDoc} * * @return Collection or null. * @see org.picocontainer.PicoContainer#getComponentAdapters() */ public Collection<ComponentAdapter<?>> getComponentAdapters() { if (logger.isDebugEnabled()) { logger.debug("Grabbing all component adapters for container: " + delegate); } return delegate.getComponentAdapters(); }
public boolean isEmpty() { return mutablePicoContainer.getComponentAdapters().size() == 0; }
public int size() { return mutablePicoContainer.getComponentAdapters().size(); }