concept name in category osgi

appears as: name, The name, name, names, The names, names
OSGi in Action: Creating Modular Applications in Java

This is an excerpt from Manning's book OSGi in Action: Creating Modular Applications in Java.

For those familiar with Swing, PaintFrame extends JFrame and contains a JToolBar and a JPanel canvas. PaintFrame maintains a list of available SimpleShape implementations, which it displays in the toolbar. When the user selects a shape in the toolbar and clicks in the canvas to draw the shape, a ShapeComponent (which extends JComponent) is added to the canvas at the location where the user clicked. A ShapeComponent is associated with a specific SimpleShape implementation by name, which it retrieves from a reference to its PaintFrame. Figure 2.4 highlights some of the UI elements in the paint program GUI.

What does this particular permission entry do? The name you set is a unique key to identify the entry and has no inherent meaning; if you specify null for the name, a unique name will be generated for you. The single ConditionInfo and Permission-Info objects in their respective arrays match your bundle and grant it AllPermission. We’ll expand on the last argument, the access-decision flag, in the next section.

More specifically, a ConditionInfo encodes two arguments: the class name of the condition and an array of String objects for any constructor arguments for the condition class. The PermissionInfo object, on the other hand, encodes three arguments: the class name of the permission and the standard name and actions arguments of the permission class constructor. As a simple example, you can construct a PermissionInfo object like this:

new PermissionInfo(
  AdminPermission.class.getName(), "(id>10)", AdminPermission.EXECUTE);

This encodes the AdminPermission with the name of (id>10) and actions of execute, which grants the right to start and stop bundles with a bundle identifier greater than 10. To see a ConditionInfo example, you’ll need a concrete condition to play with, so we’ll introduce one next. After that, we can get down to brass tacks and show you the steps involved in using ConditionalPermissionAdmin.