Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletConfig


        if (PortletEntry.TYPE_ABSTRACT.equals(regEntry.getType()))
        {
            throw new PortletException("PortletFactory: can't instanciate abstract registry entry: "+regEntry.getName());
        }
           
        PortletConfig pc = getPortletConfig(regEntry, entry.getId());

        // Set portlet config with values from PSML Entry
        pc.getInitParameters().putAll(getParameters(entry));
        pc.setPortletSkin( PortalToolkit.getSkin( entry.getSkin() ) );
        pc.setSecurityRef( getSecurityReference(entry, regEntry));

        return getPortlet( getClassname(regEntry), pc, entry.getId() );
    }
View Full Code Here


        if (PortletEntry.TYPE_ABSTRACT.equals(regEntry.getType()))
        {
            throw new PortletException("PortletFactory: can't instanciate abstract registry entry: "+name);
        }
           
        PortletConfig pc = getPortletConfig(regEntry, id);
       
        return getPortlet( getClassname(regEntry), pc, null );
    }
View Full Code Here

    protected PortletConfig getPortletConfig( PortletEntry portletEntry, String id)
    {
        Map map = new HashMap();
        map.putAll(portletEntry.getParameterMap());
       
        PortletConfig pc = new BasePortletConfig();
        pc.setName( portletEntry.getName() );
        addParentInitParameters(portletEntry, map);       
        pc.setInitParameters( map );
        pc.setMetainfo( getMetaData( portletEntry ) );
        pc.setURL( portletEntry.getURL() );
        pc.setCachedOnURL( portletEntry.isCachedOnURL() );
        pc.setSecurityRef( getSecurityReference(null, portletEntry));

        if (runDataService != null)
        {
            JetspeedRunData rundata = runDataService.getCurrentRunData();
            if (rundata != null)
            {
                Profile profile = rundata.getProfile();
                if (profile != null)
                {
                    pc.setPageId(profile.getId());
                }
            }
        }
        pc.setPortletId(id);

        return pc;
    }
View Full Code Here

    @return the newly created PortletConfig object
    */
    protected PortletConfig getPortletConfig(Portlets portlets)
    {

        PortletConfig pc = new BasePortletConfig();

        pc.setName(portlets.getName());
        pc.setInitParameters(getParameters(portlets));

        //Invocation of new skin-locating algorithim
        pc.setPortletSkin(getSkin(findSkin(portlets)));

        pc.setSecurityRef(portlets.getSecurityRef());
        pc.setMetainfo(getMetaData(portlets));

        return pc;
    }
View Full Code Here

    */
    public static String getConfigParameter(Portlet portlet,
                                            String attrName,
                                            String attrDefaultValue)
    {
        PortletConfig pc = portlet.getPortletConfig();
        return pc.getInitParameter(attrName, attrDefaultValue);
    }
