public List<Mirror> getMirrors() { List<CMirror> modelMirrors = getConfiguration( false ).getMirrors(); ArrayList<Mirror> mirrors = new ArrayList<Mirror>( modelMirrors.size() ); for ( CMirror model : modelMirrors ) { Mirror mirror = new Mirror( model.getId(), model.getUrl() ); mirrors.add( mirror ); } return Collections.unmodifiableList( mirrors ); }
public List<Mirror> getMirrors() { List<CMirror> modelMirrors = getConfiguration( false ).getRemoteStorage().getMirrors(); List<Mirror> mirrors = new ArrayList<Mirror>( modelMirrors.size() ); for ( CMirror model : modelMirrors ) { Mirror mirror = new Mirror( model.getId(), model.getUrl() ); mirrors.add( mirror ); } return Collections.unmodifiableList( mirrors ); }
/** * Method writeCMirror. * * @param cMirror * @param serializer * @param tagName * @throws java.io.IOException */ private void writeCMirror( CMirror cMirror, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( cMirror.getId() != null ) { serializer.startTag( NAMESPACE, "id" ).text( cMirror.getId() ).endTag( NAMESPACE, "id" ); } if ( cMirror.getUrl() != null ) { serializer.startTag( NAMESPACE, "url" ).text( cMirror.getUrl() ).endTag( NAMESPACE, "url" ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeCMirror( CMirror, String, XmlSerializer )
public ValidationResponse validateRepositoryMirrors( ApplicationValidationContext ctx, List<CMirror> mirrors ) { ValidationResponse response = new ApplicationValidationResponse(); if ( ctx != null ) { response.setContext( ctx ); } for ( CMirror mirror : mirrors ) { if ( StringUtils.isEmpty( mirror.getId() ) ) { String newId = generateId(); mirror.setId( newId ); response .addValidationWarning( "Fixed wrong mirror ID from '" + mirror.getId() + "' to '" + newId + "'" ); response.setModified( true ); } if ( StringUtils.isEmpty( mirror.getId() ) ) { response.addValidationError( "The Mirror may have no empty/null ID!" ); } if ( StringUtils.isEmpty( mirror.getUrl() ) ) { response.addValidationError( "The Mirror may have no empty/null URL!" ); } } return response; }