Package org.codehaus.plexus.components.io.resources

Examples of org.codehaus.plexus.components.io.resources.PlexusIoResource


    /**
     * @deprecated Use {@link #getSource()}.
     */
    public File getSourceFile()
    {
        final PlexusIoResource res = getSource();
        if ( res instanceof PlexusIoFileResource )
        {
            return ((PlexusIoFileResource) res).getFile();
        }
        return null;
View Full Code Here


        if ( vPath.length() <= 0 )
        {
            return;
        }

        PlexusIoResource in = entry.getResource();
        File outFile = new File( vPath );
       
        final long inLastModified = in.getLastModified();
        long outLastModified = outFile.lastModified();
        if ( ResourceUtils.isUptodate( inLastModified, outLastModified ) )
        {
            return;
        }
       
        outFile.setLastModified( inLastModified == PlexusIoResource.UNKNOWN_MODIFICATION_DATE
                                 ? System.currentTimeMillis() : inLastModified );

        if ( ! in.isDirectory() )
        {
            if ( ! outFile.getParentFile().exists() )
            {
                //create the parent directory...
                if ( ! outFile.getParentFile().mkdirs() )
                {
                    //Failure, unable to create specified directory for some unknown reason.
                    throw new ArchiverException( "Unable to create directory or parent directory of " + outFile );
                }
            }
            ResourceUtils.copyFile( in, outFile );
            ArchiveEntryUtils.chmod( outFile, entry.getMode(), getLogger() );
        }
        else
        { //file is a directory
            if ( outFile.exists() )
            {
                if ( ! outFile.isDirectory() )
                {
                    //should we just delete the file and replace it with a directory?
                    //throw an exception, let the user delete the file manually.
                    throw new ArchiverException(
                        "Expected directory and found file at copy destination of " + in.getName() + " to " + outFile );
                }
            }
            else if ( ! outFile.mkdirs() )
            {
                //Failure, unable to create specified directory for some unknown reason.
View Full Code Here

        {
            prefix = null;
        }
        for ( final Iterator iter = getSrc().getResources(); iter.hasNext(); )
        {
            PlexusIoResource plexusIoResource = (PlexusIoResource) iter.next();

            PlexusIoResourceAttributes attrs = null;
            if ( plexusIoResource instanceof PlexusIoResourceWithAttributes )
            {
                attrs = ( (PlexusIoResourceWithAttributes) plexusIoResource ).getAttributes();
            }

            if ( plexusIoResource.isDirectory() )
            {
                attrs =
                    PlexusIoResourceAttributeUtils.mergeAttributes( overrideDirAttributes, attrs, defaultDirAttributes );
            }
            else
            {
                attrs =
                    PlexusIoResourceAttributeUtils.mergeAttributes( overrideFileAttributes, attrs,
                                                                    defaultFileAttributes );
            }

            if ( !fileSelector.isSelected( plexusIoResource ) )
            {
                continue;
            }
            if ( !isSelected( plexusIoResource ) )
            {
                continue;
            }
            if ( plexusIoResource.isDirectory() && !isIncludingEmptyDirectories() )
            {
                continue;
            }
            if ( prefix != null )
            {
                final String name = plexusIoResource.getName();

                if ( plexusIoResource instanceof PlexusIoResourceWithAttributes )
                {
                    plexusIoResource = new PlexusIoProxyResourceWithAttributes( plexusIoResource, attrs );
                }
View Full Code Here

                    }
                    else
                    {
                        if ( ioResourceIter.hasNext() )
                        {
                            final PlexusIoResource resource = (PlexusIoResource) ioResourceIter.next();
                            nextEntry = asArchiveEntry( currentResourceCollection, resource );
                        }
                        else
                        {
                            ioResourceIter = null;
View Full Code Here

    /**
     * @deprecated Use {@link #getSource()}.
     */
    public File getSourceFile()
    {
        final PlexusIoResource res = getSource();
        if ( res instanceof PlexusIoFileResource )
        {
            return ((PlexusIoFileResource) res).getFile();
        }
        return null;
View Full Code Here

        if ( vPath.length() <= 0 )
        {
            return;
        }

        final PlexusIoResource in = entry.getResource();
        final File outFile = new File( vPath );

        final long inLastModified = in.getLastModified();
        final long outLastModified = outFile.lastModified();
        if ( ResourceUtils.isUptodate( inLastModified, outLastModified ) )
        {
            return;
        }

        outFile.setLastModified( inLastModified == PlexusIoResource.UNKNOWN_MODIFICATION_DATE ? System.currentTimeMillis()
                        : inLastModified );

        if ( !in.isDirectory() )
        {
            if ( !outFile.getParentFile()
                         .exists() )
            {
                // create the parent directory...
                if ( !outFile.getParentFile()
                             .mkdirs() )
                {
                    // Failure, unable to create specified directory for some unknown reason.
                    throw new ArchiverException( "Unable to create directory or parent directory of " + outFile );
                }
            }
            ResourceUtils.copyFile( in, outFile );

            if ( !isIgnorePermissions() )
            {
                ArchiveEntryUtils.chmod( outFile, entry.getMode(), getLogger(), isUseJvmChmod() );
            }
        }
        else
        { // file is a directory
            if ( outFile.exists() )
            {
                if ( !outFile.isDirectory() )
                {
                    // should we just delete the file and replace it with a directory?
                    // throw an exception, let the user delete the file manually.
                    throw new ArchiverException( "Expected directory and found file at copy destination of "
                                    + in.getName() + " to " + outFile );
                }
            }
            else if ( !outFile.mkdirs() )
            {
                // Failure, unable to create specified directory for some unknown reason.
View Full Code Here

                    }
                    else
                    {
                        if ( ioResourceIter.hasNext() )
                        {
                            final PlexusIoResource resource = (PlexusIoResource) ioResourceIter.next();
                            nextEntry = asArchiveEntry( currentResourceCollection, resource );
                        }
                        else
                        {
                            ioResourceIter = null;
View Full Code Here

        if (value instanceof EclipsePluginProject) {
            EclipsePluginProject pdeProject = (EclipsePluginProject) value;
            Iterator<PlexusIoResource> iterator = getPDEBinaries(project, pdeProject);
            if (iterator.hasNext()) {
                do {
                    PlexusIoResource resource = iterator.next();
                    File file = new File(resource.getURL().getFile());
                    if (file.exists() && !file.isDirectory()) {
                        pdeFiles.add(file);
                    }
                } while (iterator.hasNext());
            }
View Full Code Here

                target = outputDirectory + "/" + destName;
            }

            final PlexusIoFileResource
                res = new PlexusIoFileResource( source, ArchiverAttributeUtils.getFileAttributes( source ));
            PlexusIoResource restoUse = res;
            try
            {
                final InputStreamTransformer fileSetTransformers =
                    ReaderFormatter.getFileSetTransformers( configSource, fileItem.isFiltered(), fileItem.getLineEnding() );
View Full Code Here

                        }
                        else
                        {
                            if ( ioResourceIter.hasNext() )
                            {
                                final PlexusIoResource resource = (PlexusIoResource) ioResourceIter.next();
                                nextEntry = asArchiveEntry( currentResourceCollection, resource );
                            }
                            else
                            {
                                ioResourceIter = null;
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.components.io.resources.PlexusIoResource

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.