A configuration solution for eclipse automatic plug-in dependency

Source: Internet
Author: User

Eclipse plug-ins have the following features:

(1) Each plug-in has its own classloader

(2) Plug-in resource interaction is controlled by attributes such as "Export-package, require-bundle, and import-package" in menifest. MF.

(3) plug-ins cannot depend on each other

Recently developed systems require permission control and control granularity to view definitions and command definitions. When the system starts, you need to load the available configurations of the current user according to the configuration (database storage). The problem arises:

Eclipse plug-ins must be dependent before they can be referenced. For example, if B depends on a, B can reference A, but a does not depend on B. A cannot call B's resources. This means that if a is used as the permission to detect and load the class configured by the plug-in, B's class cannot be referenced. A solution is to add a dependency on B. But when the system grows bigger and cannot be developed by a development group, how does a know what plug-ins are there? Obviously, it cannot be a foresight. So there is a problem.

Fortunately, eclipse provides extensions to the menifest file and extends the eclipse-buddypolicy directive.

URL: http://help.eclipse.org/juno/index.jsp? Topic=%2forg.eclipse.platform.doc.isv%2freference%2fmisc%2fbundle_manifest.html introduces this command

The eclipse-buddypolicy header is used to specify the buddy classloading policies ies for a bundle. The eclipse-buddypolicy header must use the following syntax:

Eclipse-BuddyPolicy ::= ( policy-name ) ( ',' policy-name ) *policy-name ::= ( 'dependent' | 'global' | 'registered' |                   'app' | 'ext' | 'boot' | 'parent' )
    • Registered-indicates that the buddy mechanic will consult bundlesthat have been registered to it. Bundle willing to be registered to a participant bundle add in their manifest: "eclipse-Example: <strong> ";
    • Dependent-indicates that the classes/resources will be looked uptransitively in all the dependent of the bundle;
    • Global-indicates that the classes/resources will be looked up in theglobal pool of exported package;
    • App-indicates that the application classloader will be consulted;
    • EXT-indicates that the extensiont classloader will be consulted;
    • Boot-indicates that the boot classloader will be consulted.

According to the above description, insert

Eclipse-BuddyPolicy: global

Command, and then B References A, A does not need to reference B, but the resources of B that need to be called in a need to be export in B. In this way, you can use B's resources in.

In this way, the user role is used to filter the interface and control part of the interface permissions.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.