logo资料库

OSGI规范(中文版).doc

第1页 / 共245页
第2页 / 共245页
第3页 / 共245页
第4页 / 共245页
第5页 / 共245页
第6页 / 共245页
第7页 / 共245页
第8页 / 共245页
资料共245页,剩余部分请下载后查看
2008.7
OpenDoc版权说明
OSGi 服务平台核心规范
OSGi联盟
Copyright © 2005, 2000 OSGi Alliance
All Rights Reserved
OSGi Specification License, Version 1.0
Agreement (“Agreement”). You are not authorized to
Specification that: (i) fully implements the Speci
THE SPECIFICATION IS PROVIDED “AS IS,” AND THE OSG
SPECIFICATION OR THE PERFORMANCE OR IMPLEMENTATION
The name and trademarks of the OSGi Alliance or an
Trademarks
OSGi™ is a trademark, registered trademark, or ser
Alliance in the US and other countries. Java is a
Feedback
OSGi Member Companies
Alpine Electronics Europe Gmbh, Aplix Corporation,
Echelon Corporation, Electricité de France (EDF),
Harman/Becker Automotive Systems GmbH, Hitachi, Lt
Oracle Corporation, Panasonic Technologies, Inc.,
Co., Ltd., SavaJe Technologies, Inc., Sharp Corpor
1. 简介
1.1.OSGi 框架概述
1.2.更新概述
1.3.面向的读者
1.4.约定和术语
1.4.1.印刷样式
1.4.2.常规语法定义
1.4.3.面向对象技术
1.4.4.图表说明
1.4.5.关键字
1.5.版本信息
1.6.参考
[1]Bradner, S., Key words for use in RFCs to Indicate
[2]OSGi Service Gateway Specification 1.0, May 2000
[3]OSGi Service Platform, Release 2, October 2001
[4]OSGi Service Platform, Release 3, March 2003
[5]Lexical Structure Java Language
2.安全层
2.1.简介
2.1.1.要点
2.2.安全概览
2.2.1.代码验证
2.2.2.可选情况
2.3.数字签名JAR文件
2.3.1.JAR结构和Manifest
Name: x/A.class
Name: x/B.class
2.3.2.JAR文件约束
2.3.3.签名算法
2.3.4.证书
2.3.5.惟一标识名(DN,Distinguished Name)
2.3.6.证书匹配
2.4.参考
ISBN 1-57870-070-1
3.模块层
3.1.介绍
3.2.Bundle
3.2.1.Bundle Manifest Headers
3.2.1.1 Bundle-Activator: com.acme.fw.Activator
3.2.1.2 Bundle-Category: osgi, test, nursery
3.2.1.3 Bundle-Classpath: /jar/http.jar,.
3.2.1.4 Bundle-ContactAddress: 2400 Oswego Road, A
3.2.1.5 Bundle-Copyright: OSGi (c) 2002
3.2.1.6 Bundle-Description: Network Firewall
3.2.1.7 Bundle-DocURL: http:/www.acme.com/Firewall
3.2.1.8 Bundle-Localization: OSGI-INF/l10n/bundle
3.2.1.9 Bundle-ManifestVersion: 2
3.2.1.10 Bundle-Name: Firewall
3.2.1.11 Bundle-NativeCode: /lib/http.DLL; osname
3.2.1.12 Bundle-RequiredExecutionEnvironment: CDC-
3.2.1.13 Bundle-SymbolicName: com.acme.daffy
3.2.1.14 Bundle-UpdateLocation:
3.2.1.15 Bundle-Vendor: OSGi Alliance
3.2.1.16 Bundle-Version: 1.1
3.2.1.17 DynamicImport-Package: com.acme.plugin.*
3.2.1.18 Export-Package: org.osgi.util.tracker;ver
3.2.1.19 Export-Service: org.osgi.service.log.LogS
3.2.1.20 Fragment-Host: org.eclipse.swt; bundle-ve
3.2.1.21 Import-Package: org.osgi.util.tracker,org
3.2.1.22 Import-Service: org.osgi.service.log.LogS
3.2.1.23 Require-Bundle: com.acme.chess
3.2.2.标记语构
3.2.3.通用标记语构
3.2.4.版本
3.2.5.版本范围
3.2.6.过滤器正则表达式
3.3.运行环境
3.3.1.运行环境命名
3.4.类加载机制
3.4.1.解析过程
3.5.元数据处理
3.5.1.Bundle-ManifestVersion
3.5.2.Bundle-SymbolicName
3.5.3.Bundle-Version
3.5.4.Import-Package
3.5.5.Export-Package
3.5.6.导入和导出一个包
3.5.7.对遗留bundle的处理
3.6.约束处理
3.6.1.图表和标记
3.6.2.版本匹配
3.6.3.可选包
3.6.4.包约束
3.6.5.属性匹配
3.6.6.强制属性
3.6.7.类过滤
3.6.8.选择提供者(Provider selection)
3.7.解析过程
3.8.运行时类加载
3.8.1.bundle类路径
3.8.2.动态导入包(Dynamic Import Package)
3.8.3.父级代理(Parent Delegation)
3.8.4.完整查找顺序
3.8.5.父类加载器
3.8.6.资源加载
3.8.7.Bundle环
D: Require-Bundle: A
3.8.8.启动前执行代码
3.9.本地代码加载
3.9.1.本地代码算法
3.9.2.考虑使用本地库
3.10.本地化
3.10.1.查找本地化条目
3.10.2.本地化manifest
3.11.Bundle 有效性
3.12.可选项
3.13.bundle的需求(Requiring Bundles)
3.13.1.Require-Bundle
3.13.2.bundle需求中的一些问题
3.14.Bundle片断 (Fragment Bundles)
3.14.1.Fragment-Host
3.14.2.运行时Fragment ( Fragment During Runtime)
3.15.bundle的扩展
3.15.1.扩展bundle的非法manifest
3.15.2.类路径处理
3.16.安全
3.16.1.扩展bundle
3.16.2.bundle权限
3.16.3.包权限
3.16.4.资源权限
3.16.5.权限检查
Bundle A
Import-Package: p
3.17.参考
[19]The Standard for the Format of ARPA Internet Text
[20]The Hypertext Transfer Protocol - HTTP/1.1
[21]The Java 2 Platform API Specification
[22]The Java Language Specification
[23]A String Representation of LDAP Search Filters
[24]The Java Security Architecture for JDK 1.2
[25]The Java 2 Package Versioning Specification
[26]Codes for the Representation of Names of Languages
[27]Zip File Format
[28]Manifest Format
[29]W3C EBNF
[30]Lexical Structure Java Language
[31]Mathematical Convention for Interval Notation
[32]Uniform Resource Identifiers URI: Generic Syntax
RFC 2396
[33]Codes for the Representation of Names of Languages
4.生命周期层
4.1.简介
4.1.1.要点
4.1.2.名词
4.2.Bundle
4.3.Bundle实体
4.3.1.Bundle标识
4.3.2.Bundle状态
4.3.3.Bundle安装
4.3.4.Bundle解析
4.3.5.Bundle启动
4.3.6.Bundle停止
4.3.7.Bundle更新
4.3.8.Bundle卸载
4.3.9.Bundle更改检测
4.3.10.重新取得Manifest
4.3.11.类加载
4.3.12.资源访问
4.3.13.Bundle权限
4.4.Bundle 上下文环境
4.4.1.获取bundle信息
4.4.2.持久存储
4.4.3.环境属性
4.5.系统bundle
4.6.事件
4.6.1.监听器
4.6.2.事件发送
4.6.3.同步处理缺陷
4.7.框架的启动和关闭
4.7.1.启动
4.7.2.关闭
4.8.安全
4.8.1.管理权限
Class loadClass(String name) {
4.8.1.1.Actions
4.8.2.对目标使用签名
4.8.3.特权回调
For any other callbacks that are registered with a
4.9.参考
[34]The Standard for the Format of ARPA Internet Text
[35]The Hypertext Transfer Protocol - HTTP/1.1
[36]The Java 2 Platform API Specification
[37]The Java Language Specification
[38]A String Representation of LDAP Search Filters
[39]The Java Security Architecture for JDK 1.2
[40]The Java 2 Package Versioning Specification
[41]Codes for the Representation of Names of Languages
[42]Manifest Format
[43]W3C EBNF
[44]Lexical Structure Java Language
[45]Interval Notation
5.服务层
5.1.简介
5.1.1.要点
5.1.2.名词
5.2.服务
5.2.1.服务引用
5.2.2.服务接口
5.2.3.注册服务
5.2.4.服务注册对象的过早请求
5.2.5.服务属性
5.2.6.持久标志符(PID)
5.2.7.服务定位
5.2.8.获取服务属性
5.2.9.获取服务对象
5.2.10.服务的其它信息
5.3.服务事件
5.4.过期引用
5.5.过滤器
5.6.服务工厂
5.7.服务释放
5.8.取消注册服务
5.9.多版本导出
5.9.1.服务注册中心
5.9.2.服务事件
5.10.安全
5.10.1.服务权限控制
6.Framework API
6.1.org.osgi.framework
6.1.1.要点
6.1.2.public final class AdminPermission extends BasicPe
CLASS
6.1.2.1.public static final String CLASS = “class”
6.1.2.2.public static final String EXECUTE = “execute”
6.1.2.3.public static final String EXTENSIONLIFECYCLE = “e
6.1.2.4.public static final String LIFECYCLE = “lifecycle”
6.1.2.5.public static final String LISTENER = “listener”
6.1.2.6.public static final String METADATA = “metadata”
6.1.2.7.public static final String RESOLVE = “resolve”
6.1.2.8.public static final String RESOURCE = “resource”
6.1.2.9.public static final String STARTLEVEL = “startleve
6.1.2.10.public AdminPermission( )
6.1.2.11.public AdminPermission( String filter, String acti
6.1.2.12.public AdminPermission( Bundle bundle, String acti
6.1.2.13.public boolean equals( Object obj )
6.1.2.14.public String getActions( )
6.1.2.15.public int hashCode( )
6.1.2.16.public boolean implies( Permission p )
6.1.2.17.public PermissionCollection newPermissionCollectio
6.1.3.public interface AllServiceListener extends Servic
6.1.4.public interface Bundle
6.1.4.1.public static final int ACTIVE = 32
6.1.4.2.public static final int INSTALLED = 2
6.1.4.3.public static final int RESOLVED = 4
6.1.4.4.public static final int STARTING = 8
6.1.4.5.public static final int STOPPING = 16
6.1.4.6.public static final int UNINSTALLED = 1
6.1.4.7.public Enumeration findEntries( String path, Strin
6.1.4.8.public long getBundleId( )
6.1.4.9.public URL getEntry( String name )
6.1.4.10.public Enumeration getEntryPaths( String path )
6.1.4.11.public Dictionary getHeaders( )
6.1.4.12.public Dictionary getHeaders( String locale )
6.1.4.13.public long getLastModified( )
6.1.4.14.public String getLocation( )
6.1.4.15.public ServiceReference[] getRegisteredServices( )
6.1.4.16.public URL getResource( String name )
6.1.4.17.public Enumeration getResources( String name ) thr
6.1.4.18.public ServiceReference[] getServicesInUse( )
6.1.4.19.public int getState( )
6.1.4.20.public String getSymbolicName( )
6.1.4.21.public boolean hasPermission( Object permission )
6.1.4.22.public Class loadClass( String name ) throws Class
6.1.4.23.public void start( ) throws BundleException
6.1.4.24.public void stop( ) throws BundleException
6.1.4.25.public void uninstall( ) throws BundleException
6.1.4.26.public void update( ) throws BundleException
6.1.4.27.public void update( InputStream in ) throws Bundle
6.1.5.public interface BundleActivator
6.1.5.1.public void start( BundleContext context ) throws
6.1.5.2.public void stop( BundleContext context ) throws E
6.1.6.public interface BundleContext
6.1.6.1.public void addBundleListener( BundleListener list
6.1.6.2.public void addFrameworkListener( FrameworkListene
6.1.6.3.public void addServiceListener( ServiceListener li
6.1.6.4.public void addServiceListener( ServiceListener li
6.1.6.5.public Filter createFilter( String filter ) throws
6.1.6.6.public ServiceReference[] getAllServiceReferences(
6.1.6.7.public Bundle getBundle( )
6.1.6.8.public Bundle getBundle( long id )
6.1.6.9.public Bundle[] getBundle( )
6.1.6.10.public File getDataFile( String filename )
6.1.6.11.public String getProperty( String key )
6.1.6.12.public Object getService( ServiceReference referen
6.1.6.13.public ServiceReference getServiceReference( Strin
6.1.6.14.public ServiceReference[] getServiceReferences( St
6.1.6.15.public Bundle installBundle( String location ) thr
6.1.6.16.public Bundle installBundle( String location, Inpu
6.1.6.17.public ServiceRegistration registerService( String
6.1.6.18.public ServiceRegistration registerService( String
6.1.6.19.public void removeBundleListener( BundleListener l
6.1.6.20.public void removeFrameworkListener( FrameworkList
6.1.6.21.public void removeServiceListener( ServiceListener
6.1.6.22.public boolean ungetService( ServiceReference refe
6.1.7.public class BundleEvent extends EventObject
INSTALLED
6.1.7.1.public static final int INSTALLED = 1
6.1.7.2.public static final int RESOLVED = 32
6.1.7.3.public static final int STARTED = 2
6.1.7.4.public static final int STARTING = 128
6.1.7.5.public static final int STOPPED = 4
6.1.7.6.public static final int STOPPING = 256
6.1.7.7.public static final int UNINSTALLED = 16
6.1.7.8.public static final int UNRESOLVED = 64
6.1.7.9.public static final int UPDATED = 8
6.1.7.10.public BundleEvent( int type, Bundle bundle )
6.1.7.11.public Bundle getBundle( )
6.1.7.12.public int getType( )
6.1.8.public class BundleException extends Exception
6.1.8.1.public BundleException( String msg, Throwable caus
6.1.8.2.public BundleException( String msg )
6.1.8.3.public Throwable getCause( )
6.1.8.4.public Throwable getNestedException( )
6.1.8.5.public Throwable initCause( Throwable cause )
6.1.9.public interface BundleListener extends EventListe
6.1.9.1.public void bundleChanged( BundleEvent event )
6.1.10.public final class BundlePermission extends BasicP
6.1.10.1.public static final String FRAGMENT = “fragment”
6.1.10.2.public static final String HOST = “host”
6.1.10.3.public static final String PROVIDE = “provide”
6.1.10.4.public static final String REQUIRE = “require”
6.1.10.5.public BundlePermission( String symbolicName, Stri
6.1.10.6.public boolean equals( Object obj )
6.1.10.7.public String getActions( )
6.1.10.8.public int hashCode( )
6.1.10.9.public boolean implies( Permission p )
6.1.10.10.public PermissionCollection newPermissionCollectio
6.1.11.public interface Configurable
6.1.11.1.public Object getConfigurationObject( )
6.1.12.public interface Constants
6.1.12.1.public static final String BUNDLE_ACTIVATOR = “Bun
6.1.12.2.public static final String BUNDLE_CATEGORY = “Bund
6.1.12.3.public static final String BUNDLE_CLASSPATH = “Bun
6.1.12.4.public static final String BUNDLE_CONTACTADDRESS =
6.1.12.5.public static final String BUNDLE_COPYRIGHT = “Bun
6.1.12.6.public static final String BUNDLE_DESCRIPTION = “B
6.1.12.7.public static final String BUNDLE_DOCURL = “Bundle
6.1.12.8.public static final String BUNDLE_LOCALIZATION = “
6.1.12.9.public static final String BUNDLE_LOCALIZATION_DEF
6.1.12.10.public static final String BUNDLE_MANIFESTVERSION
6.1.12.11.public static final String BUNDLE_NAME = “Bundle-N
6.1.12.12.public static final String BUNDLE_NATIVECODE = “Bu
6.1.12.13.public static final String BUNDLE_NATIVECODE_LANGU
6.1.12.14.public static final String BUNDLE_NATIVECODE_OSNAM
6.1.12.15.public static final String BUNDLE_NATIVECODE_OSVER
6.1.12.16.public static final String BUNDLE_NATIVECODE_PROCE
6.1.12.17.public static final String BUNDLE_REQUIREDEXECUTIO
6.1.12.18.public static final String BUNDLE_SYMBOLICNAME = “
6.1.12.19.public static final String BUNDLE_SYMBOLICNAME_ATT
6.1.12.20.public static final String BUNDLE_UPDATELOCATION =
6.1.12.21.public static final String BUNDLE_VENDOR = “Bundle
6.1.12.22.public static final String BUNDLE_VERSION = “Bundl
6.1.12.23.public static final String BUNDLE_VERSION_ATTRIBUT
6.1.12.24.public static final String DYNAMICIMPORT_PACKAGE =
6.1.12.25.public static final String EXCLUDE_DIRECTIVE = “ex
6.1.12.26.public static final String EXPORT_PACKAGE = “Expor
6.1.12.27.public static final String EXPORT_SERVICE = “Expor
6.1.12.28.public static final String EXTENSION_DIRECTIVE = “
6.1.12.29.public static final String EXTENSION_BOOTCLASSPATH
6.1.12.30.public static final String EXTENSION_FRAMEWORK = “
6.1.12.31.public static final String FRAGMENT_ATTACHMENT_ALW
6.1.12.32.public static final String FRAGMENT_ATTACHMENT_DIR
6.1.12.33.public static final String FRAGMENT_ATTACHMENT_NEV
6.1.12.34.public static final String FRAGMENT_ATTACHMENT_RES
6.1.12.35.public static final String FRAGMENT_HOST = “Fragme
6.1.12.36.public static final String FRAMEWORK_BOOTDELEGATIO
6.1.12.37.public static final String FRAMEWORK_EXECUTIONENVI
6.1.12.38.public static final String FRAMEWORK_LANGUAGE = “o
6.1.12.39.public static final String FRAMEWORK_OS_NAME = “or
6.1.12.40.public static final String FRAMEWORK_OS_VERSION =
6.1.12.41.public static final String FRAMEWORK_PROCESSOR = “
6.1.12.42.public static final String FRAMEWORK_SYSTEMPACKAGE
6.1.12.43.public static final String FRAMEWORK_VENDOR = “org
6.1.12.44.public static final String FRAMEWORK_VERSION = “or
6.1.12.45.public static final String IMPORT_PACKAGE = “Impor
6.1.12.46.public static final String IMPORT_SERVICE = “Impor
6.1.12.47.public static final String INCLUDE_DIRECTIVE = “in
6.1.12.48.public static final String MANDATORY_DIRECTIVE = “
6.1.12.49.public static final String OBJECTCLASS = “objectCl
6.1.12.50.public static final String PACKAGE_SPECIFICATION_V
6.1.12.51.public static final String REQUIRE_BUNDLE = “Requi
6.1.12.52.public static final String RESOLUTION_DIRECTIVE =
6.1.12.53.public static final String RESOLUTION_MANDATORY =
6.1.12.54.public static final String RESOLUTION_OPTIONAL = “
6.1.12.55.public static final String SELECTION_FILTER_ATTRIB
6.1.12.56.public static final String SERVICE_DESCRIPTION = “
6.1.12.57.public static final String SERVICE_ID = “service.i
6.1.12.58.public static final String SERVICE_PID = “service.
6.1.12.59.public static final String SERVICE_RANKING = “serv
6.1.12.60.public static final String SERVICE_VENDOR = “servi
6.1.12.61.public static final String SINGLETON_DIRECTIVE = “
6.1.12.62.public static final String SUPPORTS_BOOTCLASSPATH_
6.1.12.63.public static final String SUPPORTS_FRAMEWORK_EXTE
6.1.12.64.public static final String SUPPORTS_FRAMEWORK_FRAG
6.1.12.65.public static final String SUPPORTS_FRAMEWORK_REQU
6.1.12.66.public static final String SYSTEM_BUNDLE_LOCATION
6.1.12.67.public static final String SYSTEM_BUNDLE_SYMBOLICN
6.1.12.68.public static final String USES_DIRECTIVE = “uses”
6.1.12.69.public static final String VERSION_ATTRIBUTE = “ve
6.1.12.70.public static final String VISIBILITY_DIRECTIVE =
6.1.12.71.public static final String VISIBILITY_PRIVATE = “p
6.1.12.72.public static final String VISIBILITY_REEXPORT = “
6.1.13.public interface Filter
6.1.13.1.public boolean equals( Object obj )
6.1.13.2.public int hashCode( )
6.1.13.3.public boolean match( ServiceReference reference )
6.1.13.4.public boolean match( Dictionary dictionary )
6.1.13.5.public boolean matchCase( Dictionary dictionary )
6.1.13.6.public String toString( )
6.1.14.public class FrameworkEvent extends EventObject
6.1.14.1.public static final int ERROR = 2
6.1.14.2.public static final int INFO = 32
6.1.14.3.public static final int PACKAGES_REFRESHED = 4
6.1.14.4.public static final int STARTED = 1
6.1.14.5.public static final int STARTLEVEL_CHANGED = 8
6.1.14.6.public static final int WARNING = 16
6.1.14.7.public FrameworkEvent( int type, Object source )
6.1.14.8.public FrameworkEvent( int type, Bundle bundle, Th
6.1.14.9.public Bundle getBundle( )
6.1.14.10.public Throwable getThrowable( )
6.1.14.11.public int getType( )
6.1.15.public interface FrameworkListener extends EventLi
6.1.15.1.public void frameworkEvent( FrameworkEvent event )
6.1.16.public class FrameworkUtil
6.1.16.1.public static Filter createFilter( String filter )
6.1.17.public class InvalidSyntaxException extends Except
6.1.17.1.public InvalidSyntaxException( String msg, String
6.1.17.2.public InvalidSyntaxException( String msg, String
6.1.17.3.public Throwable getCause( )
6.1.17.4.public String getFilter( )
6.1.17.5.public Throwable initCause( Throwable cause )
6.1.18.public final class PackagePermission extends Basic
6.1.18.1.public static final String EXPORT = “export”
IMPORT
6.1.18.2.public static final String IMPORT = “import”
6.1.18.3.public PackagePermission( String name, String acti
6.1.18.4.public boolean equals( Object obj )
6.1.18.5.public String getActions( )
6.1.18.6.public int hashCode( )
6.1.18.7.public boolean implies( Permission p )
6.1.18.8.public PermissionCollection newPermissionCollectio
6.1.19.public class ServiceEvent extends EventObject
6.1.19.1.public static final int MODIFIED = 2
6.1.19.2.public static final int REGISTERED = 1
6.1.19.3.public static final int UNREGISTERING = 4
6.1.19.4.public ServiceEvent( int type, ServiceReference re
6.1.19.5.public ServiceReference getServiceReference( )
6.1.19.6.public int getType( )
6.1.20.public interface ServiceFactory
6.1.20.1.public Object getService( Bundle bundle, ServiceRe
6.1.20.2.public void ungetService( Bundle bundle, ServiceRe
6.1.21.public interface ServiceListener extends EventList
6.1.21.1.public void serviceChanged( ServiceEvent event )
6.1.22.public final class ServicePermission extends Basic
6.1.22.1.public static final String GET = “get”
6.1.22.2.public static final String REGISTER = “register”
6.1.22.3.public ServicePermission( String name, String acti
6.1.22.4.public boolean equals( Object obj )
6.1.22.5.public String getActions( )
6.1.22.6.public int hashCode( )
6.1.22.7.public boolean implies( Permission p )
6.1.22.8.public PermissionCollection newPermissionCollectio
6.1.23.public interface ServiceReference
6.1.23.1.public Bundle getBundle( )
6.1.23.2.public Object getProperty( String key )
6.1.23.3.public String[] getPropertyKeys( )
6.1.23.4.public Bundle[] getUsingBundle( )
6.1.23.5.public boolean isAssignableTo( Bundle bundle, Stri
6.1.24.public interface ServiceRegistration
6.1.24.1.public ServiceReference getReference( )
6.1.24.2.public void setProperties( Dictionary properties )
6.1.24.3.public void unregister( )
6.1.25.public interface SynchronousBundleListener extends
6.1.26.public class Version implements Comparable
6.1.26.1.public static final Version emptyVersion
6.1.26.2.public Version( int major, int minor, int micro )
6.1.26.3.public Version( int major, int minor, int micro, S
6.1.26.4.public Version( String version )
6.1.26.5.public int compareTo( Object object )
6.1.26.6.public boolean equals( Object object )
6.1.26.7.public int getMajor( )
6.1.26.8.public int getMicro( )
6.1.26.9.public int getMinor( )
6.1.26.10.public String getQualifier( )
6.1.26.11.public int hashCode( )
6.1.26.12.public static Version parseVersion( String version
6.1.26.13.public String toString( )
7.包管理服务规范
7.1.简介
7.1.1.要点
7.1.2.名词
7.1.3.操作
7.2.包管理
7.2.1.包共享
7.2.2.Bundle信息
7.2.3.片断和需求的bundle
7.2.4.导出包
7.2.5.更新包和启动级别服务
7.3.安全
7.4.更改
7.5.org.osgi.service.packageadmin
7.5.1.概要
7.5.2.public interface ExportedPackage
7.5.2.1.public Bundle getExportingBundle( )
7.5.2.2.public Bundle[] getImportingBundle( )
7.5.2.3.public String getName( )
7.5.2.4.public String getSpecificationVersion( )
7.5.2.5.public Version getVersion( )
7.5.2.6.public boolean isRemovalPending( )
7.5.3.public interface PackageAdmin
7.5.3.1.public static final int BUNDLE_TYPE_FRAGMENT = 1
7.5.3.2.public Bundle getBundle( Class clazz )
7.5.3.3.public Bundle[] getBundle( String symbolicName, St
7.5.3.4.public int getBundleType( Bundle bundle )
7.5.3.5.public ExportedPackage getExportedPackage( String
7.5.3.6.public ExportedPackage[] getExportedPackages( Bund
7.5.3.7.public ExportedPackage[] getExportedPackages( Stri
7.5.3.8.public Bundle[] getFragments( Bundle bundle )
7.5.3.9.public Bundle[] getHosts( Bundle bundle )
7.5.3.10.public RequiredBundle[] getRequiredBundle( String
7.5.3.11.public void refreshPackages( Bundle[] bundle )
7.5.3.12.public boolean resolveBundle( Bundle[] bundle )
7.5.4.public interface RequiredBundle
7.5.4.1.public Bundle getBundle( )
7.5.4.2.public Bundle[] getRequiringBundle( )
7.5.4.3.public String getSymbolicName( )
7.5.4.4.public Version getVersion( )
7.5.4.5.public boolean isRemovalPending( )
8.启动级别服务规范
8.1.简介
8.1.1.要点
8.1.2.名词
8.2.启动级别服务
8.2.1.启动级别的概念
8.2.2.修改激活启动级别
8.2.3.启动顺序
8.2.4.关闭顺序
8.2.5.修改bundle的启动级别
8.2.6.启动bundle
8.2.7.BundleActivator中的异常
8.2.8.系统bundle
8.3.兼容模式
8.4.应用实例
8.4.1.安全模式启动方案
8.4.2.启动快照方案
Screen createSplash() { ... }
8.5.安全
8.6.org.osgi.service.startlevel
8.6.1.public interface StartLevel
8.6.1.1.public int getBundletartLevel( Bundle bundle )
8.6.1.2.public int getInitialBundletartLevel( )
8.6.1.3.public int getStartLevel( )
8.6.1.4.public boolean isBundlePersistentlyStarted( Bundle
8.6.1.5.public void setBundletartLevel( Bundle bundle, int
8.6.1.6.public void setInitialBundletartLevel( int startle
8.6.1.7.public void setStartLevel( int startlevel )
9.条件权限管理规范
9.1.简介
9.1.1.要点
9.1.2.名词
9.1.3.大纲
9.1.4.阅读指南
9.1.4.1.架构师
9.1.4.2.应用开发人员
9.1.4.3.管理人员
9.2.权限管理模型
9.2.1.局部权限
9.2.2.开放式部署通道
9.2.3.代理
9.2.4.组模型
9.2.5.典型示例
9.3.有效权限
9.4.条件权限
9.4.1.实例对应编码
9.5.权限检查
9.5.1.权限检查算法
9.5.2.示例
9.5.3.直接使用上下文访问控制
9.5.4.优化
9.6.权限管理
9.6.1.缺省权限
9.7.条件式
9.7.1.客户化条件式
9.7.2.实现问题
9.7.2.1.在条件式中使用权限检查
9.7.2.2.线程
9.7.2.3.类加载
9.7.2.4.条件式生命周期
9.8.标准条件式
9.8.1.Bundle签名条件式
9.8.2.Bundle位置条件式
9.9.bundle权限资源
9.9.1.移除bundle权限资源
9.10.与权限管理的关系
9.11.安全
9.11.1.服务注册安全
9.11.1.1.条件权限管理服务
9.11.1.2.客户端
9.12.org.osgi.service.condpermadmin
9.12.1.总结
BundleLocationCondition
9.12.2.public class BundleLocationCondition
9.12.2.1.public static Condition getCondition( Bundle bundl
9.12.3.public class BundleignerCondition
9.12.3.1.public static Condition getCondition( Bundle bundl
9.12.4.public interface Condition
9.12.4.1.public static final Condition FALSE
9.12.4.2.public static final Condition TRUE
9.12.4.3.public boolean isMutable( )
9.12.4.4.public boolean isPostponed( )
9.12.4.5.public boolean isSatisfied( )
9.12.4.6.public boolean isSatisfied( Condition[] conditions
9.12.5.public interface ConditionalPermissionAdmin
9.12.5.1.public ConditionalPermissionInfo addConditionalPer
9.12.5.2.public AccessControlContext getAccessControlContex
9.12.5.3.public ConditionalPermissionInfo getConditionalPer
9.12.5.4.public Enumeration getConditionalPermissionInfos(
9.12.5.5.public ConditionalPermissionInfo setConditionalPer
9.12.6.public interface ConditionalPermissionInfo
9.12.6.1.public void delete( )
9.12.6.2.public ConditionInfo[] getConditionInfos( )
9.12.6.3.public String getName( )
9.12.6.4.public PermissionInfo[] getPermissionInfos( )
9.12.7.public class ConditionInfo
9.12.7.1.public ConditionInfo( String type, String[] args )
9.12.7.2.public ConditionInfo( String encodedCondition )
9.12.7.3.public boolean equals( Object obj )
9.12.7.4.public final String[] getArgs( )
9.12.7.5.public final String getEncoded( )
9.12.7.6.public final String getType( )
9.12.7.7.public int hashCode( )
9.12.7.8.public String toString( )
9.13.参考
10.权限管理服务规范
10.1.简介
其他的框架相关机制在安全概要[P13]中进行了说明。
10.1.1.要点
缺省性(Defaults) – 权限管理服务必须提供对缺省权限的控制。这些是bundle不用指定而直
10.1.2.实体
10.1.3.操作
10.2.权限管理服务
setDefaultPermissions(PermissionInfo[]) – 设置缺省权限。
10.2.1.相对路径名称的文件权限
10.3.安全
10.4.更改
10.5.org.osgi.service.permissionadmin
10.5.1.概要
10.5.2.public interface PermissionAdmin
10.5.2.1.public PermissionInfo[] getDefaultPermissions( )
10.5.2.2.public String[] getLocations( )
10.5.2.3.public PermissionInfo[] getPermissions( String loc
10.5.2.4.public void setDefaultPermissions( PermissionInfo[
10.5.2.5.public void setPermissions( String location, Permi
10.5.3.public class PermissionInfo
为了实例化一个使用PermissionInfo表示的权限类,考虑在权限检查的时候,Permissio
10.5.3.1.public PermissionInfo( String type, String name, S
10.5.3.2.public PermissionInfo( String encodedPermission )
10.5.3.3.public boolean equals( Object obj )
10.5.3.4.public final String getActions( )
10.5.3.5.public final String getEncoded( )
10.5.3.6.public final String getName( )
10.5.3.7.public final String getType( )
10.5.3.8.public int hashCode( )
10.5.3.9.public String toString( )
11.URL处理服务规范
11.1.简介
11.1.1.要点
11.1.2.名词
11.1.3.操作
11.2.java.net中的工厂模式
11.3.框架规程
11.3.1.构建代理和处理器
11.3.2.内置处理器
11.3.3.查找内置处理器
11.3.4.保护方法和代理器
11.4.提供新的模式
11.5.内容处理器
11.6.安全问题
11.7.org.osgi.service.url
11.7.1.概要
11.7.2.public abstract class AbstractURLStreamHandlerServ
11.7.2.1.protected URLStreamHandlerSetter realHandler
11.7.2.2.public AbstractURLStreamHandlerService( )
11.7.2.3.public boolean equals( URL u1, URL u2 )
11.7.2.4.public int getDefaultPort( )
11.7.2.5.public InetAddress getHostAddress( URL u )
11.7.2.6.public int hashCode( URL u )
11.7.2.7.public boolean hostsEqual( URL u1, URL u2 )
11.7.2.8.public abstract URLConnection openConnection( URL
11.7.2.9.public void parseURL( URLStreamHandlerSetter realH
11.7.2.10.public boolean sameFile( URL u1, URL u2 )
11.7.2.11.protected void setURL( URL u, String proto, String
11.7.2.12.protected void setURL( URL u, String proto, String
11.7.2.13.public String toExternalForm( URL u )
11.7.3.public interface URLConstants
11.7.3.1.public static final String URL_CONTENT_MIMETYPE =
11.7.3.2.public static final String URL_HANDLER_PROTOCOL =
11.7.4.public interface URLStreamHandlerService
11.7.4.1.public boolean equals( URL u1, URL u2 )
11.7.4.2.public int getDefaultPort( )
11.7.4.3.public InetAddress getHostAddress( URL u )
11.7.4.4.public int hashCode( URL u )
11.7.4.5.public boolean hostsEqual( URL u1, URL u2 )
11.7.4.6.public URLConnection openConnection( URL u ) throw
11.7.4.7.public void parseURL( URLStreamHandlerSetter realH
11.7.4.8.public boolean sameFile( URL u1, URL u2 )
11.7.4.9.public String toExternalForm( URL u )
11.7.5.public interface URLStreamHandlerSetter
11.7.5.1.public void setURL( URL u, String protocol, String
11.7.5.2.public void setURL( URL u, String protocol, String
11.8.参考
OSGi R4 服务平台核心规范 中译本 翻译:范里程 审校:曹晓钢 设置格式[caoxg]: 允许西文在单词中间换行 2008.7 www.redsaga.com 满江红开放技术研究组织 删除[caoxg]: 7 删除[caoxg]: 11
OSGi R4 服务平台核心标准 文档说明 联络 Caoxg yahoo (dot ) com 作译者 范里程 曹晓钢 说明 翻译 审校 参与人员: 作译者 范里程 曹晓钢 (at) 为 email @ 符号 发布记录 版本 日期 R4 R4 2007.11 2008.7 OpenDoc 版权说明 本文档版权归原作译者所有。 在免费、且无任何附加条件的前提下,可在网络媒体中自由传播。 如需部分或者全文引用,请事先征求作译者意见。 如果本文对您有些许帮助,表达谢意的最好方式,是将您发现的问题和文档改进意见及时反馈给 作者。当然,倘若有时间和能力,能为技术群体无偿贡献自己的所学为最好的回馈。 本文档可从 http://www.redsaga.com 获取最新更新信息 So many open source projects. Why not Open your Documents? 2
OSGi R4 服务平台核心标准 OSGi 服务平台核心规范 OSGi联盟 版本4 2005年8月 So many open source projects. Why not Open your Documents? 3
OSGi R4 服务平台核心标准 Copyright © 2005, 2000 OSGi Alliance All Rights Reserved OSGi Specification License, Version 1.0 The OSGi Alliance (“OSGi Alliance”) hereby grants you a fully-paid, non-exclusive, non-transferable, worldwide, limited license (without the right to sublicense), under the OSGi Alliance's applicable intellectual property rights to view, download, and reproduce the OSGi Specification (“Specification”) which follows this License Agreement (“Agreement”). You are not authorized to create any derivative work of the Specification. The OSGi Alliance also grants you a perpetual, non-exclusive, worldwide, fully paid-up, royalty free, limited license (without the right to sublicense) under any applicable copyrights, to create and/or distribute an implementation of the Specification that: (i) fully implements the Specification including all its required interfaces and functionality; (ii) does not modify, subset, superset or otherwise extend the OSGi Name Space, or include any public or protected packages, classes, Java interfaces, fields or methods within the OSGi Name Space other than those required and authorized by the Specification. An implementation that does not satisfy limitations (i)-(ii) is not considered an implementation of the Specification, does not receive the benefits of this license, and must not be described as an implementation of the Specification. An implementation of the Specification must not claim to be a compliant implementation of the Specification unless it passes the OSGi Alliance Compliance Tests for the Specification in accordance with OSGi Alliance processes. “OSGi Name Space” shall mean the public class or interface declarations whose names begin with “org.osgi” or any recognized successors or replacements thereof. THE SPECIFICATION IS PROVIDED “AS IS,” AND THE OSGi ALLIANCE, ITS MEMBERS AND ANY OTHER AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE SPECIFICATION ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. THE OSGi ALLIANCE, ITS MEMBERS AND ANY OTHER AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SPECIFICATION OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF. The name and trademarks of the OSGi Alliance or any other Authors may NOT be used in any manner, including advertising or publicity pertaining to the Specification or its contents without specific, written prior permission. Title to copyright in the Specification will at all times remain with the Authors. No other rights are granted by implication, estoppel or otherwise. Trademarks OSGi™ is a trademark, registered trademark, or service mark of the OSGi Alliance in the US and other countries. Java is a trademark, registered trade- mark, or service mark of Sun Microsystems, Inc. in the US and other coun- tries. All other trademarks, registered trademarks, or service marks used in this document are the property of their respective owners and are hereby recognized. Feedback This specification can be downloaded from the OSGi web site: http://www.osgi.org Comments about this specification can be mailed to: speccomments@mail.osgi.org OSGi Member Companies Alpine Electronics Europe Gmbh, Aplix Corporation, Belgacom, BMW Group, Cablevision Systems, Computer Associates, Deutsche Telekom AG, Echelon Corporation, Electricité de France (EDF), Ericsson Mobile Platforms AB, Esmertec, Espial Group, Inc., ETRI Electronics and Telecommunications So many open source projects. Why not Open your Documents? 4 设置格式[范里程]: 项目符号和编号
OSGi R4 服务平台核心标准 Research Institute, France Telecom, Gatespace Telematics AB, Gemplus, Harman/Becker Automotive Systems GmbH, Hitachi, Ltd., IBM Corpora- tion, Industrial Technology Research Institute, Insignia Solutions, Intel Cor- poration, KDDI R&D Laboratories, Inc., KT Corporation, Mitsubishi Electric Corporation, Motorola, Inc., NEC Corporation, Nokia Corporation, NTT, Oracle Corporation, Panasonic Technologies, Inc., Philips Consumer Elec- tronics, ProSyst Software GmbH, Robert Bosch Gmbh, Samsung Electronics Co., Ltd., SavaJe Technologies, Inc., Sharp Corporation, Siemens AG, Sun Microsystems, Inc., Telcordia Technologies, Inc., Telefonica I+D, TeliaSon- era, Toshiba Corporation, Vodafone Group Services Limited So many open source projects. Why not Open your Documents? 5
OSGi R4 服务平台核心标准 1.1. 1.2. 1.3. 1.4. 1.5. 1.6. 3.1. 3.2. 3.3. 3.4. 3.5. 3.6. 3.7. 3.8. 3.9. 3.10. 3.11. 3.12. 3.13. 3.14. 3.15. 3.16. 3.17. 1. 简介 ............................................................................................................................................ 9 OSGi 框架概述 .........................................................................................................9 更新概述 .................................................................................................................. 10 面向的读者.............................................................................................................. 11 约定和术语.............................................................................................................. 11 版本信息 .................................................................................................................. 15 参考 .......................................................................................................................... 16 2. 安全层...................................................................................................................................... 17 简介 .......................................................................................................................... 17 安全概览 .................................................................................................................. 17 数字签名 JAR 文件 .................................................................................................18 参考 .......................................................................................................................... 27 3. 模块层...................................................................................................................................... 29 介绍 .......................................................................................................................... 29 Bundle.......................................................................................................................29 运行环境 .................................................................................................................. 34 类加载机制.............................................................................................................. 36 元数据处理.............................................................................................................. 39 约束处理 .................................................................................................................. 43 解析过程 .................................................................................................................. 50 运行时类加载 ..........................................................................................................51 本地代码加载 ..........................................................................................................58 本地化...................................................................................................................... 62 Bundle 有效性 ........................................................................................................ 63 可选项...................................................................................................................... 64 需求的 bundle.......................................................................................................... 64 Bundle 片断..............................................................................................................67 bundle 的扩展.......................................................................................................... 69 安全 .......................................................................................................................... 70 参考 .......................................................................................................................... 73 4. 生命周期层.............................................................................................................................. 74 简介 .......................................................................................................................... 74 Bundle.......................................................................................................................75 Bundle 实体..............................................................................................................76 Bundle 上下文环境 ................................................................................................ 83 系统 bundle.............................................................................................................. 86 事件 .......................................................................................................................... 86 框架的启动和关闭 ..................................................................................................88 安全 .......................................................................................................................... 89 参考 .......................................................................................................................... 92 5. 服务层...................................................................................................................................... 94 简介 .......................................................................................................................... 94 服务 .......................................................................................................................... 95 服务事件 ................................................................................................................ 100 2.1. 2.2. 2.3. 2.4. 4.1. 4.2. 4.3. 4.4. 4.5. 4.6. 4.7. 4.8. 4.9. 5.1. 5.2. 5.3. So many open source projects. Why not Open your Documents? 6
OSGi R4 服务平台核心标准 7.1. 7.2. 7.3. 7.4. 7.5. 8.1. 8.2. 8.3. 8.4. 8.5. 8.6. 过期引用 ................................................................................................................ 101 5.4. 过滤器.................................................................................................................... 101 5.5. 服务工厂 ................................................................................................................ 102 5.6. 服务释放 ................................................................................................................ 103 5.7. 取消注册服务 ........................................................................................................103 5.8. 多版本导出............................................................................................................ 104 5.9. 安全 ........................................................................................................................ 104 5.10. Framework API .......................................................................................................................106 6.1. org.osgi.framework................................................................................................ 106 7. 包管理服务规范.................................................................................................................... 173 简介 ........................................................................................................................ 173 包管理.................................................................................................................... 174 安全 ........................................................................................................................ 175 更改 ........................................................................................................................ 175 org.osgi.service.packageadmin.............................................................................. 176 8. 启动级别服务规范 ................................................................................................................ 183 简介 ........................................................................................................................ 183 启动级别服务 ........................................................................................................184 兼容模式 ................................................................................................................ 187 应用实例 ................................................................................................................ 188 安全 ........................................................................................................................ 188 org.osgi.service.startlevel.......................................................................................189 9. 条件权限管理规范 ................................................................................................................ 192 简介 ........................................................................................................................ 192 9.1. 权限管理模型 ........................................................................................................194 9.2. 有效权限 ................................................................................................................ 199 9.3. 条件权限 ................................................................................................................ 200 9.4. 权限检查 ................................................................................................................ 201 9.5. 权限管理 ................................................................................................................ 209 9.6. 条件式.................................................................................................................... 212 9.7. 标准条件式............................................................................................................ 215 9.8. 9.9. bundle 权限资源 .................................................................................................... 216 9.10. 与权限管理的关系 ................................................................................................216 安全 ........................................................................................................................ 217 9.11. org.osgi.service.condpermadmin............................................................................217 9.12. 9.13. 参考 ........................................................................................................................ 223 权限管理服务规范 ........................................................................................................224 简介 ........................................................................................................................ 224 权限管理服务 ........................................................................................................225 安全 ........................................................................................................................ 226 更改 ........................................................................................................................ 227 org.osgi.service.permissionadmin..........................................................................227 URL 处理服务规范.......................................................................................................231 简介 ........................................................................................................................ 231 10.1. 10.2. 10.3. 10.4. 10.5. 11.1. 6. 10. 11. So many open source projects. Why not Open your Documents? 7
OSGi R4 服务平台核心标准 11.2. 11.3. 11.4. 11.5. 11.6. 11.7. 11.8. java.net 中的工厂模式 .......................................................................................... 234 框架规程 ................................................................................................................ 234 提供新的模式 ........................................................................................................237 内容处理器............................................................................................................ 238 安全问题 ................................................................................................................ 239 org.osgi.service.url................................................................................................. 239 参考 ........................................................................................................................ 244 So many open source projects. Why not Open your Documents? 8
分享到:
收藏