亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? jetspeedportletfactoryservice.java

?? jetspeed源代碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
 * Copyright 2000-2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.jetspeed.services.portletfactory;

//jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletConfig;
import org.apache.jetspeed.portal.PortletException;
import org.apache.jetspeed.portal.BasePortletConfig;

import org.apache.jetspeed.portal.security.portlets.PortletWrapper;

import org.apache.jetspeed.om.SecurityReference;
import org.apache.jetspeed.om.profile.Entry;
import org.apache.jetspeed.om.profile.Parameter;
import org.apache.jetspeed.om.profile.MetaInfo;
import org.apache.jetspeed.services.JetspeedSecurity;
import org.apache.jetspeed.services.Registry;
import org.apache.jetspeed.services.PortalToolkit;
import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
import org.apache.jetspeed.services.logging.JetspeedLogger;
import org.apache.jetspeed.services.portletcache.PortletCache;
import org.apache.jetspeed.services.portletcache.Cacheable;
import org.apache.jetspeed.om.registry.PortletEntry;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.util.MetaData;
import org.apache.jetspeed.services.rundata.JetspeedRunDataService;
import org.apache.jetspeed.services.rundata.JetspeedRunData;

import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.resources.ResourceService;
import org.apache.turbine.services.rundata.RunDataService;

import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
import javax.servlet.ServletConfig;

/**
 * Simple implementation of the PortalFactoryService.
 * 
 * @author <a href="mailto:raphael@apache.org">Rapha雔 Luta</a>
 * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 * @version $Id: JetspeedPortletFactoryService.java,v 1.23 2004/02/23 03:36:42 jford Exp $
 */
