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

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

?? castorpsmlmanagerservice.java

?? jetspeed源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
     * Loads a PSML document from disk bypassing the cache
     * 
     * @param locator
     * @return PSML document from disk
     */
    public PSMLDocument refresh(ProfileLocator locator)
    {
        if (logger.isDebugEnabled())
        {
            logger.debug("CastorPsmlManagerService: psml document refreshed from disk: " + locator.getPath());
        }
        return getDocument(locator, false);
    }

    /**
     * Load a PSMLDOcument from disk
     *
     * @param fileOrUrl a String representing either an absolute URL or an
     * absolute filepath
     */
    protected PSMLDocument loadDocument(String fileOrUrl)
    {
        PSMLDocument doc = null;

        if (fileOrUrl!=null)
        {
            if (!fileOrUrl.endsWith(DEFAULT_EXT))
            {
                fileOrUrl = fileOrUrl.concat(DEFAULT_EXT);
            }

            // load the document and add it to the watcher
            // we'll assume the name is the the location of the file

            File f = getFile(fileOrUrl);
            if (null == f)
                return null;

            doc = new BasePSMLDocument();
            doc.setName(fileOrUrl);

            // now that we have a file reference, try to load the serialized PSML
            Portlets portlets = null;
            try
            {
                DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dbfactory.newDocumentBuilder();

                Document d = builder.parse(f);

                Unmarshaller unmarshaller = new Unmarshaller(this.mapping);
                portlets = (Portlets)unmarshaller.unmarshal((Node) d);

                doc.setPortlets(portlets);

            }
            catch (IOException e)
            {
                logger.error("PSMLManager: Could not load the file "+f.getAbsolutePath(), e);
                doc = null;
            }
            catch (MarshalException e)
            {
                logger.error("PSMLManager: Could not unmarshal the file "+f.getAbsolutePath(), e);
                doc = null;
            }
            catch (MappingException e)
            {
                logger.error("PSMLManager: Could not unmarshal the file "+f.getAbsolutePath(), e);
                doc = null;
            }
            catch (ValidationException e)
            {
                logger.error("PSMLManager: document "+f.getAbsolutePath()+" is not valid", e);
                doc = null;
            }
            catch (ParserConfigurationException e)
            {
                logger.error("PSMLManager: Could not load the file "+f.getAbsolutePath(), e);
                doc = null;
            }
            catch (SAXException e)
            {
                logger.error("PSMLManager: Could not load the file "+f.getAbsolutePath(), e);
                doc = null;
            }
        }

        return doc;
    }

    /** Store the PSML document on disk, using its locator
     *
     * @param profile the profile locator description.
     * @return true if the operation succeeded
     */
    public boolean store(Profile profile)
    {
        PSMLDocument doc = profile.getDocument();

        File base = this.rootDir;
        String path = mapLocatorToFile(profile);

        File file = new File(base, path);
        String fullpath = null;

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

        boolean ok = saveDocument(fullpath, doc);

        // update it in cache
        synchronized (documents)
        {
            try
            {
                documents.put(fullpath, profile);
            }
            catch (IOException e)
            {
                logger.error("Error storing document", e);
            }
        }

        return ok;
    }

    /** Save the PSML document on disk, using its name as filepath
     * @deprecated
     * @param doc the document to save
     */
    public boolean saveDocument(PSMLDocument doc)
    {
        return saveDocument(doc.getName(), doc);
    }

    /** Save the PSML document on disk to the specififed fileOrUrl
     *
     * @param fileOrUrl a String representing either an absolute URL
     * or an absolute filepath
     * @param doc the document to save
     */
    public boolean saveDocument(String fileOrUrl, PSMLDocument doc)
    {
        boolean success = false;

        if (doc == null) return false;
        File f = getFile(fileOrUrl);
        if (f == null)
        {
            f = new File(fileOrUrl);
        }

        OutputStreamWriter writer = null;
        FileOutputStream fos = null;
        try
        {
            String encoding = this.defaultEncoding;
            fos = new FileOutputStream(f);
            writer = new OutputStreamWriter(fos, encoding);

            save(writer, doc.getPortlets());
            success = true;
        }
        catch (MarshalException e)
        {
            logger.error("PSMLManager: Could not marshal the file "+f.getAbsolutePath(), e);
        }
        catch (MappingException e)
        {
            logger.error("PSMLManager: Could not marshal the file "+f.getAbsolutePath(), e);
        }
        catch (ValidationException e)
        {
            logger.error("PSMLManager: document "+f.getAbsolutePath()+" is not valid", e);
        }
        catch (IOException e)
        {
            logger.error("PSMLManager: Could not save the file "+f.getAbsolutePath(), e);
        }
        catch (Exception e)
        {
            logger.error("PSMLManager: Error while saving  "+f.getAbsolutePath(), e);
        }
        finally
        {
            try { writer.close(); } catch (IOException e) {}
            try { if(fos != null) { fos.close(); } } catch (IOException e) {}
        }

        return success;
    }

    /** Deserializes a PSML structure read from the reader using Castor
     *  XML unmarshaller
     *
     * @param reader the reader to load the PSML from
     * @param the loaded portlets structure or null
     */
    protected Portlets load(Reader reader)
        throws IOException, MarshalException, ValidationException, MappingException
    {
        Unmarshaller unmarshaller = new Unmarshaller(this.mapping);
        Portlets portlets = (Portlets)unmarshaller.unmarshal(reader);
        return portlets;
    }

    protected void loadMapping()
        throws InitializationException
    {
        // test the mapping file and create the mapping object

        if (mapFile != null)
        {
            File map = new File(mapFile);
            if (logger.isDebugEnabled())
            {
                logger.debug("PSMLManager: Loading psml mapping file "+mapFile);
            }
            if (map.exists() && map.isFile() && map.canRead())
            {
                try
                {
                    mapping = new Mapping();
                    InputSource is = new InputSource( new FileReader(map) );
                    is.setSystemId( mapFile );
                    mapping.loadMapping( is );
                }
                catch (Exception e)
                {
                    logger.error("PSMLManager: Error in psml mapping creation", e);
                    throw new InitializationException("Error in mapping",e);
                }
            }
            else
            {
                throw new InitializationException("PSML Mapping not found or not a file or unreadable: "+mapFile);
            }
        }
    }

    /** Serializes a PSML structure using the specified writer with Castor
     *  XML marshaller and a Xerces serializer for pretty printing
     *
     * @param writer the writer to use for serialization
     * @param portlets the structure to save
     */
    protected void save(Writer writer, Portlets portlets)
        throws IOException, MarshalException, ValidationException, MappingException
    {
        String encoding = this.defaultEncoding;

        if (portlets != null)
        {
            format.setEncoding(encoding);
            Serializer serializer = new XMLSerializer(writer, format);
            Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(this.mapping);
            marshaller.marshal(portlets);
        }
    }

    /** Tests wether the passed argument is an URL string or a file name
     *  and returns the corresponding file object, using diskcache for
     *  remote URLs
     *
     *  @param fileOrUrl the URL string or file path
     *  @return a File object. This file may not exist on disk.
     */
    protected File getFile(String fileOrUrl)
    {
        File f = null;

        f = new File(fileOrUrl);

        if (f.exists())
        {
            return f;
        }

        return null;
    }

    /** Create a new document.
     *
     * @param profile The description and default value for the new document.
     * @return The newly created document;
     */
    public PSMLDocument createDocument( Profile profile )
    {
        File base = this.rootDir;
        String path = mapLocatorToFile((ProfileLocator)profile);

        if (logger.isDebugEnabled())
        {
            logger.debug("PSMLManager: Create document for profile " + profile +", calculated path: " + path);
        }

        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);
        }

        PSMLDocument template = profile.getDocument();
        PSMLDocument doc = new BasePSMLDocument( name, template.getPortlets() );
        try
        {
            String parent = file.getParent();
            File filePath = new File(parent);
            filePath.mkdirs();
            if (template.getName() != null)
            {
                try
                {
                    File source = new File(template.getName());
                    if (source.exists())
                    {
                        FileCopy.copy( template.getName(), name );
                    }
                }
                catch (Exception e)
                {}
            }
            else
            {
                doc.setName(name);
            }
            saveDocument(doc);
        }
        catch (Exception e)
        {
            logger.error("PSMLManager: Failed to save document: " , e);
        }
        return doc;
    }

    /** Given a ordered list of locators, find the first document matching
     *  a profile locator, starting from the beginning of the list and working
     *  to the end.
     *
     * @param locator The ordered list of profile locators.
     */
    public PSMLDocument getDocument( List locators )
    {
        PSMLDocument doc=null;

        Iterator i = locators.iterator();
        while ((doc==null)&&(i.hasNext()))
        {
            doc=getDocument((ProfileLocator)i.next());
        }

        return doc;
    }

    /** Removes a document.
     *
     * @param locator The description of the profile resource to be removed.
     */
    public void removeDocument( ProfileLocator locator )
    {
        // remove a single document
        String fileName = mapLocatorToFile(locator);

        File base = this.rootDir;
        File file = new File(base, fileName);
        String name = null;

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


        synchronized (documents)
        {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲青青青在线视频| 国产精品自产自拍| 精品在线视频一区| av高清久久久| 日韩欧美国产1| 一区二区三区中文字幕在线观看| 久久国产日韩欧美精品| 91福利视频在线| 欧美电影免费提供在线观看| 最近中文字幕一区二区三区| 久久99精品国产麻豆不卡| 欧美主播一区二区三区美女| 精品国产一区二区三区久久久蜜月 | 国产精品污www在线观看| 亚洲人亚洲人成电影网站色| 久久99国产精品成人| 欧美日韩一本到| 国产精品沙发午睡系列990531| 日韩精品成人一区二区在线| 91女厕偷拍女厕偷拍高清| 欧美mv日韩mv国产网站app| 亚洲国产综合91精品麻豆| bt7086福利一区国产| 久久嫩草精品久久久精品一| 奇米色一区二区| 欧美日韩一区二区三区高清| 亚洲女同ⅹxx女同tv| 成人午夜av在线| 久久久蜜臀国产一区二区| 精品一区二区三区在线观看| 91麻豆精品国产91久久久久久| 亚洲精品免费在线观看| 99re热这里只有精品免费视频 | 精油按摩中文字幕久久| 欧美老女人第四色| 日韩电影一二三区| 91精品国产综合久久久久久久久久 | 国产福利一区二区| 久久女同互慰一区二区三区| 国产一区二区三区精品欧美日韩一区二区三区 | 久久精品亚洲一区二区三区浴池| 精品中文字幕一区二区小辣椒 | 91国产视频在线观看| 亚洲色图另类专区| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美激情资源网| 成人福利视频在线看| 综合av第一页| 在线精品国精品国产尤物884a| 亚洲裸体xxx| 欧美性受xxxx黑人xyx| 天天综合天天做天天综合| 欧美一级专区免费大片| 麻豆精品在线视频| 国产午夜一区二区三区| 99在线精品免费| 亚洲一区二区精品视频| 在线观看91精品国产麻豆| 精品一区二区av| 精品久久国产老人久久综合| 国产成人午夜视频| 亚洲精品精品亚洲| 欧美精品 国产精品| 国产乱码一区二区三区| 亚洲欧美日本韩国| 欧美一区二区三区免费大片| 国产资源精品在线观看| 中文字幕一区在线观看视频| 91久久人澡人人添人人爽欧美| 亚洲成人综合在线| 久久久久九九视频| 色呦呦网站一区| 日韩和欧美一区二区| 久久久777精品电影网影网 | 黑人精品欧美一区二区蜜桃| 最新中文字幕一区二区三区| 欧美美女一区二区三区| 成人动漫中文字幕| 天天亚洲美女在线视频| 欧美激情一区二区三区不卡| 欧美精品色综合| 国产老女人精品毛片久久| 亚洲狠狠丁香婷婷综合久久久| 91精品国产入口在线| 91女人视频在线观看| 国产麻豆精品在线观看| 日精品一区二区| 亚洲色图欧美偷拍| 国产校园另类小说区| 91麻豆精品国产自产在线| 91免费在线视频观看| 开心九九激情九九欧美日韩精美视频电影 | 精品在线视频一区| 亚洲第一激情av| 国产精品三级电影| 26uuu精品一区二区在线观看| 欧美三级一区二区| 成人免费电影视频| 国产综合色视频| 日本不卡一二三区黄网| 亚洲1区2区3区视频| 综合分类小说区另类春色亚洲小说欧美 | 国产成人av自拍| 蜜桃av噜噜一区| 亚洲成人免费在线观看| 亚洲免费三区一区二区| 国产精品久久久一区麻豆最新章节| 欧美电视剧在线看免费| 欧美精品aⅴ在线视频| 欧美日韩一区二区三区免费看| 91首页免费视频| 99久久精品国产观看| 成人黄色av电影| 国产在线视频精品一区| 国内外成人在线视频| 狠狠狠色丁香婷婷综合久久五月| 奇米色一区二区| 麻豆精品一区二区综合av| 蜜桃av噜噜一区| 韩国视频一区二区| 国产一区日韩二区欧美三区| 国产资源在线一区| 国产精品99久久久久久有的能看| 国产精品白丝jk白祙喷水网站| 国产美女一区二区| 国产成人综合视频| 国产·精品毛片| av一二三不卡影片| 一本大道久久a久久综合婷婷| 色综合久久综合网欧美综合网| 在线看国产日韩| 欧美日韩一本到| 欧美成人女星排行榜| 久久蜜桃av一区二区天堂| 国产人久久人人人人爽| 国产精品美女一区二区在线观看| 国产精品久久久久久久久免费丝袜| 亚洲私人影院在线观看| 亚洲国产精品视频| 久久狠狠亚洲综合| 成人动漫一区二区三区| 91久久久免费一区二区| 日韩一区二区三区电影| 久久嫩草精品久久久精品一| 亚洲欧洲成人av每日更新| 亚洲精品视频免费看| 日av在线不卡| 成人妖精视频yjsp地址| 欧美丝袜自拍制服另类| 日韩视频永久免费| 中文在线一区二区| 亚洲永久免费视频| 狠狠色丁香久久婷婷综合_中| 97国产一区二区| 91精品国产一区二区三区| 国产精品免费视频一区| 一区二区三区中文字幕精品精品| 美女脱光内衣内裤视频久久影院| 国产福利一区二区三区| 欧美视频一区二区三区四区 | 丝袜a∨在线一区二区三区不卡| 精品一二三四在线| 91麻豆国产香蕉久久精品| 日韩欧美色电影| 亚洲日本中文字幕区| 久久成人18免费观看| 91免费版在线| 久久综合九色综合久久久精品综合 | 精品日韩一区二区| 亚洲精品国产一区二区精华液| 久久精品国产亚洲a| 91网站最新网址| 欧美精品一区二区三区蜜臀| 亚洲综合色区另类av| 国产成人在线免费| 日韩午夜av一区| 一区二区久久久久| 播五月开心婷婷综合| 欧美videofree性高清杂交| 亚洲在线免费播放| 成人高清视频免费观看| 久久久综合九色合综国产精品| 视频一区二区三区在线| 日本高清视频一区二区| 国产片一区二区| 国内精品自线一区二区三区视频| 欧洲中文字幕精品| 亚洲欧美日韩在线| www.久久精品| 国产精品午夜电影| 国产精品456露脸| xf在线a精品一区二区视频网站| 日本伊人色综合网| 欧美军同video69gay| 亚洲成人综合网站| 91国产成人在线| 亚洲午夜免费福利视频| 在线观看三级视频欧美| 亚洲乱码国产乱码精品精小说| 成人丝袜18视频在线观看|