Package org.fenrir.yggdrasil.core.descriptor

Examples of org.fenrir.yggdrasil.core.descriptor.ArtifactUpdateDescriptor


                    expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_PATH, id));
                    String updateArtifactPath = (String)expression.evaluate(downloadedArtifactsDocument, XPathConstants.STRING);
                    expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_URL, id));
                    String updateArtifactUrl = (String)expression.evaluate(downloadedArtifactsDocument, XPathConstants.STRING);
                   
                    ArtifactUpdateDescriptor descriptor = new ArtifactUpdateDescriptor();
                    descriptor.setId(id);
                    descriptor.setType(ArtifactUpdateDescriptor.TYPE_CREATE_ARTIFACT);
                    descriptor.setDestinationPath(updateArtifactPath);
                    descriptor.setUrl(updateArtifactUrl);
                    artifactDescriptors.add(descriptor);
                }
                else{
                    expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_VERSION, id));
                    String updateArtifactVersion = (String)expression.evaluate(downloadedArtifactsDocument, XPathConstants.STRING);
                    expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_VERSION, id));
                    String applicationArtifactVersion = (String)expression.evaluate(applicationArtifactsDocument, XPathConstants.STRING);                   
                    // S'ha d'actualitzar tan en el cas que sigui una versió superior com una inferior per tractar els casos dels downgrades de llibreries
                    if(updateArtifactVersion.compareTo(applicationArtifactVersion)!=0){
                        if(log.isDebugEnabled()){
                            log.debug("Trobat artifact a actualitzar amb id {}", id);
                        }
                        expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_PATH, id));
                        String applicationArtifactPath = (String)expression.evaluate(applicationArtifactsDocument, XPathConstants.STRING);
                        expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_PATH, id));
                        String updateArtifactPath = (String)expression.evaluate(downloadedArtifactsDocument, XPathConstants.STRING);
                        expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_URL, id));
                        String updateArtifactUrl = (String)expression.evaluate(downloadedArtifactsDocument, XPathConstants.STRING);
                       
                        ArtifactUpdateDescriptor descriptor = new ArtifactUpdateDescriptor();
                        descriptor.setId(id);
                        descriptor.setType(ArtifactUpdateDescriptor.TYPE_UPDATE_ARTIFACT);
                        descriptor.setSourcePath(applicationArtifactPath);
                        descriptor.setDestinationPath(updateArtifactPath);
                        descriptor.setUrl(updateArtifactUrl);
                        artifactDescriptors.add(descriptor);
                    }
                    applicationArtifacts.remove(id);
                }                               
            }
            // Els que han quedat a applicationArtifacts s'han d'eliminar
            for(String id:applicationArtifacts){
                if(log.isDebugEnabled()){
                    log.debug("Trobat artifact a eliminar amb id {}", id);
                }
                expression = xpath.compile(MessageFormat.format(CoreConstants.UPDATE_ARTIFACT_PATH, id));
                String applicationArtifactPath = (String)expression.evaluate(applicationArtifactsDocument, XPathConstants.STRING);
               
                ArtifactUpdateDescriptor descriptor = new ArtifactUpdateDescriptor();
                descriptor.setId(id);
                descriptor.setType(ArtifactUpdateDescriptor.TYPE_DELETE_ARTIFACT);
                descriptor.setSourcePath(applicationArtifactPath);
                artifactDescriptors.add(descriptor);
            }
           
            return artifactDescriptors;
        }
View Full Code Here

TOP

Related Classes of org.fenrir.yggdrasil.core.descriptor.ArtifactUpdateDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.