Eclipse书籍部分翻译(英译中)3

来源:百度知道 编辑:UC知道 时间:2024/06/08 10:22:55
Bundling JARs separately is also a problem when packages are split over two or more JARs. If code in these package fragments needs to see a package's private members in the other JARs, bundling separately does not work. Each bundle gets its own classloader. As such, the package org.eclipsercp.hyperbola loaded by bundle A is actually different from the one with the same name but loaded by bundle B. They do not share package visibility.
Bundling by Wrapping
Since injecting metadata as described in the previous section requires modification of the original JARs, it is not always feasible. The following list outlines the most common problems:
Licensing Some licenses explicitly state that the licensed material cannot be modified or that modifications trigger further restrictions or obligations.
Signing JARs are often signed to prevent otherwise undetected tampering of their contents. In this use of signing, it may be possible to inject the metadata and additional fil

分别捆绑罐子也是一个问题,当软件包拆分超过两个或两个以上的罐子。如果在这些代码封装片段需要看到了一揽子的私人成员在其他罐子,捆绑分别是行不通的。每束得到自己的类加载器。因此, org.eclipsercp.hyperbola装包由捆绑实际上是不同于名称相同,但装载的捆绑B.它们不同意包知名度。
捆绑的包装
自元注射中所描述的前一节需要修改原来的罐子,它并非总是可行的。下面的列表列出了最常见的问题:
授权一些许可证明确规定,领有牌照的材料不能被修改或修改触发进一步的限制或义务。
签署罐子往往签署,以防止其他未被篡改其内容。在此使用签署,有可能注入元的和额外的filesthese档案或者未签署或正在签署了一个不同的签名。在其他情况下,签署是用来意味着权限和权利。在这种情况下,它是那么清楚,数据注入是可行的。
多罐一些图书馆来作为多个罐子。如上所述,罐子可以单独或捆绑销售,他们可以结合起来。这两种办法是可行的,但可能不会有吸引力在某些情况下。
最好的办法可能是总结了一套罐子在一个插件目录,并创建一个MANIFEST.MF ,说明他们的依赖和出口,如图20-3 。
包装代码库
同样的捆绑使用向导注入数据可以用来包装瓶。只要取消的JAR文件解压缩档案到项目中讲述了精灵复制罐子纳入项目不提取其内容。该罐,然后列出捆绑的类路径中的顺序你说他们的向导。
同样,由此产生的项目是就像任何其他插件项目。当你去出口,但是,你应该包插件作为一个目录。使用封装插件和个人JAR文件档案选项导出“ >部署插件和碎片精灵。否则,你最终将与原来的图书馆罐子嵌套在新的插件JAR文件。插件在这个布局是可用的,但效率不高,因为套瓶必须在提取和使用标准的Java编译器不能对这种编译罐子。第26章“的OSGi要点” ,有一个长时间的讨论利弊的各种插件的形状。