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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? castorpsmlmanagerservice.java

?? jetspeed源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/*
 * Copyright 2000-2001,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.psmlmanager;

//Jetspeed stuff
import org.apache.jetspeed.om.profile.ProfileLocator;
import org.apache.jetspeed.om.profile.QueryLocator;
import org.apache.jetspeed.util.FileCopy;
import org.apache.jetspeed.util.DirectoryUtils;
import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
import org.apache.jetspeed.services.logging.JetspeedLogger;
import org.apache.jetspeed.services.JetspeedSecurity;
import org.apache.jetspeed.services.resources.JetspeedResources;

//Castor defined API
import org.apache.jetspeed.om.profile.Portlets;
import org.apache.jetspeed.om.profile.*;

//turbine stuff
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.servlet.TurbineServlet;
import org.apache.turbine.services.resources.ResourceService;
import org.apache.turbine.services.servlet.ServletService;

import org.apache.jetspeed.om.security.JetspeedUser;
import org.apache.jetspeed.om.security.Role;
import org.apache.jetspeed.om.security.JetspeedRoleFactory;
import org.apache.jetspeed.om.security.Group;
import org.apache.jetspeed.om.security.JetspeedGroupFactory;
import org.apache.jetspeed.om.security.JetspeedUserFactory;

//castor support
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.ValidationException;
import org.exolab.castor.mapping.Mapping;
import org.exolab.castor.mapping.MappingException;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

// serialization support
import org.apache.xml.serialize.Serializer;
import org.apache.xml.serialize.XMLSerializer;
import org.apache.xml.serialize.OutputFormat;

//standard java stuff
import java.io.File;
import java.io.Reader;
import java.io.FileReader;
import java.io.Writer;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.LinkedList;
import javax.servlet.ServletConfig;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.jetspeed.cache.FileCache;
import org.apache.jetspeed.cache.FileCacheEventListener;
import org.apache.jetspeed.cache.FileCacheEntry;


/**
 * This service is responsible for loading and saving PSML documents.
 *
 * @author <a href="mailto:raphael@apache.org">Rapha雔 Luta</a>
 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 * @author <a href="mailto:sgala@apache.org">Santiago Gala</a>
 * @version $Id: CastorPsmlManagerService.java,v 1.44 2004/03/31 00:23:02 jford Exp $
 */
