Package org.codehaus.plexus.metadata.merge

Examples of org.codehaus.plexus.metadata.merge.MergeException


        }
        catch ( Exception e )
        {
            // TODO: log to error
            // TODO: better error message
            throw new MergeException( "Unable to merge Mergeable lists for element '" + getName() + "'.", e );
        }

    }
View Full Code Here


    {
        if ( !isExpectedElementType( me ) )
        {
            // if (getLogger().isErrorEnabled)
            //     getLogger().error ("Cannot Merge dissimilar elements. (Expected : '" + getClass ().getName () + "', found '" + me.getClass ().getName () + "')");
            throw new MergeException( "Cannot Merge dissimilar elements. " + "(Expected : '" + getClass().getName() +
                "', found '" + me.getClass().getName() + "')" );
        }
        // recessive Component Element.
        AbstractMergeableElement rce = (AbstractMergeableElement) me;

        Set allowedTags = new HashSet();

        for ( int i = 0; i < getAllowedTags().length; i++ )
        {
            String tagName = getAllowedTags()[i].getTagName();

            allowedTags.add( tagName );

            List defaultConflictChecklist = new ArrayList();
            defaultConflictChecklist.add( tagName );

            if ( !isRecessiveElementInConflict( rce, defaultConflictChecklist ) &&
                mergeableElementComesFromRecessive( rce, tagName ) )
            {
                this.addContent( (Element) rce.getChild( tagName ).clone() );
                // else dominant wins in anycase!
            }
            else
            if ( getAllowedTags()[i].isMergeable() && isRecessiveElementInConflict( rce, defaultConflictChecklist ) )
            {
                // this allows for merging multiple/list of elements.
                try
                {
                    getAllowedTags()[i].createMergeable( this.getChild( tagName ) )
                        .merge( getAllowedTags()[i].createMergeable( rce.getChild( tagName ) ),
                                getDefaultMergeStrategy() );
                }
                catch ( Exception e )
                {
                    // TODO log to error
                    throw new MergeException(
                        "Unable to create Mergeable instance for tag " + "'" + getAllowedTags()[i] + "'.", e );
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.metadata.merge.MergeException

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.