Package org.apache.jetspeed.util

Examples of org.apache.jetspeed.util.DirectoryHelper


    public void testFileSystemManagerOnDir() throws Exception
    {
        File demoApp = new File("./test/testdata/deploy/webapp");
        assertTrue(demoApp.exists());
       
        DirectoryHelper dirHelper = new DirectoryHelper(demoApp);
        File webXml = new File(dirHelper.getRootDirectory(), "WEB-INF/web.xml");
        assertTrue(webXml.exists());
            
    }
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

                String path = Jetspeed.getRealPath("WEB-INF/tld");
                if (path != null)
                {
                    File portletTaglibDir = new File(path);
                    File child = new File(warStruct.getRootDirectory(), "WEB-INF/tld");
                    DirectoryHelper dh = new DirectoryHelper(child);
                    dh.copyFrom(portletTaglibDir, new FileFilter(){

                        public boolean accept(File pathname)
                        {
                            return pathname.getName().indexOf("portlet.tld") != -1;
                        }                   
                    });               
                    dh.close();
                }
            }

        }
        catch (Exception e)
View Full Code Here

            log.info("Deploying decorator " + id + " to " + deployPath);
            JarExpander.expand(event.getDeploymentObject().getFile(), deployPathFile);
            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 locale specific decorator component 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();
                }
            }

            log.info("Decorator " + id + " deployed successfuly.");
            event.setStatus(DeploymentStatus.STATUS_OKAY);
View Full Code Here

            {
                File localeDeployPathFile = new File((File) localeSpecificDeployPathsList.get(i), id);
                if (localeDeployPathFile.exists())
                {
                    log.info("Undeploying locale specific decorator component at " + localeDeployPathFile.getPath());
                    DirectoryHelper cleanup = new DirectoryHelper(localeDeployPathFile);
                    cleanup.remove();
                    cleanup.close();
                    localeDeployPathFile.getParentFile().delete();
                }
            }

            // now undeploy the decorator root itself
            DirectoryHelper cleanup = new DirectoryHelper(deployPathFile);
            cleanup.remove();
            cleanup.close();

            log.info("Decorator " + id + " undeployed successfuly.");
        }
        catch (Exception e)
        {
View Full Code Here

{
    public static void expand(File srcFile, File targetDir) throws IOException
    {
        if (targetDir.exists())
        {
            DirectoryHelper cleanup = new DirectoryHelper(targetDir);
            cleanup.remove();
            cleanup.close();
        }

        targetDir.mkdirs();
        JarFile jarFile = new JarFile(srcFile);
       
View Full Code Here

            {
                log.warn("Not a local application " + localApps[i].getName());
            }
            else
            {
                DirectoryHelper paDirHelper = new DirectoryHelper(localApps[i]);
                try
                {
                    pam.startLocalPortletApplication(localApps[i].getName(), paDirHelper,
                                                     createLocalPAClassLoader(localApps[i]));
                }
View Full Code Here

            String fileName = event.getName();
            String appName = fileName.substring(0, fileName.length() - 4);
            pam.stopLocalPortletApplication(appName);
            File targetDir = new File(localAppDir, appName);
            JarExpander.expand(event.getDeploymentObject().getFile(), targetDir);
            DirectoryHelper paDirHelper = new DirectoryHelper(targetDir);
            pam.startLocalPortletApplication(appName, paDirHelper, createLocalPAClassLoader(targetDir));
            event.setStatus(DeploymentStatus.STATUS_OKAY);
        }
        catch (Exception e)
        {
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

                String path = Jetspeed.getRealPath("WEB-INF/tld");
                if (path != null)
                {
                    File portletTaglibDir = new File(path);
                    File child = new File(warStruct.getRootDirectory(), "WEB-INF/tld");
                    DirectoryHelper dh = new DirectoryHelper(child);
                    dh.copyFrom(portletTaglibDir, new FileFilter(){

                        public boolean accept(File pathname)
                        {
                            return pathname.getName().indexOf("portlet.tld") != -1;
                        }                   
                    });               
                    dh.close();
                }
            }

        }
        catch (Exception e)
View Full Code Here

TOP

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

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.