Package org.apache.jetspeed.util

Examples of org.apache.jetspeed.util.FileSystemHelper


     */
    public PortletApplicationWar copyWar( String targetAppRoot ) throws IOException
    {
        // FileObject target = fsManager.resolveFile(new
        // File(targetAppRoot).getAbsolutePath());
        FileSystemHelper target = new DirectoryHelper(new File(targetAppRoot));
        try
        {
            target.copyFrom(warStruct.getRootDirectory());

            return new PortletApplicationWar(target, paName, webAppContextRoot);

        }
        catch (IOException e)
        {
            throw e;
        }
        finally
        {
            target.close();

        }
    }
View Full Code Here


     */
    public PortletApplicationWar copyWar( String targetAppRoot ) throws IOException
    {
        // FileObject target = fsManager.resolveFile(new
        // File(targetAppRoot).getAbsolutePath());
        FileSystemHelper target = new DirectoryHelper(new File(targetAppRoot));
        try
        {
            target.copyFrom(warStruct.getRootDirectory());

            return new PortletApplicationWar(target, paName, webAppContextRoot, paChecksum);

        }
        catch (IOException e)
        {
            throw e;
        }
        finally
        {
            target.close();

        }
    }
View Full Code Here

     */
    public PortletApplicationWar copyWar( String targetAppRoot ) throws IOException
    {
        // FileObject target = fsManager.resolveFile(new
        // File(targetAppRoot).getAbsolutePath());
        FileSystemHelper target = new DirectoryHelper(new File(targetAppRoot));
        try
        {
            target.copyFrom(warStruct.getRootDirectory());

            return new PortletApplicationWar(target, paName, webAppContextRoot, paChecksum);

        }
        catch (IOException e)
        {
            throw e;
        }
        finally
        {
            target.close();

        }
    }
View Full Code Here

     */
    public PortletApplicationWar copyWar( String targetAppRoot ) throws IOException
    {
        // FileObject target = fsManager.resolveFile(new
        // File(targetAppRoot).getAbsolutePath());
        FileSystemHelper target = new DirectoryHelper(new File(targetAppRoot));
        try
        {
            target.copyFrom(warStruct.getRootDirectory());

            return new PortletApplicationWar(target, paName, webAppContextRoot, paChecksum);

        }
        catch (IOException e)
        {
            throw e;
        }
        finally
        {
            target.close();

        }
    }
View Full Code Here

     * @throws IOException
     */
    private ClassLoader createPortletClassloader(ClassLoader parent, String id) throws IOException
    {
        String portletAppDirectory = pam.getDeploymentPath(id);
        FileSystemHelper target = new DirectoryHelper(new File(portletAppDirectory));
        PortletApplicationWar targetWar = new PortletApplicationWar(target, id, "/" + id);
        return targetWar.createClassloader(parent);
    }
View Full Code Here

     */
    public PortletApplicationWar copyWar( String targetAppRoot ) throws IOException
    {
        // FileObject target = fsManager.resolveFile(new
        // File(targetAppRoot).getAbsolutePath());
        FileSystemHelper target = new DirectoryHelper(new File(targetAppRoot));
        try
        {
            target.copyFrom(warStruct.getRootDirectory());

            return new PortletApplicationWar(target, paName, webAppContextRoot);

        }
        catch (IOException e)
        {
            throw e;
        }
        finally
        {
            target.close();

        }
    }