public class CastorPsmlManagerService extends TurbineBaseService
                                      implements FileCacheEventListener,
                                                 PsmlManagerService
{
    /**
     * Static initialization of the logger for this class
     */    
    private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(CastorPsmlManagerService.class.getName());
    
    // resource path constants
    protected static final String PATH_GROUP              = "group";
    protected static final String PATH_ROLE               = "role";
    protected static final String PATH_USER               = "user";

    // configuration keys
    protected final static String CONFIG_ROOT             = "root";
    protected final static String CONFIG_EXT              = "ext";
    protected final static String CONFIG_SCAN_RATE        = "scanRate";
    protected final static String CONFIG_CACHE_SIZE       = "cacheSize";

    // default configuration values
    public final static String DEFAULT_ROOT             = "/WEB-INF/psml";
    public final static String DEFAULT_EXT              = ".psml";

    // default resource
    public final static String DEFAULT_RESOURCE         = "default.psml";

    // the root psml resource directory
    protected String root;
    // base store directory
    protected File rootDir = null;
    // file extension
    protected String ext;

    /** The documents loaded by this manager */
    protected FileCache documents = null;

    /** the output format for pretty printing when saving registries */
    protected OutputFormat format = null;

    /** the base refresh rate for documents */
    protected long scanRate = 1000 * 60; // every minute

    /** the default cache size */
    protected int cacheSize = 100;

    /** the import/export consumer service **/
    protected PsmlManagerService consumer = null;
    protected boolean importFlag = false;

    // castor mapping
    public static final String DEFAULT_MAPPING = "${webappRoot}/WEB-INF/conf/psml-mapping.xml";
    protected String mapFile = null;

    /** the Castor mapping file name */
    protected Mapping mapping = null;

    /** The default encoding used to serialize PSML files to disk */
    protected String defaultEncoding = JetspeedResources.getString(JetspeedResources.CONTENT_ENCODING_KEY, "utf-8");

    /**
     * This is the early initialization method called by the
     * Turbine <code>Service</code> framework
     */
    public void init( ServletConfig conf ) throws InitializationException
    {
        if (getInit())
        {
            return;
        }

        //Ensure that the servlet service is initialized
        TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, conf);

        // get configuration parameters from Jetspeed Resources
        ResourceService serviceConf = ((TurbineServices)TurbineServices.getInstance())
                                                     .getResources(PsmlManagerService.SERVICE_NAME);
        // get the PSML Root Directory
        this.root = serviceConf.getString( CONFIG_ROOT, DEFAULT_ROOT );
        this.rootDir = new File(root);

        //If the rootDir does not exist, treat it as context relative
        if ( !rootDir.exists() )
        {
            try
            {
                this.rootDir = new File(conf.getServletContext().getRealPath(root));
            }
            catch (Exception e)
            {
                // this.rootDir = new File("./webapp" + this.rootDir.toString());
            }
        }
        //If it is still missing, try to create it
        if (!rootDir.exists())
        {
            try
            {
                rootDir.mkdirs();
            }
            catch (Exception e)
            {
            }
        }

        // get default extension
        this.ext = serviceConf.getString( CONFIG_EXT, DEFAULT_EXT );

        // create the serializer output format
        this.format = new OutputFormat();
        format.setIndenting(true);
        format.setIndent(4);
        format.setLineWidth(0);

        // psml castor mapping file
        mapFile = serviceConf.getString("mapping",DEFAULT_MAPPING);
        mapFile = TurbineServlet.getRealPath( mapFile );
        loadMapping();

        this.scanRate = serviceConf.getLong(CONFIG_SCAN_RATE, this.scanRate);
        this.cacheSize= serviceConf.getInt(CONFIG_CACHE_SIZE, this.cacheSize);

        documents = new FileCache(this.scanRate, this.cacheSize);
        documents.addListener(this);
        documents.startFileScanner();


        //Mark that we are done
        setInit(true);

        // Test
        //testCases();

    }


    /** Late init method from Turbine Service model */
    public void init() throws InitializationException
    {
        while( !getInit() )
        {
            //Not yet...
            try
            {
                Thread.sleep( 500 );
            }
            catch (InterruptedException ie )
            {
                logger.error("Exception", ie);
            }
        }
    }


    /**
     * This is the shutdown method called by the
     * Turbine <code>Service</code> framework
     */
    public void shutdown()
    {
        documents.stopFileScanner();
    }

    /**
     * Returns a PSML document of the given name.
     * For this implementation, the name must be the document
     * URL or absolute filepath
     *
     * @deprecated
     * @param name the name of the document to retrieve
     */
    public PSMLDocument getDocument( String name )
    {
        if (name == null)
        {
            String message = "PSMLManager: Must specify a name";
            logger.error( message );
            throw new IllegalArgumentException( message );
        }

        if (logger.isDebugEnabled())
        {
            logger.debug( "PSMLManager: asked for " + name );
        }

        PSMLDocument doc = null;

        doc = (PSMLDocument)documents.getDocument(name);

        if (doc == null)
        {
            doc = loadDocument(name);

            synchronized (documents)
            {
                // store the document in the hash and reference it to the watcher
                try
                {
                    documents.put(name, doc);
                }
                catch (java.io.IOException e)
                {
                    logger.error("Error putting document", e);
                }
            }
        }

        return doc;
    }

    /**
     * Returns a cached PSML document for the given locator
     * 
     * @param locator The locator descriptor of the document to be retrieved.
     * @return PSML document  from cache (or disk if not yet cached)
     */
    public PSMLDocument getDocument( ProfileLocator locator)
    {
        return getDocument(locator, true);
    }

    /**
     * Returns a PSML document for the given locator
     * 
     * @param locator   The locator descriptor of the document to be retrieved.
     * @param getCached Look in the cache (true) or umarshall a fresh copy from disk (false)
     * @return 
     */
    protected PSMLDocument getDocument( ProfileLocator locator, boolean getCached )
    {
        if (locator == null)
        {
            String message = "PSMLManager: Must specify a name";
            logger.error( message );
            throw new IllegalArgumentException( message );
        }
        File base = this.rootDir;
        String path = mapLocatorToFile(locator);
        File file = new File(base, path);
        String name = null;

        try
        {
            name = file.getCanonicalPath();
        }
        catch (IOException e)
        {
            logger.error("PSMLManager: unable to resolve file path for "+ file);
        }

        if (logger.isDebugEnabled())
        {
            logger.debug("PSMLManager: calculated resource:" + path + ". Base: " + base + " File: " + name);
        }

        PSMLDocument doc = null;
        Profile profile = null;

        if (getCached == true)
        {
            profile = (Profile)documents.getDocument(name);
        }

        if (profile == null)
        {
            doc = loadDocument(name);
            if (null == doc)
            {
                if (logger.isWarnEnabled())
                {
                    logger.warn( "PSMLManager: " + name + " not found, returning null document" );
                }
                return null;
            }

            synchronized (documents)
            {
                // store the document in the hash and reference it to the watcher
                Profile newProfile = createProfile(locator);
                newProfile.setDocument(doc);
                try
                {
                    documents.put(name, newProfile);
                }
                catch (IOException e)
                {
                    logger.error("Error putting document", e);
                }
            }
        }
        else
        {
            doc = profile.getDocument();
        }

        return doc;
    }

    /**

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本欧美加勒比视频| 色综合天天综合色综合av | 国产成人a级片| 欧美美女直播网站| 国产精品理伦片| 喷白浆一区二区| 欧洲一区二区三区在线| 久久免费电影网| 欧美aⅴ一区二区三区视频| 91丨porny丨蝌蚪视频| 欧美精品一区二区三区在线| 有坂深雪av一区二区精品| 国产91清纯白嫩初高中在线观看| 91麻豆精品国产91久久久久| 国产精品国产馆在线真实露脸| 久久国产三级精品| 欧美日韩国产高清一区| 樱花草国产18久久久久| 成人视屏免费看| 久久综合久久99| 国内不卡的二区三区中文字幕| 欧美日韩高清在线播放| 亚洲与欧洲av电影| 日本电影亚洲天堂一区| 国产精品成人在线观看| 国产成人精品午夜视频免费| 久久精品网站免费观看| 国产一区二区精品久久| 日韩免费电影一区| 精品一区二区三区免费播放 | 亚洲va天堂va国产va久| 在线观看成人小视频| 夜夜嗨av一区二区三区四季av| 99久久99久久精品免费看蜜桃| 中文字幕中文字幕中文字幕亚洲无线 | 专区另类欧美日韩| 91亚洲大成网污www| 中文字幕一区二区三区乱码在线| 成a人片国产精品| 亚洲美女视频在线观看| 欧美亚洲禁片免费| 日本女人一区二区三区| 日韩午夜激情av| 国产大陆亚洲精品国产| 国产精品色噜噜| 日本久久电影网| 五月婷婷激情综合网| 欧美一级高清片在线观看| 美女视频网站久久| 国产精品色在线观看| 97久久精品人人澡人人爽| 一区二区三区在线视频播放| 欧美在线观看一二区| 日本成人中文字幕| 久久久久亚洲蜜桃| 91在线视频网址| 偷拍与自拍一区| 日韩精品一区二区三区在线 | 91黄色免费网站| 日韩中文字幕av电影| 精品免费一区二区三区| 成人在线综合网| 亚洲成人tv网| 国产日韩欧美综合一区| 91国产成人在线| 美女性感视频久久| 国产精品超碰97尤物18| 8v天堂国产在线一区二区| 激情五月激情综合网| 亚洲欧美日韩在线| 精品理论电影在线观看 | 国产+成+人+亚洲欧洲自线| 亚洲欧美二区三区| 精品国产乱码久久久久久图片| 99久久精品国产一区| 久久国产麻豆精品| 最新日韩av在线| 日韩美一区二区三区| 91丝袜美女网| 韩国av一区二区三区| 亚洲综合激情网| 国产丝袜美腿一区二区三区| 在线观看91av| 91在线精品一区二区| 美女网站色91| 亚洲不卡一区二区三区| 中文字幕亚洲在| 久久精品亚洲精品国产欧美| 91精品国产综合久久蜜臀| 色悠悠久久综合| 国产传媒一区在线| 美国十次了思思久久精品导航| 亚洲欧美一区二区三区久本道91 | 一区二区三区精品在线| 久久精品视频一区二区| 91精品视频网| 欧美色图12p| 91麻豆高清视频| 成人91在线观看| 成人免费视频免费观看| 国产美女主播视频一区| 狂野欧美性猛交blacked| 日韩高清国产一区在线| 天堂成人免费av电影一区| 亚洲影院在线观看| 亚洲国产视频一区| 亚洲国产一区二区在线播放| 一区二区三区成人| 一区二区国产盗摄色噜噜| 亚洲人成亚洲人成在线观看图片| 国产精品午夜春色av| 亚洲国产精品99久久久久久久久| 久久老女人爱爱| 久久精品水蜜桃av综合天堂| 国产性做久久久久久| 国产欧美一区二区在线| 精品福利一区二区三区免费视频| 欧美绝品在线观看成人午夜影视| 成人久久视频在线观看| 97久久超碰精品国产| 99视频有精品| 99久久免费国产| 精品视频在线免费看| 色噜噜狠狠成人中文综合| av欧美精品.com| hitomi一区二区三区精品| 国产一区二区日韩精品| 国产精品一区久久久久| 国产在线视频不卡二| 亚洲成在人线免费| 亚洲成人av一区二区| 亚洲欧洲日韩在线| 亚洲午夜久久久久久久久久久| 亚洲精品乱码久久久久久黑人| 亚洲天堂久久久久久久| 尤物在线观看一区| 视频一区二区国产| 日本亚洲天堂网| 麻豆精品视频在线观看免费| 美腿丝袜亚洲综合| 国产精品资源网| av福利精品导航| 色婷婷亚洲综合| 成人一区二区在线观看| 在线中文字幕一区| 欧美区视频在线观看| 日韩亚洲欧美在线观看| 久久尤物电影视频在线观看| 亚洲精品视频免费看| 亚洲超碰97人人做人人爱| 蜜臀av性久久久久蜜臀aⅴ流畅| 国内精品伊人久久久久av影院 | 欧美日韩小视频| 久久日韩粉嫩一区二区三区| 久久九九全国免费| 亚洲欧美乱综合| 日韩—二三区免费观看av| 调教+趴+乳夹+国产+精品| 国产一区二区导航在线播放| 成人高清免费在线播放| 欧美综合一区二区三区| 欧美一级搡bbbb搡bbbb| 日韩一级片网址| 久久精品一二三| 亚洲精品视频在线看| 九九热在线视频观看这里只有精品| 91天堂素人约啪| 欧美成人乱码一区二区三区| 久久久精品免费观看| 日本一二三四高清不卡| 麻豆久久久久久| 91免费看`日韩一区二区| 精品国内二区三区| 国产精品麻豆一区二区| 狠狠色2019综合网| 欧美撒尿777hd撒尿| 久久亚洲综合色| 亚洲影院理伦片| 91在线观看成人| 国产亚洲污的网站| 日韩激情一二三区| 成人激情视频网站| 久久久久久久一区| 男人操女人的视频在线观看欧美| 99这里只有精品| www一区二区| 五月综合激情日本mⅴ| 91在线国产福利| 中文成人综合网| 国产a久久麻豆| 日韩精品一区二区三区在线播放 | 亚洲人成网站色在线观看| 久久91精品国产91久久小草| 欧美乱妇23p| 亚洲va天堂va国产va久| 99精品欧美一区二区三区小说| 26uuu亚洲综合色| 国产一区二区0| 久久亚洲一级片| 韩国午夜理伦三级不卡影院|