View Full Code Here

    public void init() throws PortletException {
 
        if (initDone) // Why is init called more than once per portlet?
            return;

        PortletConfig config = this.getPortletConfig();
       
        try
        {
            //FIXME: HTMLRewriter should take a Reader, and work
            rewriter = new HTMLRewriter(
                    ! config.getInitParameter("dont_remove_script","no")
                        .equalsIgnoreCase("yes"),
                    ! config.getInitParameter("dont_remove_style","no")
                        .equalsIgnoreCase("yes"),
                    ! config.getInitParameter("dont_remove_noscript","no")
                        .equalsIgnoreCase("yes"),
                    ! config.getInitParameter("dont_remove_meta","no")
                        .equalsIgnoreCase("yes"),
                    ! config.getInitParameter("dont_remove_applet","no")
                        .equalsIgnoreCase("yes"),
                    ! config.getInitParameter("dont_remove_object","no")
                        .equalsIgnoreCase("yes"),
                    ! config.getInitParameter("dont_remove_head","no")
                        .equalsIgnoreCase("yes"),
                    ! config.getInitParameter("dont_remove_onsomething","no")
                        .equalsIgnoreCase("yes"),
                    config.getInitParameter("open_in_popup","no")
                        .equalsIgnoreCase("yes")
                        );

            // fetch username and password for HTTP Basic Autentication
            username = config.getInitParameter("username");
            password = config.getInitParameter("password");
           
            contentStale = true;
            initDone = true;
        } catch (Exception e) {
            Log.info("Exception occurred:" + e.toString());
View Full Code Here

    public void init() throws PortletException {
 
        if (initDone) // Why is init called more than once per portlet?
            return;

        PortletConfig config = this.getPortletConfig();
       
        try
        {
            rewriter = new HTMLRewriter();

            // fetch username and password for HTTP Basic Autentication
            username = config.getInitParameter("username");
            password = config.getInitParameter("password");
           
            contentStale = true;
            initDone = true;
        } catch (Exception e) {
            Log.info("Exception occurred:" + e.toString());
View Full Code Here

    @param data the RunData object for the request
    @return the content to be displayed to the user-agent
    */
    public ConcreteElement getContent( RunData data )
    {
        PortletConfig config = this.getPortletConfig();
       
        if (contentStale == true)
            return getWebPageContent(data, config);
       
        if (null == getExpirationMillis())
View Full Code Here

        // first make sure we propagate init
        super.init();

        try
        {
            PortletConfig config = this.getPortletConfig();
            String param = null;

            param = config.getInitParameter(PARAM_SOURCE);
            if (param != null)
            {
                setSource(param);
            }

            param = config.getInitParameter(PARAM_WIDTH);
            if (param != null)
            {
                setWidth(param);
            }

            param = config.getInitParameter(PARAM_HEIGHT);
            if (param != null)
            {
                setHeight(param);
            }

            param = config.getInitParameter(PARAM_SCROLLING);
            if (param != null)
            {
                setScrolling(param);
            }

            param = config.getInitParameter(PARAM_FRAMEBORDER);
            if (param != null)
            {
                setFrameBorder(param);
            }

            param = config.getInitParameter(PARAM_STYLE);
            if (param != null)
            {
                setStyle(param);
            }

            param = config.getInitParameter(PARAM_NAME);
            if (param != null)
            {
                setFrameName(param);
            }

            param = config.getInitParameter(PARAM_REFRESH);
            if (param != null)
            {
                setRefresh(param);
            }

            param = config.getInitParameter(PARAM_MARGINWIDTH);
            if (param != null)
            {
                setMarginWidth(param);
            }

            param = config.getInitParameter(PARAM_MARGINHEIGHT);
            if (param != null)
            {
                setMarginHeight(param);
            }

            param = config.getInitParameter(PARAM_ALIGN);
            if (param != null)
            {
                setAlign(param);
            }
View Full Code Here

        if ((p==null) || (changeRequested = false ))
        {
            doCancel(rundata, context);
            return;
        }
        PortletConfig pc = p.getPortletConfig();
        Profile profile = ((JetspeedRunData)rundata).getCustomizedProfile();
        Entry entry = profile.getDocument().getEntryById(p.getID());

        // Only update the security ref if the parent changed
        if ((newSecurityParent != null))
        {
            boolean securityChanged = false;
            SecurityReference currentSecurityRef = pc.getSecurityRef();
            if (currentSecurityRef != null)
            {
                securityChanged = (newSecurityParent.equals(currentSecurityRef.getParent()) == false);
            }
            else
            {
                securityChanged = (newSecurityParent.trim().length() > 0);
            }
            if (securityChanged == true)
            {
                SecurityReference securityRef = null;
                if ((newSecurityParent.trim().length() > 0))
                {
                    securityRef = new BaseSecurityReference();
                    securityRef.setParent( newSecurityParent);
                }
                // Note: setting the portlet's config may not be a good idea -
                // it might be used as the Portlet for other PSMLDocument Entries that
                // have a different idea of security - and the caching of Portlets does
                // NOT include security -ggolden.
                pc.setSecurityRef(securityRef);
                entry.setSecurityRef(securityRef);
                madePcChange = true;
            }
        }

        // Only update the skin if the name changed
        if (newSkinName != null)
        {
            boolean skinChanged = false;
            String currentSkinName = null;

            if  (pc.getSkin() != null)
                currentSkinName = pc.getPortletSkin().getName();

            if (currentSkinName != null)
            {
                skinChanged = (newSkinName.equals(currentSkinName) == false);
            }
            else
            {
                skinChanged = (newSkinName.trim().length() > 0);
            }

            if (skinChanged == true)
            {
                PortletSkin skin = null;
                if ((newSkinName.trim().length() > 0))
                {
                    skin = PortalToolkit.getSkin(newSkinName);
                    if (skin != null)
                    {
                        // Note: setting the portlet's config may not be a good idea -
                        // it might be used as the Portlet for other PSMLDocument Entries that
                        // have a different idea of skin - and the caching of Portlets does
                        // NOT include skin -ggolden.
                        pc.setPortletSkin(skin);

                        Skin psmlSkin = entry.getSkin();
                        if (psmlSkin == null)
                        {
                            entry.setSkin(new PsmlSkin());
                        }
                        entry.getSkin().setName(newSkinName);
                    }
                    else
                    {
                        Log.warn( "Unable to update skin for portlet entry " + entry.getId() + " because skin " + skin + " does not exist.");
                    }
                }
                else
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of skin - and the caching of Portlets does
                    // NOT include skin -ggolden.
                    pc.setPortletSkin( null);
                    entry.setSkin(null);
                }
                madePcChange = true;
            }
        }

        // Only update the title if the title changed
        if (newTitle != null)
        {
            boolean titleChanged = false;
            String currentTitle = entry.getTitle();

            MetaData md = pc.getMetainfo();
            if  (currentTitle == null && md != null && md.getTitle() != null)
                currentTitle = md.getTitle();

            if (currentTitle != null)
            {
                titleChanged = (newTitle.equals(currentTitle) == false);
            }
            else
            {
                titleChanged = (newTitle.trim().length() > 0);
            }

            if (titleChanged == true)
            {

                if ((newTitle.trim().length() > 0))
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of title - and the caching of Portlets does
                    // NOT include title -ggolden.
                    if (md == null) {
                        md = new MetaData();
                        pc.setMetainfo(md);
                    }
                    md.setTitle(newTitle);
                    entry.setTitle(newTitle);
                    madePcChange = true;
                }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.portal.PortletConfig

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.