The Bundle interface defines the uninstall method for uninstalling a bundle from the Framework. To whatever extent possible, the Framework must remove any resources related to the bundle. This method must always uninstall the bundle from the persistent storage of the Framework. If the uninstalled bundle has one or more revisions with isInUse bundle wirings then all capabilities provided by the old in use bundle wirings must remain available for existing bundles and future resolves until the bundle is refreshed, see Refreshing , or the Framework is restarted.
The Bundle object provides a convenient way to detect modifications in a bundle. The Framework must keep the time that a bundle is modified by any of the life cycle operations or, in the case of multi-release JARs, by changing the version of Java platform being used. See Multi-release JAR. The getLastModified method will return the last time the bundle was effectively modified. This last modified time must be stored persistently.
The method must return the number of milliseconds since midnight Jan. The getLastModified method is very useful when a bundle is caching resources from another bundle and needs to refresh the cache when the other bundle is effectively modified. A modification in the other bundle can happen while the caching bundle is not active.
The last modified time is therefore a convenient way to track modifications in bundles. The Bundle interface defines two methods to return manifest header information: getHeaders and getHeaders String. The values returned are localized according to the default locale returned by java. The returned values are localized using the specified locale. The locale may take the following values:.
This makes this method identical to the getHeaders method. A Specific Locale - The given locale is used to localize the manifest headers. If the bundle is a multi-release JAR, see Multi-release JAR , then the returned manifest header information must be the supplemented manifest information.
That is, the main manifest with the replacement values from a supplemental manifest, if any, for the current Java platform version. Localization is performed according to the description in Localization. If no translation is found for a specific key, the Dictionary returned by Bundle.
Bundles always have permission to read their own headers. After the bundle has been uninstalled, this method will only return manifest headers that are raw or localized for the default locale at the time the bundle was uninstalled.
A framework implementation must use only the raw unlocalized manifest headers when processing manifest headers. Localizations must not influence the operations of the Framework. In certain cases, it is necessary to load classes as if they were loaded from inside the bundle. The loadClass String method gives access to the bundle class loader.
This method can be used to:. For example, an application model could use this feature to load the initial class from the bundle and start it according to the rules of the application model.
Loading a class from a bundle can cause it to be activated if the bundle uses a lazy activation policy. The resources from a bundle can come from different sources. They can come from the raw JAR file, Fragment bundles, imported packages, or the bundle class path. Different use cases require a different resource search strategy. The Bundle interface provides a number of methods that access resources but use different strategies.
The following search strategies are supported:. Following the search order can make certain parts of the JAR files inaccessible. These methods require that the bundle is resolved. If the bundle is not resolved, the Framework must attempt to resolve it. The search order can hide certain directories of the JAR file. Split packages are taken into account; therefore, resources with the same package names can come from different JARs. If the bundle is unresolved or cannot be resolved , the getResource and getResources methods must only load resources from the bundle class path.
This search strategy should be used by code that wants to access its own resources. Calling either method can cause the creation of a class loader and force the bundle to become resolved. No searching is involved, only the raw JAR file is taken into account. The purpose of these methods is to provide low-level access without requiring that the bundle is resolved.
Useful when configuration or setup information is needed from another bundle. It considers Fragment bundles but it must never create a class loader or use the bundle class path. The method provides access to all directories in the associated JAR files. This setup is depicted in Figure 4. The following table shows the effect of getting a resource from this setup when bundle A is resolved.
The following table shows the same cases as the previous table but now for an unresolved bundle A. The Bundle interface defines a method for returning information pertaining to a bundle's permissions: hasPermission Object. This method returns true if the bundle's Protection Domain has the specified permission, and false if it does not, or if the object specified by the argument is not an instance of java. Fragments also have their own Protection Domain.
The parameter type is Object so that the Framework can be implemented on Java platforms that do not support Java based security. See The Permission Check for more information about the permission checks.
Bundles that have been started have a Bundle Context. This object is a capability ; it is intended to be used only by the bundle. However, there are a number of cases where bundles must act on behalf of other bundles. For example, the Service Component Runtime registers services on behalf of other bundles.
The framework therefore provides access to another bundle's context via the getBundleContext method. This method is potentially harmful because it allows any bundle to act as any other bundle. The adapt Class method allows the Bundle to be adapted to different types. The purpose of this method is to provide more specialized access to the Bundle object, access that is not always needed by most clients of the interface. For example, the adapt method can be used to adapt a Bundle object to the current BundleWiring object if resolved.
The adapt method is used as follows:. The following table shows the minimum list of types that can be used in the adapt method. However, implementations and specifications can extend this list.
The Framework Wiring if this bundle is the System Bundle. The relationship between the Framework and its installed bundles is realized by the use of BundleContext objects.
A BundleContext object represents the execution context of a single bundle within the OSGi framework, and acts as a proxy to the underlying Framework. A BundleContext object is created by the Framework when a bundle is started. The bundle can use this private BundleContext object for the following purposes:. Installing new bundles into the OSGi environment. See Installing Bundles. Interrogating other bundles installed in the OSGi environment.
See Getting Bundle Information. Obtaining a persistent storage area. See Persistent Storage. Retrieving service objects of registered services. See Service References. Registering services in the Framework service. See Registering Services. Subscribing or unsubscribing to events broadcast by the Framework. See Listeners. When a bundle is started, the Framework creates a BundleContext object and provides this object as an argument to the start BundleContext method of the bundle's Bundle Activator.
Each bundle is provided with its own BundleContext object; these objects should not be passed between bundles, since the BundleContext object is related to the security and resource allocation aspects of a bundle. After the stop BundleContext method has returned, the BundleContext object must no longer be used. Framework implementations must throw an exception if the BundleContext object is used after a bundle is stopped. However, the BundleContext object becomes invalid after stop BundleContext returns if the bundle has a Bundle Activator.
The BundleContext object becomes invalid before disposing of any remaining registered services and releasing any remaining services in use. The BundleContext interface defines methods to retrieve information about bundles installed in the OSGi framework:.
Bundle access is not restricted; any bundle can enumerate the set of installed bundles. The Framework should provide a private persistent storage area for each installed bundle on platforms with some form of file system support. The BundleContext interface defines access to this storage in terms of the File class, which supports platform-independent definitions of file and directory names.
The BundleContext interface defines a method to access the private persistent storage area: getDataFile String. This method takes a relative file name as an argument. It translates this file name into an absolute file name in the bundle's persistent storage area.
It then returns a File object. This method returns null if there is no support for persistent storage. This only provides execute permission within the Java environment and does not handle the potential underlying operating system issues related to executables. This special treatment applies only to FilePermission objects assigned to a bundle. Default permissions must not receive this special treatment.
A FilePermission for a relative path name assigned via the setDefaultPermission method must be ignored. The BundleContext interface defines a method for returning information pertaining to Framework properties: getProperty String.
This method can be used to return the Framework launching properties; see Launching Properties. This method will examine the System properties if the requested property is not available in the launching properties. In addition to normal bundles, the Framework itself is represented as a bundle. The bundle representing the Framework is referred to as the system bundle.
Through the system bundle, the Framework may register services that can be used by other bundles. Examples of such a service is the Conditional Permission Admin service. The system bundle resembles the framework object when a framework is launched, but implementations are not required to use the same object for the framework object and the system bundle. However, both objects must have bundle id 0, same location, and bundle symbolic name. The system bundle is listed in the set of installed bundles returned by BundleContext.
The system bundle is always assigned a bundle identifier of zero 0. The system bundle getLocation method returns the string: " System Bundle ", as defined in the Constants interface. The system bundle has a bundle symbolic name that is unique for a specific version. However, the name system. The system bundle's life cycle cannot be managed like normal bundles. Its life cycle methods must behave as follows:. See Frameworks for more information about the starting and stopping of the Framework.
The capabilities of the system bundle are obtained by adapting the system bundle to a BundleWiring as described in Adaptations. This is in preference to parsing the system bundle's headers. The system bundle's Bundle. The following headers of this OSGi specification can be returned in this dictionary. Headers not mentioned in this table should not be used.
Recommended to provide the framework vendor's contact address. Recommended to provide the framework's copyright information. Recommended description of the framework. Recommended documentation URL pointing to further information about the framework. Recommended pointer to a preferably PNG icon representing this framework. Recommended localization information. License information about this framework implementation. The maximum version of the manifest version understood by this framework.
Recommended human readable name of this framework. Mandatory: the list of execution environments supported by this framework. This header is deprecated, see osgi. The implementation name for this framework. The version of this framework implementation. Contains packages that are exported by the Framework like org.
BundleEvent - Reports changes in the life cycle of bundles. FrameworkEvent - Reports that the Framework is started, start level has changed, packages have been refreshed, or that an error has been encountered. The actual event that is reported is available with the getType method. The integer that is returned from this method can be one of the constant names that are described in the class. However, events can, and will be, extended in the future. Unrecognized event types should be ignored.
A listener interface is associated with each type of event. The following list describes these listeners. BundleListener and SynchronousBundleListener - Called with an event of type BundleEvent when a bundle's life cycle information has been changed.
SynchronousBundleListener objects are called synchronously during the processing of the event and must be called before any BundleListener object is called. The following events are sent by the Framework after it has moved to a different state:. This is only sent to SynchronousBundleListener objects. This event indicates that the Bundle Context will be destroyed. This event is only sent to SynchronousBundleListener objects. FrameworkListener - Called with an event of type FrameworkEvent.
Framework events are of type:. INFO - General information that is of interest in special situations. The Framework will be restarted after this event is fired.
BundleContext interface methods are defined which can be used to add and remove each type of listener. Events can be asynchronously delivered, unless otherwise stated, meaning that they are not necessarily delivered by the same thread that generated the event.
The thread used to call an event listener is not defined. The Framework must publish a FrameworkEvent. ERROR if a callback to an event listener generates an unchecked exception - except when the callback happens while delivering a FrameworkEvent.
ERROR to prevent an infinite loop. Synchronous events have the unfortunate effect that, in rare cases, events can be delivered out of order to a listener. If there are listeners queued behind the pathological listener then they see the unregistering before they see the registration. Collect a snapshot of the listener list at the time the event is published rather than doing so in the future just prior to event delivery , but before the event is delivered, so that listeners do not enter the list after the event happened.
Ensure, at the time the snapshot is taken, that listeners on the list still belong to active bundles at the time the event is delivered. It is possible to use more than one thread to deliver events.
If this is the case then each handler must receive the events in the same order as the events were posted. This ensures that handlers see events in the expected order. If the Framework did not capture the current listener list when the event was published, but instead waited until just prior to event delivery, then the following error could occur: a bundle could have started and registered a listener, and then the bundle could see its own BundleEvent.
Expected Behavior: Listener 1 must not receive Event A, because it was not registered at the time the event was published. Generally, a bundle that calls a listener should not hold any Java monitors. This means that neither the Framework nor the originator of a synchronous event should be in a monitor when a callback is initiated.
The purpose of a Java monitor is to protect the update of data structures. This should be a small region of code that does not call any code the effect of which cannot be overseen. Calling the OSGi Framework from synchronized code can cause unexpected side effects. One of these side effects might be deadlock. A deadlock is the situation where two threads are blocked because they are waiting for each other.
Time-outs can be used to break deadlocks, but Java monitors do not have time-outs. Therefore, the code will hang forever until the system is reset Java has deprecated all methods that can stop a thread. This type of deadlock is prevented by not calling the Framework or other code that might cause callbacks in a synchronized block.
If locks are necessary when calling other code, use the Java monitor to create semaphores that can time-out and thus provide an opportunity to escape a deadlocked situation.
The Admin Permission is a permission used to grant the right to manage the Framework with the option to restrict this right to a subset of bundles, called targets. For example, an Operator can give a bundle the right to only manage bundles of a signer that has a subject name of ACME:.
The actions of the Admin Permission are fine-grained. They allow the deployer to assign only the permissions that are necessary for a bundle. For example, an HTTP implementation could be granted access to all resources of all bundles. Code that needs to check Admin Permission must always use the constructor that takes a bundle as parameter: AdminPermission Bundle,String with a single action. For example, the implementation of the loadClass method must check that the caller has access to the class space:.
The Admin Permission takes a filter as its name. Filter based permissions are described in Filter Based Permissions. The action parameter of Admin Permission will specify the subset of privileged administrative operations that are allowed by the Framework.
The actions that are architected are listed in the following table. Future versions of the specification, as well as additional system services, can add additional actions. The given set should therefore not be assumed to be a closed set. This is an implicit permission that must be automatically given to all bundles by the Framework. The following interfaces define bundle callbacks that are invoked by the Framework:.
When any of these callbacks are invoked by the Framework, the bundle that caused the callback may still be on the stack. For example, when one bundle installs and then starts another bundle, the installer bundle may be on the stack when the BundleActivator. Likewise, when a bundle registers a service object, it may be on the stack when the Framework calls back the serviceChanged method of all qualifying ServiceListener objects.
Whenever any of these bundle callbacks try to access a protected resource or operation, the access control mechanism should consider not only the permissions of the bundle receiving the callback, but also those of the Framework and any other bundles on the stack. This means that in these callbacks, bundle programmers normally would use doPrivileged calls around any methods protected by a permission check such as getting or registering service objects.
In order to reduce the number of doPrivileged calls by bundle programmers, the Framework must perform a doPrivileged call around any bundle callbacks. The Framework should have java. Therefore, a bundle programmer can assume that the bundle is not further restricted except for its own permissions. Bundle programmers do not need to use doPrivileged calls in their implementations of any callbacks registered with and invoked by the Framework. For any other callbacks that are registered with a service object and therefore get invoked by the service-providing bundle directly, doPrivileged calls must be used in the callback implementation if the bundle's own privileges are to be exercised.
Otherwise, the callback must fail if the bundle that initiated the callback lacks the required permissions. A framework must never load classes in a doPrivileged region, but must instead use the current stack. This means that static initializers and constructors must not assume that they are privileged.
Any privileged code in a static initializer must be guarded with a doPrivileged region in the static initializer. Likewise, a framework must not instantiate a BundleActivator object in a doPrivileged region, but must instead use the current stack. This means that the BundleActivator constructor must not assume that it is privileged. How do i renew it. Hahaha… Adamu self.. I do prefer the glo nigeria bb to this mtn bb subscription. Thanks for providing the mtn blackberry subscription.
The MTN bb subscription i use the monthly one. The one naira. It has been very okay so far. Hello Admin. And later load additional money so that i will send to activate it just give me expiring date. Pls help me out. MTN Blackberry subscription is the best. I dont think am porting anytime soon. Mtn is a proud communication provider. It not there, if not the silly advanced free fraud country that has is full of nepotism.
God will help us in the selfish government country. Please blast me an e-mail if interested. Many thanks! A community powered, comprehensive reference to the functionality and utility of every node in Dynamo. Use the Dynamo Dictionary as a quick reference or an in-depth guide to extend your skills and empower your graphs. Go to Dictionary. Dynamo hosts a thriving ecosystem for Development.
This page takes you down the rabbit hole of all of the tools available for customizing your Dynamo experience. Go to Developer Resources. Launch Dynamo for the first time. Take a tour of the Dynamo user interface. Learn how to open and interact with Dynamo files. A closer look at the program elements used to interface and connect a Dynamo definition to a Revit Document. Note: This video uses Dynamo inside of the Revit application, but the workflow's logic can be applied to any other application environment.
Computational attractor system using the environment data from Autodesk Revit. Instantiate a Revit Family element with Dynamo. Control Family Type parameters with Dynamo. Control Family Instance parameters with Dynamo. Integrating Dynamo with Excel to extract model data from Revit. Getting data back into Revit in a an efficient way.
A unique feature in Dynamo that brings the visual programming and textual programming environment together. Create custom functionality to reuse it. The Advanced Tutorial videos are legacy content that has been created for the Dynamo 1. X environment. Some of the nodes you will see in these videos have been changed or deprecated in subsequent releases.
These legacy videos are posted here for educational purposes only and we have no plans to update any of these to the Dynamo 2. In this lesson we will introduce the building mass for the course, demonstrate its parametric flexibility, and explain the geometric applications of its parameters.
0コメント