osgi-core-4.3.0/ 0000755 0001750 0001750 00000000000 11655244347 013314 5 ustar drazzib drazzib osgi-core-4.3.0/LICENSE 0000644 0001750 0001750 00000026136 11527234124 014317 0 ustar drazzib drazzib Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. osgi-core-4.3.0/src/ 0000755 0001750 0001750 00000000000 11655244347 014103 5 ustar drazzib drazzib osgi-core-4.3.0/src/META-INF/ 0000755 0001750 0001750 00000000000 11655244347 015243 5 ustar drazzib drazzib osgi-core-4.3.0/src/META-INF/MANIFEST.MF 0000644 0001750 0001750 00000003244 11527234164 016672 0 ustar drazzib drazzib Manifest-Version: 1.0 Export-Package: org.osgi.framework.startlevel;uses:="org.osgi.framewor k";version="1.0",org.osgi.framework.wiring;uses:="org.osgi.framework" ;version="1.0",org.osgi.framework.hooks.bundle;uses:="org.osgi.framew ork";version="1.0",org.osgi.framework.hooks.service;uses:="org.osgi.f ramework";version="1.1",org.osgi.framework.hooks.resolver;uses:="org. osgi.framework.wiring";version="1.0",org.osgi.framework.launch;uses:= "org.osgi.framework";version="1.0",org.osgi.framework;uses:="javax.se curity.auth.x500";version="1.6",org.osgi.framework.hooks.weaving;uses :="org.osgi.framework.wiring";version="1.0",org.osgi.service.condperm admin;uses:="org.osgi.framework,org.osgi.service.permissionadmin";ver sion="1.1.1",org.osgi.service.packageadmin;uses:="org.osgi.framework" ;version="1.2",org.osgi.service.permissionadmin;version="1.2",org.osg i.service.startlevel;uses:="org.osgi.framework";version="1.1",org.osg i.service.url;version="1.0" Tool: Bnd-1.30.0 Bundle-Name: osgi.core Created-By: 1.6.0_22 (Sun Microsystems Inc.) Bundle-Copyright: Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved. Bundle-Vendor: OSGi Alliance DynamicImport-Package: * Bundle-Version: 4.3.0.201102171602 Bnd-LastModified: 1297976533399 Bundle-ManifestVersion: 2 Bundle-License: http://opensource.org/licenses/apache2.0.php; link="ht tp://www.apache.org/licenses/LICENSE-2.0"; description="Apache Licens e, Version 2.0" Bundle-Description: OSGi Service Platform Release 4 Version 4.3, Core Interfaces and Classes for use in compiling bundles. Import-Package: javax.security.auth.x500;resolution:=optional Bundle-SymbolicName: osgi.core osgi-core-4.3.0/src/org/ 0000755 0001750 0001750 00000000000 11527234164 014664 5 ustar drazzib drazzib osgi-core-4.3.0/src/org/osgi/ 0000755 0001750 0001750 00000000000 11527234164 015625 5 ustar drazzib drazzib osgi-core-4.3.0/src/org/osgi/service/ 0000755 0001750 0001750 00000000000 11527234164 017265 5 ustar drazzib drazzib osgi-core-4.3.0/src/org/osgi/service/startlevel/ 0000755 0001750 0001750 00000000000 11527234164 021452 5 ustar drazzib drazzib osgi-core-4.3.0/src/org/osgi/service/startlevel/package-info.java 0000644 0001750 0001750 00000002272 11527234116 024641 0 ustar drazzib drazzib /* * Copyright (c) OSGi Alliance (2010). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Start Level Package Version 1.1. * *
* Deprecated. * This package is deprecated and has been replaced by the * {@code org.osgi.framework.startlevel} package. * *
* Bundles wishing to use this package must list the package in the * Import-Package header of the bundle's manifest. * *
* Example import for consumers using the API in this package: *
* {@code Import-Package: org.osgi.service.startlevel; version="[1.1,2.0)"} * * @version $Id: 6e311e6e404688d5f5f88cde403ca2066de7c20b $ */ package org.osgi.service.startlevel; osgi-core-4.3.0/src/org/osgi/service/startlevel/StartLevel.java 0000644 0001750 0001750 00000027605 11527234116 024411 0 ustar drazzib drazzib /* * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.osgi.service.startlevel; import org.osgi.framework.Bundle; /** * The StartLevel service allows management agents to manage a start level * assigned to each bundle and the active start level of the Framework. There is * at most one StartLevel service present in the OSGi environment. * *
* A start level is defined to be a state of execution in which the Framework * exists. StartLevel values are defined as unsigned integers with 0 (zero) * being the state where the Framework is not launched. Progressively higher * integral values represent progressively higher start levels. e.g. 2 is a * higher start level than 1. *
* Access to the StartLevel service is protected by corresponding * {@code ServicePermission}. In addition {@code AdminPermission} * is required to actually modify start level information. *
* Start Level support in the Framework includes the ability to control the * beginning start level of the Framework, to modify the active start level of * the Framework and to assign a specific start level to a bundle. How the * beginning start level of a Framework is specified is implementation * dependent. It may be a command line argument when invoking the Framework * implementation. *
* When the Framework is first started it must be at start level zero. In this * state, no bundles are running. This is the initial state of the Framework * before it is launched. * * When the Framework is launched, the Framework will enter start level one and * all bundles which are assigned to start level one and whose autostart setting * indicates the bundle should be started are started as described in the * {@code Bundle.start} method. The Framework will continue to increase * the start level, starting bundles at each start level, until the Framework * has reached a beginning start level. At this point the Framework has * completed starting bundles and will then fire a Framework event of type * {@code FrameworkEvent.STARTED} to announce it has completed its * launch. * *
* Within a start level, bundles may be started in an order defined by the * Framework implementation. This may be something like ascending * {@code Bundle.getBundleId} order or an order based upon dependencies * between bundles. A similar but reversed order may be used when stopping * bundles within a start level. * *
* The StartLevel service can be used by management bundles to alter the active
* start level of the framework.
*
* @ThreadSafe
* @noimplement
* @version $Id: bf1b71ed6c9f9d75785b26dccb34362017d93f4a $
* @deprecated This service has been replaced by the
* org.osgi.framework.startlevel
package.
*/
public interface StartLevel {
/**
* Return the active start level value of the Framework.
*
* If the Framework is in the process of changing the start level this
* method must return the active start level if this differs from the
* requested start level.
*
* @return The active start level value of the Framework.
*/
public int getStartLevel();
/**
* Modify the active start level of the Framework.
*
*
* The Framework will move to the requested start level. This method will * return immediately to the caller and the start level change will occur * asynchronously on another thread. * *
* If the specified start level is higher than the active start level, the * Framework will continue to increase the start level until the Framework * has reached the specified start level. * * At each intermediate start level value on the way to and including the * target start level, the Framework must: *
* If the specified start level is lower than the active start level, the * Framework will continue to decrease the start level until the Framework * has reached the specified start level. * * At each intermediate start level value on the way to and including the * specified start level, the framework must: *
* If the specified start level is equal to the active start level, then no * bundles are started or stopped, however, the Framework must fire a * Framework event of type {@code FrameworkEvent.STARTLEVEL_CHANGED} * to announce it has finished moving to the specified start level. This * event may arrive before this method return. * * @param startlevel The requested start level for the Framework. * @throws IllegalArgumentException If the specified start level is less * than or equal to zero. * @throws SecurityException If the caller does not have * {@code AdminPermission[System Bundle,STARTLEVEL]} and the * Java runtime environment supports permissions. */ public void setStartLevel(int startlevel); /** * Return the assigned start level value for the specified Bundle. * * @param bundle The target bundle. * @return The start level value of the specified Bundle. * @throws java.lang.IllegalArgumentException If the specified bundle has * been uninstalled or if the specified bundle was not created by * the same framework instance that registered this * {@code StartLevel} service. */ public int getBundleStartLevel(Bundle bundle); /** * Assign a start level value to the specified Bundle. * *
* The specified bundle will be assigned the specified start level. The * start level value assigned to the bundle will be persistently recorded by * the Framework. *
* If the new start level for the bundle is lower than or equal to the * active start level of the Framework and the bundle's autostart setting * indicates the bundle must be started, the Framework will start the * specified bundle as described in the {@link Bundle#start(int)} method * using the {@link Bundle#START_TRANSIENT} option. The * {@link Bundle#START_ACTIVATION_POLICY} option must also be used if * {@link #isBundleActivationPolicyUsed(Bundle)} returns {@code true} * for the bundle. The actual starting of this bundle must occur * asynchronously. *
* If the new start level for the bundle is higher than the active start * level of the Framework, the Framework will stop the specified bundle as * described in the {@link Bundle#stop(int)} method using the * {@link Bundle#STOP_TRANSIENT} option. The actual stopping of this bundle * must occur asynchronously. * * @param bundle The target bundle. * @param startlevel The new start level for the specified Bundle. * @throws IllegalArgumentException If the specified bundle has been * uninstalled, or if the specified start level is less than or * equal to zero, or if the specified bundle is the system bundle, * or if the specified bundle was not created by the same framework * instance that registered this {@code StartLevel} service. * @throws SecurityException If the caller does not have * {@code AdminPermission[bundle,EXECUTE]} and the Java runtime * environment supports permissions. */ public void setBundleStartLevel(Bundle bundle, int startlevel); /** * Return the initial start level value that is assigned to a Bundle when it * is first installed. * * @return The initial start level value for Bundles. * @see #setInitialBundleStartLevel */ public int getInitialBundleStartLevel(); /** * Set the initial start level value that is assigned to a Bundle when it is * first installed. * *
* The initial bundle start level will be set to the specified start level. * The initial bundle start level value will be persistently recorded by the * Framework. * *
* When a Bundle is installed via {@code BundleContext.installBundle}, * it is assigned the initial bundle start level value. * *
* The default initial bundle start level value is 1 unless this method has * been called to assign a different initial bundle start level value. * *
* This method does not change the start level values of installed bundles. * * @param startlevel The initial start level for newly installed bundles. * @throws IllegalArgumentException If the specified start level is less * than or equal to zero. * @throws SecurityException If the caller does not have * {@code AdminPermission[System Bundle,STARTLEVEL]} and the * Java runtime environment supports permissions. */ public void setInitialBundleStartLevel(int startlevel); /** * Returns whether the specified bundle's autostart setting indicates the * bundle must be started. *
* The autostart setting of a bundle indicates whether the bundle is to be * started when its start level is reached. * * @param bundle The bundle whose autostart setting is to be examined. * @return {@code true} if the autostart setting of the bundle * indicates the bundle is to be started. {@code false} * otherwise. * @throws java.lang.IllegalArgumentException If the specified bundle has * been uninstalled or if the specified bundle was not created by * the same framework instance that registered this * {@code StartLevel} service. * @see Bundle#START_TRANSIENT */ public boolean isBundlePersistentlyStarted(Bundle bundle); /** * Returns whether the specified bundle's autostart setting indicates that * the activation policy declared in the bundle's manifest must be used. *
* The autostart setting of a bundle indicates whether the bundle's declared * activation policy is to be used when the bundle is started. * * @param bundle The bundle whose autostart setting is to be examined. * @return {@code true} if the bundle's autostart setting indicates the * activation policy declared in the manifest must be used. * {@code false} if the bundle must be eagerly activated. * @throws java.lang.IllegalArgumentException If the specified bundle has * been uninstalled or if the specified bundle was not created by * the same framework instance that registered this * {@code StartLevel} service. * @since 1.1 * @see Bundle#START_ACTIVATION_POLICY */ public boolean isBundleActivationPolicyUsed(Bundle bundle); } osgi-core-4.3.0/src/org/osgi/service/startlevel/packageinfo 0000644 0001750 0001750 00000000014 11527234116 023634 0 ustar drazzib drazzib version 1.1 osgi-core-4.3.0/src/org/osgi/service/permissionadmin/ 0000755 0001750 0001750 00000000000 11527234164 022466 5 ustar drazzib drazzib osgi-core-4.3.0/src/org/osgi/service/permissionadmin/package-info.java 0000644 0001750 0001750 00000002065 11527234116 025655 0 ustar drazzib drazzib /* * Copyright (c) OSGi Alliance (2010). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Permission Admin Package Version 1.2. * *
* Bundles wishing to use this package must list the package in the * Import-Package header of the bundle's manifest. * *
* Example import for consumers using the API in this package: *
* {@code Import-Package: org.osgi.service.permissionadmin; version="[1.2,2.0)"} * * @version $Id: 4e7435396ab10ff2d4f5cce1edbffc3b0ccd5e84 $ */ package org.osgi.service.permissionadmin; osgi-core-4.3.0/src/org/osgi/service/permissionadmin/PermissionAdmin.java 0000644 0001750 0001750 00000011130 11527234116 026423 0 ustar drazzib drazzib /* * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.osgi.service.permissionadmin; /** * The Permission Admin service allows management agents to manage the * permissions of bundles. There is at most one Permission Admin service present * in the OSGi environment. *
* Access to the Permission Admin service is protected by corresponding * {@code ServicePermission}. In addition {@code AdminPermission} * is required to actually set permissions. * *
* Bundle permissions are managed using a permission table. A bundle's location * serves as the key into this permission table. The value of a table entry is * the set of permissions (of type {@code PermissionInfo}) granted to * the bundle named by the given location. A bundle may have an entry in the * permission table prior to being installed in the Framework. * *
* The permissions specified in {@code setDefaultPermissions} are used as * the default permissions which are granted to all bundles that do not have an * entry in the permission table. * *
* Any changes to a bundle's permissions in the permission table will take * effect no later than when bundle's * {@code java.security.ProtectionDomain} is next involved in a * permission check, and will be made persistent. * *
* Only permission classes on the system classpath or from an exported package * are considered during a permission check. Additionally, only permission * classes that are subclasses of {@code java.security.Permission} and * define a 2-argument constructor that takes a name string and an * actions string can be used. *
* Permissions implicitly granted by the Framework (for example, a bundle's * permission to access its persistent storage area) cannot be changed, and are * not reflected in the permissions returned by {@code getPermissions} * and {@code getDefaultPermissions}. * * @ThreadSafe * @noimplement * @version $Id: 91132d707097c085fdb3fb7241c9599335427082 $ */ public interface PermissionAdmin { /** * Gets the permissions assigned to the bundle with the specified location. * * @param location The location of the bundle whose permissions are to be * returned. * * @return The permissions assigned to the bundle with the specified * location, or {@code null} if that bundle has not been * assigned any permissions. */ PermissionInfo[] getPermissions(String location); /** * Assigns the specified permissions to the bundle with the specified * location. * * @param location The location of the bundle that will be assigned the * permissions. * @param permissions The permissions to be assigned, or {@code null} * if the specified location is to be removed from the permission * table. * @throws SecurityException If the caller does not have * {@code AllPermission}. */ void setPermissions(String location, PermissionInfo[] permissions); /** * Returns the bundle locations that have permissions assigned to them, that * is, bundle locations for which an entry exists in the permission table. * * @return The locations of bundles that have been assigned any permissions, * or {@code null} if the permission table is empty. */ String[] getLocations(); /** * Gets the default permissions. * *
* These are the permissions granted to any bundle that does not have * permissions assigned to its location. * * @return The default permissions, or {@code null} if no default * permissions are set. */ PermissionInfo[] getDefaultPermissions(); /** * Sets the default permissions. * *
* These are the permissions granted to any bundle that does not have * permissions assigned to its location. * * @param permissions The default permissions, or {@code null} if the * default permissions are to be removed from the permission table. * @throws SecurityException If the caller does not have * {@code AllPermission}. */ void setDefaultPermissions(PermissionInfo[] permissions); } osgi-core-4.3.0/src/org/osgi/service/permissionadmin/packageinfo 0000644 0001750 0001750 00000000014 11527234116 024650 0 ustar drazzib drazzib version 1.2 osgi-core-4.3.0/src/org/osgi/service/permissionadmin/PermissionInfo.java 0000644 0001750 0001750 00000026115 11527234116 026277 0 ustar drazzib drazzib /* * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.osgi.service.permissionadmin; /** * Permission representation used by the Permission Admin service. * *
* This class encapsulates three pieces of information: a Permission type * (class name), which must be a subclass of * {@code java.security.Permission}, and the name and actions * arguments passed to its constructor. * *
* In order for a permission represented by a {@code PermissionInfo} to be * instantiated and considered during a permission check, its Permission class * must be available from the system classpath or an exported package. This * means that the instantiation of a permission represented by a * {@code PermissionInfo} may be delayed until the package containing its * Permission class has been exported by a bundle. * * @Immutable * @version $Id: b9516d07ada162fb8fc750f09e1e3a686189c46b $ */ public class PermissionInfo { private final String type; private final String name; private final String actions; /** * Constructs a {@code PermissionInfo} from the specified type, name, * and actions. * * @param type The fully qualified class name of the permission represented * by this {@code PermissionInfo}. The class must be a subclass * of {@code java.security.Permission} and must define a * 2-argument constructor that takes a name string and an * actions string. * * @param name The permission name that will be passed as the first argument * to the constructor of the {@code Permission} class identified * by {@code type}. * * @param actions The permission actions that will be passed as the second * argument to the constructor of the {@code Permission} class * identified by {@code type}. * * @throws NullPointerException If {@code type} is {@code null}. * @throws IllegalArgumentException If {@code action} is not * {@code null} and {@code name} is {@code null}. */ public PermissionInfo(String type, String name, String actions) { this.type = type; this.name = name; this.actions = actions; if (type == null) { throw new NullPointerException("type is null"); } if ((name == null) && (actions != null)) { throw new IllegalArgumentException("name missing"); } } /** * Constructs a {@code PermissionInfo} object from the specified * encoded {@code PermissionInfo} string. White space in the encoded * {@code PermissionInfo} string is ignored. * * * @param encodedPermission The encoded {@code PermissionInfo}. * @see #getEncoded * @throws IllegalArgumentException If the specified * {@code encodedPermission} is not properly formatted. */ public PermissionInfo(String encodedPermission) { if (encodedPermission == null) { throw new NullPointerException("missing encoded permission"); } if (encodedPermission.length() == 0) { throw new IllegalArgumentException("empty encoded permission"); } String parsedType = null; String parsedName = null; String parsedActions = null; try { char[] encoded = encodedPermission.toCharArray(); int length = encoded.length; int pos = 0; /* skip whitespace */ while (Character.isWhitespace(encoded[pos])) { pos++; } /* the first character must be '(' */ if (encoded[pos] != '(') { throw new IllegalArgumentException("expecting open parenthesis"); } pos++; /* skip whitespace */ while (Character.isWhitespace(encoded[pos])) { pos++; } /* type is not quoted or encoded */ int begin = pos; while (!Character.isWhitespace(encoded[pos]) && (encoded[pos] != ')')) { pos++; } if (pos == begin || encoded[begin] == '"') { throw new IllegalArgumentException("expecting type"); } parsedType = new String(encoded, begin, pos - begin); /* skip whitespace */ while (Character.isWhitespace(encoded[pos])) { pos++; } /* type may be followed by name which is quoted and encoded */ if (encoded[pos] == '"') { pos++; begin = pos; while (encoded[pos] != '"') { if (encoded[pos] == '\\') { pos++; } pos++; } parsedName = unescapeString(encoded, begin, pos); pos++; if (Character.isWhitespace(encoded[pos])) { /* skip whitespace */ while (Character.isWhitespace(encoded[pos])) { pos++; } /* * name may be followed by actions which is quoted and * encoded */ if (encoded[pos] == '"') { pos++; begin = pos; while (encoded[pos] != '"') { if (encoded[pos] == '\\') { pos++; } pos++; } parsedActions = unescapeString(encoded, begin, pos); pos++; /* skip whitespace */ while (Character.isWhitespace(encoded[pos])) { pos++; } } } } /* the final character must be ')' */ char c = encoded[pos]; pos++; while ((pos < length) && Character.isWhitespace(encoded[pos])) { pos++; } if ((c != ')') || (pos != length)) { throw new IllegalArgumentException( "expecting close parenthesis"); } } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException("parsing terminated abruptly"); } type = parsedType; name = parsedName; actions = parsedActions; } /** * Returns the string encoding of this {@code PermissionInfo} in a form * suitable for restoring this {@code PermissionInfo}. * *
* The encoded format is: * *
* (type) ** * or * *
* (type "name") ** * or * *
* (type "name" "actions") ** * where name and actions are strings that must be encoded for * proper parsing. Specifically, the {@code "},{@code \}, * carriage return, and line feed characters must be escaped using * {@code \"}, {@code \\},{@code \r}, and * {@code \n}, respectively. * *
* The encoded string contains no leading or trailing whitespace characters. * A single space character is used between type and * "name" and between "name" and * "actions". * * @return The string encoding of this {@code PermissionInfo}. */ public final String getEncoded() { StringBuffer output = new StringBuffer( 8 + type.length() + ((((name == null) ? 0 : name.length()) + ((actions == null) ? 0 : actions.length())) << 1)); output.append('('); output.append(type); if (name != null) { output.append(" \""); escapeString(name, output); if (actions != null) { output.append("\" \""); escapeString(actions, output); } output.append('\"'); } output.append(')'); return output.toString(); } /** * Returns the string representation of this {@code PermissionInfo}. * The string is created by calling the {@code getEncoded} method on * this {@code PermissionInfo}. * * @return The string representation of this {@code PermissionInfo}. */ public String toString() { return getEncoded(); } /** * Returns the fully qualified class name of the permission represented by * this {@code PermissionInfo}. * * @return The fully qualified class name of the permission represented by * this {@code PermissionInfo}. */ public final String getType() { return type; } /** * Returns the name of the permission represented by this * {@code PermissionInfo}. * * @return The name of the permission represented by this * {@code PermissionInfo}, or {@code null} if the * permission does not have a name. */ public final String getName() { return name; } /** * Returns the actions of the permission represented by this * {@code PermissionInfo}. * * @return The actions of the permission represented by this * {@code PermissionInfo}, or {@code null} if the * permission does not have any actions associated with it. */ public final String getActions() { return actions; } /** * Determines the equality of two {@code PermissionInfo} objects. * * This method checks that specified object has the same type, name and * actions as this {@code PermissionInfo} object. * * @param obj The object to test for equality with this * {@code PermissionInfo} object. * @return {@code true} if {@code obj} is a * {@code PermissionInfo}, and has the same type, name and * actions as this {@code PermissionInfo} object; * {@code false} otherwise. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof PermissionInfo)) { return false; } PermissionInfo other = (PermissionInfo) obj; if (!type.equals(other.type) || ((name == null) ^ (other.name == null)) || ((actions == null) ^ (other.actions == null))) { return false; } if (name != null) { if (actions != null) { return name.equals(other.name) && actions.equals(other.actions); } else { return name.equals(other.name); } } else { return true; } } /** * Returns the hash code value for this object. * * @return A hash code value for this object. */ public int hashCode() { int h = 31 * 17 + type.hashCode(); if (name != null) { h = 31 * h + name.hashCode(); if (actions != null) { h = 31 * h + actions.hashCode(); } } return h; } /** * This escapes the quotes, backslashes, \n, and \r in the string using a * backslash and appends the newly escaped string to a StringBuffer. */ private static void escapeString(String str, StringBuffer output) { int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); switch (c) { case '"' : case '\\' : output.append('\\'); output.append(c); break; case '\r' : output.append("\\r"); break; case '\n' : output.append("\\n"); break; default : output.append(c); break; } } } /** * Takes an encoded character array and decodes it into a new String. */ private static String unescapeString(char[] str, int begin, int end) { StringBuffer output = new StringBuffer(end - begin); for (int i = begin; i < end; i++) { char c = str[i]; if (c == '\\') { i++; if (i < end) { c = str[i]; switch (c) { case '"' : case '\\' : break; case 'r' : c = '\r'; break; case 'n' : c = '\n'; break; default : c = '\\'; i--; break; } } } output.append(c); } return output.toString(); } } osgi-core-4.3.0/src/org/osgi/service/condpermadmin/ 0000755 0001750 0001750 00000000000 11527234164 022105 5 ustar drazzib drazzib osgi-core-4.3.0/src/org/osgi/service/condpermadmin/package-info.java 0000644 0001750 0001750 00000002075 11527234116 025275 0 ustar drazzib drazzib /* * Copyright (c) OSGi Alliance (2010). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Conditional Permission Admin Package Version 1.1. * *
* Bundles wishing to use this package must list the package in the * Import-Package header of the bundle's manifest. * *
* Example import for consumers using the API in this package: *
* {@code Import-Package: org.osgi.service.condpermadmin; version="[1.1,2.0)"} * * @version $Id: cb84fc1342d7f8863ec8eae2dd244843246b2fc1 $ */ package org.osgi.service.condpermadmin; osgi-core-4.3.0/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java 0000644 0001750 0001750 00000025364 11527234116 030244 0 ustar drazzib drazzib /* * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.osgi.service.condpermadmin; import java.security.AccessControlContext; import java.util.Enumeration; import org.osgi.service.permissionadmin.PermissionInfo; /** * Framework service to administer Conditional Permissions. Conditional * Permissions can be added to, retrieved from, and removed from the framework. * Conditional Permissions are conceptually managed in an ordered table called * the Conditional Permission Table. * * @ThreadSafe * @noimplement * @version $Id: 887450b65e453145d57197e2db75db0bb2918ef4 $ */ public interface ConditionalPermissionAdmin { /** * Create a new Conditional Permission Info in the Conditional Permission * Table. *
* The Conditional Permission Info will be given a unique, never reused * name. This entry will be added at the beginning of the Conditional * Permission Table with an access decision of * {@link ConditionalPermissionInfo#ALLOW ALLOW}. *
* Since this method changes the Conditional Permission Table any * {@link ConditionalPermissionUpdate}s that were created prior to calling * this method can no longer be committed. * * @param conditions The conditions that need to be satisfied to enable the * specified permissions. This argument can be {@code null} or * an empty array indicating the specified permissions are not * guarded by any conditions. * @param permissions The permissions that are enabled when the specified * conditions, if any, are satisfied. This argument must not be * {@code null} and must specify at least one permission. * @return The ConditionalPermissionInfo for the specified Conditions and * Permissions. * @throws IllegalArgumentException If no permissions are specified. * @throws SecurityException If the caller does not have * {@code AllPermission}. * @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()} * instead. */ ConditionalPermissionInfo addConditionalPermissionInfo( ConditionInfo conditions[], PermissionInfo permissions[]); /** * Set or create a Conditional Permission Info with a specified name in the * Conditional Permission Table. *
* If the specified name is {@code null}, a new Conditional Permission * Info must be created and will be given a unique, never reused name. If * there is currently no Conditional Permission Info with the specified * name, a new Conditional Permission Info must be created with the * specified name. Otherwise, the Conditional Permission Info with the * specified name must be updated with the specified Conditions and * Permissions. If a new entry was created in the Conditional Permission * Table it will be added at the beginning of the table with an access * decision of {@link ConditionalPermissionInfo#ALLOW ALLOW}. *
* Since this method changes the underlying permission table any * {@link ConditionalPermissionUpdate}s that were created prior to calling * this method can no longer be committed. * * @param name The name of the Conditional Permission Info, or * {@code null}. * @param conditions The conditions that need to be satisfied to enable the * specified permissions. This argument can be {@code null} or * an empty array indicating the specified permissions are not * guarded by any conditions. * @param permissions The permissions that are enabled when the specified * conditions, if any, are satisfied. This argument must not be * {@code null} and must specify at least one permission. * @return The ConditionalPermissionInfo for the specified name, Conditions * and Permissions. * @throws IllegalArgumentException If no permissions are specified. * @throws SecurityException If the caller does not have * {@code AllPermission}. * @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()} * instead. */ ConditionalPermissionInfo setConditionalPermissionInfo(String name, ConditionInfo conditions[], PermissionInfo permissions[]); /** * Returns the Conditional Permission Infos from the Conditional Permission * Table. *
* The returned Enumeration will return elements in the order they are kept * in the Conditional Permission Table. *
* The Enumeration returned is based on a copy of the Conditional Permission
* Table and therefore will not throw exceptions if the Conditional
* Permission Table is changed during the course of reading elements from
* the Enumeration.
*
* @return An enumeration of the Conditional Permission Infos that are
* currently in the Conditional Permission Table.
* @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()}
* instead.
*/
Enumeration
*
* @param signers The signers for which to return an Access Control Context.
* @return An {@code AccessControlContext} that has the Permissions
* associated with the signer.
*/
AccessControlContext getAccessControlContext(String[] signers);
/**
* Creates a new update for the Conditional Permission Table. The update is
* a working copy of the current Conditional Permission Table. If the
* running Conditional Permission Table is modified before commit is called
* on the returned update, then the call to commit on the returned update
* will fail. That is, the commit method will return false and no change
* will be made to the running Conditional Permission Table. There is no
* requirement that commit is eventually called on the returned update.
*
* @return A new update for the Conditional Permission Table.
* @since 1.1
*/
ConditionalPermissionUpdate newConditionalPermissionUpdate();
/**
* Creates a new ConditionalPermissionInfo with the specified fields
* suitable for insertion into a {@link ConditionalPermissionUpdate}. The
* {@code delete} method on {@code ConditionalPermissionInfo}
* objects created with this method must throw
* UnsupportedOperationException.
*
* @param name The name of the created
* {@code ConditionalPermissionInfo} or {@code null} to
* have a unique name generated when the returned
* {@code ConditionalPermissionInfo} is committed in an update
* to the Conditional Permission Table.
* @param conditions The conditions that need to be satisfied to enable the
* specified permissions. This argument can be {@code null} or
* an empty array indicating the specified permissions are not
* guarded by any conditions.
* @param permissions The permissions that are enabled when the specified
* conditions, if any, are satisfied. This argument must not be
* {@code null} and must specify at least one permission.
* @param access Access decision. Must be one of the following values:
*
*
* The specified access decision value must be evaluated case
* insensitively.
* @return A {@code ConditionalPermissionInfo} object suitable for
* insertion into a {@link ConditionalPermissionUpdate}.
* @throws IllegalArgumentException If no permissions are specified or if
* the specified access decision is not a valid value.
* @since 1.1
*/
ConditionalPermissionInfo newConditionalPermissionInfo(String name,
ConditionInfo conditions[], PermissionInfo permissions[],
String access);
/**
* Creates a new {@code ConditionalPermissionInfo} from the specified
* encoded {@code ConditionalPermissionInfo} string suitable for
* insertion into a {@link ConditionalPermissionUpdate}. The
* {@code delete} method on {@code ConditionalPermissionInfo}
* objects created with this method must throw
* UnsupportedOperationException.
*
* @param encodedConditionalPermissionInfo The encoded
* {@code ConditionalPermissionInfo}. White space in the encoded
* {@code ConditionalPermissionInfo} is ignored. The access
* decision value in the encoded
* {@code ConditionalPermissionInfo} must be evaluated case
* insensitively. If the encoded
* {@code ConditionalPermissionInfo} does not contain the
* optional name, {@code null} must be used for the name and a
* unique name will be generated when the returned
* {@code ConditionalPermissionInfo} is committed in an update
* to the Conditional Permission Table.
* @return A {@code ConditionalPermissionInfo} object suitable for
* insertion into a {@link ConditionalPermissionUpdate}.
* @throws IllegalArgumentException If the specified
* {@code encodedConditionalPermissionInfo} is not properly
* formatted.
* @see ConditionalPermissionInfo#getEncoded
* @since 1.1
*/
ConditionalPermissionInfo newConditionalPermissionInfo(
String encodedConditionalPermissionInfo);
}
osgi-core-4.3.0/src/org/osgi/service/condpermadmin/Condition.java 0000644 0001750 0001750 00000011734 11527234116 024701 0 ustar drazzib drazzib /*
* Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.osgi.service.condpermadmin;
import java.util.Dictionary;
/**
* The interface implemented by a Condition. Conditions are bound to Permissions
* using Conditional Permission Info. The Permissions of a ConditionalPermission
* Info can only be used if the associated Conditions are satisfied.
*
* @ThreadSafe
* @version $Id: 7e80cf578718db713c347568e7d3232010beac0a $
*/
public interface Condition {
/**
* A Condition object that will always evaluate to true and that is never
* postponed.
*/
public final static Condition TRUE = new BooleanCondition(true);
/**
* A Condition object that will always evaluate to false and that is never
* postponed.
*/
public final static Condition FALSE = new BooleanCondition(false);
/**
* Returns whether the evaluation must be postponed until the end of the
* permission check. If this method returns {@code false} (or this
* Condition is immutable), then this Condition must be able to directly
* answer the {@link #isSatisfied()} method. In other words, isSatisfied()
* will return very quickly since no external sources, such as for example
* users or networks, need to be consulted.
* This method must always return the same value whenever it is called so
* that the Conditional Permission Admin can cache its result.
*
* @return {@code true} to indicate the evaluation must be postponed.
* Otherwise, {@code false} if the evaluation can be performed
* immediately.
*/
boolean isPostponed();
/**
* Returns whether the Condition is satisfied. This method is only called
* for immediate Condition objects or immutable postponed conditions, and
* must always be called inside a permission check. Mutable postponed
* Condition objects will be called with the grouped version
* {@link #isSatisfied(Condition[],Dictionary)} at the end of the permission
* check.
*
* @return {@code true} to indicate the Conditions is satisfied.
* Otherwise, {@code false} if the Condition is not satisfied.
*/
boolean isSatisfied();
/**
* Returns whether the Condition is mutable. A Condition can go from mutable
* ({@code true}) to immutable ({@code false}) over time but never
* from immutable ({@code false}) to mutable ({@code true}).
*
* @return {@code true} {@link #isSatisfied()} can change. Otherwise,
* {@code false} if the value returned by
* {@link #isSatisfied()} will not change for this condition.
*/
boolean isMutable();
/**
* Returns whether the specified set of Condition objects are satisfied.
* Although this method is not static, it must be implemented as if it
* were static. All of the passed Condition objects will be of the same
* type and will correspond to the class type of the object on which this
* method is invoked. This method must be called inside a permission check
* only.
*
* @param conditions The array of Condition objects, which must all be of
* the same class and mutable. The receiver must be one of those
* Condition objects.
* @param context A Dictionary object that implementors can use to track
* state. If this method is invoked multiple times in the same
* permission check, the same Dictionary will be passed multiple
* times. The SecurityManager treats this Dictionary as an opaque
* object and simply creates an empty dictionary and passes it to
* subsequent invocations if multiple invocations are needed.
* @return {@code true} if all the Condition objects are satisfied.
* Otherwise, {@code false} if one of the Condition objects is
* not satisfied.
*/
boolean isSatisfied(Condition conditions[],
Dictionary