public void addComponentDescriptor( ComponentDescriptor componentDescriptor ) throws ComponentRepositoryException { try { validateComponentDescriptor( componentDescriptor ); } catch ( ComponentImplementationNotFoundException e ) { throw new ComponentRepositoryException( "Component descriptor validation failed: ", e ); } Map maps = componentRealmDescriptorMaps.getRealmMap( componentDescriptor.getRealmId() ); String role = componentDescriptor.getRole(); String roleHint = componentDescriptor.getRoleHint(); Map map = (Map) maps.get( role ); if ( map == null ) { map = new HashMap(); maps.put( role, map ); } map.put( roleHint, componentDescriptor ); try { compositionResolver.addComponentDescriptor( componentDescriptor ); } catch ( CompositionException e ) { throw new ComponentRepositoryException( e.getMessage(), e ); } }
public void customize(PlexusContainer plexusContainer) { try { ComponentDescriptor desc = new ComponentDescriptor(); desc.setRole(TransferListener.class.getName()); plexusContainer.addComponentDescriptor(desc); desc.setImplementation("org.codehaus.mevenide.netbeans.embedder.exec.ProgressTransferListener"); //NOI18N desc = plexusContainer.getComponentDescriptor(WagonManager.ROLE); ComponentRequirement requirement = new ComponentRequirement(); requirement.setRole(TransferListener.class.getName()); desc.addRequirement(requirement); //MEVENIDE-634 desc = plexusContainer.getComponentDescriptor(KnownHostsProvider.ROLE, "file"); desc.getConfiguration().getChild("hostKeyChecking").setValue("no"); //MEVENIDE-634 desc = plexusContainer.getComponentDescriptor(KnownHostsProvider.ROLE, "null"); desc.getConfiguration().getChild("hostKeyChecking").setValue("no"); } catch (ComponentRepositoryException ex) { ex.printStackTrace(); } } });
desc.addRequirement(requirement); } catch (ComponentRepositoryException ex) { ex.printStackTrace();
public void addComponentDescriptor( PlexusConfiguration configuration ) throws ComponentRepositoryException { ComponentDescriptor componentDescriptor = null; try { componentDescriptor = PlexusTools.buildComponentDescriptor( configuration ); } catch ( PlexusConfigurationException e ) { throw new ComponentRepositoryException( "Cannot unmarshall component descriptor:", e ); } componentDescriptor.setRealmId( classRealm.getId() ); addComponentDescriptor( componentDescriptor ); }