Package org.jahia.data.applications

Examples of org.jahia.data.applications.WebAppContext


        }

        if (appBean != null && appBean.getContext() == null) {
            return null;
        }
        WebAppContext appContext = mRegistry.get (appBean.getContext());
        if (appContext == null) {
            synchronized (mRegistry) {
                if (appContext == null) {
                    // try to load from disk
                    appContext = loadContextInfoFromDisk (appBean.getID(), appBean.getContext());
                    if (appContext == null) {
                        // create a fake Application Context to avoid loading from disk the next time.
                        appContext = new WebAppContext(appBean.getContext());
                    }
                    mRegistry.put (appBean.getContext(), appContext);
                }
            }
        }
View Full Code Here


        }
       
        InputStream is = null;

        // extract data from the web.xml file
        WebAppContext appContext;
        Web_App_Xml webXmlDoc;
        try {
          is = dispatchedContext.getResourceAsStream(WEB_XML_FILE);
            webXmlDoc = Web_App_Xml.parse(is);
        } catch (Exception e) {
            logger.error("Error during loading of web.xml file for application "+ context, e);
            return null;
        } finally {
          IOUtils.closeQuietly(is);
        }

        appContext = new WebAppContext(context,
                webXmlDoc.getDisplayName (),
                webXmlDoc.getdesc (),
                null,
                webXmlDoc.getServletMappings (),
                null,
                webXmlDoc.getWelcomeFiles ());

        List<Servlet_Element> servlets = webXmlDoc.getServlets ();
        Servlet_Element servlet;
        ServletBean servletBean;
        for (int i = 0; i < servlets.size (); i++) {
            servlet = servlets.get (i);
            servletBean = new ServletBean (
                    applicationID,
                    servlet.getType (),
                    servlet.getDisplayName (),
                    servlet.getName (),
                    servlet.getSource (),
                    context,
                    servlet.getdesc ()
            );
            appContext.addServlet (servletBean);
        }

        List<Security_Role> roles = webXmlDoc.getRoles ();
        Security_Role role;
        for (int i = 0; i < roles.size (); i++) {
            role = roles.get (i);
            appContext.addRole (role.getName ());
        }

        return appContext;
    }
View Full Code Here

                    String webappRolesPath = webappPath + "/" + getWebAppQualifiedNodeName(app.getName(), "roles");
                    JCRNodeWrapper webappRolesPermNode = getOrCreatePermissionNode(webappRolesPath, session);
                    session.save();

                    try {
                        WebAppContext appContext = servletContextManager.getApplicationContext(app);
                        Iterator<String> updatedRoles = appContext.getRoles().iterator();
                        String webAppRoleName;
                        while (updatedRoles.hasNext()) {
                            webAppRoleName = updatedRoles.next();

                            JCRNodeWrapper permission = getOrCreatePermissionNode(webappRolesPath + "/" + getWebAppQualifiedNodeName(app.getName(), webAppRoleName), session);
View Full Code Here

     * create groups for each context, that is for each field id
     */
    public void createApplicationGroups(EntryPointInstance entryPointInstance) throws JahiaException {
        // update roles
        final String context = entryPointInstance.getContextName();
        WebAppContext appContext = getApplicationContext(getApplicationByContext(context));

        Iterator<String> updatedRoles = appContext.getRoles().iterator();
        String groupName;
        String role;
        while (updatedRoles.hasNext()) {
            role = updatedRoles.next();
            groupName = entryPointInstance.getID() + "_" + role;
View Full Code Here

     * and all its members
     */
    public void deleteApplicationGroups(EntryPointInstance entryPointInstance) throws JahiaException {
        final String context = entryPointInstance.getContextName();

        WebAppContext appContext = getApplicationContext(getApplicationByContext(context));

        Iterator<String> roles = appContext.getRoles().iterator();
        String groupName;
        String role;
        while (roles.hasNext()) {
            role = roles.next();
            groupName = new StringBuffer().append(entryPointInstance.getID()).append("_").append(role).toString();
View Full Code Here

    @Test
    public void testRetrievingApplicationDefinitions() throws Exception {
        List<ApplicationBean> applicationBeans = applicationsManagerService.getApplications();
        assertFalse("Applications should not be empty", applicationBeans.isEmpty());
        for (ApplicationBean applicationBean : applicationBeans) {
            WebAppContext webAppContext = applicationsManagerService.getApplicationContext(applicationBean);
            ApplicationBean appFoundByContext = applicationsManagerService.getApplicationByContext(
                    webAppContext.getContext());
            assertEquals(appFoundByContext.getID(), applicationBean.getID());
        }
    }
View Full Code Here

TOP

Related Classes of org.jahia.data.applications.WebAppContext

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.