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); }
public JMXRegistrationInfo provide( PicoContainer picoContainer, ComponentAdapter componentAdapter) { final Object _componentInstance = componentAdapter.getComponentInstance(picoContainer); try { final JMXManageable _manageable = (JMXManageable) _componentInstance; Exception _exception = null; try { // try to load XML XMBean Descriptor. String _clazzName = _manageable.getClass().getName().replace('.', '/'); URL _url = _manageable.getClass().getResource("/" + _clazzName + ".xml"); if (_url == null) { return fallback_.provide(picoContainer, componentAdapter); } final ObjectName _objectName = ObjectName.getInstance(domain_ + ":" + _manageable.getJMXObjectName()); final JMXManageableXMBean _xmbean = new JMXManageableXMBean(_manageable, _url); return new JMXRegistrationInfo(_objectName, _xmbean); } catch (MalformedObjectNameException e) { _exception = e; } catch (NotCompliantMBeanException e) { _exception = e; } catch (NullPointerException e) { _exception = e; } catch (MBeanException e) { _exception = e; } throw new JMXRegistrationException( "Cannot create MBean for component '" + componentAdapter.getComponentKey() + "'", _exception); } catch (ClassCastException e) { return null; } }
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); }