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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? osgiselectionpolicy.java

?? OSGI 的 源碼實(shí)現(xiàn),采用JAVA書寫
?? JAVA
字號(hào):
/* * Oscar - An implementation of the OSGi framework. * Copyright (c) 2004, Richard S. Hall * All rights reserved. *   * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *   *   * Redistributions of source code must retain the above copyright *     notice, this list of conditions and the following disclaimer. *   * Redistributions in binary form must reproduce the above copyright *     notice, this list of conditions and the following disclaimer in *     the documentation and/or other materials provided with the *     distribution. *   * Neither the name of the ungoverned.org nor the names of its *     contributors may be used to endorse or promote products derived *     from this software without specific prior written permission. *   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *  * Contact: Richard S. Hall (heavy@ungoverned.org) * Contributor(s): * **/package org.ungoverned.oscar;import java.net.MalformedURLException;import java.net.URL;import java.security.*;import java.security.cert.Certificate;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import org.osgi.framework.Bundle;import org.osgi.framework.PackagePermission;import org.ungoverned.moduleloader.Module;import org.ungoverned.moduleloader.ModuleEvent;import org.ungoverned.moduleloader.ModuleListener;import org.ungoverned.moduleloader.search.ImportSearchPolicy;import org.ungoverned.moduleloader.search.SelectionPolicy;import org.ungoverned.moduleloader.search.CompatibilityPolicy;public class OSGiSelectionPolicy implements SelectionPolicy, ModuleListener{    private Oscar m_oscar = null;    private Map m_resolvedPackageMap = new HashMap();    private Map m_resolvedModuleMap = new HashMap();    public OSGiSelectionPolicy(Oscar oscar)    {        m_oscar = oscar;    }    /**     * Selects a single module to resolve the specified import     * from the array of compatible candidate modules. If the import     * target has not been resolved before, then this selection policy     * chooses the module that exports the newest version of the     * import target. If the import target has been resolved already,     * then the same module that was chosen before is chosen again.     * This ensures that all modules use the same version of all     * exported classes, as described in the OSGi specification.     * @param module the module that is importing the target.     * @param identifier the identifier of the import target.     * @param version the version number of the import target.     * @param candidates array of compatible candidate modules from which to choose.     * @param compatPolicy the compatibility policy that is being used.     * @return the selected module or <tt>null</tt> if no module     *         can be selected.    **/    public synchronized Module select(Module module, Object identifier,        Object v, Module[] candidates, CompatibilityPolicy compatPolicy)    {        String pkgName = (String) identifier;        int[] version = (int[]) v;        // See if a module was already selected to resolve this package.        Module selModule = (Module) m_resolvedPackageMap.get(pkgName);        // If no module was previously selected to resolve the package,        // then try to choose one now.        if (selModule == null)        {            int[] selVersion = version;            Bundle selBundle = null;            // Examine all exported instances of the package and            // choose the one with the newest version number. If            // there is more than one source for the newest version,            // then select the package coming from the bundle with            // the with the smallest bundle ID.            for (int i = 0; i < candidates.length; i++)            {                // Get the bundle associated with the module.                long id = BundleInfo.getBundleIdFromModuleId(candidates[i].getId());                if (id < 0)                {                    // Ignore modules for which there is no bundle.                    continue;                }                BundleImpl bundle = (BundleImpl) m_oscar.getBundle(id);                // The bundle may be uninstalled, so just ignore that case.                if (bundle == null)                {                    continue;                }                // Ignore the package if its bundle is not resolved,                // active, or installed.                if ((bundle.getState() != Bundle.RESOLVED)                    && (bundle.getState() != Bundle.ACTIVE)                    && (bundle.getState() != Bundle.INSTALLED))                {                    continue;                }                // If the security manager is set, then check if the                // exporting bundle is allowed to export the package,                // unless the bundle is the system bundle.                if ((System.getSecurityManager() != null) && (bundle.getBundleId() != 0))                {                    URL url = null;                    try                    {                        url = new URL(bundle.getInfo().getLocation());                    }                    catch (MalformedURLException ex)                    {                        // For safety, ignore if we can't get its                        // location URL.                        continue;                    }                    try                    {                        AccessController.doPrivileged(                            new CheckExportPrivileged(url, pkgName));                    }                    catch (PrivilegedActionException ex)                    {                        // If we are here, then most likely the security                        // check failed, so ignore this package.                        continue;                    }                }                int[] tmpVersion = (int[])                    ImportSearchPolicy.getExportVersion(candidates[i], pkgName);                // If this is the first match, then just select it.                if ((selModule == null) &&                    (compatPolicy.compare(pkgName, tmpVersion, pkgName, selVersion) >= 0))                {                    selModule = candidates[i];                    selVersion = tmpVersion;                    selBundle = bundle;                }                // If the current export package version is greater                // than the selected export package version, then                // record it instead.                else if (compatPolicy.compare(pkgName, tmpVersion, pkgName, selVersion) > 0)                {                    selModule = candidates[i];                    selVersion = tmpVersion;                    selBundle = bundle;                }                // If the current export package version is equal to                // the selected export package version, but has a lower                // bundle ID, then record it instead.                else if ((compatPolicy.compare(pkgName, tmpVersion, pkgName, selVersion) == 0)                    && (bundle.getBundleId() < selBundle.getBundleId()))                {                    selModule = candidates[i];                    selVersion = tmpVersion;                    selBundle = bundle;                }            }            m_resolvedPackageMap.put(pkgName, selModule);            m_resolvedModuleMap.put(selModule, selModule);        }        // See if the previously selected export module satisfies        // the current request, otherwise return null.        else        {            int[] selVersion = (int[])                ImportSearchPolicy.getExportVersion(selModule, pkgName);            Module tmpModule = selModule;            selModule = null;            if (compatPolicy.isCompatible(pkgName, selVersion, pkgName, version))            {                selModule = tmpModule;            }        }        return selModule;    }    public void moduleAdded(ModuleEvent event)    {    }    public void moduleReset(ModuleEvent event)    {        moduleRemoved(event);    }    public synchronized void moduleRemoved(ModuleEvent event)    {// TODO: Synchronization?        // If the module that was removed was chosen for        // exporting packages, then flush it from our        // data structures.        if (m_resolvedModuleMap.get(event.getModule()) != null)        {            // Remove from module map.            m_resolvedModuleMap.remove(event.getModule());            // Remove each exported package from package map.            Iterator iter = m_resolvedPackageMap.entrySet().iterator();            while (iter.hasNext())            {                Map.Entry entry = (Map.Entry) iter.next();                if (entry.getValue() == event.getModule())                {                    iter.remove();                }            }        }    }    /**     * This simple class is used to perform the privileged action of     * checking if a bundle has permission to export a package.    **/    private static class CheckExportPrivileged implements PrivilegedExceptionAction    {        private URL m_url = null;        private String m_pkgName = null;        public CheckExportPrivileged(URL url, String pkgName)        {            m_url = url;            m_pkgName = pkgName;        }        public Object run() throws Exception        {            // Get permission collection for code source; we cannot            // call AccessController.checkPermission() directly since            // the bundle's code is not on the access context yet and            // might never be if it is only a library bundle, for example.            CodeSource cs = new CodeSource(m_url, (Certificate[]) null);            PermissionCollection pc = Policy.getPolicy().getPermissions(cs);            PackagePermission perm = new PackagePermission(                m_pkgName, PackagePermission.EXPORT);            if (!pc.implies(perm))            {                throw new AccessControlException("access denied " + perm);            }            return null;        }    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美va亚洲va| 亚洲老妇xxxxxx| 韩国三级电影一区二区| 91精品婷婷国产综合久久竹菊| 一区二区三区在线观看视频| 91色九色蝌蚪| 专区另类欧美日韩| 色综合中文字幕| 一区二区三区欧美久久| 日本乱码高清不卡字幕| 洋洋成人永久网站入口| 色先锋资源久久综合| 亚洲狠狠丁香婷婷综合久久久| 色婷婷久久久久swag精品| 一区二区三区欧美久久| 欧美日韩综合色| 日韩高清不卡一区二区| 日韩欧美精品在线视频| 精品一区二区三区久久| 久久免费午夜影院| 国产xxx精品视频大全| 中文字幕一区二区视频| 91在线观看视频| 一区二区三区中文字幕电影| 欧美午夜不卡视频| 日韩电影在线一区| 久久久久国产精品人| 粉嫩久久99精品久久久久久夜 | 91福利在线免费观看| 亚洲国产精品久久艾草纯爱| 欧美男人的天堂一二区| 另类欧美日韩国产在线| 国产欧美在线观看一区| av不卡免费电影| 亚洲一区二区三区在线| 91精品国产福利| 国产一区二区在线免费观看| 成人精品小蝌蚪| 亚洲欧美二区三区| 欧美伦理视频网站| 国产酒店精品激情| 中文字幕的久久| 精品视频在线免费| 乱一区二区av| 国产精品国产三级国产| 欧美日韩一区视频| 激情综合网最新| 最近日韩中文字幕| 欧美一级专区免费大片| 国产精品18久久久久久久久| 亚洲蜜桃精久久久久久久| 欧美日韩国产高清一区二区三区| 激情欧美一区二区| 亚洲精品视频在线观看免费| 欧美一区二区三区四区在线观看| 国产精品资源在线看| 亚洲激情校园春色| 日韩欧美电影一区| aaa欧美大片| 免费久久精品视频| 亚洲人成小说网站色在线| 欧美高清精品3d| 成人深夜在线观看| 秋霞成人午夜伦在线观看| 国产精品毛片大码女人| 91精品在线一区二区| 成人a免费在线看| 日韩精品午夜视频| 亚洲图片你懂的| 精品福利二区三区| 在线观看免费成人| 国产高清成人在线| 视频一区视频二区中文| 国产精品美女一区二区三区 | 久久一区二区三区国产精品| 色欧美乱欧美15图片| 极品尤物av久久免费看| 亚洲资源在线观看| 中文字幕欧美激情一区| 日韩欧美国产精品| 在线精品视频一区二区三四| 国产一区二区调教| 日本亚洲三级在线| 亚洲欧美乱综合| 久久影院电视剧免费观看| 欧美日韩一本到| 99热国产精品| 国产传媒日韩欧美成人| 三级不卡在线观看| 亚洲欧美激情视频在线观看一区二区三区| 日韩欧美综合一区| 欧美女孩性生活视频| 99re热视频精品| 国产精品自拍毛片| 免费成人在线影院| 午夜精品影院在线观看| 伊人夜夜躁av伊人久久| 国产精品人妖ts系列视频| 精品少妇一区二区三区在线视频| 亚洲小说欧美激情另类| 中文字幕日韩一区| 国产欧美一区二区精品性| 制服丝袜亚洲网站| 欧美三电影在线| 在线亚洲欧美专区二区| av日韩在线网站| 成人永久免费视频| 国内久久精品视频| 麻豆国产精品一区二区三区| 亚洲成a人在线观看| 亚洲一区二区av电影| 综合自拍亚洲综合图不卡区| 国产欧美日韩在线观看| xvideos.蜜桃一区二区| 日韩美女视频在线| 日韩一区二区三区电影| 69久久99精品久久久久婷婷| 欧美私模裸体表演在线观看| 欧美又粗又大又爽| 色偷偷成人一区二区三区91| 99久久伊人久久99| 成人av电影在线网| 成人动漫一区二区| 成人激情小说网站| a在线播放不卡| www.久久精品| 91丝袜高跟美女视频| 91视视频在线观看入口直接观看www | 国产精品入口麻豆原神| 欧美极品aⅴ影院| 中文字幕精品—区二区四季| 国产欧美一区视频| 国产精品久久久久久久久久免费看| 欧美激情一区二区在线| 国产女人18水真多18精品一级做| 国产欧美日韩在线| 国产精品久久久久久久岛一牛影视| 国产精品久久久久三级| 亚洲欧美aⅴ...| 亚洲午夜久久久久久久久电影院| 一个色在线综合| 视频在线观看一区二区三区| 天天色 色综合| 久久99久久99小草精品免视看| 久久精品999| 国产成人午夜精品影院观看视频 | av午夜一区麻豆| 色94色欧美sute亚洲线路一ni | 国产精品人人做人人爽人人添| 国产精品久久久久桃色tv| 亚洲丝袜精品丝袜在线| 艳妇臀荡乳欲伦亚洲一区| 日韩av成人高清| 国产乱色国产精品免费视频| 成人黄色av网站在线| 色av一区二区| 69堂成人精品免费视频| 久久婷婷国产综合精品青草| 中文字幕av一区二区三区免费看| 亚洲欧美综合色| 亚洲一二三四久久| 五月天亚洲精品| 国产综合色在线视频区| www.性欧美| 欧美日韩色综合| 日韩欧美一区二区在线视频| 国产女主播视频一区二区| 洋洋av久久久久久久一区| 美腿丝袜亚洲三区| av中文字幕在线不卡| 欧美日韩视频专区在线播放| 2022国产精品视频| 亚洲精品中文在线影院| 日本成人在线网站| 不卡视频一二三四| 91.麻豆视频| 欧美国产1区2区| 亚洲第一狼人社区| 国产盗摄女厕一区二区三区| 91成人免费在线视频| 日韩一卡二卡三卡国产欧美| 国产精品久久久久婷婷二区次| 婷婷综合五月天| 大桥未久av一区二区三区中文| 欧美少妇一区二区| 国产视频一区二区在线| 一区二区三区中文在线| 国产在线观看免费一区| 在线精品视频小说1| 国产亚洲欧美激情| 亚洲国产成人va在线观看天堂| 黑人巨大精品欧美黑白配亚洲| 日本高清成人免费播放| www久久精品| 午夜精品福利一区二区三区av| 国产成人免费视频一区| 欧美色精品在线视频| 中文字幕国产一区二区| 免费在线观看成人| 色伊人久久综合中文字幕|