Examples of DirectoryHelper


Examples of org.apache.jetspeed.util.DirectoryHelper

                PortletApplicationManagement pam =
                    (PortletApplicationManagement)services.getService("PAM");

                if (pam != null && pam.isStarted())
                {
                    DirectoryHelper paDirHelper = new DirectoryHelper(new File(paDir));
                    pam.startPortletApplication(contextPath, paDirHelper, paClassLoader);
                    started = true;
                    psm = (PortalSessionsManager)services.getService(PortalSessionsManager.SERVICE_NAME);

                    context.log(STARTED_MSG + contextPath);
View Full Code Here

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

Examples of org.apache.jetspeed.util.DirectoryHelper

                            {
                                if (monitorInfo.isChanged())
                                {
                                    try
                                    {
                                        pam.startPA(monitorInfo.getContextName(), new DirectoryHelper(monitorInfo.getPADir()),
                                                monitorInfo.getPAClassLoader(), monitorInfo.getPortletApplicationType(), monitorInfo.getChecksum());
                                    }
                                    catch (Exception e)
                                    {
                                        log.error("Failed to restart PortletApplication "+monitorInfo.getContextName(),e);
View Full Code Here

Examples of org.apache.jetspeed.util.DirectoryHelper

     */
    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

Examples of org.apache.jetspeed.util.DirectoryHelper

                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

Examples of org.apache.jetspeed.util.DirectoryHelper

     *
     * @throws RegistryException
     */
    public void startPortletApplication() throws RegistryException
    {
        DirectoryHelper portletApplicationDir = new DirectoryHelper(new File(baseDir+"/test/testdata/"+TestPortletApplicationManager.CONTEXT_NAME));
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        portletApplicationManager.startPortletApplication(TestPortletApplicationManager.CONTEXT_NAME, TestPortletApplicationManager.CONTEXT_PATH, portletApplicationDir, contextClassLoader);
    }
View Full Code Here

Examples of org.apache.jetspeed.util.DirectoryHelper

   
    public void testSecurityRoles() throws Exception
    {
        System.out.println("Testing securityRoles");
        File warFile = new File("./test/testdata/deploy/webapp");
        PortletApplicationWar paWar = new PortletApplicationWar(new DirectoryHelper(warFile), "unit-test", "/" );

        MutablePortletApplication app = paWar.createPortletApp(false);
        assertNotNull("App is null", app);

        MutableWebApplication webApp = paWar.createWebApp();
View Full Code Here

Examples of org.apache.jetspeed.util.DirectoryHelper

    }

    public void testInfusingWebXML() throws Exception
    {
        File warFile = new File("./test/testdata/deploy/webapp");
        PortletApplicationWar paWar = new PortletApplicationWar(new DirectoryHelper(warFile), "unit-test", "/" );

        SAXBuilder builder = new SAXBuilder(false);

        // Use the local dtd instead of remote dtd. This
        // allows to deploy the application offline
        builder.setEntityResolver(new EntityResolver()
        {
            public InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
                throws SAXException, java.io.IOException
            {

                if (systemId.equals("http://java.sun.com/dtd/web-app_2_3.dtd"))
                {
                    return new InputSource(PortletApplicationWar.class.getResourceAsStream("web-app_2_3.dtd"));
                }
                else
                    return null;
            }
        });

        FileReader srcReader = new FileReader("./test/testdata/deploy/webapp/WEB-INF/web.xml");
        FileReader targetReader = null;
        Document  doc = builder.build(srcReader);

        Element root = doc.getRootElement();

        try
        {
            Object jetspeedServlet = XPath.selectSingleNode(root, PortletApplicationWar.JETSPEED_SERVLET_XPATH);
            Object jetspeedServletMapping = XPath.selectSingleNode(root, PortletApplicationWar.JETSPEED_SERVLET_MAPPING_XPATH);

            assertNull(jetspeedServlet);
            assertNull(jetspeedServletMapping);

            PortletApplicationWar targetWar = paWar.copyWar("./target/webapp");
            targetWar.processWebXML();

            targetReader = new FileReader("./target/webapp/WEB-INF/web.xml");

            Document targetDoc = builder.build(targetReader);

            jetspeedServlet = XPath.selectSingleNode(targetDoc, PortletApplicationWar.JETSPEED_SERVLET_XPATH);
            jetspeedServletMapping = XPath.selectSingleNode(targetDoc, PortletApplicationWar.JETSPEED_SERVLET_MAPPING_XPATH);


            assertNotNull(jetspeedServlet);
            assertNotNull(jetspeedServletMapping);

        }
        finally
        {
            srcReader.close();
            paWar.close();
            if (targetReader != null)
            {
                targetReader.close();
            }
            File warFile2 = new File("./target/webapp");
            if (warFile2.exists())
            {
                DirectoryHelper dirHelper = new DirectoryHelper(warFile2);
                dirHelper.remove();
                dirHelper.close();
            }
        }

    }
View Full Code Here

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

Examples of org.apache.jetspeed.util.DirectoryHelper

                                // has been detected (monitorInfo.isChanged() == true).
                                if (monitorInfo.isChanged() || (unsuccessfulStarts > 0 && unsuccessfulStarts <= maxRetriedStarts))
                                {
                                    try
                                    {
                                        pam.tryStartPortletApplication(monitorInfo.getContextName(), monitorInfo.getContextPath(), new DirectoryHelper(monitorInfo.getPADir()),
                                                                       monitorInfo.getPAClassLoader(), monitorInfo.getPortletApplicationType(), monitorInfo.getChecksum(), true);
                                        // great! we have a successful start. set unsuccessful starts to 0
                                        monitorInfo.setUnsuccessfulStarts(0);
                                    }
                                    catch (Exception e)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.