public class JetspeedPortletFactoryService extends TurbineBaseService
    implements PortletFactoryService
{
    /**
     * Static initialization of the logger for this class
     */    
    private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(JetspeedPortletFactoryService.class.getName());
    
    /** The default control to use when none is specified */
    private boolean enableCache = false;

    /** The JetspeedRunData Service. */
    private JetspeedRunDataService runDataService = null;
    
    /**
     * This is the early initialization method called by the 
     * Turbine <code>Service</code> framework
     */
    public void init( ServletConfig conf ) throws InitializationException
    {

        ResourceService serviceConf = ((TurbineServices)TurbineServices.getInstance())
                                                     .getResources(PortletFactoryService.SERVICE_NAME);

        this.enableCache = serviceConf.getBoolean("enable.cache",true);
        
        // get the runData service
        this.runDataService =
            (JetspeedRunDataService)TurbineServices.getInstance()
                .getService(RunDataService.SERVICE_NAME);

        setInit(true);
    }
            
    /**
     * Given a PSML Entry return an instanciated Portlet.
     *
     * @param entry a PSML Entry describing a portlet
     * @param id the PSML entry's portlet id     
     * @return an instanciated portlet corresponding to this entry
     */
    public Portlet getPortlet( Entry entry ) throws PortletException
    {
        PortletEntry regEntry = (PortletEntry)Registry.getEntry(Registry.PORTLET, 
                                                                entry.getParent() );
        if (regEntry == null)
        {
            throw new PortletException("PortletFactory: unknown portlet entry in Registry: "+entry.getParent());
        }
        
        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() );
    }

    /**
     * Given a Portlet registry entry name, instanciate it
     *
     * @param name the name of a portlet in the registry
     * @return an instanciated portlet corresponding to this entry
     */
    public Portlet getPortlet( String name, String id ) throws PortletException
    {
        PortletEntry regEntry = (PortletEntry)Registry.getEntry(Registry.PORTLET, name );

        if (regEntry == null)
        {
            throw new PortletException("PortletFactory: unknown portlet entry in Registry: "+name);
        }
        
        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 );
    }
    
    /** 
     * Instanciates or retrieve from memory cache a portlet corresponding to the 
     * passed parameters
     *
     * @param classname the classname of the portlet to instanciate
     * @param pc the PortletConfig object to be associated with this object
     * @param id the PSML entry's portlet id
     * @return the Portlet created or retrieve from cache
     */
    protected Portlet getPortlet( String classname, PortletConfig pc, String id )
        throws PortletException
    {

        //record the begining of the portlet creation
        long begin = System.currentTimeMillis();

        Portlet portlet = null;
        Class portletClass = null;
        String handle = null;
        
        try
        {
            portletClass = Class.forName(classname);
        }
        catch (Exception e)
        {
            throw new PortletException( "PortletFactory: Unable to load class " + classname );
        }
        
        if (enableCache)
        {
            try
            {
                // try to invoke a static getHandle() for this class
                Class[] signatureParams = { Object.class };
                Object[] methodParams = { pc };
                handle = (String)portletClass.getMethod("getHandle",signatureParams)
                                             .invoke(null,methodParams);
                // make sure the handle is differenciated by class
                handle = String.valueOf(classname.hashCode())+handle;
            }
            catch (NoSuchMethodException e)
            {
                // ignore, this simply means the portlet is not cacheable
            }
            catch (Exception e)
            {
                // invocation failed or security exception, in both case
                // log the error and treat the class as non cacheable
                logger.error("PortletFactory: failed to get cache handle",e);
            }
        }
        
        try {

            if (enableCache && (handle != null))
            {
                portlet = (Portlet)PortletCache.getCacheable( handle );

                //portlet in cache but expired, remove it from cache
                if ((portlet!=null) && ((Cacheable)portlet).getExpire().isExpired() )
                {
                    logger.info( "The portlet (" + handle + ") is expired" );
                    PortletCache.removeCacheable(handle);
                    if ( logger.isDebugEnabled() )
                    {
                        logger.debug( "After removal of object(" + handle + ")." );
                    }
                    portlet = null;
                }
            }

            // we found a portlet in the cache
            if ( (portlet != null)
                 && ( portlet instanceof Cacheable )
                 && (! ((Cacheable)portlet).getExpire().isExpired()) )
            {
                // update the config for the portlet to the current one
                // Note: this is what was used to find the cached portlet.
                // Note: the init params may have changed in the psml since caching,
                //       this will update the portlet to use them.
                portlet.setPortletConfig( pc );
                portlet.setID( id );
                portlet.setName( pc.getName() );

                //FIXME: we now avoid to override metainfo when nothing is set
                //in the markup, so that cached portlets can keep their metainfo
                //This may lead to an incorrect metainfo retrieved if the first
                //instance of the portlet, which is put in the cache, has some
                //special metainfo defined in the markup 

                MetaData meta = pc.getMetainfo();
                
                if ( meta != null)
                {

                    if (! MetaData.DEFAULT_TITLE.equals( meta.getTitle() ) )
                    {
                        portlet.setTitle( meta.getTitle() );
                    }
    
                    if (! MetaData.DEFAULT_DESCRIPTION.equals( meta.getDescription() ) )
                    {
                        portlet.setDescription( meta.getDescription() );
                    }
                }

                //FIXME: Notice here we are putting the portlet without wrapper
                //in the cache, and we must wrap it on return.
                //Security implications: the portletcache should not be
                //publicly accessible.
                //Alternative: we could wrap the portlet before putting
                //it in the cache.

                //now compute the time it took to instantate and log it...
                // time in millis, sugested by Thomas Schaeck (schaeck@de.ibm.com)
                long milliseconds = ( System.currentTimeMillis() - begin );
        
                if (logger.isDebugEnabled())
                    logger.debug( "PortletFactory.getPortlet(): found in cache in "
                        + milliseconds + " ms - handle: " + handle );

                return PortletWrapper.wrap( portlet );
            }

            // if not found in the cache, instanciate a new Portlet
            portlet = (Portlet)portletClass.newInstance();

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产喂奶挤奶一区二区三区| 一本高清dvd不卡在线观看| 亚洲精品欧美综合四区| 国产欧美日本一区视频| 日韩精品一区二区三区视频播放 | 99久久婷婷国产| 成人毛片视频在线观看| 色婷婷久久久亚洲一区二区三区| 99久久精品免费观看| 欧美性受极品xxxx喷水| 555www色欧美视频| 国产日韩欧美在线一区| 亚洲欧美国产高清| 日韩黄色免费网站| 黄色小说综合网站| 高清不卡在线观看| 在线观看91av| 国产精品国产成人国产三级| 国产一区二区在线电影| 亚洲.国产.中文慕字在线| 日韩高清一区在线| 黑人巨大精品欧美一区| 成人综合在线观看| 免费看欧美美女黄的网站| 国产精品一区一区三区| 成人av网站在线| 欧美三级电影在线看| 日韩欧美黄色影院| 亚洲欧洲精品一区二区精品久久久| 国产精品成人在线观看| 午夜精彩视频在线观看不卡| 久久国产精品99久久久久久老狼| 国产一区在线观看麻豆| 色综合久久六月婷婷中文字幕| 欧美日韩国产乱码电影| 国产精品拍天天在线| 中文欧美字幕免费| 性做久久久久久| 91久久香蕉国产日韩欧美9色| 日韩一区二区三区四区五区六区| 国产色91在线| 激情亚洲综合在线| 91精品国产欧美一区二区成人| 国产精品成人网| 国产一本一道久久香蕉| 精品久久久影院| 五月天精品一区二区三区| 色综合天天综合网国产成人综合天 | 国产精品国产a| 麻豆成人免费电影| 日韩精品专区在线影院重磅| 一区二区三区日本| 欧美日韩一级二级| 亚洲国产成人精品视频| 99精品偷自拍| 国产精品麻豆久久久| 另类小说图片综合网| 欧美日韩1234| 日日夜夜免费精品| 日韩午夜激情免费电影| 麻豆91在线看| 国产人妖乱国产精品人妖| 成人黄色一级视频| 国产精品国产三级国产专播品爱网| 高清视频一区二区| 亚洲精品视频自拍| 制服视频三区第一页精品| 美女视频网站久久| 国产亚洲视频系列| 色美美综合视频| 亚洲欧美视频在线观看视频| 欧美影视一区在线| 久久激五月天综合精品| 亚洲日本在线a| 69久久夜色精品国产69蝌蚪网| 精品制服美女丁香| 亚洲综合无码一区二区| 精品国精品国产| 欧美性大战xxxxx久久久| 韩国三级在线一区| 天天综合色天天综合色h| 久久久久久亚洲综合影院红桃| 欧美日韩一区三区| 在线视频欧美区| 天天射综合影视| 亚洲啪啪综合av一区二区三区| 欧美男男青年gay1069videost| 国产一区二区三区免费在线观看 | 一二三四社区欧美黄| 91精品国产入口| 色吊一区二区三区| 97久久精品人人做人人爽| 精品一区免费av| 免费一级片91| 日韩精品乱码av一区二区| 亚洲影视在线观看| 樱花影视一区二区| 一个色在线综合| 国产精品午夜春色av| 国产人妖乱国产精品人妖| 亚洲精品一区二区在线观看| 欧美精品日韩精品| 在线观看av一区| 欧美性生活久久| 91高清视频免费看| 欧美一区二区三区爱爱| 欧美一区二区三区性视频| 日韩一区二区精品| 2023国产精品自拍| 国产精品乱子久久久久| 国产精品夫妻自拍| 亚洲精品国产高清久久伦理二区| 国产精品不卡视频| 日韩中文字幕亚洲一区二区va在线 | 日韩电影免费在线| 国产a视频精品免费观看| 99精品视频在线播放观看| 91精品国产综合久久国产大片| 欧美肥妇毛茸茸| 国产精品久久免费看| 五月天精品一区二区三区| 国产91精品免费| 欧美日本国产视频| 欧美激情综合在线| 蜜臀va亚洲va欧美va天堂| 岛国一区二区三区| 日韩精品一区二区在线观看| 国产精品网站在线| 捆绑变态av一区二区三区| 91网站最新网址| 国产欧美精品国产国产专区| 一区二区高清在线| 丁香激情综合国产| 久久亚洲一区二区三区四区| 亚洲国产欧美另类丝袜| 99久久99久久精品免费观看| 日韩欧美一级在线播放| 亚洲成人免费在线观看| 成人不卡免费av| 国产精品无码永久免费888| 国产成人在线免费观看| 久久久久久久国产精品影院| 亚洲成va人在线观看| 欧美在线看片a免费观看| √…a在线天堂一区| 不卡av电影在线播放| 亚洲欧洲成人精品av97| 在线视频综合导航| 亚洲一区二区三区中文字幕| 欧美在线一区二区三区| 亚洲国产精品自拍| 日韩一区二区麻豆国产| 精品一区二区日韩| 亚洲国产精品99久久久久久久久| 国产精品综合一区二区三区| 精品欧美一区二区在线观看| 精品一区二区免费| 日本一区二区三级电影在线观看 | 久久精品人人做人人爽人人| 国产在线一区观看| 日本一区二区三级电影在线观看| 9久草视频在线视频精品| 香港成人在线视频| 国产亚洲一区二区三区在线观看 | 欧美v日韩v国产v| 成人性视频免费网站| 一区二区三区四区不卡视频| 日韩欧美第一区| 91丨porny丨首页| 激情六月婷婷久久| 亚洲综合成人网| 精品国产区一区| 波多野结衣中文字幕一区| 青青草91视频| 亚洲一区在线免费观看| 国产精品麻豆网站| 26uuu亚洲综合色| 日韩一区二区三区观看| 91福利国产成人精品照片| 国产一区啦啦啦在线观看| 三级在线观看一区二区| 亚洲精品自拍动漫在线| 国产欧美一区二区精品性色超碰| 91亚洲精品久久久蜜桃| 不卡在线观看av| av高清不卡在线| 国产91精品露脸国语对白| 国产一区二区三区不卡在线观看 | 国产精品国产馆在线真实露脸| 日韩一区二区三区精品视频| 欧美日韩中字一区| 欧美日韩久久久一区| 6080午夜不卡| 欧美剧在线免费观看网站 | 欧美一区三区二区| 日韩欧美在线观看一区二区三区| 欧美欧美午夜aⅴ在线观看| 欧美精品久久一区二区三区| 欧美日韩久久不卡| 精品国产a毛片|