Package org.apache.jetspeed.om.portlet

Examples of org.apache.jetspeed.om.portlet.PortletApplication


    }
   
    @Override
    protected DisplayNameBean load()
    {
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
        PortletDefinition def = app.getPortlet(paNodeBean.getName());
        DisplayName displayName = def.getDisplayName(locale);
        return new DisplayNameBean(displayName);
    }
View Full Code Here


                FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
               
                try
                {
                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                    PortletDefinition def = app.getPortlet(paNodeBean.getName());
                   
                    if (newTitle != null && newShortTitle != null && newKeywords != null && newLocale != null)
                    {
                        Locale locale = new Locale(newLocale);
                        Language newLanguage = def.addLanguage(locale);
View Full Code Here

    @Override
    public void delete(IModel<LanguageBean>[] fieldBeans)
    {
        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
        PortletDefinition def = app.getPortlet(paNodeBean.getName());
       
        for (Iterator<Language> it = def.getLanguages().iterator(); it.hasNext(); )
        {
            LanguageBean tempBean = new LanguageBean(it.next());
           
View Full Code Here

    @Override
    public Iterator<IModel<LanguageBean>> getItemModels()
    {
        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
        PortletDefinition def = app.getPortlet(paNodeBean.getName());
        List<IModel<LanguageBean>> list = new LinkedList<IModel<LanguageBean>>();
       
        for (Language field : def.getLanguages())
        {
            list.add(new LanguageBeanModel(locator, paNodeBean, new LanguageBean(field)));
View Full Code Here

     * @throws PortletException
     */
    public PortletInstance getPortletInstance(ServletContext servletContext, PortletDefinition pd, boolean proxyUsed) throws PortletException
    {
        PortletInstance portlet = null;
        PortletApplication pa = pd.getApplication();
        String paName = pa.getName();
        String pdName = pd.getPortletName();
       
        try
        {
            Map<String, PortletInstance> instanceCache = this.portletCache.get(paName);
View Full Code Here

        }
    }

    public void reloadResourceBundles(PortletDefinition pd) throws PortletException
    {
        PortletApplication pa = pd.getApplication();
        String paName = pa.getName();
        String pdName = pd.getPortletName();
       
        Map<String, Map<Locale, ResourceBundle>> portletResourceBundleCache = portletsResourceBundleCache.get(paName);
       
        if (portletResourceBundleCache != null)
View Full Code Here

        }
        else if ( !Fragment.LAYOUT.equals(fragment.getType()) )
        {
            fragmentSupportsActions = true;
            String fragmentId = fragment.getId();
            PortletApplication pa = window.getPortletDefinition().getApplication();

            String portletName = portlet.getUniqueName();

            PortletMode currentMappedMode = pa.getMappedPortletMode(currentMode);
            WindowState currentMappedState = pa.getMappedWindowState(currentState);

            Object action;
            PortletMode mappedMode;
            PortletMode customMode;
            WindowState mappedState;
            WindowState customState;
           
            ArrayList actionTemplates = new ArrayList();
           
            DecoratorActionsFactory actionsAdapter = getDecoratorActionsAdapter(decoration);
           
            List supportedActions = actionsAdapter.getSupportedActions(requestContext, pa, window, currentMappedMode, currentMappedState, decoration);
            Iterator iter = supportedActions.iterator();
           
            String currentModeAction = null;
            String currentStateAction = null;

            while ( iter.hasNext() )
            {
                action = iter.next();
                if ( action instanceof PortletMode )
                {
                    mappedMode = (PortletMode)action;
                    customMode = pa.getCustomPortletMode(mappedMode);
                   
                    if ( customMode != null )
                    {
                        boolean equalsCurrentMode = customMode.equals(currentMode);
                        if ( equalsCurrentMode )
                        {
                            currentModeAction = mappedMode.toString();
                        }
                        if ( ! equalsCurrentMode || isAjaxRequest )
                        {
                            if ( (supportsPortletMode(supports,customMode) || isAutoSwitchableCustomMode(window, customMode))
                                 && (!PortletMode.EDIT.equals(customMode) || pageActionAccess.isEditAllowed())
                                 && pageActionAccess.checkPortletMode(fragmentId, portletName, mappedMode)
                                 )
                            {
                                actionTemplates.add(new DecoratorActionTemplate(mappedMode, customMode));
                            }
                        }
                    }
                }
                else if ( action instanceof WindowState )
                {
                    mappedState = (WindowState)action;
                    customState = pa.getCustomWindowState(mappedState);

                    if ( customState != null )
                    {
                        boolean equalsCurrentState = customState.equals(currentState);
                        if ( equalsCurrentState )
View Full Code Here

    {
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
        try
        {
            PortletApplication pa = null;
           
            try
            {
                pa = registry.getPortletApplication(paName);
            }
View Full Code Here

            revision = oldPA.getRevision();
            unregisterPortletApplication(oldPA, false);
            oldPA = null;
        }

        PortletApplication pa        = null;
        boolean                   registered = false;
        String                    paName     = paWar.getPortletApplicationName();

        try
        {
            log.info("Loading deployment descriptors for "+paName+" ....");
            pa = paWar.createPortletApp(paClassLoader);
            pa.setApplicationType(paType);
            if (revision > 0)
            {
                pa.setRevision(revision);
            }

            if (paType == PortletApplication.LOCAL)
            {
                pa.setContextPath("<portal>");
            }
        }
        catch (Exception e)
        {
            String msg = "Failed to load portlet application for "
                + paWar.getPortletApplicationName();
            if (!silent || log.isDebugEnabled())
            {
                log.error(msg, e);
            }
            throw new RegistryException(msg, e);
        }

        // register the portlet application
        try
        {
            registry.registerPortletApplication(pa);
            registered = true;
            log.info("Registered the portlet application " + paName);

            // add to search engine result
            this.updateSearchEngine(false, pa);
           
            // and add to the current node info
            if (nodeManager != null)
            {           
                nodeManager.addNode(new Long(pa.getRevision()), pa.getName());
            }
            // grant default permissions to portlet application
            grantDefaultPermissions(paName);
           
            if ( autoCreateRoles && roleManager != null && pa.getSecurityRoles() != null )
            {
                try
                {
                    for (SecurityRole sr : pa.getSecurityRoles())
                        if ( !roleManager.roleExists(sr.getName()) )
                        {
                            roleManager.addRole(sr.getName());
                            log.info("AutoCreated role: "+sr.getName()+" from portlet application "+paName+" its web definition");
                        }
View Full Code Here

                }
                register = false;
            }

            // try to get the PA from database by context name
            PortletApplication pa = registry.getPortletApplication(contextName);

            if (pa != null)
            {
                if (log.isDebugEnabled())
                {
                    log.debug("Portlet Application " + contextName + " found in registry.");
                }
                if ( pa.getApplicationType() != paType )
                {
                    throw new RegistryException("Cannot start portlet application "+contextName+": as Application Types don't match: " + pa.getApplicationType() + " != " + paType);
                }
                if (!monitored && changeMonitor != null)
                {
                    changeMonitor.remove(contextName);
                }
                if (log.isDebugEnabled())
                {
                    log.debug("unregistering portlet application " + contextName + "...");
                }
                portletFactory.unregisterPortletApplication(pa);                       
            }
//            if (register && (pa == null || checksum != pa.getChecksum()))
            if (register)
            {
                if (pa == null)
                {
                    // new
                    try
                    {
                        if (log.isDebugEnabled())
                        {
                            log.debug("Register new portlet application " + contextName + ".");
                        }
                       
                        pa = registerPortletApplication(paWar, pa, paType, paClassLoader, silent);
                    }
                    catch (RegistryException e)
                    {
                        throw e;
                    }
                    catch (Exception e)
                    {
                        String msg = "Error register new portlet application " + contextName + ".";
                       
                        if (log.isDebugEnabled())
                        {
                            log.debug(msg);
                        }
                       
                        throw new RegistryException(msg);
                    }
                }
                else
                {
                    if (log.isDebugEnabled())
                    {
                        log.debug("Re-register existing portlet application " + contextName + ".");
                    }
                    int status = nodeManager.checkNode(new Long(pa.getRevision()), pa.getName());
                    boolean reregister = false;
                    boolean deploy = false;
                    switch (status)
                    {
                        case  NodeManager.NODE_NEW:
                        {
                            if (log.isDebugEnabled())
                            {
                                log.debug("Node for Portlet application " + contextName + " is NEW.");
                            }
                            //only reason is that the file got somehow corrupted
                            // so we really do not know what is going on here...
                            // the best chance at this point is to reregister (which might be the absolute wrong choice)
                            log.warn("The portlet application " + pa.getName() + " is registered in the database but not locally .... we will reregister");
                            reregister = true;
                            if (checksum != pa.getChecksum())
                            {
                                log.warn("The provided portlet application " + pa.getName() + " is a different version than in the database (db-checksum=" + pa.getChecksum() + ", local-checksum=: " + checksum + ") .... we will redeploy (also to the database)");
                                deploy = true;
                            }
                            break;
                        }
                        case  NodeManager.NODE_SAVED:
                        {
                            if (log.isDebugEnabled())
                            {
                                log.debug("Node for Portlet application " + contextName + " is SAVED.");
                            }
                            if (checksum != pa.getChecksum())
                            {  
                                log.warn("The provided portlet application " + pa.getName() + " is a different version than in the local node info and the database (db-checksum=" + pa.getChecksum() + ", local-checksum=: " + checksum + ") .... we will reregister AND redeploy (also to the database)");
                                //database and local node info are in synch, so we assume that this is a brand new
                                // war .... let's deploy
                                reregister = true;
                                deploy = true;
                            }
                            break;
                        }
                        case  NodeManager.NODE_OUTDATED:
                        {
                            // new version in database, maybe changed by a different cluster node
                            if (log.isDebugEnabled())
                            {
                                log.debug("Node for Portlet application " + contextName + " is OUTDATED (local PA.id < DB PA.id).");
                            }
                            //database version is older (determined by id) than the database
                            //let's deploy and reregister
                            if (checksum != pa.getChecksum())
                            {
                                log.error("The portlet application " + pa.getName() + " provided for the upgrade IS WRONG. The database checksum= " + pa.getChecksum() + ", but the local=" + checksum + "....THIS NEEDS TO BE CORRECTED");
                                // if the checksums do not match make sure the database is updated with the new PA from file system
                                // I've observed "unavailable PA" in clustered env for the cluster node that reported OUTDATED state
                                deploy = true;
                            }
                            reregister = true;
                            break;
                        }
                    }
                    if (deploy)
                    {
                        if (log.isDebugEnabled())
                        {
                            log.debug("Register (deploy=true) Portlet application " + contextName + " in database.");
                        }
                        pa = registerPortletApplication(paWar, pa, paType, paClassLoader, silent);
                    }
                    else
                        if (reregister)
                        {
                            if (log.isDebugEnabled())
                            {
                                log.debug("Re-Register (reregister=true) Portlet application " + contextName + ".");
                            }
                            // add to search engine result
                            this.updateSearchEngine(true, pa);
                            this.updateSearchEngine(false, pa);
                           
                            // and add to the current node info
                            try
                            {
                                nodeManager.addNode(new Long(pa.getRevision()), pa.getName());
                            } catch (Exception e)
                            {
                                log.error("Adding node for portlet application " + pa.getName() + " caused exception" , e);
                            }
                        }
                       
               
                }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.portlet.PortletApplication

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.