/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.felix.framework;
import org.osgi.framework.launch.Framework;
import java.io.*;
import java.net.*;
import java.security.*;
import java.util.*;
import org.apache.felix.framework.cache.*;
import org.apache.felix.framework.ext.SecurityProvider;
import org.apache.felix.framework.searchpolicy.*;
import org.apache.felix.framework.ServiceRegistry.ServiceRegistryCallbacks;
import org.apache.felix.framework.util.*;
import org.apache.felix.framework.util.manifestparser.*;
import org.apache.felix.moduleloader.*;
import org.osgi.framework.*;
import org.osgi.framework.BundleReference;
import org.osgi.framework.hooks.service.*;
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.startlevel.StartLevel;
public class Felix extends BundleImpl implements Framework
{
// The secure action used to do privileged calls
static final SecureAction m_secureAction = new SecureAction();
// The extension manager to handle extension bundles
ExtensionManager m_extensionManager;
// Logging related member variables.
private final Logger m_logger;
// Immutable config properties.
private final Map m_configMap;
// Mutable configuration properties passed into constructor.
private final Map m_configMutableMap;
// MODULE FACTORY.
private final FelixResolverState m_resolverState;
private final FelixResolver m_felixResolver;
// Lock object used to determine if an individual bundle
// lock or the global lock can be acquired.
private final Object[] m_bundleLock = new Object[0];
// Keeps track of threads wanting to acquire the global lock.
private final List m_globalLockWaitersList = new ArrayList();
// The thread currently holding the global lock.
private Thread m_globalLockThread = null;
// How many times the global lock was acquired by the thread holding
// the global lock; if this value is zero, then it means the global
// lock is free.
private int m_globalLockCount = 0;
// Maps a bundle location to a bundle location;
// used to reserve a location when installing a bundle.
private final Map m_installRequestMap = new HashMap();
// This lock must be acquired to modify m_installRequestMap;
// to help avoid deadlock this lock as priority 1 and should
// be acquired before locks with lower priority.
private final Object[] m_installRequestLock_Priority1 = new Object[0];
// Maps a bundle location to a bundle.
private HashMap m_installedBundleMap;
private SortedMap m_installedBundleIndex;
// This lock must be acquired to modify m_installedBundleMap;
// to help avoid deadlock this lock as priority 2 and should
// be acquired before locks with lower priority.
private final Object[] m_installedBundleLock_Priority2 = new Object[0];
// An array of uninstalled bundles before a refresh occurs.
private BundleImpl[] m_uninstalledBundles = null;
// This lock must be acquired to modify m_uninstalledBundles;
// to help avoid deadlock this lock as priority 3 and should
// be acquired before locks with lower priority.
private final Object[] m_uninstalledBundlesLock_Priority3 = new Object[0];
// Framework's active start level.
private volatile int m_activeStartLevel = FelixConstants.FRAMEWORK_INACTIVE_STARTLEVEL;
// Local bundle cache.
private BundleCache m_cache = null;
// System bundle activator list.
List m_activatorList = null;
// Next available bundle identifier.
private long m_nextId = 1L;
private final Object m_nextIdLock = new Object[0];
// List of event listeners.
private EventDispatcher m_dispatcher = null;
// Service registry.
private ServiceRegistry m_registry = null;
// Reusable bundle URL stream handler.
private final URLStreamHandler m_bundleStreamHandler;
// Boot package delegation.
private final String[] m_bootPkgs;
private final boolean[] m_bootPkgWildcards;
// Shutdown thread.
private Thread m_shutdownThread = null;
private volatile ThreadGate m_shutdownGate = null;
/**
* <p>
* This constructor creates a framework instance with a specified <tt>Map</tt>
* of configuration properties. Configuration properties are used internally
* by the framework to alter its default behavior. The configuration properties
* should have a <tt>String</tt> key and an <tt>Object</tt> value. The passed
* in <tt>Map</tt> is copied by the framework and all keys are converted to
* <tt>String</tt>s.
* </p>
* <p>
* Configuration properties are generally the sole means to configure the
* framework's default behavior; the framework does not typically refer to
* any system properties for configuration information. If a <tt>Map</tt> is
* supplied to this method for configuration properties, then the framework
* will consult the <tt>Map</tt> instance for any and all configuration
* properties. It is possible to specify a <tt>null</tt> for the configuration
* property map, in which case the framework will use its default behavior
* in all cases.
* </p>
* <p>
* The following configuration properties can be specified (properties starting
* with "<tt>felix</tt>" are specific to Felix, while those starting with
* "<tt>org.osgi</tt>" are standard OSGi properties):
* </p>
* <ul>
* <li><tt>org.osgi.framework.storage</tt> - Sets the directory to use as
* the bundle cache; by default bundle cache directory is
* <tt>felix-cache</tt> in the current working directory. The value
* should be a valid directory name. The directory name can be either absolute
* or relative. Relative directory names are relative to the current working
* directory. The specified directory will be created if it does
* not exist.
* </li>
* <li><tt>org.osgi.framework.storage.clean</tt> - Determines whether the
* bundle cache is flushed. The value can either be "<tt>none</tt>"
* or "<tt>onFirstInit</tt>", where "<tt>none</tt>" does not flush
* the bundle cache and "<tt>onFirstInit</tt>" flushes the bundle
* cache when the framework instance is first initialized. The default
* value is "<tt>none</tt>".
* </li>
* <li><tt>felix.cache.rootdir</tt> - Sets the root directory to use to
* calculate the bundle cache directory for relative directory names. If
* <tt>org.osgi.framework.storage</tt> is set to a relative name, by
* default it is relative to the current working directory. If this
* property is set, then it will be calculated as being relative to
* the specified root directory.
* </li>
* <li><tt>felix.cache.bufsize</tt> - Sets the buffer size to be used by
* the cache; the default value is 4096. The integer value of this
* string provides control over the size of the internal buffer of the
* disk cache for performance reasons.
* </li>
* <li><tt>org.osgi.framework.syst
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Felix-2.0.2-src (321个子文件)
Felix.class 59KB
ModuleImpl.class 32KB
Resolver.class 25KB
ManifestParser.class 24KB
BundleImpl.class 22KB
FelixResolverState.class 18KB
SecureAction.class 16KB
ExtensionManager.class 16KB
EventDispatcher.class 15KB
BundleArchive.class 15KB
ServiceRegistry.class 14KB
FrameworkUtil$FilterImpl.class 14KB
URLHandlersStreamHandlerProxy.class 12KB
Util.class 11KB
URLHandlers.class 10KB
AdminPermission.class 10KB
ModuleImpl$ModuleClassLoader.class 10KB
R4LibraryClause.class 9KB
JarContent.class 9KB
ServiceTracker.class 9KB
BundleContextImpl.class 9KB
ServiceRegistrationImpl.class 9KB
Felix$FelixResolver.class 8KB
SecureAction$Actions.class 8KB
ServicePermission.class 8KB
DirectoryContent.class 7KB
Capability.class 7KB
Requirement.class 7KB
PackagePermission.class 7KB
PackageAdminImpl.class 7KB
FrameworkUtil$DNChainMatching.class 7KB
BundleCache.class 6KB
Logger.class 6KB
ServicePermissionCollection.class 6KB
Constants.class 6KB
PackagePermissionCollection.class 6KB
Felix$SystemBundleActivator.class 6KB
FrameworkUtil$FilterImpl$Parser.class 6KB
ServiceRegistrationImpl$ServiceReferenceImpl.class 5KB
BundlePermission.class 5KB
JarRevision.class 5KB
AdminPermissionCollection.class 5KB
BundlePermissionCollection.class 5KB
ExtensionManager$ExtensionManagerModule.class 5KB
URLHandlersContentHandlerProxy.class 4KB
StartLevelImpl.class 4KB
EventDispatcher$ListenerBundleContextCollectionWrapper.class 4KB
Version.class 4KB
BundleTracker.class 4KB
URLHandlersBundleURLConnection.class 4KB
R4Library.class 4KB
R4Wire.class 4KB
FindEntriesEnumeration.class 4KB
AbstractTracked.class 3KB
R4WireModule.class 3KB
URLHandlersActivator.class 3KB
Capability$1.class 3KB
VersionRange.class 3KB
DirectoryRevision.class 3KB
ServicePermission$Properties.class 3KB
StringMap.class 3KB
RequiredBundleImpl.class 3KB
ContentDirectoryContent.class 3KB
BundleProtectionDomain.class 3KB
ExportedPackageImpl.class 3KB
AbstractURLStreamHandlerService.class 2KB
ServiceTracker$Tracked.class 2KB
FrameworkUtil$CaseInsensitiveDictionary.class 2KB
ResolvedPackage.class 2KB
URLHandlersBundleStreamHandler.class 2KB
GetEntryPathsEnumeration.class 2KB
Felix$2.class 2KB
SignerProperty.class 2KB
EventDispatcher$ListenerBundleContextCollectionWrapper$WrapperIterator.class 2KB
DirectoryContent$EntriesEnumeration.class 2KB
BundleTracker$Tracked.class 2KB
ShrinkableCollection.class 2KB
JarFileX.class 2KB
MapToDictionary.class 2KB
FrameworkUtil.class 2KB
Felix$RefreshHelper.class 2KB
BundleException.class 2KB
BundleContext.class 2KB
Bundle.class 2KB
FelixConstants.class 2KB
ListenerHookInfoImpl.class 2KB
Felix$7.class 2KB
StartLevelActivator.class 2KB
Resolver$1.class 2KB
ContentDirectoryContent$EntriesEnumeration.class 2KB
ServicePermission$1.class 1KB
FrameworkUtil$ServiceReferenceDictionary.class 1KB
EventDispatcher$2.class 1KB
CompoundEnumeration.class 1KB
IModule.class 1KB
PackagePermission$1.class 1KB
PackageAdminActivator.class 1KB
AdminPermission$1.class 1KB
FrameworkEvent.class 1KB
BundleRevision.class 1KB
共 321 条
- 1
- 2
- 3
- 4
资源评论
- yang3425483432012-12-12源码没问题 很好
- MYCS_20122014-02-07不错,能用,很好
- chunjingshuiwuran2013-05-20没问题 能用
- chongchuanbing2014-01-26没问题 能用
- 三轮车2013-05-16不错,很好,值得借鉴。
zouzhile
- 粉丝: 36
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功