View Full Code Here

            Entry entry = new Entry();
            entry.setId(id);
            entry.setAttribute(DEPLOYMENT_OBJECT_PATH_ATTR, event.getDeploymentObject().getPath());
            entry.setAttribute(DEPLOYMENT_CONFIGURATION_ATTR, conf);

            FileSystemHelper sourceObject = null;
            FileSystemHelper deployObject = null;
            try
            {
                // construct decorator deploy path
                String baseDeployPath = getBaseDeployPath(conf);
                String deployPath = baseDeployPath + File.separator + id;
                File deployPathFile = new File(deployPath);
               
                // undeploy decorator if it already exists and is a redeploy or
                // skip deployment if initial deployment
                if (deployPathFile.exists())
                {
                    if (event.getEventType().equals(DeploymentEvent.EVENT_TYPE_REDEPLOY))
                    {
                        invokeUndeploy(event);
                    }
                    else if (event.getEventType().equals(DeploymentEvent.EVENT_TYPE_DEPLOY))
                    {
                        log.info("Skipping initial deployment of decorator " + id + " to " + deployPath);
                       
                        // register deployed decorator
                        registry.register(entry);
                        log.info("Registering decorator " + id);
                        return;
                    }
                }
               
                // redeploy/deploy decorator w/o META_INF jar metadata
                log.info("Deploying decorator " + id + " to " + deployPath);
                deployPathFile.mkdirs();
                deployObject = new DirectoryHelper(deployPathFile);
                sourceObject = event.getDeploymentObject().getFileObject();
                deployObject.copyFrom(sourceObject.getRootDirectory());
                File metaInf = new File(deployPathFile, "META-INF");
                if (metaInf.exists())
                {
                    DirectoryHelper cleanup = new DirectoryHelper(metaInf);
                    cleanup.remove();
                    cleanup.close();
                }
               
                // detect language/country localized decorator components
                final List localeSpecificDeployPathsList = getLocaleSpecificDeployPaths(deployPathFile);
               
                // deploy individual locale specific decorator components
                Iterator deployPathsIter = localeSpecificDeployPathsList.iterator();
                while (deployPathsIter.hasNext())
                {
                    File localeDeployPathFile = (File) deployPathsIter.next();
                   
                    // deploy to locale specific location
                    File deployToPathFile = new File(baseDeployPath + localeDeployPathFile.getPath().substring(deployPath.length()) + File.separator + id);
                    log.info("Deploying decorator " + id + " to " + deployToPathFile.getPath());
                    deployToPathFile.mkdirs();
                   
                    // deploy decorator components by moving from deployed decorator
                    File [] filesToDeploy = localeDeployPathFile.listFiles(new FileFilter()
                        {
                            public boolean accept(File pathname)
                            {
                                return !localeSpecificDeployPathsList.contains(pathname);
                            }
                        });
                    for (int i = 0; (i < filesToDeploy.length); i++)
                    {
                        filesToDeploy[i].renameTo(new File(deployToPathFile, filesToDeploy[i].getName()));
                    }
                }
               
                // cleanup locale specific deployment directories
                Iterator cleanupDeployPathsIter = localeSpecificDeployPathsList.iterator();
                while (cleanupDeployPathsIter.hasNext())
                {
                    File cleanupLocaleDeployPathFile = (File) cleanupDeployPathsIter.next();
                    if (cleanupLocaleDeployPathFile.exists())
                    {
                        DirectoryHelper cleanup = new DirectoryHelper(cleanupLocaleDeployPathFile);
                        cleanup.remove();
                        cleanup.close();
                    }
                }
               
                // register
                registry.register(entry);
                log.info("Registering decorator " + id);
               
                log.info("Decorator " + id + " deployed and registered successfuly.");
            }
            catch (Exception e)
            {
                log.error("Error deploying or registering decorator " + id + ": " + e.toString(), e);
            }
            finally
            {
                try
                {
                    if (sourceObject != null)
                    {
                        sourceObject.close();
                    }
                    if (deployObject != null)
                    {
                        deployObject.close();
                    }
                }
                catch (IOException e2)
                {
                }
View Full Code Here

     */
    public PortletApplicationWar copyWar( String targetAppRoot ) throws IOException
    {
        // FileObject target = fsManager.resolveFile(new
        // File(targetAppRoot).getAbsolutePath());
        FileSystemHelper target = new DirectoryHelper(new File(targetAppRoot));
        try
        {
            target.copyFrom(warStruct.getRootDirectory());

            return new PortletApplicationWar(target, paName, webAppContextRoot);

        }
        catch (IOException e)
        {
            throw e;
        }
        finally
        {
            target.close();

        }
    }
View Full Code Here

     */
    public PortletApplicationWar copyWar( String targetAppRoot ) throws IOException
    {
        // FileObject target = fsManager.resolveFile(new
        // File(targetAppRoot).getAbsolutePath());
        FileSystemHelper target = new DirectoryHelper(new File(targetAppRoot));
        try
        {
            target.copyFrom(warStruct.getRootDirectory());

            return new PortletApplicationWar(target, paName, webAppContextRoot, paChecksum, this.descriptorService);

        }
        catch (IOException e)
        {
            throw e;
        }
        finally
        {
            target.close();

        }
    }
View Full Code Here

                DeploymentRegistration registrar =
                    (DeploymentRegistration)services.getService("PAM");

                if (registrar != null)
                {
                    FileSystemHelper webapp = new DirectoryHelper(new File(context.getRealPath("/")));
                    if (registrar.registerPortletApplication(webapp, portletApplicationName))
                    {
                        context.log(JCS + "Portlet Application Registered at Servlet Init: " + portletApplicationName);
                    }
                    else
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.util.FileSystemHelper

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.