Package org.apache.jetspeed.util

Examples of org.apache.jetspeed.util.DirectoryHelper


    public void startInternalApplication(String contextName) throws RegistryException
    {
        checkStarted();
        File webinf = new File (appRoot);
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();       
        DirectoryHelper dir = new DirectoryHelper(webinf);
        String appName = (contextName.startsWith("/")) ? contextName.substring(1) : contextName;
        MutablePortletApplication app = registry.getPortletApplicationByIdentifier(appName);
        if (app != null && app.getApplicationType() == MutablePortletApplication.LOCAL)
        {
            app.setApplicationType(MutablePortletApplication.INTERNAL);
View Full Code Here


                                // has been detected (monitorInfo.isChanged() == true).
                                if (monitorInfo.isChanged() || (unsuccessfulStarts > 0 && unsuccessfulStarts <= maxRetriedStarts))
                                {
                                    try
                                    {
                                        pam.startPA(monitorInfo.getContextName(), monitorInfo.getContextPath(), new DirectoryHelper(monitorInfo.getPADir()),
                                                monitorInfo.getPAClassLoader(), monitorInfo.getPortletApplicationType(), monitorInfo.getChecksum());
                                        // great! we have a successful start. set unsuccessful starts to 0
                                        monitorInfo.setUnsuccessfulStarts(0);
                                    }
                                    catch (Exception e)
View Full Code Here

    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

       
        // So, first deploy the typical demo.war we have been using before.
        copyDeployables();
        autoDeployment.fireDeploymentEvent();
        verifyDemoAppCreated(TEST_PORTLET_APP_NAME, demoApp);
        DirectoryHelper demoAppDeployedDir = new DirectoryHelper(demoAppDeployed);
        long beforeSize = new File(demoAppDeployedDir.getRootDirectory(), "WEB-INF/portlet.xml").length();
       
        // Trigger re-deployment using a demo.war that has a slightly larger portlet.xml
        // then the one we just deployed.  We will use size comparisons as or litmus test.
        File redeployDemoWar = new File("./test/deployment/redeploy/demo.war");
        FileChannel srcDemoWarChannel = new FileInputStream(redeployDemoWar).getChannel();
        FileChannel dstDemoWarChannel = new FileOutputStream(demoWar).getChannel();
        dstDemoWarChannel.transferFrom(srcDemoWarChannel, 0, srcDemoWarChannel.size());
        srcDemoWarChannel.close();
        dstDemoWarChannel.close();
       
        // Make sure the demo.war that will trigger redeploy has a larger portlet.xml then the current one
        JarHelper rdDemoWar = new JarHelper(demoWar, true);
        assertTrue(new File(rdDemoWar.getRootDirectory(), "WEB-INF/portlet.xml").length() > beforeSize);
       
        // Need to slow it down so the timestamp check works
        Thread.sleep(500);
        demoWar.setLastModified(System.currentTimeMillis());
        autoDeployment.fireRedeploymentEvent();
     
        long afterSize = new File(demoAppDeployedDir.getRootDirectory(), "WEB-INF/portlet.xml").length();
        // The portlet.xml in re-deploy has an additional portlet entry in portlet.xml, so it should be bigger
        assertTrue(afterSize > beforeSize);
        autoDeployment.stop();
       
    }
View Full Code Here

        manager = new TomcatManager("", "", 0, "", 0, "", "");
        FileSystemPAM pam = new FileSystemPAM(webAppsDir, portletRegistry, entityAccess, windowAccess, portletCache, manager);

        try
        {
            DirectoryHelper dirHelper = new DirectoryHelper(new File(webAppsDir + "/" + TEST_PORTLET_APP_NAME));
            paWar1 = new PortletApplicationWar(dirHelper, TEST_PORTLET_APP_NAME, "/"
                    + TEST_PORTLET_APP_NAME);
            pam.undeploy(paWar1);
        }
        catch (Exception e1)
        {

        }

        pam.unregister("jetspeed");

        try
        {
            DirectoryHelper dirHelper = new DirectoryHelper(new File(webAppsDir + "/TestSecurityRoles"));
            paWar3 = new PortletApplicationWar(dirHelper, "TestSecurityRoles", "/TestSecurityRoles" );

            pam.undeploy(paWar3);
        }
        catch (Exception e3)
        {

        }

        // DirectoryUtils.rmdir(new File("./target/deployment"));
        new DirectoryHelper(new File("./target/deployment")).remove();
        JetspeedPortletFactoryProxy.reset();
        super.tearDown();

    }
View Full Code Here

    public StandardDeploymentObject(File deploymentObject) throws IOException, FileNotDeployableException
    {
        super();
        if(deploymentObject.isDirectory())
        {
            fsh = new DirectoryHelper(deploymentObject);
        }
        else if(verifyExtension(deploymentObject))
        {
            boolean deleteOnClose = !deploymentObject.getName().startsWith("jetspeed-");          
            fsh = new JarHelper(deploymentObject, deleteOnClose);
View Full Code Here

                pam.unregister(paName);
            }
            else
            {
                log.info("Preparing to undeploy portlet application \"" + paName + "\"");
                DirectoryHelper dir = new DirectoryHelper(new File(webAppDir + "/" + paName));
                deployedWar = new PortletApplicationWar(dir, paName, webAppContextRoot );
                pam.undeploy(deployedWar);
            }

            log.info("Portlet application \"" + paName + "\"" + " was successfuly undeployed.");
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

     * @see junit.framework.TestCase#setUp()
     */
protected void setUp() throws Exception
    {
        super.setUp();
        dirHelper = new DirectoryHelper(new File("target/testdata/pages"));
        FileFilter noCVS = new FileFilter() {

            public boolean accept( File pathname )
            {
                return !pathname.getName().equals("CVS");               
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

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.