Package org.apache.maven.archiva.xml

Examples of org.apache.maven.archiva.xml.XMLReader


        }

        boolean configOk = false;
        try
        {
            XMLReader xml = new XMLReader( "configuration", userConfigFile );
            String configVersion = xml.getElementText( "//configuration/version" );
            if ( StringUtils.isNotBlank( configVersion ) )
            {
                configOk = true;

                // Found an embedded configuration version.
View Full Code Here


    public ArchivaProjectModel read( File pomFile )
        throws ProjectModelException
    {
        try
        {
            XMLReader xml = new XMLReader( "project", pomFile );

            ArchivaProjectModel model = new ArchivaProjectModel();

            if ( !"http://maven.apache.org/POM/4.0.0".equals( xml.getDefaultNamespaceURI() ) )
            {
                // No namespace defined
                // TODO: Output to monitor the problem with the Namespace.
            }

            xml.removeNamespaces();

            Element project = xml.getElement( "//project" );

            model.setGroupId( project.elementTextTrim( "groupId" ) );
            model.setArtifactId( project.elementTextTrim( "artifactId" ) );
            model.setVersion( project.elementTextTrim( "version" ) );
            model.setName( project.elementTextTrim( "name" ) );
            model.setDescription( project.elementTextTrim( "description" ) );
            model.setUrl( project.elementTextTrim( "url" ) );

            model.setPackaging( StringUtils.defaultIfEmpty( project.elementTextTrim( "packaging" ), "jar" ) );

            model.setParentProject( getParentProject( xml ) );

            model.setMailingLists( getMailingLists( xml ) );
            model.setCiManagement( getCiManagement( xml ) );
            model.setIndividuals( getIndividuals( xml ) );
            model.setIssueManagement( getIssueManagement( xml ) );
            model.setLicenses( getLicenses( xml ) );
            model.setOrganization( getOrganization( xml ) );
            model.setScm( getSCM( xml ) );
            model.setRepositories( getRepositories( xml ) );

            model.setDependencies( getDependencies( xml ) );
            model.setDependencyManagement( getDependencyManagement( xml ) );
            model.setPlugins( getPlugins( xml ) );
            model.setReports( getReports( xml ) );
            model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );

            model.setBuildExtensions( getBuildExtensions( xml ) );

            model.setRelocation( getRelocation( xml ) );
View Full Code Here

    public ArchivaProjectModel read( File pomFile )
        throws ProjectModelException
    {
        try
        {
            XMLReader xml = new XMLReader( "project", pomFile );

            ArchivaProjectModel model = new ArchivaProjectModel();

            xml.removeNamespaces();

            Element project = xml.getElement( "//project" );

            // TODO: Handle <extend /> ?? (is this even possible?)

            model.setGroupId( project.elementTextTrim( "groupId" ) );
            model.setArtifactId( project.elementTextTrim( "artifactId" ) );
            // TODO: Handle <id />
            model.setVersion( project.elementTextTrim( "currentVersion" ) );
            model.setName( project.elementTextTrim( "name" ) );
            model.setDescription( project.elementTextTrim( "description" ) );
            // TODO: what to do with <shortDescription /> ?
            model.setUrl( project.elementTextTrim( "url" ) );
            // TODO: Handle <logo />
            // TODO: Handle <inceptionYear />

            model.setIssueManagement( getIssueManagement( xml ) );
            // TODO: What to do with <gumpRepositoryId /> ?
            // TODO: Handle <siteAddress />
            // TODO: Handle <siteDirectory /> ?
            // TODO: Handle <distributionSite />
            // TODO: Handle <distributionDirectory />
            model.setMailingLists( getMailingLists( xml ) );
            model.setIndividuals( getIndividuals( xml ) );
            model.setLicenses( getLicenses( xml ) );
            model.setReports( getReports( xml ) );
            model.setRepositories( getRepositories( xml ) );
            model.setScm( getSCM( xml ) );
            model.setOrganization( getOrganization( xml ) );
            model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );
            model.setDependencies( getDependencies( xml ) );
           
            /* Following are not valid for <pomVersion>3</pomVersion> / Maven 1 pom files.
             *
             * model.setDependencyManagement()
 
View Full Code Here

    public static ArchivaRepositoryMetadata read( File metadataFile )
        throws RepositoryMetadataException
    {
        try
        {
            XMLReader xml = new XMLReader( "metadata", metadataFile );

            ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();

            metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) );
            metadata.setArtifactId( xml.getElementText( "//metadata/artifactId" ) );
            metadata.setVersion( xml.getElementText( "//metadata/version" ) );
            metadata.setFileLastModified( new Date( metadataFile.lastModified() ) );
            metadata.setFileSize( metadataFile.length() );
            metadata.setWhenIndexed( null );

            metadata.setLastUpdated( xml.getElementText( "//metadata/versioning/lastUpdated" ) );
            metadata.setLatestVersion( xml.getElementText( "//metadata/versioning/latest" ) );
            metadata.setReleasedVersion( xml.getElementText( "//metadata/versioning/release" ) );
            metadata.setAvailableVersions( xml.getElementListText( "//metadata/versioning/versions/version" ) );

            Element snapshotElem = xml.getElement( "//metadata/versioning/snapshot" );
            if ( snapshotElem != null )
            {
                SnapshotVersion snapshot = new SnapshotVersion();
                snapshot.setTimestamp( snapshotElem.elementTextTrim( "timestamp" ) );
                String tmp = snapshotElem.elementTextTrim( "buildNumber" );
View Full Code Here

    public ArchivaProjectModel read( File pomFile )
        throws ProjectModelException
    {
        try
        {
            XMLReader xml = new XMLReader( "project", pomFile );

            ArchivaProjectModel model = new ArchivaProjectModel();

            if ( !"http://maven.apache.org/POM/4.0.0".equals( xml.getDefaultNamespaceURI() ) )
            {
                // No namespace defined
                // TODO: Output to monitor the problem with the Namespace.
            }

            xml.removeNamespaces();

            Element project = xml.getElement( "//project" );

            model.setGroupId( project.elementTextTrim( "groupId" ) );
            model.setArtifactId( project.elementTextTrim( "artifactId" ) );
            model.setVersion( project.elementTextTrim( "version" ) );
            model.setName( project.elementTextTrim( "name" ) );
            model.setDescription( project.elementTextTrim( "description" ) );
            model.setUrl( project.elementTextTrim( "url" ) );

            model.setPackaging( StringUtils.defaultIfEmpty( project.elementTextTrim( "packaging" ), "jar" ) );

            model.setParentProject( getParentProject( xml ) );

            model.setMailingLists( getMailingLists( xml ) );
            model.setCiManagement( getCiManagement( xml ) );
            model.setIndividuals( getIndividuals( xml ) );
            model.setIssueManagement( getIssueManagement( xml ) );
            model.setLicenses( getLicenses( xml ) );
            model.setOrganization( getOrganization( xml ) );
            model.setScm( getSCM( xml ) );
            model.setRepositories( getRepositories( xml ) );

            model.setDependencies( getDependencies( xml ) );
            model.setDependencyManagement( getDependencyManagement( xml ) );
            model.setPlugins( getPlugins( xml ) );
            model.setReports( getReports( xml ) );
            model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );

            model.setBuildExtensions( getBuildExtensions( xml ) );

            model.setRelocation( getRelocation( xml ) );
View Full Code Here

    public ArchivaProjectModel read( File pomFile )
        throws ProjectModelException
    {
        try
        {
            XMLReader xml = new XMLReader( "project", pomFile );

            ArchivaProjectModel model = new ArchivaProjectModel();

            if ( !"http://maven.apache.org/POM/4.0.0".equals( xml.getDefaultNamespaceURI() ) )
            {
                // No namespace defined
                // TODO: Output to monitor the problem with the Namespace.
            }

            xml.removeNamespaces();

            Element project = xml.getElement( "//project" );

            model.setGroupId( project.elementTextTrim( "groupId" ) );
            model.setArtifactId( project.elementTextTrim( "artifactId" ) );
            model.setVersion( project.elementTextTrim( "version" ) );
            model.setName( project.elementTextTrim( "name" ) );
            model.setDescription( project.elementTextTrim( "description" ) );
            model.setUrl( project.elementTextTrim( "url" ) );

            model.setPackaging( StringUtils.defaultIfEmpty( project.elementTextTrim( "packaging" ), "jar" ) );

            model.setParentProject( getParentProject( xml ) );

            model.setMailingLists( getMailingLists( xml ) );
            model.setCiManagement( getCiManagement( xml ) );
            model.setIndividuals( getIndividuals( xml ) );
            model.setIssueManagement( getIssueManagement( xml ) );
            model.setLicenses( getLicenses( xml ) );
            model.setOrganization( getOrganization( xml ) );
            model.setScm( getSCM( xml ) );
            model.setRepositories( getRepositories( xml ) );

            model.setDependencies( getDependencies( xml ) );
            model.setDependencyManagement( getDependencyManagement( xml ) );
            model.setPlugins( getPlugins( xml ) );
            model.setReports( getReports( xml ) );
            model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );

            model.setBuildExtensions( getBuildExtensions( xml ) );

            model.setRelocation( getRelocation( xml ) );
View Full Code Here

    public ArchivaProjectModel read( File pomFile )
        throws ProjectModelException
    {
        try
        {
            XMLReader xml = new XMLReader( "project", pomFile );

            ArchivaProjectModel model = new ArchivaProjectModel();

            xml.removeNamespaces();

            Element project = xml.getElement( "//project" );

            // TODO: Handle <extend /> ?? (is this even possible?)

            model.setGroupId( project.elementTextTrim( "groupId" ) );
            model.setArtifactId( project.elementTextTrim( "artifactId" ) );
            // TODO: Handle <id />
            model.setVersion( project.elementTextTrim( "currentVersion" ) );
            model.setName( project.elementTextTrim( "name" ) );
            model.setDescription( project.elementTextTrim( "description" ) );
            // TODO: what to do with <shortDescription /> ?
            model.setUrl( project.elementTextTrim( "url" ) );
            // TODO: Handle <logo />
            // TODO: Handle <inceptionYear />

            model.setIssueManagement( getIssueManagement( xml ) );
            // TODO: What to do with <gumpRepositoryId /> ?
            // TODO: Handle <siteAddress />
            // TODO: Handle <siteDirectory /> ?
            // TODO: Handle <distributionSite />
            // TODO: Handle <distributionDirectory />
            model.setMailingLists( getMailingLists( xml ) );
            model.setIndividuals( getIndividuals( xml ) );
            model.setLicenses( getLicenses( xml ) );
            model.setReports( getReports( xml ) );
            model.setRepositories( getRepositories( xml ) );
            model.setScm( getSCM( xml ) );
            model.setOrganization( getOrganization( xml ) );
            model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );
            model.setDependencies( getDependencies( xml ) );
           
            /* Following are not valid for <pomVersion>3</pomVersion> / Maven 1 pom files.
             *
             * model.setDependencyManagement()
 
View Full Code Here

    public static ArchivaRepositoryMetadata read( File metadataFile )
        throws RepositoryMetadataException
    {
        try
        {
            XMLReader xml = new XMLReader( "metadata", metadataFile );

            ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();

            metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) );
            metadata.setArtifactId( xml.getElementText( "//metadata/artifactId" ) );
            metadata.setVersion( xml.getElementText( "//metadata/version" ) );
            metadata.setFileLastModified( new Date( metadataFile.lastModified() ) );
            metadata.setFileSize( metadataFile.length() );
            metadata.setWhenIndexed( null );

            metadata.setLastUpdated( xml.getElementText( "//metadata/versioning/lastUpdated" ) );
            metadata.setLatestVersion( xml.getElementText( "//metadata/versioning/latest" ) );
            metadata.setReleasedVersion( xml.getElementText( "//metadata/versioning/release" ) );
            metadata.setAvailableVersions( xml.getElementListText( "//metadata/versioning/versions/version" ) );

            Element snapshotElem = xml.getElement( "//metadata/versioning/snapshot" );
            if ( snapshotElem != null )
            {
                SnapshotVersion snapshot = new SnapshotVersion();
                snapshot.setTimestamp( snapshotElem.elementTextTrim( "timestamp" ) );
                String tmp = snapshotElem.elementTextTrim( "buildNumber" );
                if( NumberUtils.isNumber( tmp ))
                {
                    snapshot.setBuildNumber( NumberUtils.toInt( tmp ) );
                }
                metadata.setSnapshotVersion( snapshot );
            }

            for ( Element plugin : xml.getElementList( "//metadata/plugins/plugin" ) )
            {
                Plugin p = new Plugin();
                p.setPrefix( plugin.elementTextTrim( "prefix" ) );
                p.setArtifactId( plugin.elementTextTrim( "artifactId" ) );
                p.setName( plugin.elementTextTrim( "name" ) );
View Full Code Here

    implements ProjectModelReader
{
    public ArchivaProjectModel read( File pomFile )
        throws XMLException
    {
        XMLReader xml = new XMLReader( "project", pomFile );

        ArchivaProjectModel model = new ArchivaProjectModel();

        if ( !"http://maven.apache.org/POM/4.0.0".equals( xml.getDefaultNamespaceURI() ) )
        {
            // No namespace defined
            // TODO: Output to monitor the problem with the Namespace.
        }

        xml.removeNamespaces();

        Element project = xml.getElement( "//project" );

        model.setGroupId( project.elementTextTrim( "groupId" ) );
        model.setArtifactId( project.elementTextTrim( "artifactId" ) );
        model.setVersion( project.elementTextTrim( "version" ) );
        model.setName( project.elementTextTrim( "name" ) );
        model.setDescription( project.elementTextTrim( "description" ) );
        model.setUrl( project.elementTextTrim( "url" ) );

        model.setPackaging( StringUtils.defaultIfEmpty( project.elementTextTrim( "packaging" ), "jar" ) );

        model.setParentProject( getParentProject( xml ) );

        model.setMailingLists( getMailingLists( xml ) );
        model.setCiManagement( getCiManagement( xml ) );
        model.setIndividuals( getIndividuals( xml ) );
        model.setIssueManagement( getIssueManagement( xml ) );
        model.setLicenses( getLicenses( xml ) );
        model.setOrganization( getOrganization( xml ) );
        model.setScm( getSCM( xml ) );
        model.setRepositories( getRepositories( xml ) );

        model.setDependencies( getDependencies( xml ) );
        model.setDependencyManagement( getDependencyManagement( xml ) );
        model.setPlugins( getPlugins( xml ) );
        model.setReports( getReports( xml ) );
        model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );

        model.setBuildExtensions( getBuildExtensions( xml ) );

        model.setRelocation( getRelocation( xml ) );
View Full Code Here

    public static ArchivaRepositoryMetadata read( File metadataFile )
        throws RepositoryMetadataException
    {
        try
        {
            XMLReader xml = new XMLReader( "metadata", metadataFile );
            // invoke this to remove namespaces, see MRM-1136
            xml.removeNamespaces();
           
            ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();

            metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) );
            metadata.setArtifactId( xml.getElementText( "//metadata/artifactId" ) );
            metadata.setVersion( xml.getElementText( "//metadata/version" ) );
            metadata.setFileLastModified( new Date( metadataFile.lastModified() ) );
            metadata.setFileSize( metadataFile.length() );
            metadata.setWhenIndexed( null );

            metadata.setLastUpdated( xml.getElementText( "//metadata/versioning/lastUpdated" ) );
            metadata.setLatestVersion( xml.getElementText( "//metadata/versioning/latest" ) );
            metadata.setReleasedVersion( xml.getElementText( "//metadata/versioning/release" ) );
            metadata.setAvailableVersions( xml.getElementListText( "//metadata/versioning/versions/version" ) );

            Element snapshotElem = xml.getElement( "//metadata/versioning/snapshot" );
            if ( snapshotElem != null )
            {
                SnapshotVersion snapshot = new SnapshotVersion();
                snapshot.setTimestamp( snapshotElem.elementTextTrim( "timestamp" ) );
                String tmp = snapshotElem.elementTextTrim( "buildNumber" );
                if( NumberUtils.isNumber( tmp ))
                {
                    snapshot.setBuildNumber( NumberUtils.toInt( tmp ) );
                }
                metadata.setSnapshotVersion( snapshot );
            }

            for ( Element plugin : xml.getElementList( "//metadata/plugins/plugin" ) )
            {
                Plugin p = new Plugin();
                p.setPrefix( plugin.elementTextTrim( "prefix" ) );
                p.setArtifactId( plugin.elementTextTrim( "artifactId" ) );
                p.setName( plugin.elementTextTrim( "name" ) );
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.xml.XMLReader

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.