diff -Nru osgi-compendium-4.2.0/about.html osgi-compendium-4.3.0/about.html --- osgi-compendium-4.2.0/about.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/about.html 2010-06-15 15:44:10.000000000 +0000 @@ -8,7 +8,7 @@

About This Content

Copyright

-

Copyright © OSGi Alliance (2000, 2009). All Rights Reserved.

+

Copyright © OSGi Alliance (2000, 2011). All Rights Reserved.

OSGi Alliance
Bishop Ranch 6
diff -Nru osgi-compendium-4.2.0/debian/changelog osgi-compendium-4.3.0/debian/changelog --- osgi-compendium-4.2.0/debian/changelog 2011-10-03 18:21:14.000000000 +0000 +++ osgi-compendium-4.3.0/debian/changelog 2011-11-09 19:43:15.000000000 +0000 @@ -1,3 +1,11 @@ +osgi-compendium (4.3.0-1) unstable; urgency=low + + * New upstream release. + * Add Build-Depends on libgeronimo-jpa-2.0-spec-java. + * d/watch: Use new bndtools project on github. + + -- Damien Raude-Morvan Wed, 09 Nov 2011 20:42:22 +0100 + osgi-compendium (4.2.0-1) unstable; urgency=low * Initial release. (Closes: #643979). diff -Nru osgi-compendium-4.2.0/debian/control osgi-compendium-4.3.0/debian/control --- osgi-compendium-4.2.0/debian/control 2011-10-03 18:21:14.000000000 +0000 +++ osgi-compendium-4.3.0/debian/control 2011-11-09 19:43:15.000000000 +0000 @@ -11,6 +11,7 @@ libosgi-core-java, libosgi-foundation-ee-java, libservlet2.5-java, + libgeronimo-jpa-2.0-spec-java, maven-repo-helper Standards-Version: 3.9.2 Homepage: http://www.osgi.org/Specifications/HomePage diff -Nru osgi-compendium-4.2.0/debian/copyright osgi-compendium-4.3.0/debian/copyright --- osgi-compendium-4.2.0/debian/copyright 2011-10-03 18:21:14.000000000 +0000 +++ osgi-compendium-4.3.0/debian/copyright 2011-11-09 19:43:15.000000000 +0000 @@ -1,7 +1,7 @@ Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174 Upstream-Name: OSGi Compendium Classes Upstream-Contact: OSGi Alliance (http://www.osgi.org/) -Source: http://www.osgi.org/Download/Release4V42 +Source: http://www.osgi.org/Download/Release4V43 Files: * Copyright: Copyright (c) OSGi Alliance (2000, 2009) diff -Nru osgi-compendium-4.2.0/debian/orig-tar.sh osgi-compendium-4.3.0/debian/orig-tar.sh --- osgi-compendium-4.2.0/debian/orig-tar.sh 2011-10-03 18:21:14.000000000 +0000 +++ osgi-compendium-4.3.0/debian/orig-tar.sh 2011-11-09 19:43:15.000000000 +0000 @@ -6,7 +6,8 @@ DIR=osgi-compendium-$VERSION TAG=42 -wget -O osgi.compendium.jar http://www.osgi.org/download/r4v$TAG/osgi.cmpn.jar +wget -O osgi.compendium.jar --no-check-certificate https://github.com/bndtools/bnd/raw/master/cnf/repo/osgi.cmpn/osgi.cmpn-4.3.0.jar +# http://www.osgi.org/download/r4v$TAG/osgi.cmpn.jar mkdir -p $DIR/src/ (cd $DIR && jar xvf ../osgi.compendium.jar) diff -Nru osgi-compendium-4.2.0/debian/pom.xml osgi-compendium-4.3.0/debian/pom.xml --- osgi-compendium-4.2.0/debian/pom.xml 2011-10-03 18:21:14.000000000 +0000 +++ osgi-compendium-4.3.0/debian/pom.xml 2011-11-09 19:43:15.000000000 +0000 @@ -4,6 +4,6 @@ 4.0.0 org.osgi org.osgi.compendium - 4.2.0 + 4.3.0 POM was created by Sonatype Nexus diff -Nru osgi-compendium-4.2.0/debian/rules osgi-compendium-4.3.0/debian/rules --- osgi-compendium-4.2.0/debian/rules 2011-10-03 18:21:14.000000000 +0000 +++ osgi-compendium-4.3.0/debian/rules 2011-11-09 19:43:15.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/make -f export JAVA_HOME := /usr/lib/jvm/default-java -export CLASSPATH := /usr/share/java/osgi.core.jar:/usr/share/java/servlet-api-2.5.jar:/usr/share/java/ee.foundation.jar +export CLASSPATH := /usr/share/java/osgi.core.jar:/usr/share/java/servlet-api-2.5.jar:/usr/share/java/ee.foundation.jar:/usr/share/java/geronimo-jpa-2.0-spec.jar MAVEN_REPO := http://repo1.maven.org/maven2/org/osgi/org.osgi.compendium VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p' | sed -e 's/-[^-]*$$//') diff -Nru osgi-compendium-4.2.0/debian/watch osgi-compendium-4.3.0/debian/watch --- osgi-compendium-4.2.0/debian/watch 2011-10-03 18:21:14.000000000 +0000 +++ osgi-compendium-4.3.0/debian/watch 2011-11-09 19:43:15.000000000 +0000 @@ -1,4 +1,4 @@ version=3 opts="uversionmangle=s/-(alpha|beta)-/~$1/" \ - https://github.com/bnd/bnd/tree/master/cnf/repo/osgi.cmpn/ \ - .*/osgi.cmpn-(.*).jar debian debian/orig-tar.sh \ No newline at end of file + https://github.com/bndtools/bnd/tree/master/cnf/repo/osgi.cmpn/ \ + .*/osgi.cmpn-(.*).jar debian debian/orig-tar.sh diff -Nru osgi-compendium-4.2.0/src/bnd.bnd osgi-compendium-4.3.0/src/bnd.bnd --- osgi-compendium-4.2.0/src/bnd.bnd 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/bnd.bnd 2011-09-08 14:54:02.000000000 +0000 @@ -1,10 +1,5 @@ -#Generated by BND, at Mon Aug 31 18:45:48 EDT 2009 -#Mon Aug 31 18:45:48 EDT 2009 --sub= -Bundle-Description=OSGi Service Platform Release ${version;\=;${cmpn.release.version}} Version ${version;\=\=;${cmpn.release.version}}, Compendium Interfaces and Classes for use in compiling bundles. -Import-Package=*; resolution\:\=optional -Export-Package=${cmpn.packages} -Bundle-Version=4.2.0.200908310645 -DynamicImport-Package=* -project.dir=/home/osgi/build/r4v42-core-cmpn-final/osgi.companion -Include-Resource=${cmpn.resources} +#Generated by BND, at Thu Sep 08 16:54:03 CEST 2011 +#Thu Sep 08 16:54:03 CEST 2011 +Bundle-Version=4.3.0.201109081654 +Service-Component= +project.dir=/Ws/osgi/build/osgi.cmpn diff -Nru osgi-compendium-4.2.0/src/info/dmtree/Acl.java osgi-compendium-4.3.0/src/info/dmtree/Acl.java --- osgi-compendium-4.2.0/src/info/dmtree/Acl.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/info/dmtree/Acl.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -22,20 +22,20 @@ import java.util.Vector; /** - * Acl is an immutable class representing structured access to DMT + * {@code Acl} is an immutable class representing structured access to DMT * ACLs. Under OMA DM the ACLs are defined as strings with an internal syntax. *

* The methods of this class taking a principal as parameter accept remote * server IDs (as passed to {@link DmtAdmin#getSession(String, String, int) - * DmtAdmin.getSession}), as well as " * " indicating any + * DmtAdmin.getSession}), as well as " {@code *} " indicating any * principal. *

* The syntax for valid remote server IDs:
* <server-identifier> ::= All printable characters except - * '=', '&', '*', '+' or white-space + * {@code '='}, {@code '&'}, {@code '*'}, {@code '+'} or white-space * characters. * - * @version $Revision: 5673 $ + * @version $Id: 13eb07de6924756e573ff2eb72db6b66e4e53cc7 $ */ public final class Acl { @@ -103,7 +103,7 @@ * Create an instance of the ACL from its canonic string representation. * * @param acl The string representation of the ACL as defined in OMA DM. If - * null or empty then it represents an empty list of + * {@code null} or empty then it represents an empty list of * principals with no permissions. * @throws IllegalArgumentException if acl is not a valid OMA DM ACL string */ @@ -159,7 +159,7 @@ /** * Creates an instance with a specified list of principals and the * permissions they hold. The two arrays run in parallel, that is - * principals[i] will hold permissions[i] in + * {@code principals[i]} will hold {@code permissions[i]} in * the ACL. *

* A principal name may not appear multiple times in the 'principals' @@ -171,7 +171,7 @@ * @param permissions The array of permissions * @throws IllegalArgumentException if the length of the two arrays are not * the same, if any array element is invalid, or if a principal - * appears multiple times in the principals array + * appears multiple times in the {@code principals} array */ public Acl(String[] principals, int[] permissions) { if (principals.length != permissions.length) @@ -207,19 +207,19 @@ // ----- Private constructors -----// /** - * Creates an instance identical to the base ACL except for - * the permissions of the given principal, which are - * overwritten with the given permissions. + * Creates an instance identical to the {@code base} ACL except for + * the permissions of the given {@code principal}, which are + * overwritten with the given {@code permissions}. *

* Assumes that the permissions parameter has been checked. All - * modifications of an Acl (add, delete, set) are done + * modifications of an {@code Acl} (add, delete, set) are done * through this method. * * @param base The ACL that provides all permissions except for permissions * of the given principal. * @param principal The entity to which permission should be granted. * @param permissions The set of permissions to be given. The parameter can - * be a logical or of the permission constants defined + * be a logical {@code or} of the permission constants defined * in this class. */ private Acl(Acl base, String principal, int permissions) { @@ -254,12 +254,12 @@ // ----- Public methods -----// /** - * Checks whether the given object is equal to this Acl - * instance. Two Acl instances are equal if they allow the + * Checks whether the given object is equal to this {@code Acl} + * instance. Two {@code Acl} instances are equal if they allow the * same set of permissions for the same set of principals. * - * @param obj the object to compare with this Acl instance - * @return true if the parameter represents the same ACL as + * @param obj the object to compare with this {@code Acl} instance + * @return {@code true} if the parameter represents the same ACL as * this instance */ public boolean equals(Object obj) { @@ -285,31 +285,41 @@ } /** - * Returns the hash code for this ACL instance. If two Acl + * Returns the hash code for this ACL instance. If two {@code Acl} * instances are equal according to the {@link #equals} method, then calling * this method on each of them must produce the same integer result. * * @return hash code for this ACL */ - public int hashcode() { + public int hashCode() { // Using the hash code of the canonical string representation, because // the principalPermissions set is not canonical (see above). return toString().hashCode(); } + /** + * Use {@link #hashCode()} instead. + * + * @return Result of {@link #hashCode()} + * @deprecated Use correct method {@link #hashCode()}; + */ + public int hashcode() { + return hashCode(); + } + /** - * Create a new Acl instance from this Acl with + * Create a new {@code Acl} instance from this {@code Acl} with * the given permission added for the given principal. The already existing * permissions of the principal are not affected. * * @param principal The entity to which permissions should be granted, or * "*" to grant permissions to all principals. * @param permissions The permissions to be given. The parameter can be a - * logical or of more permission constants defined in + * logical {@code or} of more permission constants defined in * this class. - * @return a new Acl instance - * @throws IllegalArgumentException if principal is not a - * valid principal name or if permissions is not a + * @return a new {@code Acl} instance + * @throws IllegalArgumentException if {@code principal} is not a + * valid principal name or if {@code permissions} is not a * valid combination of the permission constants defined in this * class */ @@ -321,7 +331,7 @@ } /** - * Create a new Acl instance from this Acl with + * Create a new {@code Acl} instance from this {@code Acl} with * the given permission revoked from the given principal. Other permissions * of the principal are not affected. *

@@ -331,11 +341,11 @@ * @param principal The entity from which permissions should be revoked, or * "*" to revoke permissions from all principals. * @param permissions The permissions to be revoked. The parameter can be a - * logical or of more permission constants defined in + * logical {@code or} of more permission constants defined in * this class. - * @return a new Acl instance - * @throws IllegalArgumentException if principal is not a - * valid principal name, if permissions is not a + * @return a new {@code Acl} instance + * @throws IllegalArgumentException if {@code principal} is not a + * valid principal name, if {@code permissions} is not a * valid combination of the permission constants defined in this * class, or if a globally granted permission would have been * revoked from a specific principal @@ -354,9 +364,9 @@ * to query the permissions that are granted globally, to all * principals * @return The permissions of the given principal. The returned - * int is a bitmask of the permission constants defined + * {@code int} is a bitmask of the permission constants defined * in this class - * @throws IllegalArgumentException if principal is not a + * @throws IllegalArgumentException if {@code principal} is not a * valid principal name */ public synchronized int getPermissions(String principal) { @@ -375,14 +385,14 @@ /** * Check whether the given permissions are granted to a certain principal. * The requested permissions are specified as a bitfield, for example - * (Acl.ADD | Acl.DELETE | Acl.GET). + * {@code (Acl.ADD | Acl.DELETE | Acl.GET)}. * * @param principal The entity to check, or "*" to check whether * the given permissions are granted to all principals globally * @param permissions The permissions to check - * @return true if the principal holds all the given permissions - * @throws IllegalArgumentException if principal is not a - * valid principal name or if permissions is not a + * @return {@code true} if the principal holds all the given permissions + * @throws IllegalArgumentException if {@code principal} is not a + * valid principal name or if {@code permissions} is not a * valid combination of the permission constants defined in this * class */ @@ -394,7 +404,7 @@ } /** - * Create a new Acl instance from this Acl where + * Create a new {@code Acl} instance from this {@code Acl} where * all permissions for the given principal are overwritten with the given * permissions. *

@@ -406,9 +416,9 @@ * "*" to globally grant permissions to all principals. * @param permissions The set of permissions to be given. The parameter is * a bitmask of the permission constants defined in this class. - * @return a new Acl instance - * @throws IllegalArgumentException if principal is not a - * valid principal name, if permissions is not a + * @return a new {@code Acl} instance + * @throws IllegalArgumentException if {@code principal} is not a + * valid principal name, if {@code permissions} is not a * valid combination of the permission constants defined in this * class, or if a globally granted permission would have been * revoked from a specific principal diff -Nru osgi-compendium-4.2.0/src/info/dmtree/DmtAdmin.java osgi-compendium-4.3.0/src/info/dmtree/DmtAdmin.java --- osgi-compendium-4.2.0/src/info/dmtree/DmtAdmin.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/info/dmtree/DmtAdmin.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -17,11 +17,11 @@ /** * An interface providing methods to open sessions and register listeners. The - * implementation of DmtAdmin should register itself in the OSGi - * service registry as a service. DmtAdmin is the entry point for + * implementation of {@code DmtAdmin} should register itself in the OSGi + * service registry as a service. {@code DmtAdmin} is the entry point for * applications to use the DMT API. *

- * The getSession methods are used to open a session on a specified + * The {@code getSession} methods are used to open a session on a specified * subtree of the DMT. A typical way of usage: * *

@@ -44,152 +44,152 @@
  * management tree must support read operations on their nodes, while support
  * for write operations depends on the Management Object. Management Objects
  * supporting write access may support transactional write, non-transactional
- * write or both. Users of DmtAdmin should consult the Management
+ * write or both. Users of {@code DmtAdmin} should consult the Management
  * Object specification and implementation for the supported update modes. If
  * Management Object definition permits, implementations are encouraged to
  * support both update modes.
  * 

* This interface also contains methods for manipulating the set of - * DmtEventListener objects that are called when the structure or + * {@code DmtEventListener} objects that are called when the structure or * content of the tree is changed. These methods are not needed in an OSGi * environment, clients should register listeners through the Event Admin * service. * - * @version $Revision: 5673 $ + * @version $Id: d34854b75471e0738ef0458a6cf154f0bd3a581d $ */ public interface DmtAdmin { /** - * Opens a DmtSession for local usage on a given subtree of + * Opens a {@code DmtSession} for local usage on a given subtree of * the DMT with non transactional write lock. This call is equivalent to the * following: - * getSession(null, subtreeUri, DmtSession.LOCK_TYPE_EXCLUSIVE) + * {@code getSession(null, subtreeUri, DmtSession.LOCK_TYPE_EXCLUSIVE)} *

- * The subtreeUri parameter must contain an absolute URI. It - * can also be null, in this case the session is opened with + * The {@code subtreeUri} parameter must contain an absolute URI. It + * can also be {@code null}, in this case the session is opened with * the default session root, ".", that gives access to the whole * tree. *

- * To perform this operation the caller must have DmtPermission - * for the subtreeUri node with the Get action present. + * To perform this operation the caller must have {@code DmtPermission} + * for the {@code subtreeUri} node with the Get action present. * * @param subtreeUri the subtree on which DMT manipulations can be performed * within the returned session - * @return a DmtSession object for the requested subtree + * @return a {@code DmtSession} object for the requested subtree * @throws DmtException with the following possible error codes: *

* @throws SecurityException if the caller does not have - * DmtPermission for the given root node with the Get + * {@code DmtPermission} for the given root node with the Get * action present */ DmtSession getSession(String subtreeUri) throws DmtException; /** - * Opens a DmtSession for local usage on a specific DMT + * Opens a {@code DmtSession} for local usage on a specific DMT * subtree with a given lock mode. This call is equivalent to the - * following: getSession(null, subtreeUri, lockMode) + * following: {@code getSession(null, subtreeUri, lockMode)} *

- * The subtreeUri parameter must contain an absolute URI. It - * can also be null, in this case the session is opened with + * The {@code subtreeUri} parameter must contain an absolute URI. It + * can also be {@code null}, in this case the session is opened with * the default session root, ".", that gives access to the whole * tree. *

- * To perform this operation the caller must have DmtPermission - * for the subtreeUri node with the Get action present. + * To perform this operation the caller must have {@code DmtPermission} + * for the {@code subtreeUri} node with the Get action present. * * @param subtreeUri the subtree on which DMT manipulations can be performed * within the returned session * @param lockMode one of the lock modes specified in - * DmtSession - * @return a DmtSession object for the requested subtree + * {@code DmtSession} + * @return a {@code DmtSession} object for the requested subtree * @throws DmtException with the following possible error codes: *

* @throws SecurityException if the caller does not have - * DmtPermission for the given root node with the Get + * {@code DmtPermission} for the given root node with the Get * action present */ DmtSession getSession(String subtreeUri, int lockMode) throws DmtException; /** - * Opens a DmtSession on a specific DMT subtree using a + * Opens a {@code DmtSession} on a specific DMT subtree using a * specific lock mode on behalf of a remote principal. If local management * applications are using this method then they should provide - * null as the first parameter. Alternatively they can use + * {@code null} as the first parameter. Alternatively they can use * other forms of this method without providing a principal string. *

- * The subtreeUri parameter must contain an absolute URI. It - * can also be null, in this case the session is opened with + * The {@code subtreeUri} parameter must contain an absolute URI. It + * can also be {@code null}, in this case the session is opened with * the default session root, ".", that gives access to the whole * tree. *

- * This method is guarded by DmtPrincipalPermission in case of + * This method is guarded by {@code DmtPrincipalPermission} in case of * remote sessions. In addition, the caller must have Get access rights - * (ACL in case of remote sessions, DmtPermission in case of - * local sessions) on the subtreeUri node to perform this + * (ACL in case of remote sessions, {@code DmtPermission} in case of + * local sessions) on the {@code subtreeUri} node to perform this * operation. * * @param principal the identifier of the remote server on whose behalf the - * data manipulation is performed, or null for local + * data manipulation is performed, or {@code null} for local * sessions * @param subtreeUri the subtree on which DMT manipulations can be performed * within the returned session * @param lockMode one of the lock modes specified in - * DmtSession - * @return a DmtSession object for the requested subtree + * {@code DmtSession} + * @return a {@code DmtSession} object for the requested subtree * @throws DmtException with the following possible error codes: *

* @throws SecurityException in case of remote sessions, if the caller does - * not have the required DmtPrincipalPermission with a - * target matching the principal parameter, or in case + * not have the required {@code DmtPrincipalPermission} with a + * target matching the {@code principal} parameter, or in case * of local sessions, if the caller does not have - * DmtPermission for the given root node with the Get + * {@code DmtPermission} for the given root node with the Get * action present */ DmtSession getSession(String principal, String subtreeUri, int lockMode) @@ -202,7 +202,7 @@ * delivered to the registered listener if at least one affected node is * within this subtree. The events can also be filtered by specifying a * bitmask of relevant event types (e.g. - * DmtEvent.ADDED | DmtEvent.REPLACED | DmtEvent.SESSION_CLOSED). + * {@code DmtEvent.ADDED | DmtEvent.REPLACED | DmtEvent.SESSION_CLOSED}). * Only event types included in the bitmask will be delivered to the * listener. *

@@ -210,21 +210,21 @@ * which the registering application has the appropriate GET * {@link info.dmtree.security.DmtPermission}. *

- * If the specified listener was already registered, calling + * If the specified {@code listener} was already registered, calling * this method will update the registration. * * @param type a bitmask of event types the caller is interested in * @param uri the URI of the root node of a subtree, must not be - * null + * {@code null} * @param listener the listener to be registered, must not be - * null + * {@code null} * @throws SecurityException if the caller doesn't have the necessary GET - * DmtPermission for the given URI - * @throws NullPointerException if the uri or - * listener parameter is null - * @throws IllegalArgumentException if the type parameter + * {@code DmtPermission} for the given URI + * @throws NullPointerException if the {@code uri} or + * {@code listener} parameter is {@code null} + * @throws IllegalArgumentException if the {@code type} parameter * contains invalid bits (not corresponding to any event type - * defined in DmtEvent), or if the uri + * defined in {@code DmtEvent}), or if the {@code uri} * parameter is invalid (is not an absolute URI or is syntactically * incorrect) */ @@ -237,32 +237,32 @@ * delivered to the registered listener if at least one affected node is * within this subtree. The events can also be filtered by specifying a * bitmask of relevant event types (e.g. - * DmtEvent.ADDED | DmtEvent.REPLACED | DmtEvent.SESSION_CLOSED). + * {@code DmtEvent.ADDED | DmtEvent.REPLACED | DmtEvent.SESSION_CLOSED}). * Only event types included in the bitmask will be delivered to the * listener. *

* The listener will only receive the change notifications of nodes for * which the node ACL grants GET access to the specified principal. *

- * If the specified listener was already registered, calling + * If the specified {@code listener} was already registered, calling * this method will update the registration. * * @param principal the management server identity the caller is acting on - * behalf of, must not be null + * behalf of, must not be {@code null} * @param type a bitmask of event types the caller is interested in * @param uri the URI of the root node of a subtree, must not be - * null + * {@code null} * @param listener the listener to be registered, must not be - * null + * {@code null} * @throws SecurityException if the caller doesn't have the necessary - * DmtPrincipalPermission to use the specified + * {@code DmtPrincipalPermission} to use the specified * principal - * @throws NullPointerException if the principal, - * uri or listener parameter is - * null - * @throws IllegalArgumentException if the type parameter + * @throws NullPointerException if the {@code principal}, + * {@code uri} or {@code listener} parameter is + * {@code null} + * @throws IllegalArgumentException if the {@code type} parameter * contains invalid bits (not corresponding to any event type - * defined in DmtEvent), or if the uri + * defined in {@code DmtEvent}), or if the {@code uri} * parameter is invalid (is not an absolute URI or is syntactically * incorrect) */ @@ -274,9 +274,9 @@ * will not receive change notifications. * * @param listener the listener to be unregistered, must not be - * null - * @throws NullPointerException if the listener parameter is - * null + * {@code null} + * @throws NullPointerException if the {@code listener} parameter is + * {@code null} */ void removeEventListener(DmtEventListener listener); } diff -Nru osgi-compendium-4.2.0/src/info/dmtree/DmtData.java osgi-compendium-4.3.0/src/info/dmtree/DmtData.java --- osgi-compendium-4.2.0/src/info/dmtree/DmtData.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/info/dmtree/DmtData.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -26,73 +26,73 @@ * An immutable data structure representing the contents of a leaf or interior * node. This structure represents only the value and the format property of the * node, all other properties (like MIME type) can be set and read using the - * DmtSession interface. + * {@code DmtSession} interface. *

* Different constructors are available to create nodes with different formats. - * Nodes of null format can be created using the static + * Nodes of {@code null} format can be created using the static * {@link #NULL_VALUE} constant instance of this class. *

* {@link #FORMAT_RAW_BINARY} and {@link #FORMAT_RAW_STRING} enable the support * of future data formats. When using these formats, the actual format name is - * specified as a String. The application is responsible for the + * specified as a {@code String}. The application is responsible for the * proper encoding of the data according to the specified format. * - * @version $Revision: 5673 $ + * @version $Id: 6c2015a5ae3d771d4d09128428373b61fe832523 $ */ public final class DmtData { /** - * The node holds an OMA DM int value. + * The node holds an OMA DM {@code int} value. */ public static final int FORMAT_INTEGER = 0x0001; /** - * The node holds an OMA DM float value. + * The node holds an OMA DM {@code float} value. */ public static final int FORMAT_FLOAT = 0x0002; /** - * The node holds an OMA DM chr value. + * The node holds an OMA DM {@code chr} value. */ public static final int FORMAT_STRING = 0x0004; /** - * The node holds an OMA DM bool value. + * The node holds an OMA DM {@code bool} value. */ public static final int FORMAT_BOOLEAN = 0x0008; /** - * The node holds an OMA DM date value. + * The node holds an OMA DM {@code date} value. */ public static final int FORMAT_DATE = 0x0010; /** - * The node holds an OMA DM time value. + * The node holds an OMA DM {@code time} value. */ public static final int FORMAT_TIME = 0x0020; /** - * The node holds an OMA DM bin value. The value of the node - * corresponds to the Java byte[] type. + * The node holds an OMA DM {@code bin} value. The value of the node + * corresponds to the Java {@code byte[]} type. */ public static final int FORMAT_BINARY = 0x0040; /** - * The node holds an OMA DM b64 value. Like + * The node holds an OMA DM {@code b64} value. Like * {@link #FORMAT_BINARY}, this format is also represented by the Java - * byte[] type, the difference is only in the corresponding + * {@code byte[]} type, the difference is only in the corresponding * OMA DM format. */ public static final int FORMAT_BASE64 = 0x0080; /** - * The node holds an OMA DM xml value. + * The node holds an OMA DM {@code xml} value. */ public static final int FORMAT_XML = 0x0100; /** - * The node holds an OMA DM null value. This corresponds to - * the Java null type. + * The node holds an OMA DM {@code null} value. This corresponds to + * the Java {@code null} type. */ public static final int FORMAT_NULL = 0x0200; @@ -107,7 +107,7 @@ public static final int FORMAT_NODE = 0x0400; /** - * The node holds raw protocol data encoded as String. The + * The node holds raw protocol data encoded as {@code String}. The * {@link #getFormatName()} method can be used to get the actual format * name. */ @@ -138,7 +138,7 @@ } /** - * Constant instance representing a leaf node of null format. + * Constant instance representing a leaf node of {@code null} format. */ public static final DmtData NULL_VALUE = new DmtData(); // FORMAT_NAMES must be initialized by the time the constr. is called @@ -160,7 +160,7 @@ private final Object complex; /** - * Create a DmtData instance of null format. + * Create a {@code DmtData} instance of {@code null} format. * This constructor is private and used only to create the public * {@link #NULL_VALUE} constant. */ @@ -177,8 +177,8 @@ } /** - * Create a DmtData instance of chr format - * with the given string value. The null string argument is + * Create a {@code DmtData} instance of {@code chr} format + * with the given string value. The {@code null} string argument is * valid. * * @param str the string value to set @@ -196,7 +196,7 @@ } /** - * Create a DmtData instance of node format + * Create a {@code DmtData} instance of {@code node} format * with the given object value. The value represents complex data associated * with an interior node. *

@@ -204,7 +204,7 @@ * complex values, making it simpler to retrieve or update all leaf nodes in * a subtree. *

- * The given value must be a non-null immutable object. + * The given value must be a non-{@code null} immutable object. * * @param complex the complex data object to set */ @@ -224,7 +224,7 @@ } /** - * Create a DmtData instance of the specified format and set + * Create a {@code DmtData} instance of the specified format and set * its value based on the given string. Only the following string-based * formats can be created using this constructor: *

- * The null string argument is only valid if the format is + * The {@code null} string argument is only valid if the format is * string or XML. * * @param value the string, XML, date or time value to set - * @param format the format of the DmtData instance to be + * @param format the format of the {@code DmtData} instance to be * created, must be one of the formats specified above - * @throws IllegalArgumentException if format is not one of - * the allowed formats, or value is not a valid + * @throws IllegalArgumentException if {@code format} is not one of + * the allowed formats, or {@code value} is not a valid * string for the given format * @throws NullPointerException if a date or time is constructed and - * value is null + * {@code value} is {@code null} */ public DmtData(String value, int format) { switch (format) { @@ -278,7 +278,7 @@ } /** - * Create a DmtData instance of int format and + * Create a {@code DmtData} instance of {@code int} format and * set its value. * * @param integer the integer value to set @@ -296,7 +296,7 @@ } /** - * Create a DmtData instance of float format + * Create a {@code DmtData} instance of {@code float} format * and set its value. * * @param flt the float value to set @@ -314,7 +314,7 @@ } /** - * Create a DmtData instance of bool format + * Create a {@code DmtData} instance of {@code bool} format * and set its value. * * @param bool the boolean value to set @@ -332,11 +332,11 @@ } /** - * Create a DmtData instance of bin format and + * Create a {@code DmtData} instance of {@code bin} format and * set its value. * - * @param bytes the byte array to set, must not be null - * @throws NullPointerException if bytes is null + * @param bytes the byte array to set, must not be {@code null} + * @throws NullPointerException if {@code bytes} is {@code null} */ public DmtData(byte[] bytes) { if (bytes == null) @@ -354,15 +354,15 @@ } /** - * Create a DmtData instance of bin or - * b64 format and set its value. The chosen format is - * specified by the base64 parameter. - * - * @param bytes the byte array to set, must not be null - * @param base64 if true, the new instance will have - * b64 format, if false, it will have - * bin format - * @throws NullPointerException if bytes is null + * Create a {@code DmtData} instance of {@code bin} or + * {@code b64} format and set its value. The chosen format is + * specified by the {@code base64} parameter. + * + * @param bytes the byte array to set, must not be {@code null} + * @param base64 if {@code true}, the new instance will have + * {@code b64} format, if {@code false}, it will have + * {@code bin} format + * @throws NullPointerException if {@code bytes} is {@code null} */ public DmtData(byte[] bytes, boolean base64) { if (bytes == null) @@ -380,16 +380,16 @@ } /** - * Create a DmtData instance in {@link #FORMAT_RAW_STRING} - * format. The data is provided encoded as a String. The - * actual data format is specified in formatName. The - * encoding used in data must conform to this format. + * Create a {@code DmtData} instance in {@link #FORMAT_RAW_STRING} + * format. The data is provided encoded as a {@code String}. The + * actual data format is specified in {@code formatName}. The + * encoding used in {@code data} must conform to this format. * - * @param formatName the name of the format, must not be null + * @param formatName the name of the format, must not be {@code null} * @param data the data encoded according to the specified format, must not - * be null - * @throws NullPointerException if formatName or - * data is null + * be {@code null} + * @throws NullPointerException if {@code formatName} or + * {@code data} is {@code null} */ public DmtData(String formatName, String data) { if(formatName == null) @@ -409,16 +409,16 @@ } /** - * Create a DmtData instance in {@link #FORMAT_RAW_BINARY} + * Create a {@code DmtData} instance in {@link #FORMAT_RAW_BINARY} * format. The data is provided encoded as binary. The actual data format is - * specified in formatName. The encoding used in - * data must conform to this format. + * specified in {@code formatName}. The encoding used in + * {@code data} must conform to this format. * - * @param formatName the name of the format, must not be null + * @param formatName the name of the format, must not be {@code null} * @param data the data encoded according to the specified format, must not - * be null - * @throws NullPointerException if formatName or - * data is null + * be {@code null} + * @throws NullPointerException if {@code formatName} or + * {@code data} is {@code null} */ public DmtData(String formatName, byte[] data) { if(formatName == null) @@ -438,7 +438,7 @@ } /** - * Gets the value of a node with string (chr) format. + * Gets the value of a node with string ({@code chr}) format. * * @return the string value * @throws DmtIllegalStateException if the format of the node is not string @@ -453,7 +453,7 @@ /** * Gets the value of a node with date format. The returned date string is * formatted according to the ISO 8601 definition of a calendar date in - * complete representation, basic format (pattern CCYYMMDD). + * complete representation, basic format (pattern {@code CCYYMMDD}). * * @return the date value * @throws DmtIllegalStateException if the format of the node is not date @@ -470,8 +470,8 @@ * formatted according to the ISO 8601 definition of the time of day. The * exact format depends on the value the object was initialized with: either * local time, complete representation, basic format (pattern - * hhmmss) or Coordinated Universal Time, basic format (pattern - * hhmmssZ). + * {@code hhmmss}) or Coordinated Universal Time, basic format (pattern + * {@code hhmmssZ}). * * @return the time value * @throws DmtIllegalStateException if the format of the node is not time @@ -484,11 +484,11 @@ } /** - * Gets the value of a node with xml format. + * Gets the value of a node with {@code xml} format. * * @return the XML value * @throws DmtIllegalStateException if the format of the node is not - * xml + * {@code xml} */ public String getXml() { if (format == FORMAT_XML) @@ -498,7 +498,7 @@ } /** - * Gets the value of a node with integer (int) format. + * Gets the value of a node with integer ({@code int}) format. * * @return the integer value * @throws DmtIllegalStateException if the format of the node is not integer @@ -511,11 +511,11 @@ } /** - * Gets the value of a node with float format. + * Gets the value of a node with {@code float} format. * * @return the float value * @throws DmtIllegalStateException if the format of the node is not - * float + * {@code float} */ public float getFloat() { if (format == FORMAT_FLOAT) @@ -525,7 +525,7 @@ } /** - * Gets the value of a node with boolean (bool) format. + * Gets the value of a node with boolean ({@code bool}) format. * * @return the boolean value * @throws DmtIllegalStateException if the format of the node is not boolean @@ -538,7 +538,7 @@ } /** - * Gets the value of a node with binary (bin) format. + * Gets the value of a node with binary ({@code bin}) format. * * @return the binary value * @throws DmtIllegalStateException if the format of the node is not binary @@ -571,12 +571,12 @@ } /** - * Gets the value of a node in raw String + * Gets the value of a node in raw {@code String} * ({@link #FORMAT_RAW_STRING}) format. * - * @return the data value in raw String format + * @return the data value in raw {@code String} format * @throws DmtIllegalStateException if the format of the node is not raw - * String + * {@code String} */ public String getRawString() { if (format == FORMAT_RAW_STRING) @@ -587,7 +587,7 @@ } /** - * Gets the value of a node with base 64 (b64) format. + * Gets the value of a node with base 64 ({@code b64}) format. * * @return the binary value * @throws DmtIllegalStateException if the format of the node is not base 64. @@ -606,7 +606,7 @@ } /** - * Gets the complex data associated with an interior node (node + * Gets the complex data associated with an interior node ({@code node} * format). *

* Certain interior nodes can support access to their subtrees through @@ -615,7 +615,7 @@ * * @return the data object associated with an interior node * @throws DmtIllegalStateException if the format of the data is not - * node + * {@code node} */ public Object getNode() { if(format == FORMAT_NODE) @@ -637,12 +637,12 @@ } /** - * Returns the format of this DmtData as String. + * Returns the format of this {@code DmtData} as {@code String}. * For the predefined data formats this is the OMA DM defined name of the * format. For {@link #FORMAT_RAW_STRING} and {@link #FORMAT_RAW_BINARY} * this is the format specified when the object was created. * - * @return the format name as String + * @return the format name as {@code String} */ public String getFormatName() { return formatName; @@ -655,7 +655,7 @@ *

  • {@link #FORMAT_STRING}, {@link #FORMAT_XML}, {@link #FORMAT_BINARY}, * {@link #FORMAT_BASE64}, {@link #FORMAT_RAW_STRING}, and * {@link #FORMAT_RAW_BINARY}: the length of the stored data, or 0 if - * the data is null + * the data is {@code null} *
  • {@link #FORMAT_INTEGER} and {@link #FORMAT_FLOAT}: 4 *
  • {@link #FORMAT_DATE} and {@link #FORMAT_TIME}: the length of the * date or time in its string representation @@ -693,7 +693,7 @@ } /** - * Gets the string representation of the DmtData. This + * Gets the string representation of the {@code DmtData}. This * method works for all formats. *

    * For string format data - including {@link #FORMAT_RAW_STRING} - the @@ -702,10 +702,10 @@ * Binary - including {@link #FORMAT_RAW_BINARY} - and base64 data is * represented by two-digit hexadecimal numbers for each byte separated by * spaces. The {@link #NULL_VALUE} data has the string form of - * "null". Data of string or XML format containing the Java - * null value is represented by an empty string. + * "{@code null}". Data of string or XML format containing the Java + * {@code null} value is represented by an empty string. * - * @return the string representation of this DmtData instance + * @return the string representation of this {@code DmtData} instance */ public String toString() { switch (format) { @@ -735,16 +735,16 @@ } /** - * Compares the specified object with this DmtData instance. - * Two DmtData objects are considered equal if their format + * Compares the specified object with this {@code DmtData} instance. + * Two {@code DmtData} objects are considered equal if their format * is the same, and their data (selected by the format) is equal. *

    * In case of {@link #FORMAT_RAW_BINARY} and {@link #FORMAT_RAW_STRING} * the textual name of the data format - as returned by * {@link #getFormatName()} - must be equal as well. * - * @param obj the object to compare with this DmtData - * @return true if the argument represents the same DmtData + * @param obj the object to compare with this {@code DmtData} + * @return true if the argument represents the same {@code DmtData} * as this object */ public boolean equals(Object obj) { @@ -787,7 +787,7 @@ } /** - * Returns the hash code value for this DmtData instance. The + * Returns the hash code value for this {@code DmtData} instance. The * hash code is calculated based on the data (selected by the format) of * this object. * diff -Nru osgi-compendium-4.2.0/src/info/dmtree/DmtEvent.java osgi-compendium-4.3.0/src/info/dmtree/DmtEvent.java --- osgi-compendium-4.2.0/src/info/dmtree/DmtEvent.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/info/dmtree/DmtEvent.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -17,7 +17,7 @@ /** * Event class storing the details of a change in the tree. - * DmtEvent is used by DmtAdmin to notify registered + * {@code DmtEvent} is used by {@code DmtAdmin} to notify registered * {@link DmtEventListener EventListeners} about important changes. Events are * generated after every successful DMT change, and also when sessions are * opened or closed. If a {@link DmtSession} is opened in atomic mode, DMT @@ -28,13 +28,13 @@ * renamed or copied, in this order. Events are also generated when sessions are * opened and closed. *

    - * The type of the event describes the change that triggered the + * The {@code type} of the event describes the change that triggered the * event delivery. Each event carries the unique identifier of the session in * which the described change happened. The events describing changes in the DMT * carry the list of affected nodes. In case of {@link #COPIED} or * {@link #RENAMED} events, the event carries the list of new nodes as well. *

    - * When a DmtEvent is delivered to a listener, the event contains + * When a {@code DmtEvent} is delivered to a listener, the event contains * only those node URIs that the listener has access to. This access control * decision is based on the principal specified when the listener was * registered: @@ -48,7 +48,7 @@ * corresponding node. * * - * @version $Revision: 5673 $ + * @version $Id: 506872c6a60ee9170672b0e6cb2bc9688d70ad57 $ */ public interface DmtEvent { @@ -106,7 +106,7 @@ /** * This method can be used to query the subject nodes of this event. The - * method returns null for {@link #SESSION_OPENED} and + * method returns {@code null} for {@link #SESSION_OPENED} and * {@link #SESSION_CLOSED}. *

    * The method returns only those affected nodes that the caller has the GET @@ -123,7 +123,7 @@ /** * This method can be used to query the new nodes, when the type of the * event is {@link #COPIED} or {@link #RENAMED}. For all other event types - * this method returns null. + * this method returns {@code null}. *

    * The array returned by this method runs parallel to the array returned by * {@link #getNodes}, the elements in the two arrays contain the source and diff -Nru osgi-compendium-4.2.0/src/info/dmtree/DmtEventListener.java osgi-compendium-4.3.0/src/info/dmtree/DmtEventListener.java --- osgi-compendium-4.2.0/src/info/dmtree/DmtEventListener.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/info/dmtree/DmtEventListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -22,16 +22,16 @@ * {@link DmtSession} is opened in atomic mode, DMT events are only sent when * the session is committed, when the changes are actually performed. * - * @version $Revision: 5673 $ + * @version $Id: 275675e7ed60b346c1081e1b5bacdfa348ad8350 $ */ public interface DmtEventListener { /** - * DmtAdmin uses this method to notify the registered + * {@code DmtAdmin} uses this method to notify the registered * listeners about the change. This method is called asynchronously from the * actual event occurrence. * - * @param event the DmtEvent describing the change in detail + * @param event the {@code DmtEvent} describing the change in detail */ void changeOccurred(DmtEvent event); } diff -Nru osgi-compendium-4.2.0/src/info/dmtree/DmtException.java osgi-compendium-4.3.0/src/info/dmtree/DmtException.java --- osgi-compendium-4.2.0/src/info/dmtree/DmtException.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/info/dmtree/DmtException.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -20,7 +20,7 @@ /** * Checked exception received when a DMT operation fails. Beside the exception - * message, a DmtException always contains an error code (one of + * message, a {@code DmtException} always contains an error code (one of * the constants specified in this class), and may optionally contain the URI of * the related node, and information about the cause of the exception. *

    @@ -30,22 +30,22 @@ * different range, starting from 1. *

    * The cause of the exception (if specified) can either be a single - * Throwable instance, or a list of such instances if several + * {@code Throwable} instance, or a list of such instances if several * problems occurred during the execution of a method. An example for the latter - * is the close method of DmtSession that tries to + * is the {@code close} method of {@code DmtSession} that tries to * close multiple plugins, and has to report the exceptions of all failures. *

    - * Each constructor has two variants, one accepts a String node - * URI, the other accepts a String[] node path. The former is used + * Each constructor has two variants, one accepts a {@code String} node + * URI, the other accepts a {@code String[]} node path. The former is used * by the DmtAdmin implementation, the latter by the plugins, who receive the * node URI as an array of segment names. The constructors are otherwise * identical. *

    * Getter methods are provided to retrieve the values of the additional - * parameters, and the printStackTrace(PrintWriter) method is + * parameters, and the {@code printStackTrace(PrintWriter)} method is * extended to print the stack trace of all causing throwables as well. * - * @version $Revision: 5837 $ + * @version $Id: 4c28c365160136f6d2da2229ab0ba127dea78527 $ */ public class DmtException extends Exception { private static final long serialVersionUID = -63006267148118655L; @@ -137,8 +137,8 @@ /** * The requested node creation operation failed because the target already * exists. This can occur if the node is created directly (with one of the - * create... methods), or indirectly (during a - * copy operation). + * {@code create...} methods), or indirectly (during a + * {@code copy} operation). *

    * This error code corresponds to the OMA DM response status code 418 * "Already exists". @@ -207,7 +207,7 @@ /** * Operation failed because of meta data restrictions. This covers any * attempted deviation from the parameters defined by the - * MetaNode objects of the affected nodes, for example in the + * {@code MetaNode} objects of the affected nodes, for example in the * following situations: *

    *

    * This error code can also be used to indicate any other meta data - * violation, even if it cannot be described by the MetaNode + * violation, even if it cannot be described by the {@code MetaNode} * class. For example, detecting a multi-node constraint violation while * committing an atomic session should result in this error. *

    @@ -237,15 +237,15 @@ /** * The requested command failed because the target URI or node name is - * null or syntactically invalid. This covers the following + * {@code null} or syntactically invalid. This covers the following * cases: *

    - * These system properties are all of type String. + * These system properties are all of type {@code String}. * *

    * If the corresponding Managed Service/Managed Service Factory is @@ -108,12 +109,12 @@ * *

    * Also initiates an asynchronous call to all - * ConfigurationListeners with a - * ConfigurationEvent.CM_UPDATED event. + * {@code ConfigurationListener}s with a + * {@code ConfigurationEvent.CM_UPDATED} event. * * @param properties the new set of properties for this configuration * @throws IOException if update cannot be made persistent - * @throws IllegalArgumentException if the Dictionary object + * @throws IllegalArgumentException if the {@code Dictionary} object * contains invalid configuration types or contains case variants of * the same key name. * @throws IllegalStateException if this configuration has been deleted @@ -121,19 +122,19 @@ public void update(Dictionary properties) throws IOException; /** - * Delete this Configuration object. + * Delete this {@code Configuration} object. * * Removes this configuration object from the persistent store. Notify * asynchronously the corresponding Managed Service or Managed Service - * Factory. A ManagedService object is notified by a call to - * its updated method with a null properties - * argument. A ManagedServiceFactory object is notified by a - * call to its deleted method. + * Factory. A {@code ManagedService} object is notified by a call to + * its {@code updated} method with a {@code null} properties + * argument. A {@code ManagedServiceFactory} object is notified by a + * call to its {@code deleted} method. * *

    * Also initiates an asynchronous call to all - * ConfigurationListeners with a - * ConfigurationEvent.CM_DELETED event. + * {@code ConfigurationListener}s with a + * {@code ConfigurationEvent.CM_DELETED} event. * * @throws IOException If delete fails * @throws IllegalStateException if this configuration has been deleted @@ -142,25 +143,25 @@ /** * For a factory configuration return the PID of the corresponding Managed - * Service Factory, else return null. + * Service Factory, else return {@code null}. * - * @return factory PID or null + * @return factory PID or {@code null} * @throws IllegalStateException if this configuration has been deleted */ public String getFactoryPid(); /** - * Update the Configuration object with the current + * Update the {@code Configuration} object with the current * properties. * - * Initiate the updated callback to the Managed Service or + * Initiate the {@code updated} callback to the Managed Service or * Managed Service Factory with the current properties asynchronously. * *

    * This is the only way for a bundle that uses a Configuration Plugin * service to initiate a callback. For example, when that bundle detects a * change that requires an update of the Managed Service or Managed Service - * Factory via its ConfigurationPlugin object. + * Factory via its {@code ConfigurationPlugin} object. * * @see ConfigurationPlugin * @throws IOException if update cannot access the properties in persistent @@ -170,20 +171,20 @@ public void update() throws IOException; /** - * Bind this Configuration object to the specified bundle + * Bind this {@code Configuration} object to the specified bundle * location. * - * If the bundleLocation parameter is null then the - * Configuration object will not be bound to a location. It + * If the bundleLocation parameter is {@code null} then the + * {@code Configuration} object will not be bound to a location. It * will be set to the bundle's location before the first time a Managed - * Service/Managed Service Factory receives this Configuration + * Service/Managed Service Factory receives this {@code Configuration} * object via the updated method and before any plugins are called. The * bundle location will be set persistently. * - * @param bundleLocation a bundle location or null + * @param bundleLocation a bundle location or {@code null} * @throws IllegalStateException If this configuration has been deleted. * @throws SecurityException If the caller does not have - * ConfigurationPermission[*,CONFIGURE]. + * {@code ConfigurationPermission[*,CONFIGURE]}. */ public void setBundleLocation(String bundleLocation); @@ -191,14 +192,14 @@ * Get the bundle location. * * Returns the bundle location to which this configuration is bound, or - * null if it is not yet bound to a bundle location. + * {@code null} if it is not yet bound to a bundle location. * * @return location to which this configuration is bound, or - * null. - * @throws IllegalStateException If this Configuration object + * {@code null}. + * @throws IllegalStateException If this {@code Configuration} object * has been deleted. * @throws SecurityException If the caller does not have - * ConfigurationPermission[*,CONFIGURE]. + * {@code ConfigurationPermission[*,CONFIGURE]}. */ public String getBundleLocation(); @@ -207,9 +208,9 @@ * * Two Configuration objects are equal when their PIDs are equal. * - * @param other Configuration object to compare against - * @return true if equal, false if not a - * Configuration object or one with a different PID. + * @param other {@code Configuration} object to compare against + * @return {@code true} if equal, {@code false} if not a + * {@code Configuration} object or one with a different PID. */ public boolean equals(Object other); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/cm/ConfigurationListener.java osgi-compendium-4.3.0/src/org/osgi/service/cm/ConfigurationListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/cm/ConfigurationListener.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/cm/ConfigurationListener.java 2011-06-13 15:35:44.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -16,33 +16,33 @@ package org.osgi.service.cm; /** - * Listener for Configuration Events. When a ConfigurationEvent + * Listener for Configuration Events. When a {@code ConfigurationEvent} * is fired, it is asynchronously delivered to a - * ConfigurationListener. + * {@code ConfigurationListener}. * *

    - * ConfigurationListener objects are registered with the + * {@code ConfigurationListener} objects are registered with the * Framework service registry and are notified with a - * ConfigurationEvent object when an event is fired. + * {@code ConfigurationEvent} object when an event is fired. *

    - * ConfigurationListener objects can inspect the received - * ConfigurationEvent object to determine its type, the pid of - * the Configuration object with which it is associated, and the + * {@code ConfigurationListener} objects can inspect the received + * {@code ConfigurationEvent} object to determine its type, the pid of + * the {@code Configuration} object with which it is associated, and the * Configuration Admin service that fired the event. * *

    * Security Considerations. Bundles wishing to monitor configuration events will - * require ServicePermission[ConfigurationListener,REGISTER] to - * register a ConfigurationListener service. + * require {@code ServicePermission[ConfigurationListener,REGISTER]} to + * register a {@code ConfigurationListener} service. * - * @version $Revision: 5673 $ + * @version $Id: bc0872c4df2541cba4060a0036f8aeb24a608051 $ * @since 1.2 */ public interface ConfigurationListener { /** * Receives notification of a Configuration that has changed. * - * @param event The ConfigurationEvent. + * @param event The {@code ConfigurationEvent}. */ public void configurationEvent(ConfigurationEvent event); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/cm/ConfigurationPermission.java osgi-compendium-4.3.0/src/org/osgi/service/cm/ConfigurationPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/cm/ConfigurationPermission.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/cm/ConfigurationPermission.java 2011-07-21 13:53:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved. + * 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. @@ -28,14 +28,14 @@ * This permission has only a single action: CONFIGURE. * * @ThreadSafe - * @version $Revision: 6381 $ + * @version $Id: 6b918f50972aaa9890b9a2d613ddd08598509280 $ * @since 1.2 */ public final class ConfigurationPermission extends BasicPermission { static final long serialVersionUID = 5716868734811965383L; /** - * The action string configure. + * The action string {@code configure}. */ public final static String CONFIGURE = "configure"; @@ -43,7 +43,7 @@ * Create a new ConfigurationPermission. * * @param name Name must be "*". - * @param actions configure (canonical order). + * @param actions {@code configure} (canonical order). */ public ConfigurationPermission(String name, String actions) { @@ -59,12 +59,12 @@ } /** - * Determines if a ConfigurationPermission object "implies" + * Determines if a {@code ConfigurationPermission} object "implies" * the specified permission. * * @param p The target permission to check. - * @return true if the specified permission is implied by - * this object; false otherwise. + * @return {@code true} if the specified permission is implied by + * this object; {@code false} otherwise. */ public boolean implies(Permission p) { @@ -72,14 +72,14 @@ } /** - * Determines the equality of two ConfigurationPermission + * Determines the equality of two {@code ConfigurationPermission} * objects. *

    - * Two ConfigurationPermission objects are equal. + * Two {@code ConfigurationPermission} objects are equal. * * @param obj The object being compared for equality with this object. - * @return true if obj is equivalent to this - * ConfigurationPermission; false + * @return {@code true} if {@code obj} is equivalent to this + * {@code ConfigurationPermission}; {@code false} * otherwise. */ public boolean equals(Object obj) { @@ -100,24 +100,24 @@ /** * Returns the canonical string representation of the - * ConfigurationPermission actions. + * {@code ConfigurationPermission} actions. * *

    - * Always returns present ConfigurationPermission actions in - * the following order: CONFIGURE + * Always returns present {@code ConfigurationPermission} actions in + * the following order: {@code CONFIGURE} * * @return Canonical string representation of the - * ConfigurationPermission actions. + * {@code ConfigurationPermission} actions. */ public String getActions() { return CONFIGURE; } /** - * Returns a new PermissionCollection object suitable for - * storing ConfigurationPermissions. + * Returns a new {@code PermissionCollection} object suitable for + * storing {@code ConfigurationPermission}s. * - * @return A new PermissionCollection object. + * @return A new {@code PermissionCollection} object. */ public PermissionCollection newPermissionCollection() { return new ConfigurationPermissionCollection(); @@ -125,7 +125,7 @@ } /** - * Stores a set of ConfigurationPermission permissions. + * Stores a set of {@code ConfigurationPermission} permissions. * * @see java.security.Permission * @see java.security.Permissions @@ -141,7 +141,7 @@ private volatile boolean hasElement; /** - * Creates an empty ConfigurationPermissionCollection object. + * Creates an empty {@code ConfigurationPermissionCollection} object. * */ public ConfigurationPermissionCollection() { @@ -150,13 +150,13 @@ /** * Adds the specified permission to the - * ConfigurationPermissionCollection. The key for the hash is + * {@code ConfigurationPermissionCollection}. The key for the hash is * the interface name of the service. * - * @param permission The Permission object to add. + * @param permission The {@code Permission} object to add. * * @exception IllegalArgumentException If the permission is not an - * ConfigurationPermission. + * {@code ConfigurationPermission}. * * @exception SecurityException If this ConfigurationPermissionCollection * object has been marked read-only. @@ -177,7 +177,7 @@ /** * Determines if the specified set of permissions implies the permissions - * expressed in the parameter permission. + * expressed in the parameter {@code permission}. * * @param p The Permission object to compare. * @@ -190,9 +190,9 @@ } /** - * Returns an enumeration of an ConfigurationPermission object. + * Returns an enumeration of an {@code ConfigurationPermission} object. * - * @return Enumeration of an ConfigurationPermission object. + * @return Enumeration of an {@code ConfigurationPermission} object. */ public Enumeration elements() { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/cm/ConfigurationPlugin.java osgi-compendium-4.3.0/src/org/osgi/service/cm/ConfigurationPlugin.java --- osgi-compendium-4.2.0/src/org/osgi/service/cm/ConfigurationPlugin.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/cm/ConfigurationPlugin.java 2011-07-21 13:53:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -24,13 +24,13 @@ * update. * *

    - * A bundle registers a ConfigurationPlugin object in order to + * A bundle registers a {@code ConfigurationPlugin} object in order to * process configuration updates before they reach the Managed Service or * Managed Service Factory. The Configuration Admin service will detect * registrations of Configuration Plugin services and must call these services - * every time before it calls the ManagedService or - * ManagedServiceFactory - * updated method. The + * every time before it calls the {@code ManagedService} or + * {@code ManagedServiceFactory} + * {@code updated} method. The * Configuration Plugin service thus has the opportunity to view and modify the * properties before they are passed to the Managed Service or Managed Service * Factory. @@ -39,24 +39,24 @@ * Configuration Plugin (plugin) services have full read/write access to all * configuration information. Therefore, bundles using this facility should be * trusted. Access to this facility should be limited with - * ServicePermission[ConfigurationPlugin,REGISTER]. + * {@code ServicePermission[ConfigurationPlugin,REGISTER]}. * Implementations of a Configuration Plugin service should assure that they * only act on appropriate configurations. * *

    - * The Integer service.cmRanking registration + * The {@code Integer} {@code service.cmRanking} registration * property may be specified. Not specifying this registration property, or - * setting it to something other than an Integer, is the same as - * setting it to the Integer zero. The - * service.cmRanking property determines the order in which + * setting it to something other than an {@code Integer}, is the same as + * setting it to the {@code Integer} zero. The + * {@code service.cmRanking} property determines the order in which * plugins are invoked. Lower ranked plugins are called before higher ranked * ones. In the event of more than one plugin having the same value of - * service.cmRanking, then the Configuration Admin service + * {@code service.cmRanking}, then the Configuration Admin service * arbitrarily chooses the order in which they are called. * *

    - * By convention, plugins with service.cmRanking< 0 or - * service.cmRanking > 1000 should not make modifications to + * By convention, plugins with {@code service.cmRanking< 0} or + * {@code service.cmRanking > 1000} should not make modifications to * the properties. * *

    @@ -66,15 +66,15 @@ * defined. * *

    - * A plugin may optionally specify a cm.target registration + * A plugin may optionally specify a {@code cm.target} registration * property whose value is the PID of the Managed Service or Managed Service * Factory whose configuration updates the plugin is intended to intercept. The * plugin will then only be called with configuration updates that are targeted * at the Managed Service or Managed Service Factory with the specified PID. - * Omitting the cm.target registration property means that the + * Omitting the {@code cm.target} registration property means that the * plugin is called for all configuration updates. * - * @version $Revision: 5673 $ + * @version $Id: 3b134aa21524b8f9cd461f040a8899334eb07d2a $ */ public interface ConfigurationPlugin { /** @@ -82,7 +82,7 @@ * Factory configuration dictionaries a Configuration Plugin service * receives. * - * This property contains a String[] of PIDs. A Configuration + * This property contains a {@code String[]} of PIDs. A Configuration * Admin service must call a Configuration Plugin service only when this * property is not set, or the target service's PID is listed in this * property. @@ -91,10 +91,10 @@ /** * A service property to specify the order in which plugins are invoked. * - * This property contains an Integer ranking of the plugin. + * This property contains an {@code Integer} ranking of the plugin. * Not specifying this registration property, or setting it to something - * other than an Integer, is the same as setting it to the - * Integer zero. This property determines the order in which + * other than an {@code Integer}, is the same as setting it to the + * {@code Integer} zero. This property determines the order in which * plugins are invoked. Lower ranked plugins are called before higher ranked * ones. * @@ -106,15 +106,15 @@ * View and possibly modify the a set of configuration properties before * they are sent to the Managed Service or the Managed Service Factory. The * Configuration Plugin services are called in increasing order of their - * service.cmRanking property. If this property is undefined - * or is a non- Integer type, 0 is used. + * {@code service.cmRanking} property. If this property is undefined + * or is a non- {@code Integer} type, 0 is used. * *

    * This method should not modify the properties unless the - * service.cmRanking of this plugin is in the range - * 0 <= service.cmRanking <= 1000. + * {@code service.cmRanking} of this plugin is in the range + * {@code 0 <= service.cmRanking <= 1000}. *

    - * If this method throws any Exception, the Configuration + * If this method throws any {@code Exception}, the Configuration * Admin service must catch it and should log it. * * @param reference reference to the Managed Service or Managed Service @@ -122,7 +122,7 @@ * @param properties The configuration properties. This argument must not * contain the "service.bundleLocation" property. The value of this * property may be obtained from the - * Configuration.getBundleLocation method. + * {@code Configuration.getBundleLocation} method. */ public void modifyConfiguration(ServiceReference reference, Dictionary properties); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/cm/ManagedServiceFactory.java osgi-compendium-4.3.0/src/org/osgi/service/cm/ManagedServiceFactory.java --- osgi-compendium-4.2.0/src/org/osgi/service/cm/ManagedServiceFactory.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/cm/ManagedServiceFactory.java 2011-07-21 13:53:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -29,10 +29,10 @@ *

    * Each of these service instances is represented, in the persistent * storage of the Configuration Admin service, by a factory - * Configuration object that has a PID. When such a - * Configuration is updated, the Configuration Admin service - * calls the ManagedServiceFactory updated method with the new - * properties. When updated is called with a new PID, the Managed + * {@code Configuration} object that has a PID. When such a + * {@code Configuration} is updated, the Configuration Admin service + * calls the {@code ManagedServiceFactory} updated method with the new + * properties. When {@code updated} is called with a new PID, the Managed * Service Factory should create a new factory instance based on these * configuration properties. When called with a PID that it has seen before, it * should update that existing service instance with the new configuration @@ -44,7 +44,7 @@ * created. The semantics of a factory instance are defined by the Managed * Service Factory. However, if the factory instance is registered as a service * object with the service registry, its PID should match the PID of the - * corresponding Configuration object (but it should not + * corresponding {@code Configuration} object (but it should not * be registered as a Managed Service!). * *

    @@ -92,7 +92,7 @@ * *

  • * - * @version $Revision: 5673 $ + * @version $Id: 107d3da81f09a25309cc8052073057afdd2d36e3 $ */ public interface ManagedServiceFactory { /** @@ -106,19 +106,19 @@ * Create a new instance, or update the configuration of an existing * instance. * - * If the PID of the Configuration object is new for the + * If the PID of the {@code Configuration} object is new for the * Managed Service Factory, then create a new factory instance, using the - * configuration properties provided. Else, update the - * service instance with the provided properties. + * configuration {@code properties} provided. Else, update the + * service instance with the provided {@code properties}. * *

    * If the factory instance is registered with the Framework, then the - * configuration properties should be copied to its registry + * configuration {@code properties} should be copied to its registry * properties. This is not mandatory and security sensitive properties * should obviously not be copied. * *

    - * If this method throws any Exception, the Configuration + * If this method throws any {@code Exception}, the Configuration * Admin service must catch it and should log it. * *

    @@ -128,7 +128,7 @@ * *

    * The Configuration Admin service must call this method asynchronously. - * This implies that implementors of the ManagedServiceFactory + * This implies that implementors of the {@code ManagedServiceFactory} * class can be assured that the callback will not take place during * registration when they execute the registration in a synchronized method. * @@ -136,7 +136,7 @@ * @param properties A copy of the configuration properties. This argument * must not contain the service.bundleLocation" property. The value * of this property may be obtained from the - * Configuration.getBundleLocation method. + * {@code Configuration.getBundleLocation} method. * @throws ConfigurationException when the configuration properties are * invalid. */ @@ -149,7 +149,7 @@ * Remove the factory instance associated with the PID. If the instance was * registered with the service registry, it should be unregistered. *

    - * If this method throws any Exception, the Configuration + * If this method throws any {@code Exception}, the Configuration * Admin service must catch it and should log it. *

    * The Configuration Admin service must call this method asynchronously. diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/cm/ManagedService.java osgi-compendium-4.3.0/src/org/osgi/service/cm/ManagedService.java --- osgi-compendium-4.2.0/src/org/osgi/service/cm/ManagedService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/cm/ManagedService.java 2011-07-21 13:53:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -24,29 +24,29 @@ *

    * A Managed Service is a service that needs configuration data. Such an object * should be registered with the Framework registry with the - * service.pid property set to some unique identifier called a + * {@code service.pid} property set to some unique identifier called a * PID. * *

    - * If the Configuration Admin service has a Configuration object - * corresponding to this PID, it will callback the updated() - * method of the ManagedService object, passing the properties of - * that Configuration object. + * If the Configuration Admin service has a {@code Configuration} object + * corresponding to this PID, it will callback the {@code updated()} + * method of the {@code ManagedService} object, passing the properties of + * that {@code Configuration} object. * *

    - * If it has no such Configuration object, then it calls back - * with a null properties argument. Registering a Managed Service - * will always result in a callback to the updated() method + * If it has no such {@code Configuration} object, then it calls back + * with a {@code null} properties argument. Registering a Managed Service + * will always result in a callback to the {@code updated()} method * provided the Configuration Admin service is, or becomes active. This callback * must always be done asynchronously. * *

    - * Else, every time that either of the updated() methods is - * called on that Configuration object, the - * ManagedService.updated() method with the new properties is - * called. If the delete() method is called on that - * Configuration object, ManagedService.updated() - * is called with a null for the properties parameter. All these + * Else, every time that either of the {@code updated()} methods is + * called on that {@code Configuration} object, the + * {@code ManagedService.updated()} method with the new properties is + * called. If the {@code delete()} method is called on that + * {@code Configuration} object, {@code ManagedService.updated()} + * is called with a {@code null} for the properties parameter. All these * callbacks must be done asynchronously. * *

    @@ -84,9 +84,9 @@ * public synchronized void updated( * Dictionary configuration ) { * if ( configuration == - * + * {@code * null - * + * } * ) * registration.setProperties( getDefaults() ); * else { @@ -105,21 +105,21 @@ * registration properties. This will allow the Configuration Admin service to * set properties on services which can then be used by other applications. * - * @version $Revision: 5673 $ + * @version $Id: 6dc466c566ce80e1cd8dfc4d78e4a9c699c7b655 $ */ public interface ManagedService { /** * Update the configuration for a Managed Service. * *

    - * When the implementation of updated(Dictionary) detects any + * When the implementation of {@code updated(Dictionary)} detects any * kind of error in the configuration properties, it should create a new - * ConfigurationException which describes the problem. This + * {@code ConfigurationException} which describes the problem. This * can allow a management system to provide useful information to a human * administrator. * *

    - * If this method throws any other Exception, the + * If this method throws any other {@code Exception}, the * Configuration Admin service must catch it and should log it. *

    * The Configuration Admin service must call this method asynchronously @@ -128,9 +128,9 @@ * registration when they execute the registration in a synchronized method. * * @param properties A copy of the Configuration properties, or - * null. This argument must not contain the + * {@code null}. This argument must not contain the * "service.bundleLocation" property. The value of this property may - * be obtained from the Configuration.getBundleLocation + * be obtained from the {@code Configuration.getBundleLocation} * method. * @throws ConfigurationException when the update fails */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/cm/package.html osgi-compendium-4.3.0/src/org/osgi/service/cm/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/cm/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/cm/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - -

    Configuration Admin Package Version 1.3. -

    Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

    -Import-Package: org.osgi.service.cm; version="[1.3,2.0)"
    -
    - - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/cm/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/cm/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/cm/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/cm/package-info.java 2011-07-21 13:53:52.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Configuration Admin Package Version 1.3. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.cm; version="[1.3,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.cm; version="[1.3,1.4)"} + * + * @version $Id: 10168cbf1555ba91c73aff69ff27fed93f5f7e69 $ + */ + +package org.osgi.service.cm; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Activate.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Activate.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Activate.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Activate.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Identify the annotated method as the {@code activate} method of a Service + * Component. + * + *

    + * The annotated method is the activate method of the Component. + * + *

    + * This annotation is not processed at runtime by a Service Component Runtime + * implementation. It must be processed by tools and used to add a Component + * Description to the bundle. + * + * @see "The activate attribute of the component element of a Component Description." + * @version $Id: b61a8aecb6d8df3d60a2e6b05e6021801b580331 $ + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.METHOD) +public @interface Activate { + // marker annotation +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Component.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Component.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Component.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Component.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,171 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Identify the annotated class as a Service Component. + * + *

    + * The annotated class is the implementation class of the Component. + * + *

    + * This annotation is not processed at runtime by a Service Component Runtime + * implementation. It must be processed by tools and used to add a Component + * Description to the bundle. + * + * @see "The component element of a Component Description." + * @version $Id: 6d6332dbb471a2bc582bf8fc9a9b7f3efd02bfc2 $ + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE) +public @interface Component { + /** + * The name of this Component. + * + *

    + * If not specified, the name of this Component is the fully qualified type + * name of the class being annotated. + * + * @see "The name attribute of the component element of a Component Description." + */ + String name() default ""; + + /** + * The types under which to register this Component as a service. + * + *

    + * If no service should be registered, the empty value + * {} must be specified. + * + *

    + * If not specified, the service types for this Component are all the + * directly implemented interfaces of the class being annotated. + * + * @see "The service element of a Component Description." + */ + Class< ? >[] service() default {}; + + /** + * The factory identifier of this Component. Specifying a factory identifier + * makes this Component a Factory Component. + * + *

    + * If not specified, the default is that this Component is not a Factory + * Component. + * + * @see "The factory attribute of the component element of a Component Description." + */ + String factory() default ""; + + /** + * Declares whether this Component uses the OSGi ServiceFactory concept and + * each bundle using this Component's service will receive a different + * component instance. + * + *

    + * If {@code true}, this Component uses the OSGi ServiceFactory concept. If + * {@code false} or not specified, this Component does not use the OSGi + * ServiceFactory concept. + * + * @see "The servicefactory attribute of the service element of a Component Description." + */ + boolean servicefactory() default false; + + /** + * Declares whether this Component is enabled when the bundle containing it + * is started. + * + *

    + * If {@code true}, this Component is enabled. If {@code false} or not + * specified, this Component is disabled. + * + * @see "The enabled attribute of the component element of a Component Description." + */ + boolean enabled() default true; + + /** + * Declares whether this Component must be immediately activated upon + * becoming satisfied or whether activation should be delayed. + * + *

    + * If {@code true}, this Component must be immediately activated upon + * becoming satisfied. If {@code false}, activation of this Component is + * delayed. If this property is specified, its value must be {@code false} + * if the {@link #factory} property is also specified or must be + * {@code true} if the {@link #service} property is specified with an empty + * value. + * + *

    + * If not specified, the default is {@code false} if the {@link #factory} + * property is specified or the {@link #service} property is not specified + * or specified with a non-empty value and {@code true} otherwise. + * + * @see "The immediate attribute of the component element of a Component Description." + */ + boolean immediate() default false; + + /** + * The configuration policy of this Component. + * + *

    + * Controls whether component configurations must be satisfied depending on + * the presence of a corresponding Configuration object in the OSGi + * Configuration Admin service. A corresponding configuration is a + * Configuration object where the PID equals the name of the component. + * + *

    + * If not specified, the {@link ConfigurationPolicy#OPTIONAL OPTIONAL} + * configuration policy is used. + * + * @see "The configuration-policy attribute of the component element of a Component Description." + */ + ConfigurationPolicy configurationPolicy() default ConfigurationPolicy.OPTIONAL; + + /** + * Properties for this Component. + * + *

    + * Each property string is specified as {@code "key=value"}. The type of the + * property value can be specified in the key as {@code key:type=value}. The + * type must be one of the property types supported by the type attribute of + * the property element of a Component Description. + * + *

    + * To specify a property with multiple values, use multiple key, value + * pairs. For example, {@code "foo=bar", "foo=baz"}. + * + * @see "The property element of a Component Description." + */ + String[] property() default {}; + + /** + * Property entries for this Component. + * + *

    + * Specifies the name of an entry in the bundle whose contents conform to a + * standard Java Properties File. The entry is read and processed to obtain + * the properties and their values. + * + * @see "The properties element of a Component Description." + */ + String[] properties() default {}; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/ConfigurationPolicy.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/ConfigurationPolicy.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/ConfigurationPolicy.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/ConfigurationPolicy.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +/** + * Configuration Policy for the {@link Component} annotation. + * + *

    + * Controls whether component configurations must be satisfied depending on the + * presence of a corresponding Configuration object in the OSGi Configuration + * Admin service. A corresponding configuration is a Configuration object where + * the PID is the name of the component. + * + * @version $Id: 333d73c609620e0474ec143b6a9b9cba7ce271e7 $ + */ +public enum ConfigurationPolicy { + /** + * Use the corresponding Configuration object if present but allow the + * component to be satisfied even if the corresponding Configuration object + * is not present. + */ + OPTIONAL, + /** + * There must be a corresponding Configuration object for the component + * configuration to become satisfied. + */ + REQUIRE, + /** + * Always allow the component configuration to be satisfied and do not use + * the corresponding Configuration object even if it is present. + */ + IGNORE; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Deactivate.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Deactivate.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Deactivate.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Deactivate.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Identify the annotated method as the {@code deactivate} method of a Service + * Component. + * + *

    + * The annotated method is the deactivate method of the Component. + * + *

    + * This annotation is not processed at runtime by a Service Component Runtime + * implementation. It must be processed by tools and used to add a Component + * Description to the bundle. + * + * @see "The deactivate attribute of the component element of a Component Description." + * @version $Id: 397f31967ac41b758dd65190962f620bf9a86bdc $ + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.METHOD) +public @interface Deactivate { + // marker annotation +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Modified.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Modified.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Modified.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Modified.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Identify the annotated method as the {@code modified} method of a Service + * Component. + * + *

    + * The annotated method is the modified method of the Component. + * + *

    + * This annotation is not processed at runtime by a Service Component Runtime + * implementation. It must be processed by tools and used to add a Component + * Description to the bundle. + * + * @see "The modified attribute of the component element of a Component Description." + * @version $Id: 2a93eb9a641883494d39ddb6ecdf42779d787f7a $ + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.METHOD) +public @interface Modified { + // marker annotation +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/packageinfo 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/packageinfo 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1 @@ +version 1.0 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/package-info.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,28 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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. + */ + +/** + * Service Component Annotations Package Version 1.0. + * + *

    + * This package is not used at runtime. Annotated classes are processed by + * tools to generate Component Descriptions which are used at runtime. + * + * @version $Id: 2d28d03f84156d782d6a07cf6c6b814744a6d087 $ + */ + +package org.osgi.service.component.annotations; + diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/ReferenceCardinality.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/ReferenceCardinality.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/ReferenceCardinality.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/ReferenceCardinality.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +/** + * Cardinality for the {@link Reference} annotation. + * + *

    + * Specifies if the reference is optional and if the component implementation + * support a single bound service or multiple bound services. + * + * @version $Id: a86f2f25880cbd49111f9d8ab8279cbd5bc6e7c1 $ + */ +public enum ReferenceCardinality { + /** + * The reference is optional and unary. That is, the reference has a + * cardinality of {@code 0..1}. + */ + OPTIONAL, // 0..1 + /** + * The reference is mandatory and unary. That is, the reference has a + * cardinality of {@code 1..1}. + */ + MANDATORY, // 1..1 + /** + * The reference is optional and multiple. That is, the reference has a + * cardinality of {@code 0..n}. + */ + MULTIPLE, // 0..n + /** + * The reference is mandatory and multiple. That is, the reference has a + * cardinality of {@code 1..n}. + */ + AT_LEAST_ONE; // 1..n +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Reference.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Reference.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/Reference.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/Reference.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,112 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Identify the annotated method as a {@code bind} method of a Service + * Component. + * + *

    + * The annotated method is a bind method of the Component. + * + *

    + * This annotation is not processed at runtime by a Service Component Runtime + * implementation. It must be processed by tools and used to add a Component + * Description to the bundle. + * + * @see "The reference element of a Component Description." + * @version $Id: 4fffce54b3954d421d7f2b98962ff8e1ac7f076a $ + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.METHOD) +public @interface Reference { + /** + * The name of this reference. + * + *

    + * If not specified, the name of this reference is based upon the name of + * the method being annotated. If the method name begins with {@code set} or + * {@code add}, that is removed. + * + * @see "The name attribute of the reference element of a Component Description." + */ + String name() default ""; + + /** + * The type of the service to bind to this reference. + * + *

    + * If not specified, the type of the service to bind is based upon the type + * of the first argument of the method being annotated. + * + * @see "The interface attribute of the reference element of a Component Description." + */ + Class< ? > service() default Object.class; + + /** + * The cardinality of the reference. + * + *

    + * If not specified, the reference has a + * {@link ReferenceCardinality#MANDATORY 1..1} cardinality. + * + * @see "The cardinality attribute of the reference element of a Component Description." + */ + ReferenceCardinality cardinality() default ReferenceCardinality.MANDATORY; + + /** + * The policy for the reference. + * + *

    + * If not specified, the {@link ReferencePolicy#STATIC STATIC} reference + * policy is used. + * + * @see "The policy attribute of the reference element of a Component Description." + */ + ReferencePolicy policy() default ReferencePolicy.STATIC; + + /** + * The target filter for the reference. + * + * @see "The target attribute of the reference element of a Component Description." + */ + String target() default ""; + + /** + * The name of the unbind method which pairs with the annotated bind method. + * + *

    + * To declare no unbind method, the value {@code "-"} must be used. + * + *

    + * If not specified, the name of the unbind method is derived from the name + * of the annotated bind method. If the annotated method name begins with + * {@code set}, that is replaced with {@code unset} to derive the unbind + * method name. If the annotated method name begins with {@code add}, that + * is replaced with {@code remove} to derive the unbind method name. + * Otherwise, {@code un} is prefixed to the annotated method name to derive + * the unbind method name. + * + * @see "The unbind attribute of the reference element of a Component Description." + */ + String unbind() default ""; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/ReferencePolicy.java osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/ReferencePolicy.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/annotations/ReferencePolicy.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/annotations/ReferencePolicy.java 2011-09-08 14:21:52.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) OSGi Alliance (2011). 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.component.annotations; + +/** + * Policy for the {@link Reference} annotation. + * + * @version $Id: 698f862af7645e7a5baf98070cfbf71223041241 $ + */ +public enum ReferencePolicy { + /** + * The static policy is the most simple policy and is the default policy. A + * component instance never sees any of the dynamics. Component + * configurations are deactivated before any bound service for a reference + * having a static policy becomes unavailable. If a target service is + * available to replace the bound service which became unavailable, the + * component configuration must be reactivated and bound to the replacement + * service. + */ + STATIC, + /** + * The dynamic policy is slightly more complex since the component + * implementation must properly handle changes in the set of bound services. + * With the dynamic policy, SCR can change the set of bound services without + * deactivating a component configuration. If the component uses the event + * strategy to access services, then the component instance will be notified + * of changes in the set of bound services by calls to the bind and unbind + * methods. + */ + DYNAMIC; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentConstants.java osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentConstants.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentConstants.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentConstants.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved. + * 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. @@ -19,30 +19,31 @@ /** * Defines standard names for Service Component constants. * - * @version $Revision: 6454 $ + * @noimplement + * @version $Id: b2e509f16a23384cc6c90697b0fd8a70c8f9eae7 $ */ public interface ComponentConstants { /** * Manifest header specifying the XML documents within a bundle that contain * the bundle's Service Component descriptions. *

    - * The attribute value may be retrieved from the Dictionary - * object returned by the Bundle.getHeaders method. + * The attribute value may be retrieved from the {@code Dictionary} + * object returned by the {@code Bundle.getHeaders} method. */ public static final String SERVICE_COMPONENT = "Service-Component"; /** * A component property for a component configuration that contains the name - * of the component as specified in the name attribute of the - * component element. The value of this property must be of - * type String. + * of the component as specified in the {@code name} attribute of the + * {@code component} element. The value of this property must be of + * type {@code String}. */ public final static String COMPONENT_NAME = "component.name"; /** * A component property that contains the generated id for a component * configuration. The value of this property must be of type - * Long. + * {@code Long}. * *

    * The value of this property is assigned by the Service Component Runtime @@ -55,15 +56,15 @@ /** * A service registration property for a Component Factory that contains the - * value of the factory attribute. The value of this property - * must be of type String. + * value of the {@code factory} attribute. The value of this property + * must be of type {@code String}. */ public final static String COMPONENT_FACTORY = "component.factory"; /** * The suffix for reference target properties. These properties contain the * filter to select the target services for a reference. The value of this - * property must be of type String. + * property must be of type {@code String}. */ public final static String REFERENCE_TARGET_SUFFIX = ".target"; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentContext.java osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentContext.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentContext.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentContext.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved. + * 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. @@ -31,28 +31,29 @@ * A component instance may have an activate method. If a component instance has * a suitable and accessible activate method, this method will be called when a * component configuration is activated. If the activate method takes a - * ComponentContext argument, it will be passed the component + * {@code ComponentContext} argument, it will be passed the component * instance's Component Context object. If the activate method takes a - * BundleContext argument, it will be passed the component + * {@code BundleContext} argument, it will be passed the component * instance's Bundle Context object. If the activate method takes a - * Map argument, it will be passed an unmodifiable Map containing + * {@code Map} argument, it will be passed an unmodifiable Map containing * the component properties. * *

    * A component instance may have a deactivate method. If a component instance * has a suitable and accessible deactivate method, this method will be called * when the component configuration is deactivated. If the deactivate method - * takes a ComponentContext argument, it will be passed the + * takes a {@code ComponentContext} argument, it will be passed the * component instance's Component Context object. If the deactivate method takes - * a BundleContext argument, it will be passed the component + * a {@code BundleContext} argument, it will be passed the component * instance's Bundle Context object. If the deactivate method takes a - * Map argument, it will be passed an unmodifiable Map containing - * the component properties. If the deactivate method takes an int - * or Integer argument, it will be passed the reason code for the + * {@code Map} argument, it will be passed an unmodifiable Map containing + * the component properties. If the deactivate method takes an {@code int} + * or {@code Integer} argument, it will be passed the reason code for the * component instance's deactivation. * * @ThreadSafe - * @version $Revision: 6462 $ + * @noimplement + * @version $Id: 78c996676c92ad2d2457f75337b3d97a18c88e5d $ */ public interface ComponentContext { /** @@ -67,19 +68,19 @@ * Returns the service object for the specified reference name. * *

    - * If the cardinality of the reference is 0..n or - * 1..n and multiple services are bound to the reference, the + * If the cardinality of the reference is {@code 0..n} or + * {@code 1..n} and multiple services are bound to the reference, the * service with the highest ranking (as specified in its - * Constants.SERVICE_RANKING property) is returned. If there is + * {@code Constants.SERVICE_RANKING} property) is returned. If there is * a tie in ranking, the service with the lowest service ID (as specified in - * its Constants.SERVICE_ID property); that is, the service + * its {@code Constants.SERVICE_ID} property); that is, the service * that was registered first is returned. * * @param name The name of a reference as specified in a - * reference element in this component's description. - * @return A service object for the referenced service or null - * if the reference cardinality is 0..1 or - * 0..n and no bound service is available. + * {@code reference} element in this component's description. + * @return A service object for the referenced service or {@code null} + * if the reference cardinality is {@code 0..1} or + * {@code 0..n} and no bound service is available. * @throws ComponentException If the Service Component Runtime catches an * exception while activating the bound service. */ @@ -87,16 +88,16 @@ /** * Returns the service object for the specified reference name and - * ServiceReference. + * {@code ServiceReference}. * * @param name The name of a reference as specified in a - * reference element in this component's description. - * @param reference The ServiceReference to a bound service. - * This must be a ServiceReference provided to the + * {@code reference} element in this component's description. + * @param reference The {@code ServiceReference} to a bound service. + * This must be a {@code ServiceReference} provided to the * component via the bind or unbind method for the specified * reference name. - * @return A service object for the referenced service or null - * if the specified ServiceReference is not a bound + * @return A service object for the referenced service or {@code null} + * if the specified {@code ServiceReference} is not a bound * service for the specified reference name. * @throws ComponentException If the Service Component Runtime catches an * exception while activating the bound service. @@ -107,12 +108,12 @@ * Returns the service objects for the specified reference name. * * @param name The name of a reference as specified in a - * reference element in this component's description. + * {@code reference} element in this component's description. * @return An array of service objects for the referenced service or - * null if the reference cardinality is - * 0..1 or 0..n and no bound service is - * available. If the reference cardinality is 0..1 or - * 1..1 and a bound service is available, the array + * {@code null} if the reference cardinality is + * {@code 0..1} or {@code 0..n} and no bound service is + * available. If the reference cardinality is {@code 0..1} or + * {@code 1..1} and a bound service is available, the array * will have exactly one element. * @throws ComponentException If the Service Component Runtime catches an * exception while activating a bound service. @@ -120,25 +121,25 @@ public Object[] locateServices(String name); /** - * Returns the BundleContext of the bundle which contains this + * Returns the {@code BundleContext} of the bundle which contains this * component. * - * @return The BundleContext of the bundle containing this + * @return The {@code BundleContext} of the bundle containing this * component. */ public BundleContext getBundleContext(); /** * If the component instance is registered as a service using the - * servicefactory="true" attribute, then this method + * {@code servicefactory="true"} attribute, then this method * returns the bundle using the service provided by the component instance. *

    - * This method will return null if: + * This method will return {@code null} if: *

      *
    • The component instance is not a service, then no bundle can be using * it as a service. *
    • The component instance is a service but did not specify the - * servicefactory="true" attribute, then all bundles + * {@code servicefactory="true"} attribute, then all bundles * using the service provided by the component instance will share the same * component instance. *
    • The service provided by the component instance is not currently being @@ -146,7 +147,7 @@ *
    * * @return The bundle using the component instance as a service or - * null. + * {@code null}. */ public Bundle getUsingBundle(); @@ -162,7 +163,7 @@ * Enables the specified component name. The specified component name must * be in the same bundle as this component. * - * @param name The name of a component or null to indicate all + * @param name The name of a component or {@code null} to indicate all * components in the bundle. */ public void enableComponent(String name); @@ -177,14 +178,14 @@ /** * If the component instance is registered as a service using the - * service element, then this method returns the service + * {@code service} element, then this method returns the service * reference of the service provided by this component instance. *

    - * This method will return null if the component instance is + * This method will return {@code null} if the component instance is * not registered as a service. * - * @return The ServiceReference object for the component - * instance or null if the component instance is not + * @return The {@code ServiceReference} object for the component + * instance or {@code null} if the component instance is not * registered as a service. */ public ServiceReference getServiceReference(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentException.java osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentException.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentException.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentException.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -19,7 +19,7 @@ /** * Unchecked exception which may be thrown by the Service Component Runtime. * - * @version $Revision: 6083 $ + * @version $Id: ce00b5bdbe563ef48a1e76cfc6ce88ce2e13298b $ */ public class ComponentException extends RuntimeException { static final long serialVersionUID = -7438212656298726924L; @@ -28,7 +28,7 @@ * Construct a new ComponentException with the specified message and cause. * * @param message The message for the exception. - * @param cause The cause of the exception. May be null. + * @param cause The cause of the exception. May be {@code null}. */ public ComponentException(String message, Throwable cause) { super(message, cause); @@ -46,17 +46,17 @@ /** * Construct a new ComponentException with the specified cause. * - * @param cause The cause of the exception. May be null. + * @param cause The cause of the exception. May be {@code null}. */ public ComponentException(Throwable cause) { super(cause); } /** - * Returns the cause of this exception or null if no cause was + * Returns the cause of this exception or {@code null} if no cause was * set. * - * @return The cause of this exception or null if no cause was + * @return The cause of this exception or {@code null} if no cause was * set. */ public Throwable getCause() { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentFactory.java osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentFactory.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentFactory.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentFactory.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -19,14 +19,15 @@ import java.util.Dictionary; /** - * When a component is declared with the factory attribute on its - * component element, the Service Component Runtime will register + * When a component is declared with the {@code factory} attribute on its + * {@code component} element, the Service Component Runtime will register * a Component Factory service to allow new component configurations to be * created and activated rather than automatically creating and activating * component configuration as necessary. * * @ThreadSafe - * @version $Revision: 5654 $ + * @noimplement + * @version $Id: 7ec637e902c10319017d2a7c9e67bc76127dbce4 $ */ public interface ComponentFactory { /** @@ -34,11 +35,11 @@ * may be provided for the component configuration. * * @param properties Additional properties for the component configuration - * or null if there are no additional properties. - * @return A ComponentInstance object encapsulating the + * or {@code null} if there are no additional properties. + * @return A {@code ComponentInstance} object encapsulating the * component instance of the component configuration. The component * configuration has been activated and, if the component specifies - * a service element, the component instance has been + * a {@code service} element, the component instance has been * registered as a service. * @throws ComponentException If the Service Component Runtime is unable to * activate the component configuration. diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentInstance.java osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentInstance.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/ComponentInstance.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/ComponentInstance.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -26,7 +26,8 @@ * created when the component configuration is activated again. * * @ThreadSafe - * @version $Revision: 5654 $ + * @noimplement + * @version $Id: 153a0cbf3bc5bd82afeceea35cfd6dcd8498083e $ */ public interface ComponentInstance { /** @@ -39,7 +40,7 @@ /** * Returns the component instance of the activated component configuration. * - * @return The component instance or null if the component + * @return The component instance or {@code null} if the component * configuration has been deactivated. */ public Object getInstance(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/package.html osgi-compendium-4.3.0/src/org/osgi/service/component/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/component/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - -

    Service Component Package Version 1.1. -

    Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

    -Import-Package: org.osgi.service.component; version="[1.1,2.0)"
    -
    - - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/component/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/component/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/component/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/component/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Service Component Package Version 1.1. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.component; version="[1.1,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.component; version="[1.1,1.2)"} + * + * @version $Id: b9d67bb6dc2a108f89d826771b56d7b3a67b3e9b $ + */ + +package org.osgi.service.component; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/coordinator/CoordinationException.java osgi-compendium-4.3.0/src/org/osgi/service/coordinator/CoordinationException.java --- osgi-compendium-4.2.0/src/org/osgi/service/coordinator/CoordinationException.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/coordinator/CoordinationException.java 2011-05-16 12:29:18.000000000 +0000 @@ -0,0 +1,159 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2011). 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.coordinator; + +/** + * Unchecked exception which may be thrown by a Coordinator implementation. + * + * @version $Id: 9813b5b25a0572e81529626cb162f88bd005c707 $ + */ +public class CoordinationException extends RuntimeException { + private static final long serialVersionUID = 1L; + + /** + * Unknown reason for this exception. + */ + public final static int UNKNOWN = 0; + + /** + * Registering a Participant with a Coordination would have resulted in a + * deadlock. + */ + public final static int DEADLOCK_DETECTED = 1; + + /** + * The Coordination has terminated as a failure with + * {@link Coordination#fail(Throwable)}. When this exception type is used, + * the {@link #getCause()} method must return a non-null value. + */ + public final static int FAILED = 2; + + /** + * The Coordination has partially ended. + */ + public final static int PARTIALLY_ENDED = 3; + + /** + * The Coordination has already terminated normally. + */ + public final static int ALREADY_ENDED = 4; + + /** + * The Coordination was already on a thread's thread local Coordination + * stack. + */ + public final static int ALREADY_PUSHED = 5; + + /** + * The current thread was interrupted while waiting to register a + * Participant with a Coordination. + */ + public final static int LOCK_INTERRUPTED = 6; + + /** + * The Coordination cannot be ended by the calling thread since the + * Coordination is on the thread local Coordination stack of another thread. + */ + public final static int WRONG_THREAD = 7; + + private final String name; + private final int type; + private final long id; + + /** + * Create a new Coordination Exception with a cause. + * + * @param message The detail message for this exception. + * @param coordination The Coordination associated with this exception. + * @param cause The cause associated with this exception. + * @param type The type of this exception. + */ + public CoordinationException(String message, Coordination coordination, + int type, Throwable cause) { + super(message, cause); + this.type = type; + if (coordination == null) { + this.id = -1L; + this.name = "<>"; + } + else { + this.id = coordination.getId(); + this.name = coordination.getName(); + } + if ((type == FAILED) && (cause == null)) { + throw new IllegalArgumentException( + "A cause must be specified for type FAILED"); + } + } + + /** + * Create a new Coordination Exception. + * + * @param message The detail message for this exception. + * @param coordination The Coordination associated with this exception. + * @param type The type of this exception. + */ + public CoordinationException(String message, Coordination coordination, + int type) { + super(message); + this.type = type; + if (coordination == null) { + this.id = -1L; + this.name = "<>"; + } + else { + this.id = coordination.getId(); + this.name = coordination.getName(); + } + if (type == FAILED) { + throw new IllegalArgumentException( + "A cause must be specified for type FAILED"); + } + } + + /** + * Returns the name of the {@link Coordination} associated with this + * exception. + * + * @return The name of the Coordination associated with this exception or + * {@code "<>"} if no Coordination is associated with this + * exception. + */ + public String getName() { + return name; + } + + /** + * Returns the type for this exception. + * + * @return The type of this exception. + */ + public int getType() { + return type; + } + + /** + * Returns the id of the {@link Coordination} associated with this + * exception. + * + * @return The id of the Coordination associated with this exception or + * {@code -1} if no Coordination is associated with this exception. + */ + + public long getId() { + return id; + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/coordinator/Coordination.java osgi-compendium-4.3.0/src/org/osgi/service/coordinator/Coordination.java --- osgi-compendium-4.2.0/src/org/osgi/service/coordinator/Coordination.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/coordinator/Coordination.java 2011-08-18 14:13:16.000000000 +0000 @@ -0,0 +1,398 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2011). 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.coordinator; + +import java.util.List; +import java.util.Map; + +import org.osgi.framework.Bundle; + +/** + * A Coordination object is used to coordinate a number of independent + * Participants. + * + *

    + * Once a Coordination is {@link Coordinator#create(String, long) created}, it + * can be used to add {@link Participant} objects. When the Coordination is + * ended, the participants are {@link Participant#ended(Coordination) notified}. + * A Coordination can also fail for various reasons. When this occurs, the + * participants are {@link Participant#failed(Coordination) notified} of the + * failure. + * + *

    + * A Coordination must be in one of two states, either ACTIVE or TERMINATED. The + * transition between ACTIVE and TERMINATED must be atomic, ensuring that a + * Participant can be guaranteed of either receiving an exception when adding + * itself to a Coordination or of receiving notification the Coordination has + * terminated. + * + *

    + * A Coordination object is thread safe and can be passed as a parameter to + * other parties regardless of the threads these parties use. + * + *

    + * The following example code shows how a Coordination should be used. + * + *

    + * void foo() {
    + *   Coordination c = coordinator.create("work", 0);
    + * 	 try {
    + * 	   doWork(c);
    + * 	 }
    + * 	 catch (Exception e) {
    + *     c.fail(e);
    + * 	 }
    + * 	 finally {
    + * 	   c.end();
    + * 	 }
    + * }
    + * 
    + * + * @ThreadSafe + * @noimplement + * @version $Id: 3094850161a4b3ea5c235d1e0df6d9174b8f40e3 $ + */ + +public interface Coordination { + + /** + * A singleton exception that will be the failure cause when a Coordination + * times out. + */ + Exception TIMEOUT = new Exception("TIMEOUT"); + + /** + * A singleton exception that will be the failure cause when the + * Coordinations created by a bundle are terminated because the bundle + * released the Coordinator service. + */ + Exception RELEASED = new Exception("RELEASED"); + + /** + * Returns the id assigned to this Coordination. + * + * The id is assigned by the {@link Coordinator} service which created this + * Coordination and is unique among all the Coordinations created by the + * Coordinator service and must not be reused as long as the Coordinator + * service remains registered. The id must be positive and monotonically + * increases for each Coordination created by the Coordinator service. + * + * @return The id assigned to this Coordination. + */ + long getId(); + + /** + * Returns the name of this Coordination. + * + * The name is specified when this Coordination was created. + * + * @return The name of this Coordination. + * + */ + String getName(); + + /** + * Terminate this Coordination normally. + * + *

    + * If this Coordination has been {@link #push() pushed} on the thread local + * Coordination stack of another thread, this method does nothing except + * throw a CoordinationException of type + * {@link CoordinationException#WRONG_THREAD}. + * + *

    + * If this Coordination has been {@link #push() pushed} on the thread local + * Coordination stack of this thread but is not the + * {@link Coordinator#peek() current Coordination}, then the Coordinations + * on the thread local Coordination stack above this Coordination must be + * terminated and removed from the thread local Coordination stack before + * this Coordination is terminated. Each of these Coordinations, starting + * with the current Coordination, will be {@link #end() terminated normally} + * . If the termination throws a {@link CoordinationException}, then the + * next Coordination on the thread local Coordination stack will be + * {@link #fail(Throwable) terminated as a failure} with a failure cause of + * the thrown CoordinationException. At the end of this process, this + * Coordination will be the current Coordination and will have been + * terminated as a failure if any of the terminated Coordinations threw a + * CoordinationException + * + *

    + * If this Coordination is the {@link Coordinator#peek() current + * Coordination}, then it will be {@link Coordinator#pop() removed} from the + * thread local Coordination stack. + * + *

    + * If this Coordination is already terminated, a CoordinationException is + * thrown. If this Coordination was terminated as a failure, the + * {@link #getFailure() failure cause} will be the cause of the thrown + * CoordinationException. + * + *

    + * Otherwise, this Coordination is terminated normally and then all + * registered {@link #getParticipants() Participants} are + * {@link Participant#ended(Coordination) notified}. Participants should + * finalize any work associated with this Coordination. The successful + * return of this method indicates that the Coordination has terminated + * normally and all registered Participants have been notified of the normal + * termination. + * + *

    + * It is possible that one of the Participants throws an exception during + * notification. If this happens, this Coordination is considered to have + * partially failed and this method must throw a CoordinationException of + * type {@link CoordinationException#PARTIALLY_ENDED} after all the + * registered Participants have been notified. + * + * @throws CoordinationException If this Coordination has failed, including + * timed out, or partially failed or this Coordination is on the + * thread local Coordination stack of another thread. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[INITIATE]} for this Coordination. + */ + void end(); + + /** + * Terminate this Coordination as a failure with the specified failure + * cause. + * + *

    + * If this Coordination is already {@link #isTerminated() terminated}, this + * method does nothing and returns {@code false}. + * + *

    + * Otherwise, this Coordination is terminated as a failure with the + * specified failure cause and then all registered + * {@link #getParticipants() Participants} are + * {@link Participant#failed(Coordination) notified}. Participants should + * discard any work associated with this Coordination. This method will + * return {@code true}. + * + *

    + * If this Coordination has been {@link #push() pushed} onto a thread local + * Coordination stack, this Coordination is not removed from the stack. The + * creator of this Coordination must still call {@link #end()} on this + * Coordination to cause it to be removed from the thread local Coordination + * stack. + * + * @param cause The failure cause. The failure cause must not be + * {@code null}. + * @return {@code true} if this Coordination was active and was terminated + * by this method, otherwise {@code false}. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[PARTICIPATE]} for this Coordination. + */ + boolean fail(Throwable cause); + + /** + * Returns the failure cause of this Coordination. + * + *

    + * If this Coordination has {@link #fail(Throwable) failed}, then this + * method will return the failure cause. + * + *

    + * If this Coordination timed out, this method will return {@link #TIMEOUT} + * as the failure cause. If this Coordination was active when the bundle + * that created it released the {@link Coordinator} service, this method + * will return {@link #RELEASED} as the failure cause. + * + * @return The failure cause of this Coordination or {@code null} if this + * Coordination has not terminated as a failure. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[INITIATE]} for this Coordination. + */ + Throwable getFailure(); + + /** + * Returns whether this Coordination is terminated. + * + * @return {@code true} if this Coordination is terminated, otherwise + * {@code false} if this Coordination is active. + */ + boolean isTerminated(); + + /** + * Register a Participant with this Coordination. + * + *

    + * Once a Participant is registered with this Coordination, it is guaranteed + * to receive a notification for either + * {@link Participant#ended(Coordination) normal} or + * {@link Participant#failed(Coordination) failure} termination when this + * Coordination is terminated. + * + *

    + * Participants are registered using their object identity. Once a + * Participant is registered with this Coordination, subsequent attempts to + * register the Participant again with this Coordination are ignored and the + * Participant is only notified once when this Coordination is terminated. + * + *

    + * A Participant can only be registered with a single active Coordination at + * a time. If a Participant is already registered with an active + * Coordination, attempts to register the Participation with another active + * Coordination will block until the Coordination the Participant is + * registered with terminates. Notice that in edge cases the notification to + * the Participant that this Coordination has terminated can happen before + * this method returns. + * + *

    + * Attempting to register a Participant with a {@link #isTerminated() + * terminated} Coordination will result in a CoordinationException being + * thrown. + * + *

    + * The ordering of notifying Participants must follow the order in which the + * Participants were registered. + * + * @param participant The Participant to register with this Coordination. + * The participant must not be {@code null}. + * @throws CoordinationException If the Participant could not be registered + * with this Coordination. This exception should normally not be + * caught by the caller but allowed to be caught by the initiator of + * this Coordination. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[PARTICIPATE]} for this Coordination. + */ + void addParticipant(Participant participant); + + /** + * Returns a snapshot of the Participants registered with this Coordination. + * + * @return A snapshot of the Participants registered with this Coordination. + * If no Participants are registered with this Coordination, the + * returned list will be empty. The list is ordered in the order the + * Participants were registered. The returned list is the property + * of the caller and can be modified by the caller. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[INITIATE]} for this Coordination. + */ + List getParticipants(); + + /** + * Returns the variable map associated with this Coordination. + * + * Each Coordination has a map that can be used for communicating between + * different Participants. The key of the map is a class, allowing for + * private data to be stored in the map by using implementation classes or + * shared data by using shared interfaces. + * + * The returned map is not synchronized. Users of the map must synchronize + * on the Map object while making changes. + * + * @return The variable map associated with this Coordination. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[PARTICIPANT]} for this Coordination. + */ + Map, Object> getVariables(); + + /** + * Extend the time out of this Coordination. + * + *

    + * Participants can call this method to extend the timeout of this + * Coordination with at least the specified time. This can be done by + * Participants when they know a task will take more than normal time. + * + * This method returns the new deadline. Specifying a timeout extension of 0 + * will return the existing deadline. + * + * @param timeMillis The time in milliseconds to extend the current timeout. + * If the initial timeout was specified as 0, no extension must take + * place. A zero must have no effect. + * @return The new deadline in milliseconds. If the specified time is 0, the + * existing deadline is returned. If this Coordination was created + * with an initial timeout of 0, no timeout is set and 0 is + * returned. + * @throws CoordinationException If this Coordination + * {@link #isTerminated() is terminated}. + * @throws IllegalArgumentException If the specified time is negative. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[PARTICIPATE]} for this Coordination. + */ + long extendTimeout(long timeMillis); + + /** + * Wait until this Coordination is terminated and all registered + * Participants have been notified. + * + * @param timeMillis Maximum time in milliseconds to wait. Specifying a time + * of 0 will wait until this Coordination is terminated. + * @throws InterruptedException If the wait is interrupted. + * @throws IllegalArgumentException If the specified time is negative. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[PARTICIPATE]} for this Coordination. + */ + + void join(long timeMillis) throws InterruptedException; + + /** + * Push this Coordination object onto the thread local Coordination stack to + * make it the {@link Coordinator#peek() current Coordination}. + * + * @return This Coordination. + * @throws CoordinationException If this Coordination is already on the any + * thread's thread local Coordination stack or this Coordination + * {@link #isTerminated() is terminated}. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[INITIATE]} for this Coordination. + */ + Coordination push(); + + /** + * Returns the thread in whose thread local Coordination stack this + * Coordination has been {@link #push() pushed}. + * + * @return The thread in whose thread local Coordination stack this + * Coordination has been pushed or {@code null} if this Coordination + * is not in any thread local Coordination stack. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[ADMIN]} for this Coordination. + */ + Thread getThread(); + + /** + * Returns the bundle that created this Coordination. This is the bundle + * that obtained the {@link Coordinator} service that was used to create + * this Coordination. + * + * @return The bundle that created this Coordination. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[ADMIN]} for this Coordination. + */ + Bundle getBundle(); + + /** + * Returns the Coordination enclosing this Coordination if this Coordination + * is on the thread local Coordination stack. + * + *

    + * When a Coordination is {@link #push() pushed} onto the thread local + * Coordination stack, the former {@link Coordinator#peek() current + * Coordination}, if any, is the enclosing Coordination of this + * Coordination. When this Coordination is {@link Coordinator#pop() removed} + * from the thread local Coordination stack, this Coordination no longer has + * an enclosing Coordination. + * + * @return The Coordination enclosing this Coordination if this Coordination + * is on the thread local Coordination stack or {@code null} if this + * Coordination is not on the thread local Coordination stack or has + * no enclosing Coordination. + * @throws SecurityException If the caller does not have {@code + * CoordinationPermission[ADMIN]} for this Coordination. + */ + Coordination getEnclosingCoordination(); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/coordinator/CoordinationPermission.java osgi-compendium-4.3.0/src/org/osgi/service/coordinator/CoordinationPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/coordinator/CoordinationPermission.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/coordinator/CoordinationPermission.java 2011-05-16 12:29:18.000000000 +0000 @@ -0,0 +1,808 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2011). 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.coordinator; + +import java.io.IOException; +import java.io.NotSerializableException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamField; +import java.security.AccessController; +import java.security.BasicPermission; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.PrivilegedAction; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osgi.framework.Bundle; +import org.osgi.framework.Filter; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; + +/** + * A bundle's authority to create or use a {@link Coordination}. + * + *

    + * {@code CoordinationPermission} has three actions: {@code initiate}, + * {@code participate} and {@code admin}. + * + * @ThreadSafe + * @version $Id: 5c0e011abe0732906361e08819354ec794e1e2fd $ + */ +public class CoordinationPermission extends BasicPermission { + + private static final long serialVersionUID = 1L; + + /** + * The action string {@code initiate}. + */ + public final static String INITIATE = "initiate"; + /** + * The action string {@code participate}. + */ + public final static String PARTICIPATE = "participate"; + /** + * The action string {@code admin}. + */ + public final static String ADMIN = "admin"; + + private final static int ACTION_INITIATE = 0x00000001; + private final static int ACTION_PARTICIPATE = 0x00000002; + private final static int ACTION_ADMIN = 0x00000004; + private final static int ACTION_ALL = ACTION_INITIATE + | ACTION_PARTICIPATE + | ACTION_ADMIN; + final static int ACTION_NONE = 0; + + /** + * The actions mask. + */ + transient int action_mask; + + /** + * The actions in canonical form. + * + * @serial + */ + private volatile String actions = null; + + /** + * The bundle used by this CoordinationPermission. + */ + transient final Bundle bundle; + + /** + * If this CoordinationPermission was constructed with a filter, this holds + * a Filter matching object used to evaluate the filter in implies. + */ + transient Filter filter; + + /** + * This map holds the properties of the permission, used to match a filter + * in implies. This is not initialized until necessary, and then cached in + * this object. + */ + private transient volatile Map properties; + + /** + * Creates a new granted {@code CoordinationPermission} object. + * + * This constructor must only be used to create a permission that is going + * to be checked. + *

    + * Examples: + * + *

    +	 * (coordination.name=com.acme.*)
    +	 * (&(signer=\*,o=ACME,c=US)(coordination.name=com.acme.*))
    +	 * (signer=\*,o=ACME,c=US)
    +	 * 
    + * + *

    + * When a signer key is used within the filter expression the signer value + * must escape the special filter chars ('*', '(', ')'). + *

    + * The name is specified as a filter expression. The filter gives access to + * the following attributes: + *

      + *
    • signer - A Distinguished Name chain used to sign the exporting + * bundle. Wildcards in a DN are not matched according to the filter string + * rules, but according to the rules defined for a DN chain.
    • + *
    • location - The location of the exporting bundle.
    • + *
    • id - The bundle ID of the exporting bundle.
    • + *
    • name - The symbolic name of the exporting bundle.
    • + *
    • coordination.name - The name of the requested coordination.
    • + *
    + * Filter attribute names are processed in a case sensitive manner. + * + * @param filter A filter expression. Filter attribute names are processed + * in a case sensitive manner. A special value of {@code "*"} can be + * used to match all coordinations. + * @param actions {@code admin}, {@code initiate} or {@code participate} + * (canonical order). + * @throws IllegalArgumentException If the filter has an invalid syntax. + */ + public CoordinationPermission(String filter, String actions) { + this(parseFilter(filter), parseActions(actions)); + } + + /** + * Creates a new requested {@code CoordinationPermission} object to be used + * by the code that must perform {@code checkPermission}. + * {@code CoordinationPermission} objects created with this constructor + * cannot be added to an {@code CoordinationPermission} permission + * collection. + * + * @param coordinationName The name of the requested Coordination. + * @param coordinationBundle The bundle which + * {@link Coordination#getBundle() created} the requested + * Coordination. + * @param actions {@code admin}, {@code initiate} or {@code participate} + * (canonical order). + */ + public CoordinationPermission(String coordinationName, + Bundle coordinationBundle, String actions) { + super(coordinationName); + setTransients(null, parseActions(actions)); + this.bundle = coordinationBundle; + if (coordinationName == null) { + throw new NullPointerException("coordinationName must not be null"); + } + if (coordinationBundle == null) { + throw new NullPointerException( + "coordinationBundle must not be null"); + } + } + + /** + * Package private constructor used by CoordinationPermissionCollection. + * + * @param filter name filter + * @param mask action mask + */ + CoordinationPermission(Filter filter, int mask) { + super((filter == null) ? "*" : filter.toString()); + setTransients(filter, mask); + this.bundle = null; + } + + /** + * Called by constructors and when deserialized. + * + * @param filter Permission's filter or {@code null} for wildcard. + * @param mask action mask + */ + private void setTransients(Filter filter, int mask) { + this.filter = filter; + if ((mask == ACTION_NONE) || ((mask & ACTION_ALL) != mask)) { + throw new IllegalArgumentException("invalid action string"); + } + this.action_mask = mask; + } + + /** + * Parse action string into action mask. + * + * @param actions Action string. + * @return action mask. + */ + private static int parseActions(String actions) { + boolean seencomma = false; + + int mask = ACTION_NONE; + + if (actions == null) { + return mask; + } + + char[] a = actions.toCharArray(); + + int i = a.length - 1; + if (i < 0) + return mask; + + while (i != -1) { + char c; + + // skip whitespace + while ((i != -1) + && ((c = a[i]) == ' ' || c == '\r' || c == '\n' + || c == '\f' || c == '\t')) + i--; + + // check for the known strings + int matchlen; + + if (i >= 4 && (a[i - 4] == 'a' || a[i - 4] == 'A') + && (a[i - 3] == 'd' || a[i - 3] == 'D') + && (a[i - 2] == 'm' || a[i - 2] == 'M') + && (a[i - 1] == 'i' || a[i - 1] == 'I') + && (a[i] == 'n' || a[i] == 'N')) { + matchlen = 5; + mask |= ACTION_ADMIN; + + } + else + if (i >= 7 && (a[i - 7] == 'i' || a[i - 7] == 'I') + && (a[i - 6] == 'n' || a[i - 6] == 'N') + && (a[i - 5] == 'i' || a[i - 5] == 'I') + && (a[i - 4] == 't' || a[i - 4] == 'T') + && (a[i - 3] == 'i' || a[i - 3] == 'I') + && (a[i - 2] == 'a' || a[i - 2] == 'A') + && (a[i - 1] == 't' || a[i - 1] == 'T') + && (a[i] == 'e' || a[i] == 'E')) { + matchlen = 8; + mask |= ACTION_INITIATE; + + } + else { + if (i >= 10 && (a[i - 10] == 'p' || a[i - 10] == 'P') + && (a[i - 9] == 'a' || a[i - 9] == 'A') + && (a[i - 8] == 'r' || a[i - 8] == 'R') + && (a[i - 7] == 't' || a[i - 7] == 'T') + && (a[i - 6] == 'i' || a[i - 6] == 'I') + && (a[i - 5] == 'c' || a[i - 5] == 'C') + && (a[i - 4] == 'i' || a[i - 4] == 'I') + && (a[i - 3] == 'p' || a[i - 3] == 'P') + && (a[i - 2] == 'a' || a[i - 2] == 'A') + && (a[i - 1] == 't' || a[i - 1] == 'T') + && (a[i] == 'e' || a[i] == 'E')) { + matchlen = 11; + mask |= ACTION_PARTICIPATE; + + } + else { + // parse error + throw new IllegalArgumentException( + "invalid permission: " + actions); + } + } + + // make sure we didn't just match the tail of a word + // like "ackbarfadmin". Also, skip to the comma. + seencomma = false; + while (i >= matchlen && !seencomma) { + switch (a[i - matchlen]) { + case ',' : + seencomma = true; + /* FALLTHROUGH */ + case ' ' : + case '\r' : + case '\n' : + case '\f' : + case '\t' : + break; + default : + throw new IllegalArgumentException( + "invalid permission: " + actions); + } + i--; + } + + // point i at the location of the comma minus one (or -1). + i -= matchlen; + } + + if (seencomma) { + throw new IllegalArgumentException("invalid permission: " + actions); + } + + return mask; + } + + /** + * Parse filter string into a Filter object. + * + * @param filterString The filter string to parse. + * @return a Filter for this bundle. + * @throws IllegalArgumentException If the filter syntax is invalid. + */ + private static Filter parseFilter(String filterString) { + filterString = filterString.trim(); + if (filterString.equals("*")) { + return null; + } + try { + return FrameworkUtil.createFilter(filterString); + } + catch (InvalidSyntaxException e) { + IllegalArgumentException iae = new IllegalArgumentException( + "invalid filter"); + iae.initCause(e); + throw iae; + } + } + + /** + * Determines if the specified permission is implied by this object. + * + *

    + * This method checks that the filter of the target is implied by the + * coordination name of this object. The list of + * {@code CoordinationPermission} actions must either match or allow for the + * list of the target object to imply the target + * {@code CoordinationPermission} action. + *

    + * + * @param p The requested permission. + * @return {@code true} if the specified permission is implied by this + * object; {@code false} otherwise. + */ + public boolean implies(Permission p) { + if (!(p instanceof CoordinationPermission)) { + return false; + } + CoordinationPermission requested = (CoordinationPermission) p; + if (bundle != null) { + return false; + } + // if requested permission has a filter, then it is an invalid argument + if (requested.filter != null) { + return false; + } + return implies0(requested, ACTION_NONE); + } + + /** + * Internal implies method. Used by the implies and the permission + * collection implies methods. + * + * @param requested The requested CoordinationPermission which has already + * be validated as a proper argument. The requested + * CoordinationPermission must not have a filter expression. + * @param effective The effective actions with which to start. + * @return {@code true} if the specified permission is implied by this + * object; {@code false} otherwise. + */ + boolean implies0(CoordinationPermission requested, int effective) { + /* check actions first - much faster */ + effective |= action_mask; + final int desired = requested.action_mask; + if ((effective & desired) != desired) { + return false; + } + /* Get filter */ + Filter f = filter; + if (f == null) { + // it's "*" + return true; + } + return f.matches(requested.getProperties()); + } + + /** + * Returns the canonical string representation of the + * {@code CoordinationPermission} actions. + * + *

    + * Always returns present {@code CoordinationPermission} actions in the + * following order: {@code admin}, {@code initiate}, {@code participate}. + * + * @return Canonical string representation of the + * {@code CoordinationPermission} actions. + */ + public String getActions() { + String result = actions; + if (result == null) { + StringBuffer sb = new StringBuffer(); + boolean comma = false; + + int mask = action_mask; + if ((mask & ACTION_ADMIN) == ACTION_ADMIN) { + sb.append(ADMIN); + comma = true; + } + + if ((mask & ACTION_INITIATE) == ACTION_INITIATE) { + if (comma) + sb.append(','); + sb.append(INITIATE); + comma = true; + } + + if ((mask & ACTION_PARTICIPATE) == ACTION_PARTICIPATE) { + if (comma) + sb.append(','); + sb.append(PARTICIPATE); + comma = true; + } + + actions = result = sb.toString(); + } + return result; + } + + /** + * Returns a new {@code PermissionCollection} object suitable for storing + * {@code CoordinationPermission} objects. + * + * @return A new {@code PermissionCollection} object. + */ + public PermissionCollection newPermissionCollection() { + return new CoordinationPermissionCollection(); + } + + /** + * Determines the equality of two {@code CoordinationPermission} objects. + * + * This method checks that specified permission has the same name and + * {@code CoordinationPermission} actions as this + * {@code CoordinationPermission} object. + * + * @param obj The object to test for equality with this + * {@code CoordinationPermission} object. + * @return {@code true} if {@code obj} is a {@code CoordinationPermission}, + * and has the same name and actions as this + * {@code CoordinationPermission} object; {@code false} otherwise. + */ + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (!(obj instanceof CoordinationPermission)) { + return false; + } + + CoordinationPermission cp = (CoordinationPermission) obj; + + return (action_mask == cp.action_mask) + && getName().equals(cp.getName()) + && ((bundle == cp.bundle) || ((bundle != null) && bundle + .equals(cp.bundle))); + } + + /** + * Returns the hash code value for this object. + * + * @return A hash code value for this object. + */ + public int hashCode() { + int h = 31 * 17 + getName().hashCode(); + h = 31 * h + getActions().hashCode(); + if (bundle != null) { + h = 31 * h + bundle.hashCode(); + } + return h; + } + + /** + * WriteObject is called to save the state of this permission object to a + * stream. The actions are serialized, and the superclass takes care of the + * name. + */ + private synchronized void writeObject(java.io.ObjectOutputStream s) + throws IOException { + if (bundle != null) { + throw new NotSerializableException("cannot serialize"); + } + // Write out the actions. The superclass takes care of the name + // call getActions to make sure actions field is initialized + if (actions == null) + getActions(); + s.defaultWriteObject(); + } + + /** + * readObject is called to restore the state of this permission from a + * stream. + */ + private synchronized void readObject(java.io.ObjectInputStream s) + throws IOException, ClassNotFoundException { + // Read in the action, then initialize the rest + s.defaultReadObject(); + setTransients(parseFilter(getName()), parseActions(actions)); + } + + /** + * Called by {@code <@link CoordinationPermission#implies(Permission)>}. + * This method is only called on a requested permission which cannot have a + * filter set. + * + * @return a map of properties for this permission. + */ + private Map getProperties() { + Map result = properties; + if (result != null) { + return result; + } + final Map map = new HashMap(5); + map.put("coordination.name", getName()); + if (bundle != null) { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + map.put("id", new Long(bundle.getBundleId())); + map.put("location", bundle.getLocation()); + String name = bundle.getSymbolicName(); + if (name != null) { + map.put("name", name); + } + SignerProperty signer = new SignerProperty(bundle); + if (signer.isBundleSigned()) { + map.put("signer", signer); + } + return null; + } + }); + } + return properties = map; + } +} + +/** + * Package private class used for filter matching on signer key during filter + * expression evaluation in the permission implies method. + * + * @Immutable + */ +final class SignerProperty { + private final Bundle bundle; + private final String pattern; + + /** + * String constructor used by the filter matching algorithm to construct + * a SignerProperty from the attribute value in a filter expression. + * + * @param pattern Attribute value in the filter expression. + */ + public SignerProperty(String pattern) { + this.pattern = pattern; + this.bundle = null; + } + + /** + * Used by the permission implies method to build the properties for a + * filter match. + * + * @param bundle The bundle whose signers are to be matched. + */ + SignerProperty(Bundle bundle) { + this.bundle = bundle; + this.pattern = null; + } + + /** + * Used by the filter matching algorithm. This methods does NOT satisfy + * the normal equals contract. Since the class is only used in filter + * expression evaluations, it only needs to support comparing an + * instance created with a Bundle to an instance created with a pattern + * string from the filter expression. + * + * @param o SignerProperty to compare against. + * @return true if the DN name chain matches the pattern. + */ + public boolean equals(Object o) { + if (!(o instanceof SignerProperty)) + return false; + SignerProperty other = (SignerProperty) o; + Bundle matchBundle = bundle != null ? bundle : other.bundle; + String matchPattern = bundle != null ? other.pattern : pattern; + Map> signers = matchBundle + .getSignerCertificates(Bundle.SIGNERS_TRUSTED); + for (List signerCerts : signers.values()) { + List dnChain = new ArrayList(signerCerts.size()); + for (X509Certificate signerCert : signerCerts) { + dnChain.add(signerCert.getSubjectDN().getName()); + } + try { + if (FrameworkUtil.matchDistinguishedNameChain(matchPattern, + dnChain)) { + return true; + } + } + catch (IllegalArgumentException e) { + continue; // bad pattern + } + } + return false; + } + + /** + * Since the equals method does not obey the general equals contract, + * this method cannot generate hash codes which obey the equals + * contract. + */ + public int hashCode() { + return 31; + } + + /** + * Check if the bundle is signed. + * + * @return true if constructed with a bundle that is signed. + */ + boolean isBundleSigned() { + if (bundle == null) { + return false; + } + Map> signers = bundle + .getSignerCertificates(Bundle.SIGNERS_TRUSTED); + return !signers.isEmpty(); + } +} + +/** + * Stores a set of {@code CoordinationPermission} permissions. + * + * @see java.security.Permission + * @see java.security.Permissions + * @see java.security.PermissionCollection + */ + +final class CoordinationPermissionCollection extends PermissionCollection { + static final long serialVersionUID = -3350758995234427603L; + /** + * Collection of permissions. + * + * @serial + * @GuardedBy this + */ + private Map permissions; + + /** + * Boolean saying if "*" is in the collection. + * + * @serial + * @GuardedBy this + */ + private boolean all_allowed; + + /** + * Create an empty CoordinationPermissions object. + */ + public CoordinationPermissionCollection() { + permissions = new HashMap(); + all_allowed = false; + } + + /** + * Adds a permission to this permission collection. + * + * @param permission The {@code CoordinationPermission} object to add. + * @throws IllegalArgumentException If the specified permission is not a + * {@code CoordinationPermission} instance or was constructed with a + * Bundle object. + * @throws SecurityException If this + * {@code CoordinationPermissionCollection} object has been marked + * read-only. + */ + public void add(final Permission permission) { + if (!(permission instanceof CoordinationPermission)) { + throw new IllegalArgumentException("invalid permission: " + + permission); + } + if (isReadOnly()) { + throw new SecurityException("attempt to add a Permission to a " + + "readonly PermissionCollection"); + } + + final CoordinationPermission cp = (CoordinationPermission) permission; + if (cp.bundle != null) { + throw new IllegalArgumentException("cannot add to collection: " + + cp); + } + + final String name = cp.getName(); + synchronized (this) { + Map pc = permissions; + final CoordinationPermission existing = pc.get(name); + if (existing != null) { + final int oldMask = existing.action_mask; + final int newMask = cp.action_mask; + if (oldMask != newMask) { + pc.put(name, new CoordinationPermission(existing.filter, + oldMask + | newMask)); + + } + } + else { + pc.put(name, cp); + } + + if (!all_allowed) { + if (name.equals("*")) { + all_allowed = true; + } + } + } + } + + /** + * Determines if the specified permissions implies the permissions expressed + * in {@code permission}. + * + * @param permission The Permission object to compare with this + * {@code CoordinationPermission} object. + * @return {@code true} if {@code permission} is a proper subset of a + * permission in the set; {@code false} otherwise. + */ + public boolean implies(final Permission permission) { + if (!(permission instanceof CoordinationPermission)) { + return false; + } + final CoordinationPermission requested = (CoordinationPermission) permission; + /* if requested permission has a filter, then it is an invalid argument */ + if (requested.filter != null) { + return false; + } + + int effective = CoordinationPermission.ACTION_NONE; + + Collection perms; + synchronized (this) { + Map pc = permissions; + /* short circuit if the "*" Permission was added */ + if (all_allowed) { + CoordinationPermission cp = pc.get("*"); + if (cp != null) { + effective |= cp.action_mask; + final int desired = requested.action_mask; + if ((effective & desired) == desired) { + return true; + } + } + } + perms = pc.values(); + } + /* iterate one by one over filteredPermissions */ + for (CoordinationPermission perm : perms) { + if (perm.implies0(requested, effective)) { + return true; + } + } + return false; + } + + /** + * Returns an enumeration of all {@code CoordinationPermission} objects in + * the container. + * + * @return Enumeration of all {@code CoordinationPermission} objects. + */ + public synchronized Enumeration elements() { + List all = new ArrayList(permissions.values()); + return Collections.enumeration(all); + } + + /* serialization logic */ + private static final ObjectStreamField[] serialPersistentFields = { + new ObjectStreamField("permissions", HashMap.class), + new ObjectStreamField("all_allowed", Boolean.TYPE) }; + + private synchronized void writeObject(ObjectOutputStream out) + throws IOException { + ObjectOutputStream.PutField pfields = out.putFields(); + pfields.put("permissions", permissions); + pfields.put("all_allowed", all_allowed); + out.writeFields(); + } + + private synchronized void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gfields = in.readFields(); + permissions = (HashMap) gfields.get( + "permissions", null); + all_allowed = gfields.get("all_allowed", false); + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/coordinator/Coordinator.java osgi-compendium-4.3.0/src/org/osgi/service/coordinator/Coordinator.java --- osgi-compendium-4.2.0/src/org/osgi/service/coordinator/Coordinator.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/coordinator/Coordinator.java 2011-08-18 14:13:16.000000000 +0000 @@ -0,0 +1,257 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2011). 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.coordinator; + +import java.util.Collection; + +/** + * A Coordinator service coordinates activities between different parties. + * + *

    + * A bundle can use the Coordinator service to create {@link Coordination} + * objects. Once a Coordination object is created, it can be + * {@link Coordination#push() pushed} on the thread local Coordination stack to + * be an implicit parameter as the current Coordination for calls to other + * parties, or it can be passed directly to other parties as an argument. The + * current Coordination, which is on the top of the current thread's thread + * local Coordination stack, can be obtained with {@link #peek()}. + * + *

    + * Any active Coordinations created by a bundle must be terminated when the + * bundle releases the Coordinator service. The Coordinator service must + * {@link Coordination#fail(Throwable) fail} these Coordinations with the + * {@link Coordination#RELEASED RELEASED} exception. + * + *

    + * A {@link Participant} can {@link Coordination#addParticipant(Participant) + * register} to participate in a Coordination and receive notification of the + * termination of the Coordination. + * + *

    + * The following example code shows a example usage of the Coordinator service. + * + *

    + * void foo() {
    + *   Coordination c = coordinator.begin("work", 0);
    + *   try {
    + *     doWork();
    + *   } catch (Exception e) {
    + *     c.fail(e);
    + *   } finally {
    + *     c.end();
    + *   }
    + * }
    + * 
    + * + * In the {@code doWork} method, code can be called that requires notification + * of the termination of the Coordination. The {@code doWork} method can then + * register a Participant with the Coordination. + * + *
    + * void doWork() {
    + *   if (coordinator.addParticipant(this)) {
    + *      beginWork();
    + *   } else {
    + *     beginWork();
    + *     finishWork();
    + *   }
    + * }
    + * 
    + * void ended(Coordination c) {
    + *   finishWork();
    + * }
    + * 
    + * void failed(Coordination c) {
    + *   undoWork();
    + * }
    + * 
    + * + * @ThreadSafe + * @noimplement + * @version $Id: 0de5b2dd348d68331f61f85f2aba7eb793b73d9d $ + */ +public interface Coordinator { + + /** + * Create a new Coordination. + * + * @param name The name of this coordination. The name does not have to be + * unique but must follow the {@code symbolic-name} syntax from the + * Core specification. + * @param timeMillis Timeout in milliseconds. A value of 0 means no timeout. + * If the Coordination is not terminated within the timeout, the + * Coordinator service will {@link Coordination#fail(Throwable) fail} + * the Coordination with a {@link Coordination#TIMEOUT TIMEOUT} + * exception. + * @return The new Coordination object. + * @throws IllegalArgumentException If the specified name does not follow + * the {@code symbolic-name} syntax or the specified time is + * negative. + * @throws SecurityException If the caller does not have + * {@code CoordinationPermission[INITIATE]} for the specified name + * and creating bundle. + */ + Coordination create(String name, long timeMillis); + + /** + * Create a new Coordination and make it the {@link #peek() current + * Coordination}. + * + *

    + * This method does that same thing as calling {@link #create(String, long) + * create(name, timeMillis)}.{@link Coordination#push() push()} + * + * @param name The name of this coordination. The name does not have to be + * unique but must follow the {@code symbolic-name} syntax from the + * Core specification. + * @param timeMillis Timeout in milliseconds. A value of 0 means no timeout. + * If the Coordination is not terminated within the timeout, the + * Coordinator service will {@link Coordination#fail(Throwable) fail} + * the Coordination with a {@link Coordination#TIMEOUT TIMEOUT} + * exception. + * @return A new Coordination object + * @throws IllegalArgumentException If the specified name does not follow + * the {@code symbolic-name} syntax or the specified time is + * negative. + * @throws SecurityException If the caller does not have + * {@code CoordinationPermission[INITIATE]} for the specified name + * and creating bundle. + */ + Coordination begin(String name, long timeMillis); + + /** + * Returns the current Coordination. + * + *

    + * The current Coordination is the Coordination at the top of the thread + * local Coordination stack. If the thread local Coordination stack is + * empty, there is no current Coordination. Each Coordinator service + * maintains thread local Coordination stacks. + * + *

    + * This method does not alter the thread local Coordination stack. + * + * @return The current Coordination or {@code null} if the thread local + * Coordination stack is empty. + */ + Coordination peek(); + + /** + * Remove the current Coordination from the thread local Coordination stack. + * + *

    + * The current Coordination is the Coordination at the top of the thread + * local Coordination stack. If the thread local Coordination stack is + * empty, there is no current Coordination. Each Coordinator service + * maintains its own thread local Coordination stacks. + * + *

    + * This method alters the thread local Coordination stack, if it is not + * empty, by removing the Coordination at the top of the thread local + * Coordination stack. + * + * @return The Coordination that was the current Coordination or + * {@code null} if the thread local Coordination stack is empty. + * @throws SecurityException If the caller does not have + * {@code CoordinationPermission[INITIATE]} for the current + * Coordination. + */ + Coordination pop(); + + /** + * Terminate the {@link #peek() current Coordination} as a failure with the + * specified failure cause. + * + *

    + * If there is no current Coordination, this method does nothing and returns + * {@code false}. + * + *

    + * Otherwise, this method returns the result from calling + * {@link Coordination#fail(Throwable)} with the specified failure cause on + * the current Coordination. + * + * @param cause The failure cause. The failure cause must not be + * {@code null} . + * @return {@code false} if there was no current Coordination, otherwise + * returns the result from calling + * {@link Coordination#fail(Throwable)} on the current Coordination. + * @throws SecurityException If the caller does not have + * {@code CoordinationPermission[PARTICIPATE]} for the current + * Coordination. + * @see Coordination#fail(Throwable) + */ + boolean fail(Throwable cause); + + /** + * Register a Participant with the {@link #peek() current Coordination}. + * + *

    + * If there is no current Coordination, this method does nothing and returns + * {@code false}. + * + *

    + * Otherwise, this method calls + * {@link Coordination#addParticipant(Participant)} with the specified + * Participant on the current Coordination and returns {@code true}. + * + * @param participant The Participant to register with the current + * Coordination. The participant must not be {@code null}. + * @return {@code false} if there was no current Coordination, otherwise + * returns {@code true}. + * @throws CoordinationException If the Participant could not be registered + * with the current Coordination. This exception should normally not + * be caught by the caller but allowed to be caught by the initiator + * of this Coordination. + * @throws SecurityException If the caller does not have + * {@code CoordinationPermission[PARTICIPATE]} for the current + * Coordination. + * @see Coordination#addParticipant(Participant) + */ + boolean addParticipant(Participant participant); + + /** + * Returns a snapshot of all active Coordinations. + * + *

    + * Since Coordinations can be terminated at any time, Coordinations in the + * returned collection can be terminated before the caller examines the + * returned collection. + * + *

    + * The returned collection must only contain the Coordinations for which the + * caller has {@code CoordinationPermission[ADMIN]}. + * + * @return A snapshot of all active Coordinations. If there are no active + * Coordinations, the returned list will be empty. The returned + * collection is the property of the caller and can be modified by + * the caller. + */ + Collection getCoordinations(); + + /** + * Returns the Coordination with the specified id. + * + * @param id The id of the requested Coordination. + * @return A Coordination having with specified id or {@code null} if no + * Coordination with the specified id exists, the Coordination with + * the specified id is {@link Coordination#isTerminated() + * terminated} or the caller does not have + * {@code CoordinationPermission[ADMIN]} for the Coordination with + * the specified id. + */ + Coordination getCoordination(long id); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/coordinator/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/coordinator/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/coordinator/packageinfo 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/coordinator/packageinfo 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1 @@ +version 1.0 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/coordinator/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/coordinator/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/coordinator/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/coordinator/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Coordinator Package Version 1.0. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.coordinator; version="[1.0,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.coordinator; version="[1.0,1.1)"} + * + * @version $Id: a48f965a7fbabafad167e82d6dd9ece79e19d977 $ + */ + +package org.osgi.service.coordinator; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/coordinator/Participant.java osgi-compendium-4.3.0/src/org/osgi/service/coordinator/Participant.java --- osgi-compendium-4.2.0/src/org/osgi/service/coordinator/Participant.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/coordinator/Participant.java 2011-05-16 12:29:18.000000000 +0000 @@ -0,0 +1,87 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2011). 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.coordinator; + +/** + * A Participant participates in a Coordination. + * + *

    + * A Participant can participate in a Coordination by + * {@link Coordination#addParticipant(Participant) registering} itself with the + * Coordination. After successfully registering itself, the Participant is + * notified when the Coordination is terminated. + * + *

    + * If a Coordination terminates {@link Coordination#end() normally}, then all + * registered Participants are notified on their {@link #ended(Coordination)} + * method. If the Coordination terminates as a + * {@link Coordination#fail(Throwable) failure}, then all registered + * Participants are notified on their {@link #failed(Coordination)} method. + * + *

    + * Participants are required to be thread safe as notification can be made on + * any thread. + * + *

    + * A Participant can only be registered with a single active Coordination at a + * time. If a Participant is already registered with an active Coordination, + * attempts to register the Participation with another active Coordination will + * block until the Coordination the Participant is registered with terminates. + * Notice that in edge cases the notification to the Participant that the + * Coordination has terminated can happen before the registration method + * returns. + * + * @ThreadSafe + * @version $Id: 52e3d84eb0cb8a8cc04c4ca787dde8db81c0140d $ + */ +public interface Participant { + /** + * Notification that a Coordination has terminated + * {@link Coordination#end() normally}. + * + *

    + * This Participant should finalize any work associated with the specified + * Coordination. + * + * @param coordination The Coordination that has terminated normally. + * @throws Exception If this Participant throws an exception, the + * {@link Coordinator} service should log the exception. The + * {@link Coordination#end()} method which is notifying this + * Participant must continue notification of other registered + * Participants. When this is completed, the + * {@link Coordination#end()} method must throw a + * CoordinationException of type + * {@link CoordinationException#PARTIALLY_ENDED}. + */ + void ended(Coordination coordination) throws Exception; + + /** + * Notification that a Coordination has terminated as a + * {@link Coordination#fail(Throwable) failure}. + * + *

    + * This Participant should discard any work associated with the specified + * Coordination. + * + * @param coordination The Coordination that has terminated as a failure. + * @throws Exception If this Participant throws an exception, the + * {@link Coordinator} service should log the exception. The + * {@link Coordination#fail(Throwable)} method which is notifying + * this Participant must continue notification of other registered + * Participants. + */ + void failed(Coordination coordination) throws Exception; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentAdmin.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentAdmin.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentAdmin.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentAdmin.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -47,10 +47,10 @@ * with this new version even if it is older (downgrade). If the two versions are the same, then this * method simply returns with the old (target) Deployment Package without any action. * - * @param in the input stream the Deployment Package can be read from. It mustn't be null. + * @param in the input stream the Deployment Package can be read from. It mustn't be {@code null}. * @return A DeploymentPackage object representing the newly installed/updated Deployment Package. - * It is never null. - * @throws IllegalArgumentException if the got InputStream parameter is null + * It is never {@code null}. + * @throws IllegalArgumentException if the got InputStream parameter is {@code null} * @throws DeploymentException if the installation was not successful. For detailed error code description * see {@link DeploymentException}. * @throws SecurityException if the caller doesn't have the appropriate @@ -72,11 +72,11 @@ * * During an installation of an existing package (update) or during an uninstallation, * the target must remain in this list until the installation (uninstallation) process - * is completed, after which the source (or null in case of uninstall) + * is completed, after which the source (or {@code null} in case of uninstall) * replaces the target. * - * @return the array of DeploymentPackage objects representing all the - * installed Deployment Packages. The return value cannot be null. + * @return the array of {@code DeploymentPackage} objects representing all the + * installed Deployment Packages. The return value cannot be {@code null}. * In case of missing permissions it may give back an empty array. * @see DeploymentPackage * @see DeploymentAdminPermission @@ -89,15 +89,15 @@ * * During an installation of an existing package (update) or during an uninstallation, * the target Deployment Package must remain the return value until the installation - * (uninstallation) process is completed, after which the source (or null + * (uninstallation) process is completed, after which the source (or {@code null} * in case of uninstall) is the return value. * * @param symbName the symbolic name of the Deployment Package to be retrieved. It mustn't be - * null. - * @return The DeploymentPackage for the given symbolic name. + * {@code null}. + * @return The {@code DeploymentPackage} for the given symbolic name. * If there is no Deployment Package with that symbolic name currently installed, - * null is returned. - * @throws IllegalArgumentException if the given symbName is null + * {@code null} is returned. + * @throws IllegalArgumentException if the given {@code symbName} is {@code null} * @throws SecurityException if the caller doesn't have the appropriate * {@link DeploymentAdminPermission}("<filter>", "list") permission. * @see DeploymentPackage @@ -112,9 +112,9 @@ * Deployment Package by the Symbolic Name of the bundle.

    * * @param bundle the bundle whose owner is queried - * @return the Deployment Package Object that owns the bundle or null if the bundle doesn't + * @return the Deployment Package Object that owns the bundle or {@code null} if the bundle doesn't * belong to any Deployment Packages (standalone bundles) - * @throws IllegalArgumentException if the given bundle is null + * @throws IllegalArgumentException if the given {@code bundle} is {@code null} * @throws SecurityException if the caller doesn't have the appropriate * {@link DeploymentAdminPermission}("<filter>", "list") permission. * @see DeploymentPackage diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentAdminPermission.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentAdminPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentAdminPermission.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentAdminPermission.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2011). 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. @@ -27,99 +27,124 @@ import org.osgi.framework.Bundle; /** - * DeploymentAdminPermission controls access to the Deployment Admin service.

    + * DeploymentAdminPermission controls access to the Deployment Admin service. + *

    * - * The permission uses a filter string formatted similarly to the {@link org.osgi.framework.Filter}. - * The filter determines the target of the permission. The DeploymentAdminPermission uses the - * name and the signer filter attributes only. The value of the signer - * attribute is matched against the signer chain (represented with its semicolon separated Distinguished Name chain) - * of the Deployment Package, and the value of the name attribute is matched against the value of the - * "DeploymentPackage-Name" manifest header of the Deployment Package. Example: + * The permission uses a filter string formatted similarly to the + * {@link org.osgi.framework.Filter}. The filter determines the target of the + * permission. The {@code DeploymentAdminPermission} uses the {@code name} and + * the {@code signer} filter attributes only. The value of the {@code signer} + * attribute is matched against the signer chain (represented with its semicolon + * separated Distinguished Name chain) of the Deployment Package, and the value + * of the {@code name} attribute is matched against the value of the + * "DeploymentPackage-Name" manifest header of the Deployment Package. Example: * *

      - *
    • (signer=cn = Bugs Bunny, o = ACME, c = US)
    • - *
    • (name=org.osgi.ExampleApp)
    • + *
    • (signer=cn = Bugs Bunny, o = ACME, c = US)
    • + *
    • (name=org.osgi.ExampleApp)
    • *
    * - * Wildcards also can be used:

    + * Wildcards also can be used: + *

    * *

    - * (signer=cn=*,o=ACME,c=*)  
    + * (signer=cn=*,o=ACME,c=*)
      * 
    + * * "cn" and "c" may have an arbitrary value * *
    - * (signer=*, o=ACME, c=US)  
    + * (signer=*, o=ACME, c=US)
      * 
    + * * Only the value of "o" and "c" are significant * *
      * (signer=* ; ou=S & V, o=Tweety Inc., c=US)
      * 
    - * The first element of the certificate chain is - * not important, only the second (the - * Distinguished Name of the root certificate) + * + * The first element of the certificate chain is not important, only the second + * (the Distinguished Name of the root certificate) * *
      * (signer=- ; *, o=Tweety Inc., c=US)
      * 
    - * The same as the previous but '-' represents - * zero or more certificates, whereas the asterisk - * only represents a single certificate + * + * The same as the previous but '-' represents zero or more certificates, + * whereas the asterisk only represents a single certificate * *
    - * (name=*)                  
    + * (name=*)
      * 
    + * * The name of the Deployment Package doesn't matter * *
    - * (name=org.osgi.*)         
    + * (name=org.osgi.*)
      * 
    + * * The name has to begin with "org.osgi." * - *

    The following actions are allowed:

    + *

    + * The following actions are allowed: + *

    * * list *

    - * A holder of this permission can access the inventory information of the deployment - * packages selected by the <filter> string. The filter selects the deployment packages - * on which the holder of the permission can acquire detailed inventory information. - * See {@link DeploymentAdmin#getDeploymentPackage(Bundle)}, + * A holder of this permission can access the inventory information of the + * deployment packages selected by the <filter> string. The filter selects + * the deployment packages on which the holder of the permission can acquire + * detailed inventory information. See + * {@link DeploymentAdmin#getDeploymentPackage(Bundle)}, * {@link DeploymentAdmin#getDeploymentPackage(String)} and - * {@link DeploymentAdmin#listDeploymentPackages}.

    + * {@link DeploymentAdmin#listDeploymentPackages}. + *

    * - * install

    + * install + *

    * - * A holder of this permission can install/update deployment packages if the deployment - * package satisfies the <filter> string. See {@link DeploymentAdmin#installDeploymentPackage}.

    + * A holder of this permission can install/update deployment packages if the + * deployment package satisfies the <filter> string. See + * {@link DeploymentAdmin#installDeploymentPackage}. + *

    * - * uninstall

    + * uninstall + *

    * - * A holder of this permission can uninstall deployment packages if the deployment - * package satisfies the <filter> string. See {@link DeploymentPackage#uninstall}.

    + * A holder of this permission can uninstall deployment packages if the + * deployment package satisfies the <filter> string. See + * {@link DeploymentPackage#uninstall()}. + *

    * - * uninstall_forced

    + * uninstall_forced + *

    * - * A holder of this permission can forcefully uninstall deployment packages if the deployment - * package satisfies the <filter> string. See {@link DeploymentPackage#uninstallForced}.

    + * A holder of this permission can forcefully uninstall deployment packages if + * the deployment package satisfies the <filter> string. See + * {@link DeploymentPackage#uninstallForced()}. + *

    * - * cancel

    + * cancel + *

    * - * A holder of this permission can cancel an active deployment action. This action being - * canceled could correspond to the install, update or uninstall of a deployment package - * that satisfies the <filter> string. See {@link DeploymentAdmin#cancel}

    + * A holder of this permission can cancel an active deployment action. This + * action being canceled could correspond to the install, update or uninstall of + * a deployment package that satisfies the <filter> string. See + * {@link DeploymentAdmin#cancel()} + *

    * - * metadata

    + * metadata + *

    * - * A holder of this permission is able to retrieve metadata information about a Deployment - * Package (e.g. is able to ask its manifest headers). - * See {@link org.osgi.service.deploymentadmin.DeploymentPackage#getBundle(String)}, + * A holder of this permission is able to retrieve metadata information about a + * Deployment Package (e.g. is able to ask its manifest headers). See + * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getBundle(String)}, * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getBundleInfos()}, - * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getHeader(String)}, + * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getHeader(String)}, * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getResourceHeader(String, String)}, - * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getResourceProcessor(String)}, - * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getResources()}

    - * + * {@link org.osgi.service.deploymentadmin.DeploymentPackage#getResourceProcessor(String)}, {@link org.osgi.service.deploymentadmin.DeploymentPackage#getResources()} + *

    + * * The actions string is converted to lower case before processing. */ public final class DeploymentAdminPermission extends Permission { @@ -158,12 +183,13 @@ * @see DeploymentPackage#uninstallForced() */ public static final String UNINSTALL_FORCED = "uninstall_forced"; - - /** - * Constant String to the "cancel" action.

    - * - * @see DeploymentAdmin#cancel - */ + + /** + * Constant String to the "cancel" action. + *

    + * + * @see DeploymentAdmin#cancel() + */ public static final String CANCEL = "cancel"; /** @@ -198,10 +224,10 @@ } /** - * Creates a new DeploymentAdminPermission object for the given name and - * action.

    - * The name parameter identifies the target deployment package the permission - * relates to. The actions parameter contains the comma separated list of allowed actions. + * Creates a new {@code DeploymentAdminPermission} object for the given {@code name} and + * {@code action}.

    + * The {@code name} parameter identifies the target deployment package the permission + * relates to. The {@code actions} parameter contains the comma separated list of allowed actions. * * @param name filter string, must not be null. * @param actions action string, must not be null. "*" means all the possible actions. @@ -264,7 +290,7 @@ /** * Returns the String representation of the action list.

    * The method always gives back the actions in the following (alphabetical) order: - * cancel, install, list, metadata, uninstall, uninstall_forced + * {@code cancel, install, list, metadata, uninstall, uninstall_forced} * * @return Action list of this permission instance. This is a comma-separated * list that reflects the action parameter of the constructor. @@ -281,8 +307,8 @@ * by the {@link org.osgi.framework.Filter} rules and the "OSGi Service Platform, Core * Specification Release 4, Chapter Certificate Matching".

    * - * The allowed attributes are: name (the symbolic name of the deployment - * package) and signer (the signer of the deployment package). In both cases + * The allowed attributes are: {@code name} (the symbolic name of the deployment + * package) and {@code signer} (the signer of the deployment package). In both cases * wildcards can be used.

    * * Examples: diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentException.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentException.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentException.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentException.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -20,7 +20,7 @@ /** * Checked exception received when something fails during any deployment - * processes. A DeploymentException always contains an error code + * processes. A {@code DeploymentException} always contains an error code * (one of the constants specified in this class), and may optionally contain * the textual description of the error condition and a nested cause exception. */ @@ -146,7 +146,7 @@ * An artifact of any resource already exists.

    * * This exception is thrown when the called resource processor throws a - * ResourceProcessorException with the + * {@code ResourceProcessorException} with the * {@link org.osgi.service.deploymentadmin.spi.ResourceProcessorException#CODE_RESOURCE_SHARING_VIOLATION} * error code.

    * @@ -157,7 +157,7 @@ /** * Exception with this error code is thrown when one of the Resource Processors - * involved in the deployment session threw a ResourceProcessorException with the + * involved in the deployment session threw a {@code ResourceProcessorException} with the * {@link org.osgi.service.deploymentadmin.spi.ResourceProcessorException#CODE_PREPARE} error * code.

    * @@ -169,7 +169,7 @@ /** * Other error condition.

    * - * All Deployment Admin methods which throw DeploymentException + * All Deployment Admin methods which throw {@code DeploymentException} * can throw an exception with this error code if the error condition cannot be * categorized. */ @@ -177,7 +177,7 @@ /** * The Resource Processor service with the given PID (see - * Resource-Processor manifest header) is not found.

    + * {@code Resource-Processor} manifest header) is not found.

    * * {@link DeploymentAdmin#installDeploymentPackage(InputStream)}, * {@link DeploymentPackage#uninstall()} and @@ -206,7 +206,7 @@ * Create an instance of the exception. * * @param code The error code of the failure. Code should be one of the - * predefined integer values (CODE_X). + * predefined integer values ({@code CODE_X}). * @param message Message associated with the exception * @param cause the originating exception */ @@ -220,7 +220,7 @@ * null. * * @param code The error code of the failure. Code should be one of the - * predefined integer values (CODE_X). + * predefined integer values ({@code CODE_X}). * @param message Message associated with the exception */ public DeploymentException(int code, String message) { @@ -233,7 +233,7 @@ * implicitly set to null. * * @param code The error code of the failure. Code should be one of the - * predefined integer values (CODE_X). + * predefined integer values ({@code CODE_X}). */ public DeploymentException(int code) { super(); @@ -241,10 +241,10 @@ } /** - * Returns the cause of this exception or null if no cause was + * Returns the cause of this exception or {@code null} if no cause was * set. * - * @return The cause of this exception or null if no cause was + * @return The cause of this exception or {@code null} if no cause was * set. */ public Throwable getCause() { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentPackage.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentPackage.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/DeploymentPackage.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/DeploymentPackage.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2011). 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. @@ -23,7 +23,7 @@ import org.osgi.framework.Version; /** - * The DeploymentPackage object represents a deployment package + * The {@code DeploymentPackage} object represents a deployment package * (already installed or being currently processed). A Deployment Package groups * resources as a unit of management. A deployment package is something that can * be installed, updated, and uninstalled as a unit. A deployment package is a @@ -52,7 +52,7 @@ *

    * * If a deployment package is being updated the old version is visible through - * the DeploymentPackage interface until the update process ends. + * the {@code DeploymentPackage} interface until the update process ends. * After the package is updated the updated version is visible and the old one * is not accessible any more. */ @@ -111,10 +111,10 @@ *

  • {@link #uninstallForced()}
  • * * - * @return true if the deployment package is stale. - * false otherwise - * @see #uninstall - * @see #uninstallForced + * @return {@code true} if the deployment package is stale. {@code false} + * otherwise + * @see #uninstall() + * @see #uninstallForced() */ boolean isStale(); @@ -129,11 +129,11 @@ * Returns the Deployment Package human readable name. * * This method returns the localized human readable name as set with the - * DeploymentPackage-Name manifest header using the default - * locale. If no header is set, this method will return null. + * {@code DeploymentPackage-Name} manifest header using the default + * locale. If no header is set, this method will return {@code null}. * * @return The human readable name of the deployment package or - * null if header is not set. + * {@code null} if header is not set. * @since 1.1 */ String getDisplayName(); @@ -150,7 +150,7 @@ * specified in the manifest of this deployment package. Its size is equal * to the number of the bundles in the deployment package. * - * @return array of BundleInfo objects + * @return array of {@code BundleInfo} objects * @throws SecurityException * if the caller doesn't have the appropriate * {@link DeploymentAdminPermission} with "metadata" action @@ -161,15 +161,15 @@ * Returns a URL pointing to an image that represents the icon for this * Deployment Package. * - * The DeploymentPackage-Icon header can set an icon for the + * The {@code DeploymentPackage-Icon} header can set an icon for the * the deployment package. This method returns an absolute URL that is * defined by this header. The Deployment Admin service must provide this * icon as a local resource. That is, the Deployment Admin must make a local - * copy of the specified icon. The returned URL's must point to + * copy of the specified icon. The returned {@code URL}'s must point to * a local resource. * * @return An absolute URL to a local (device resident) image resource or - * null if not found + * {@code null} if not found * @since 1.1 */ URL getIcon(); @@ -177,7 +177,7 @@ /** * Returns the bundle instance, which is part of this deployment package, * that corresponds to the bundle's symbolic name passed in the - * symbolicName parameter. This method will return null for + * {@code symbolicName} parameter. This method will return null for * request for bundles that are not part of this deployment package. *

    * @@ -188,7 +188,7 @@ * * @param symbolicName * the symbolic name of the requested bundle - * @return The Bundle instance for a given bundle symbolic + * @return The {@code Bundle} instance for a given bundle symbolic * name. * @throws SecurityException * if the caller doesn't have the appropriate @@ -242,7 +242,7 @@ * @param resource * the name of the resource (it is the same as the value of the * "Name" attribute in the deployment package's manifest) - * @return resource processor for the resource or null. + * @return resource processor for the resource or {@code null}. * @throws SecurityException if the caller doesn't have the appropriate {@link DeploymentAdminPermission} * with "metadata" action * @throws IllegalStateException if the package is stale @@ -261,7 +261,7 @@ * * @param header * the requested header - * @return the value of the header or null if the header does + * @return the value of the header or {@code null} if the header does * not exist * @throws SecurityException * if the caller doesn't have the appropriate @@ -284,7 +284,7 @@ * "Name" attribute in the deployment package's manifest) * @param header * the requested header - * @return the value of the header or null if the resource or + * @return the value of the header or {@code null} if the resource or * the header doesn't exist * @throws SecurityException * if the caller doesn't have the appropriate @@ -295,7 +295,7 @@ /** * Uninstalls the deployment package. After uninstallation, the deployment * package object becomes stale. This can be checked by using - * {@link #isStale()}, which will return true when stale. + * {@link #isStale()}, which will return {@code true} when stale. *

    * * @throws DeploymentException @@ -316,27 +316,23 @@ * couldn't be uninstalled using traditional means ({@link #uninstall()}) * due to exceptions. After uninstallation, the deployment package object * becomes stale. This can be checked by using {@link #isStale()}, which - * will return true when stale. + * will return {@code true} when stale. *

    * * The method forces removal of the Deployment Package from the repository * maintained by the Deployment Admin service. This method follows the same - * steps as {@link #uninstall}. However, any errors or the absence of + * steps as {@link #uninstall()}. However, any errors or the absence of * Resource Processor services are ignored, they must not cause a roll back. * These errors should be logged. * * @return true if the operation was successful - * @throws DeploymentException - * only {@link DeploymentException#CODE_TIMEOUT} and - * {@link DeploymentException#CODE_CANCELLED} can be thrown. For - * detailed error code description see - * {@link DeploymentException}. - * @throws SecurityException - * if the caller doesn't have the appropriate - * {@link DeploymentAdminPermission}("<filter>", - * "uninstall_forced") permission. - * @throws IllegalStateException - * if the package is stale + * @throws DeploymentException only {@link DeploymentException#CODE_TIMEOUT} + * and {@link DeploymentException#CODE_CANCELLED} can be thrown. For + * detailed error code description see {@link DeploymentException}. + * @throws SecurityException if the caller doesn't have the appropriate + * {@link DeploymentAdminPermission}("<filter>", + * "uninstall_forced") permission. + * @throws IllegalStateException if the package is stale */ boolean uninstallForced() throws DeploymentException; @@ -352,10 +348,9 @@ * deployment packages are equal if they have the same deployment package * symbolic name and version. * - * @param other - * the reference object with which to compare. - * @return true if this object is the same as the other argument; false - * otherwise. + * @param other the reference object with which to compare. + * @return true if this object is the same as the {@code other} argument; + * false otherwise. */ boolean equals(Object other); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/package.html osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

    Deployment 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. -For example: -

    -Import-Package: org.osgi.service.deploymentadmin; version="[1.1,2.0)"
    -
    - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Deployment 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. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.deploymentadmin; version="[1.1,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.deploymentadmin; version="[1.1,1.2)"} + * + * @version $Id: e0715bf01a0adbbd55cd771a53f8771f856015fb $ + */ + +package org.osgi.service.deploymentadmin; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,6 +1,5 @@ /* - * - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2011). 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. @@ -24,19 +23,25 @@ import java.security.PermissionCollection; import java.security.PrivilegedAction; +import org.osgi.framework.Bundle; import org.osgi.service.deploymentadmin.DeploymentAdminPermission; /** - * The DeploymentCustomizerPermission permission gives the right to - * Resource Processors to access a bundle's (residing in a Deployment Package) private area. - * The bundle and the Resource Processor (customizer) have to be in the same Deployment Package.

    + * The {@code DeploymentCustomizerPermission} permission gives the right to + * Resource Processors to access a bundle's (residing in a Deployment Package) + * private area. The bundle and the Resource Processor (customizer) have to be + * in the same Deployment Package. + *

    * - * The Resource Processor that has this permission is allowed to access the bundle's - * private area by calling the {@link DeploymentSession#getDataFile} method during the session - * (see {@link DeploymentSession}). After the session ends the FilePermissions are withdrawn. - * The Resource Processor will have FilePermission with "read", "write" and "delete" - * actions for the returned {@link java.io.File} that represents the the base directory of the - * persistent storage area and for its subdirectories.

    + * The Resource Processor that has this permission is allowed to access the + * bundle's private area by calling the + * {@link DeploymentSession#getDataFile(Bundle)} method during the session (see + * {@link DeploymentSession}). After the session ends the FilePermissions are + * withdrawn. The Resource Processor will have {@code FilePermission} with + * "read", "write" and "delete" actions for the returned {@link java.io.File} + * that represents the the base directory of the persistent storage area and for + * its subdirectories. + *

    * * The actions string is converted to lowercase before processing. */ @@ -71,31 +76,37 @@ }}); } - /** - * Creates a new DeploymentCustomizerPermission object for the given - * name and action.

    - * - * The name parameter is a filter string. This filter has the same syntax as an OSGi filter - * but only the "name" attribute is allowed. The value of the attribute - * is a Bundle Symbolic Name that represents a bundle. The only allowed action is the - * "privatearea" action. E.g. - * - *

    -     * 		Permission perm = new DeploymentCustomizerPermission("(name=com.acme.bundle)", "privatearea");
    -     * 
    - * - * The Resource Processor that has this permission is allowed to access the bundle's - * private area by calling the {@link DeploymentSession#getDataFile} method. The - * Resource Processor will have FilePermission with "read", "write" and "delete" - * actions for the returned {@link java.io.File} and its subdirectories during the deployment - * session. - * - * @param name Bundle Symbolic Name of the target bundle, must not be null. - * @param actions action string (only the "privatearea" or "*" action is valid; "*" means all - * the possible actions), must not be null. - * @throws IllegalArgumentException if the filter is invalid, the list of actions - * contains unknown operations or one of the parameters is null - */ + /** + * Creates a new {@code DeploymentCustomizerPermission} object for the given + * {@code name} and {@code action}. + *

    + * + * The name parameter is a filter string. This filter has the same syntax as + * an OSGi filter but only the "name" attribute is allowed. The value of the + * attribute is a Bundle Symbolic Name that represents a bundle. The only + * allowed action is the "privatearea" action. E.g. + * + *

    +	 * Permission	perm	= new DeploymentCustomizerPermission(
    +	 * 							"(name=com.acme.bundle)", "privatearea");
    +	 * 
    + * + * The Resource Processor that has this permission is allowed to access the + * bundle's private area by calling the + * {@link DeploymentSession#getDataFile(Bundle)} method. The Resource + * Processor will have {@code FilePermission} with "read", "write" and + * "delete" actions for the returned {@link java.io.File} and its + * subdirectories during the deployment session. + * + * @param name Bundle Symbolic Name of the target bundle, must not be + * {@code null}. + * @param actions action string (only the "privatearea" or "*" action is + * valid; "*" means all the possible actions), must not be + * {@code null}. + * @throws IllegalArgumentException if the filter is invalid, the list of + * actions contains unknown operations or one of the parameters is + * {@code null} + */ public DeploymentCustomizerPermission(String name, String actions) { super(name); try { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/DeploymentSession.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/DeploymentSession.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/DeploymentSession.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/DeploymentSession.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -36,8 +36,8 @@ *
  • it has no resources * (see {@link DeploymentPackage#getResources()})
  • *
  • it has no headers except
    - * DeploymentPackage-SymbolicName and
    - * DeploymentPackage-Version
    + * {@code DeploymentPackage-SymbolicName} and
    + * {@code DeploymentPackage-Version}
    * (see {@link DeploymentPackage#getHeader(String)})
  • *
  • it has no resource headers (see * {@link DeploymentPackage#getResourceHeader(String, String)})
  • @@ -52,7 +52,7 @@ /** * If the deployment action is an update or an uninstall, this call returns - * the DeploymentPackage instance for the installed deployment package. If the + * the {@code DeploymentPackage} instance for the installed deployment package. If the * deployment action is an install, this call returns the empty deployment package (see * {@link DeploymentPackage}). * @@ -63,7 +63,7 @@ /** * If the deployment action is an install or an update, this call returns - * the DeploymentPackage instance that corresponds to the deployment package + * the {@code DeploymentPackage} instance that corresponds to the deployment package * being streamed in for this session. If the deployment action is an uninstall, this call * returns the empty deployment package (see {@link DeploymentPackage}). * diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/package.html osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - -

    Deployment Admin SPI Package Version 1.0. -The SPI is used by Resource Processors. -

    Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

    -Import-Package: org.osgi.service.deploymentadmin.spi; version="[1.0,2.0)"
    -
    - - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * 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. + */ + +/** + * Deployment Admin SPI Package Version 1.0. + * The SPI is used by Resource Processors. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.deploymentadmin.spi; version="[1.0,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.deploymentadmin.spi; version="[1.0,1.1)"} + * + * @version $Id: 7d1c2f2d315c8e8a18549c69c52679ad751b0818 $ + */ + +package org.osgi.service.deploymentadmin.spi; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessorException.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessorException.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessorException.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessorException.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -19,7 +19,7 @@ /** * Checked exception received when something fails during a call to a Resource - * Processor. A ResourceProcessorException always contains an error + * Processor. A {@code ResourceProcessorException} always contains an error * code (one of the constants specified in this class), and may optionally contain * the textual description of the error condition and a nested cause exception. */ @@ -51,7 +51,7 @@ /** * Other error condition.

    * - * All Resource Processor methods which throw ResourceProcessorException + * All Resource Processor methods which throw {@code ResourceProcessorException} * is allowed throw an exception with this error code if the error condition cannot be * categorized. */ @@ -63,7 +63,7 @@ * Create an instance of the exception. * * @param code The error code of the failure. Code should be one of the - * predefined integer values (CODE_X). + * predefined integer values ({@code CODE_X}). * @param message Message associated with the exception * @param cause the originating exception */ @@ -77,7 +77,7 @@ * null. * * @param code The error code of the failure. Code should be one of the - * predefined integer values (CODE_X). + * predefined integer values ({@code CODE_X}). * @param message Message associated with the exception */ public ResourceProcessorException(int code, String message) { @@ -90,7 +90,7 @@ * implicitly set to null. * * @param code The error code of the failure. Code should be one of the - * predefined integer values (CODE_X). + * predefined integer values ({@code CODE_X}). */ public ResourceProcessorException(int code) { super(); @@ -98,10 +98,10 @@ } /** - * Returns the cause of this exception or null if no cause was + * Returns the cause of this exception or {@code null} if no cause was * set. * - * @return The cause of this exception or null if no cause was + * @return The cause of this exception or {@code null} if no cause was * set. */ public Throwable getCause() { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessor.java osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessor.java --- osgi-compendium-4.2.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessor.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/deploymentadmin/spi/ResourceProcessor.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -23,7 +23,7 @@ * in deployment packages. Resource Processors expose their services as standard OSGi services. * Bundles exporting the service may arrive in the deployment package (customizers) or may be * preregistered (they are installed previously). Resource processors has to define the - * service.pid standard OSGi service property which should be a unique string.

    + * {@code service.pid} standard OSGi service property which should be a unique string.

    * * The order of the method calls on a particular Resource Processor in case of install/update * session is the following:

    @@ -98,10 +98,10 @@ /** * This method is called on the Resource Processor immediately before calling the - * commit method. The Resource Processor has to check whether it is able - * to commit the operations since the last begin method call. If it determines + * {@code commit} method. The Resource Processor has to check whether it is able + * to commit the operations since the last {@code begin} method call. If it determines * that it is not able to commit the changes, it has to raise a - * ResourceProcessorException with the {@link ResourceProcessorException#CODE_PREPARE} + * {@code ResourceProcessorException} with the {@link ResourceProcessorException#CODE_PREPARE} * error code. * * @throws ResourceProcessorException if the resource processor is able to determine it is @@ -127,10 +127,10 @@ /** * Processing of a resource passed to the resource processor may take long. - * The cancel() method notifies the resource processor that it should + * The {@code cancel()} method notifies the resource processor that it should * interrupt the processing of the current resource. This method is called by the - * DeploymentAdmin implementation after the - * DeploymentAdmin.cancel() method is called. + * {@code DeploymentAdmin} implementation after the + * {@code DeploymentAdmin.cancel()} method is called. */ void cancel(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/Constants.java osgi-compendium-4.3.0/src/org/osgi/service/device/Constants.java --- osgi-compendium-4.2.0/src/org/osgi/service/device/Constants.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/Constants.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -20,10 +20,11 @@ * {@link Device} and {@link Driver} services. * *

    - * The values associated with these keys are of type java.lang.String, + * The values associated with these keys are of type {@code java.lang.String}, * unless otherwise stated. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 58acb0b3339b5db94bb014d32f4eeb360a394fd4 $ * @since 1.1 * @see Device * @see Driver @@ -33,8 +34,8 @@ * Property (named "DRIVER_ID") identifying a driver. * *

    - * A DRIVER_ID should start with the reversed domain name of the - * company that implemented the driver (e.g., com.acme), and + * A {@code DRIVER_ID} should start with the reversed domain name of the + * company that implemented the driver (e.g., {@code com.acme}), and * must meet the following requirements: * *

      @@ -46,14 +47,14 @@ *
    * *

    - * This property is mandatory, i.e., every Driver service must be + * This property is mandatory, i.e., every {@code Driver} service must be * registered with it. */ public static final String DRIVER_ID = "DRIVER_ID"; /** * Property (named "DEVICE_CATEGORY") containing a human readable * description of the device categories implemented by a device. This - * property is of type String[] + * property is of type {@code String[]} * *

    * Services registered with this property will be treated as devices and diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/Device.java osgi-compendium-4.3.0/src/org/osgi/service/device/Device.java --- osgi-compendium-4.2.0/src/org/osgi/service/device/Device.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/Device.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2011). 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. @@ -15,6 +15,8 @@ */ package org.osgi.service.device; +import org.osgi.framework.ServiceReference; + /** *

    * Interface for identifying device services. @@ -23,39 +25,39 @@ * A service must implement this interface or use the * {@link Constants#DEVICE_CATEGORY} registration property to indicate that it * is a device. Any services implementing this interface or registered with the - * DEVICE_CATEGORY property will be discovered by the device - * manager. + * {@code DEVICE_CATEGORY} property will be discovered by the device manager. * *

    * Device services implementing this interface give the device manager the * opportunity to indicate to the device that no drivers were found that could * (further) refine it. In this case, the device manager calls the - * {@link #noDriverFound} method on the Device object. + * {@link #noDriverFound()} method on the {@code Device} object. * *

    * Specialized device implementations will extend this interface by adding * methods appropriate to their device category to it. * - * @version $Revision: 5654 $ + * @version $Id: 40e60d46b721a8b94408fdb97844904acec60cdf $ * @see Driver * @ThreadSafe */ public interface Device { /** - * Return value from {@link Driver#match} indicating that the driver cannot - * refine the device presented to it by the device manager. + * Return value from {@link Driver#match(ServiceReference)} indicating that + * the driver cannot refine the device presented to it by the device + * manager. * * The value is zero. */ public static final int MATCH_NONE = 0; /** - * Indicates to this Device object that the device manager has + * Indicates to this {@code Device} object that the device manager has * failed to attach any drivers to it. * *

    - * If this Device object can be configured differently, the - * driver that registered this Device object may unregister it + * If this {@code Device} object can be configured differently, the + * driver that registered this {@code Device} object may unregister it * and register a different Device service instead. */ public void noDriverFound(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/Driver.java osgi-compendium-4.3.0/src/org/osgi/service/device/Driver.java --- osgi-compendium-4.2.0/src/org/osgi/service/device/Driver.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/Driver.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2011). 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. @@ -18,14 +18,14 @@ import org.osgi.framework.ServiceReference; /** - * A Driver service object must be registered by each Driver bundle + * A {@code Driver} service object must be registered by each Driver bundle * wishing to attach to Device services provided by other drivers. For each * newly discovered {@link Device} object, the device manager enters a bidding - * phase. The Driver object whose {@link #match} method bids the - * highest for a particular Device object will be instructed by the - * device manager to attach to the Device object. + * phase. The {@code Driver} object whose {@link #match(ServiceReference)} + * method bids the highest for a particular {@code Device} object will be + * instructed by the device manager to attach to the {@code Device} object. * - * @version $Revision: 5654 $ + * @version $Id: 8d86c732bdc1e4d50c18a237427578472e13dcbf $ * @see Device * @see DriverLocator * @ThreadSafe @@ -42,7 +42,7 @@ *

    * The return value must be one of the possible match values defined in the * device category definition for the given Device service, or - * Device.MATCH_NONE if the category of the Device service is + * {@code Device.MATCH_NONE} if the category of the Device service is * not recognized. * *

    @@ -60,11 +60,11 @@ * The match function is called by the device manager during the matching * process. * - * @param reference the ServiceReference object of the device + * @param reference the {@code ServiceReference} object of the device * to match * * @return value indicating how well this driver can support the given - * Device service, or Device.MATCH_NONE if it cannot + * Device service, or {@code Device.MATCH_NONE} if it cannot * support the Device service at all * * @throws java.lang.Exception if this Driver service cannot examine the @@ -74,13 +74,13 @@ /** * Attaches this Driver service to the Device service represented by the - * given ServiceReference object. + * given {@code ServiceReference} object. * *

    - * A return value of null indicates that this Driver service + * A return value of {@code null} indicates that this Driver service * has successfully attached to the given Device service. If this Driver * service is unable to attach to the given Device service, but knows of a - * more suitable Driver service, it must return the DRIVER_ID + * more suitable Driver service, it must return the {@code DRIVER_ID} * of that Driver service. This allows for the implementation of referring * drivers whose only purpose is to refer to other drivers capable of * handling a given Device service. @@ -93,12 +93,12 @@ *

    * This method is called by the device manager. * - * @param reference the ServiceReference object of the device + * @param reference the {@code ServiceReference} object of the device * to attach to * - * @return null if this Driver service has successfully + * @return {@code null} if this Driver service has successfully * attached to the given Device service, or the - * DRIVER_ID of a more suitable driver + * {@code DRIVER_ID} of a more suitable driver * * @throws java.lang.Exception if the driver cannot attach to the given * device and does not know of a more suitable driver diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/DriverLocator.java osgi-compendium-4.3.0/src/org/osgi/service/device/DriverLocator.java --- osgi-compendium-4.2.0/src/org/osgi/service/device/DriverLocator.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/DriverLocator.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -21,42 +21,42 @@ /** * A Driver Locator service can find and load device driver bundles given a - * property set. Each driver is represented by a unique DRIVER_ID. + * property set. Each driver is represented by a unique {@code DRIVER_ID}. *

    * Driver Locator services provide the mechanism for dynamically downloading new * device driver bundles into an OSGi environment. They are supplied by * providers and encapsulate all provider-specific details related to the * location and acquisition of driver bundles. * - * @version $Revision: 5654 $ + * @version $Id: 85498ef85f1a48248b6dc01455264b2f866022ea $ * @see Driver * @ThreadSafe */ public interface DriverLocator { /** - * Returns an array of DRIVER_ID strings of drivers capable of + * Returns an array of {@code DRIVER_ID} strings of drivers capable of * attaching to a device with the given properties. * *

    - * The property keys in the specified Dictionary objects are + * The property keys in the specified {@code Dictionary} objects are * case-insensitive. * * @param props the properties of the device for which a driver is sought - * @return array of driver DRIVER_ID strings of drivers capable + * @return array of driver {@code DRIVER_ID} strings of drivers capable * of attaching to a Device service with the given properties, or - * null if this Driver Locator service does not know of + * {@code null} if this Driver Locator service does not know of * any such drivers */ public String[] findDrivers(Dictionary props); /** - * Get an InputStream from which the driver bundle providing a - * driver with the giving DRIVER_ID can be installed. + * Get an {@code InputStream} from which the driver bundle providing a + * driver with the giving {@code DRIVER_ID} can be installed. * - * @param id the DRIVER_ID of the driver that needs to be + * @param id the {@code DRIVER_ID} of the driver that needs to be * installed. - * @return An InputStream object from which the driver bundle - * can be installed or null if the driver with the + * @return An {@code InputStream} object from which the driver bundle + * can be installed or {@code null} if the driver with the * given ID cannot be located * @throws java.io.IOException the input stream for the bundle cannot be * created diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/DriverSelector.java osgi-compendium-4.3.0/src/org/osgi/service/device/DriverSelector.java --- osgi-compendium-4.2.0/src/org/osgi/service/device/DriverSelector.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/DriverSelector.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -24,16 +24,16 @@ * there is a Driver Selector service registered with the Framework, the device * manager will ask it to make the selection. If there is no Driver Selector * service, or if it returns an invalid result, or throws an - * Exception, the device manager uses the default selection + * {@code Exception}, the device manager uses the default selection * strategy. * - * @version $Revision: 5654 $ + * @version $Id: f3ab3493b4fe468954a709a5699f92244efacb0e $ * @since 1.1 * @ThreadSafe */ public interface DriverSelector { /** - * Return value from DriverSelector.select, if no Driver + * Return value from {@code DriverSelector.select}, if no Driver * service should be attached to the Device service. The value is -1. */ public static final int SELECT_NONE = -1; @@ -42,13 +42,13 @@ * Select one of the matching Driver services. The device manager calls this * method if there is at least one driver bidding for a device. Only Driver * services that have responded with nonzero (not {@link Device#MATCH_NONE}) - * match values will be included in the list. + * {@code } match values will be included in the list. * - * @param reference the ServiceReference object of the Device + * @param reference the {@code ServiceReference} object of the Device * service. * @param matches the array of all non-zero matches. - * @return index into the array of Match objects, or - * SELECT_NONE if no Driver service should be attached + * @return index into the array of {@code Match} objects, or + * {@code SELECT_NONE} if no Driver service should be attached */ public int select(ServiceReference reference, Match[] matches); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/Match.java osgi-compendium-4.3.0/src/org/osgi/service/device/Match.java --- osgi-compendium-4.2.0/src/org/osgi/service/device/Match.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/Match.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2001, 2011). 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. @@ -18,19 +18,21 @@ import org.osgi.framework.ServiceReference; /** - * Instances of Match are used in the {@link DriverSelector#select} - * method to identify Driver services matching a Device service. + * Instances of {@code Match} are used in the + * {@link DriverSelector#select(ServiceReference, Match[])} method to identify + * Driver services matching a Device service. * - * @version $Revision: 5654 $ + * @ThreadSafe + * @noimplement + * @version $Id: e5c5171200f54046030901c55a7ca484ca217c35 $ * @since 1.1 * @see DriverSelector - * @ThreadSafe */ public interface Match { /** * Return the reference to a Driver service. * - * @return ServiceReference object to a Driver service. + * @return {@code ServiceReference} object to a Driver service. */ public ServiceReference getDriver(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/package.html osgi-compendium-4.3.0/src/org/osgi/service/device/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/device/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

    Device Access Package Version 1.1. -

    Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

    -Import-Package: org.osgi.service.device; version="[1.1,2.0)"
    -
    - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/device/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/device/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/device/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/device/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Device Access Package Version 1.1. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.device; version="[1.1,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.device; version="[1.1,1.2)"} + * + * @version $Id: 0c957a50efbc06eb4bb7f1c46695a757bc12e9a6 $ + */ + +package org.osgi.service.device; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/EventAdmin.java osgi-compendium-4.3.0/src/org/osgi/service/event/EventAdmin.java --- osgi-compendium-4.2.0/src/org/osgi/service/event/EventAdmin.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/EventAdmin.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -21,18 +21,20 @@ * Event Admin service and call one of the event delivery methods. * * @ThreadSafe - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: d21a164e318da4b9ca165d1e481e270610cc0c77 $ */ public interface EventAdmin { /** - * Initiate asynchronous delivery of an event. This method returns to the - * caller before delivery of the event is completed. + * Initiate asynchronous, ordered delivery of an event. This method returns + * to the caller before delivery of the event is completed. Events are + * delivered in the order that they are received by this method. * * @param event The event to send to all listeners which subscribe to the * topic of the event. * * @throws SecurityException If the caller does not have - * TopicPermission[topic,PUBLISH] for the topic + * {@code TopicPermission[topic,PUBLISH]} for the topic * specified in the event. */ void postEvent(Event event); @@ -45,7 +47,7 @@ * topic of the event. * * @throws SecurityException If the caller does not have - * TopicPermission[topic,PUBLISH] for the topic + * {@code TopicPermission[topic,PUBLISH]} for the topic * specified in the event. */ void sendEvent(Event event); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/EventConstants.java osgi-compendium-4.3.0/src/org/osgi/service/event/EventConstants.java --- osgi-compendium-4.2.0/src/org/osgi/service/event/EventConstants.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/EventConstants.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -23,37 +23,40 @@ import org.osgi.framework.Version; /** - * Defines standard names for EventHandler properties. + * Defines standard names for {@code EventHandler} properties. * - * @version $Revision: 7368 $ + * @noimplement + * @version $Id: 4416a32be106f158ab6f776219a2203ed54c9b7d $ */ public interface EventConstants { /** - * Service registration property (named event.topics) - * specifying the Event topics of interest to a Event Handler - * service. - *

    - * Event handlers SHOULD be registered with this property. The value of the - * property is a string or an array of strings that describe the topics in - * which the handler is interested. An asterisk ('*') may be used as a - * trailing wildcard. Event Handlers which do not have a value for this - * property must not receive events. More precisely, the value of each - * string must conform to the following grammar: + * Service registration property specifying the {@code Event} topics of + * interest to an Event Handler service. + *

    + * Event handlers SHOULD be registered with this property. Each value of + * this property is a string that describe the topics in which the handler + * is interested. An asterisk ('*') may be used as a trailing wildcard. + * Event Handlers which do not have a value for this property must not + * receive events. More precisely, the value of each string must conform to + * the following grammar: * *

     	 *  topic-description := '*' | topic ( '/*' )?
     	 *  topic := token ( '/' token )*
     	 * 
    * + *

    + * The value of this property must be of type {@code String}, + * {@code String[]}, or {@code Collection<String>}. + * * @see Event */ public static final String EVENT_TOPIC = "event.topics"; /** - * Service Registration property (named event.filter) - * specifying a filter to further select Event s of interest to - * a Event Handler service. + * Service Registration property specifying a filter to further select + * {@code Event} s of interest to an Event Handler service. *

    * Event handlers MAY be registered with this property. The value of this * property is a string containing an LDAP-style filter specification. Any @@ -67,27 +70,80 @@ * If the filter syntax is invalid, then the Event Handler must be ignored * and a warning should be logged. * + *

    + * The value of this property must be of type {@code String}. + * * @see Event * @see Filter */ public static final String EVENT_FILTER = "event.filter"; /** + * Service Registration property specifying the delivery qualities requested + * by an Event Handler service. + *

    + * Event handlers MAY be registered with this property. Each value of this + * property is a string specifying a delivery quality for the Event handler. + * + *

    + * The value of this property must be of type {@code String}, + * {@code String[]}, or {@code Collection<String>}. + * + * @see #DELIVERY_ASYNC_ORDERED + * @see #DELIVERY_ASYNC_UNORDERED + * @since 1.3 + */ + public static final String EVENT_DELIVERY = "event.delivery"; + + /** + * Event Handler delivery quality value specifying the Event Handler + * requires asynchronously delivered events be delivered in order. Ordered + * delivery is the default for asynchronously delivered events. + * + *

    + * This delivery quality value is mutually exclusive with + * {@link #DELIVERY_ASYNC_UNORDERED}. However, if both this value and + * {@link #DELIVERY_ASYNC_UNORDERED} are specified for an event handler, + * this value takes precedence. + * + * @see #EVENT_DELIVERY + * @since 1.3 + */ + public static final String DELIVERY_ASYNC_ORDERED = "async.ordered"; + + /** + * Event Handler delivery quality value specifying the Event Handler does + * not require asynchronously delivered events be delivered in order. This + * may allow an Event Admin implementation to optimize asynchronous event + * delivery by relaxing ordering requirements. + * + *

    + * This delivery quality value is mutually exclusive with + * {@link #DELIVERY_ASYNC_ORDERED}. However, if both this value and + * {@link #DELIVERY_ASYNC_ORDERED} are specified for an event handler, + * {@link #DELIVERY_ASYNC_ORDERED} takes precedence. + * + * @see #EVENT_DELIVERY + * @since 1.3 + */ + public static final String DELIVERY_ASYNC_UNORDERED = "async.unordered"; + + /** * The Distinguished Names of the signers of the bundle relevant to the * event. The type of the value for this event property is - * String or Collection of String. + * {@code String} or {@code Collection} of {@code String}. */ public static final String BUNDLE_SIGNER = "bundle.signer"; /** * The Bundle Symbolic Name of the bundle relevant to the event. The type of - * the value for this event property is String. + * the value for this event property is {@code String}. */ public static final String BUNDLE_SYMBOLICNAME = "bundle.symbolicName"; /** * The Bundle id of the bundle relevant to the event. The type of the value - * for this event property is Long. + * for this event property is {@code Long}. * * @since 1.1 */ @@ -112,20 +168,20 @@ /** * The forwarded event object. Used when rebroadcasting an event that was * sent via some other event mechanism. The type of the value for this event - * property is Object. + * property is {@code Object}. */ public static final String EVENT = "event"; /** * An exception or error. The type of the value for this event property is - * Throwable. + * {@code Throwable}. */ public static final String EXCEPTION = "exception"; /** * The name of the exception type. Must be equal to the name of the class of * the exception in the event property {@link #EXCEPTION}. The type of the - * value for this event property is String. + * value for this event property is {@code String}. * * @since 1.1 */ @@ -133,15 +189,15 @@ /** * The exception message. Must be equal to the result of calling - * getMessage() on the exception in the event property + * {@code getMessage()} on the exception in the event property * {@link #EXCEPTION}. The type of the value for this event property is - * String. + * {@code String}. */ public static final String EXCEPTION_MESSAGE = "exception.message"; /** * A human-readable message that is usually not localized. The type of the - * value for this event property is String. + * value for this event property is {@code String}. */ public static final String MESSAGE = "message"; @@ -153,26 +209,26 @@ /** * A service's id. The type of the value for this event property is - * Long. + * {@code Long}. */ public static final String SERVICE_ID = Constants.SERVICE_ID; /** * A service's objectClass. The type of the value for this event property is - * String[]. + * {@code String[]}. */ public static final String SERVICE_OBJECTCLASS = "service.objectClass"; /** * A service's persistent identity. The type of the value for this event - * property is String. + * property is {@code String}. */ public static final String SERVICE_PID = Constants.SERVICE_PID; /** * The time when the event occurred, as reported by - * System.currentTimeMillis(). The type of the value for this - * event property is Long. + * {@code System.currentTimeMillis()}. The type of the value for this + * event property is {@code Long}. */ public static final String TIMESTAMP = "timestamp"; @@ -183,4 +239,4 @@ * @deprecated As of 1.1, replaced by EXCEPTION_CLASS */ public static final String EXECPTION_CLASS = "exception.class"; -} \ No newline at end of file +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/EventHandler.java osgi-compendium-4.3.0/src/org/osgi/service/event/EventHandler.java --- osgi-compendium-4.2.0/src/org/osgi/service/event/EventHandler.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/EventHandler.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -20,15 +20,15 @@ * Listener for Events. * *

    - * EventHandler objects are registered with the Framework service - * registry and are notified with an Event object when an event + * {@code EventHandler} objects are registered with the Framework service + * registry and are notified with an {@code Event} object when an event * is sent or posted. *

    - * EventHandler objects can inspect the received - * Event object to determine its topic and properties. + * {@code EventHandler} objects can inspect the received + * {@code Event} object to determine its topic and properties. * *

    - * EventHandler objects must be registered with a service + * {@code EventHandler} objects must be registered with a service * property {@link EventConstants#EVENT_TOPIC} whose value is the list of topics * in which the event handler is interested. *

    @@ -47,16 +47,16 @@ * be ignored by the Event Admin service. The Event Admin service should log a * warning. *

    - * Security Considerations. Bundles wishing to monitor Event - * objects will require ServicePermission[EventHandler,REGISTER] - * to register an EventHandler service. The bundle must also have - * TopicPermission[topic,SUBSCRIBE] for the topic specified in + * Security Considerations. Bundles wishing to monitor {@code Event} + * objects will require {@code ServicePermission[EventHandler,REGISTER]} + * to register an {@code EventHandler} service. The bundle must also have + * {@code TopicPermission[topic,SUBSCRIBE]} for the topic specified in * the event in order to receive the event. * * @see Event * * @ThreadSafe - * @version $Revision: 5673 $ + * @version $Id: 2b8202d10e77b774897c74714115059f46abc7e1 $ */ public interface EventHandler { /** diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/Event.java osgi-compendium-4.3.0/src/org/osgi/service/event/Event.java --- osgi-compendium-4.2.0/src/org/osgi/service/event/Event.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/Event.java 2011-05-16 12:29:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2009). All Rights Reserved. + * 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. @@ -16,11 +16,14 @@ package org.osgi.service.event; +import static org.osgi.service.event.EventConstants.EVENT_TOPIC; + +import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Dictionary; import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; +import java.util.List; import java.util.Map; import org.osgi.framework.Filter; @@ -28,11 +31,11 @@ /** * An event. * - * Event objects are delivered to EventHandler + * {@code Event} objects are delivered to {@code EventHandler} * services which subscribe to the topic of the event. * * @Immutable - * @version $Revision: 7003 $ + * @version $Id: 3f12c0b086a6cda93122ce3cb2b83e21a5023ecc $ */ public class Event { /** @@ -43,81 +46,85 @@ * The properties carried by this event. Keys are strings and values are * objects */ - private final Map /* */properties; + private final EventProperties properties; /** * Constructs an event. * * @param topic The topic of the event. - * @param properties The event's properties (may be null). A - * property whose key is not of type String will be + * @param properties The event's properties (may be {@code null}). A + * property whose key is not of type {@code String} will be * ignored. * @throws IllegalArgumentException If topic is not a valid topic name. * @since 1.2 */ - public Event(String topic, Map/* */properties) { + public Event(String topic, Map properties) { validateTopicName(topic); this.topic = topic; - int size = (properties == null) ? 1 : (properties.size() + 1); - Map p = new HashMap(size); - if (properties != null) { - for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) { - Object key = iter.next(); - if (key instanceof String) { - Object value = properties.get(key); - p.put(key, value); - } - } - } - p.put(EventConstants.EVENT_TOPIC, topic); - this.properties = p; // safely publish the map + // safely publish the event properties + this.properties = (properties instanceof EventProperties) ? (EventProperties) properties + : new EventProperties(properties); } /** * Constructs an event. * * @param topic The topic of the event. - * @param properties The event's properties (may be null). A - * property whose key is not of type String will be + * @param properties The event's properties (may be {@code null}). A + * property whose key is not of type {@code String} will be * ignored. * @throws IllegalArgumentException If topic is not a valid topic name. */ - public Event(String topic, Dictionary/* */properties) { + public Event(String topic, Dictionary properties) { validateTopicName(topic); this.topic = topic; - int size = (properties == null) ? 1 : (properties.size() + 1); - Map p = new HashMap(size); - if (properties != null) { - for (Enumeration e = properties.keys(); e.hasMoreElements();) { - Object key = e.nextElement(); - if (key instanceof String) { - Object value = properties.get(key); - p.put(key, value); - } - } - } - p.put(EventConstants.EVENT_TOPIC, topic); - this.properties = p; // safely publish the map + // safely publish the event properties + this.properties = new EventProperties(properties); } /** - * Retrieves a property. + * Retrieve the value of an event property. The event topic may be retrieved + * with the property name "event.topics". * - * @param name the name of the property to retrieve - * @return The value of the property, or null if not found. + * @param name The name of the property to retrieve. + * @return The value of the property, or {@code null} if not found. */ public final Object getProperty(String name) { + if (EVENT_TOPIC.equals(name)) { + return topic; + } return properties.get(name); } /** - * Returns a list of this event's property names. + * Indicate the presence of an event property. The event topic is present + * using the property name "event.topics". + * + * @param name The name of the property. + * @return {@code true} if a property with the specified name is in the + * event. This property may have a {@code null} value. + * {@code false} otherwise. + * @since 1.3 + */ + public final boolean containsProperty(String name) { + if (EVENT_TOPIC.equals(name)) { + return true; + } + return properties.containsKey(name); + } + + /** + * Returns a list of this event's property names. The list will include the + * event topic property name "event.topics". * * @return A non-empty array with one element per property. */ public final String[] getPropertyNames() { - return (String[]) properties.keySet().toArray( - new String[properties.size()]); + int size = properties.size(); + String[] result = new String[size + 1]; + properties.keySet().toArray(result); + result[size] = EVENT_TOPIC; + return result; } /** @@ -138,19 +145,21 @@ * otherwise. */ public final boolean matches(Filter filter) { - return filter.matchCase(new UnmodifiableDictionary(properties)); + return filter.matchCase(new FilterProperties(topic, properties)); } /** - * Compares this Event object to another object. + * Compares this {@code Event} object to another object. * *

    * An event is considered to be equal to another event if the topic - * is equal and the properties are equal. - * - * @param object The Event object to be compared. - * @return true if object is a Event - * and is equal to this object; false otherwise. + * is equal and the properties are equal. The properties are compared using + * the {@code java.util.Map.equals()} rules which includes identity + * comparison for array values. + * + * @param object The {@code Event} object to be compared. + * @return {@code true} if {@code object} is a {@code Event} + * and is equal to this object; {@code false} otherwise. */ public boolean equals(Object object) { if (object == this) { // quick test @@ -166,7 +175,7 @@ } /** - * Returns a hash code value for the object. + * Returns a hash code value for this object. * * @return An integer which is a hash code value for this object. */ @@ -182,7 +191,7 @@ * @return The string representation of this event. */ public String toString() { - return getClass().getName() + " [topic=" + topic + "]"; + return getClass().getName() + " [topic=" + topic + "]"; } /** @@ -192,72 +201,92 @@ * @throws IllegalArgumentException If the topic name is invalid. */ private static void validateTopicName(String topic) { - char[] chars = topic.toCharArray(); - int length = chars.length; - if (length == 0) { + char[] chars = topic.toCharArray(); + int length = chars.length; + if (length == 0) { throw new IllegalArgumentException("empty topic"); } for (int i = 0; i < length; i++) { - char ch = chars[i]; - if (ch == '/') { - // Can't start or end with a '/' but anywhere else is okay + char ch = chars[i]; + if (ch == '/') { + // Can't start or end with a '/' but anywhere else is okay if (i == 0 || (i == length - 1)) { - throw new IllegalArgumentException( - "invalid topic: " - + topic); - } - // Can't have "//" as that implies empty token - if (chars[i-1] == '/') { - throw new IllegalArgumentException( - "invalid topic: " - + topic); - } - continue; - } - if (('A' <= ch) && (ch <= 'Z')) { - continue; - } - if (('a' <= ch) && (ch <= 'z')) { - continue; - } - if (('0' <= ch) && (ch <= '9')) { - continue; - } - if ((ch == '_') || (ch == '-')) { - continue; - } - throw new IllegalArgumentException("invalid topic: " + topic); - } - } - - /** - * Unmodifiable wrapper for Dictionary. - */ - private static class UnmodifiableDictionary extends Dictionary { - private final Map wrapped; - UnmodifiableDictionary(Map wrapped) { - this.wrapped = wrapped; + throw new IllegalArgumentException("invalid topic: " + + topic); + } + // Can't have "//" as that implies empty token + if (chars[i - 1] == '/') { + throw new IllegalArgumentException("invalid topic: " + + topic); + } + continue; + } + if (('A' <= ch) && (ch <= 'Z')) { + continue; + } + if (('a' <= ch) && (ch <= 'z')) { + continue; + } + if (('0' <= ch) && (ch <= '9')) { + continue; + } + if ((ch == '_') || (ch == '-')) { + continue; + } + throw new IllegalArgumentException("invalid topic: " + topic); } - public Enumeration elements() { - return Collections.enumeration(wrapped.values()); + } + + /** + * Dictionary to use for Filter matching. + */ + static private final class FilterProperties extends + Dictionary { + private final String topic; + private final EventProperties properties; + + FilterProperties(String topic, EventProperties properties) { + this.topic = topic; + this.properties = properties; } + + public Enumeration elements() { + Collection values = properties.values(); + List result = new ArrayList(values.size() + 1); + result.add(topic); + result.addAll(values); + return Collections.enumeration(result); + } + public Object get(Object key) { - return wrapped.get(key); + if (EVENT_TOPIC.equals(key)) { + return topic; + } + return properties.get(key); } + public boolean isEmpty() { - return wrapped.isEmpty(); + return false; } - public Enumeration keys() { - return Collections.enumeration(wrapped.keySet()); + + public Enumeration keys() { + Collection keys = properties.keySet(); + List result = new ArrayList(keys.size() + 1); + result.add(EVENT_TOPIC); + result.addAll(keys); + return Collections.enumeration(result); } - public Object put(Object key, Object value) { + + public Object put(String key, Object value) { throw new UnsupportedOperationException(); } + public Object remove(Object key) { throw new UnsupportedOperationException(); } + public int size() { - return wrapped.size(); + return properties.size() + 1; } } } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/EventProperties.java osgi-compendium-4.3.0/src/org/osgi/service/event/EventProperties.java --- osgi-compendium-4.2.0/src/org/osgi/service/event/EventProperties.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/EventProperties.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,262 @@ +/* + * 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. + */ + +package org.osgi.service.event; + +import static org.osgi.service.event.EventConstants.EVENT_TOPIC; + +import java.util.Collection; +import java.util.Collections; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +/** + * The properties for an {@link Event}. An event source can create an + * EventProperties object if it needs to reuse the same event properties for + * multiple events. + * + *

    + * The keys are all of type {@code String}. The values are of type + * {@code Object}. The key "event.topics" is ignored as event + * topics can only be set when an {@link Event} is constructed. + * + *

    + * Once constructed, an EventProperties object is unmodifiable. However, the + * values of the map used to construct an EventProperties object are still + * subject to modification as they are not deeply copied. + * + * @Immutable + * @since 1.3 + * @version $Id: 2b1e756cdb49df53926aede978132c26f31515ed $ + */ +public class EventProperties implements Map { + /** + * The properties for an event. Keys are strings and values are objects. The + * object is unmodifiable. + */ + private final Map properties; + + /** + * Create an EventProperties from the specified properties. + * + *

    + * The specified properties will be copied into this EventProperties. + * Properties whose key is not of type {@code String} will be ignored. + * A property with the key "event.topics" will be ignored. + * + * @param properties The properties to use for this EventProperties object + * (may be {@code null}). + */ + public EventProperties(Map properties) { + int size = (properties == null) ? 0 : properties.size(); + Map p = new HashMap(size); + if (size > 0) { + for (Object key : (Set< ? >) properties.keySet()) { + if ((key instanceof String) && !EVENT_TOPIC.equals(key)) { + Object value = properties.get(key); + p.put((String) key, value); + } + } + } + // safely publish the map + this.properties = Collections.unmodifiableMap(p); + } + + /** + * Create an EventProperties from the specified dictionary. + * + *

    + * The specified properties will be copied into this EventProperties. + * Properties whose key is not of type {@code String} will be ignored. + * A property with the key "event.topics" will be ignored. + * + * @param properties The properties to use for this EventProperties object + * (may be {@code null}). + */ + EventProperties(Dictionary properties) { + int size = (properties == null) ? 0 : properties.size(); + Map p = new HashMap(size); + if (size > 0) { + for (Enumeration< ? > e = properties.keys(); e.hasMoreElements();) { + Object key = e.nextElement(); + if ((key instanceof String) && !EVENT_TOPIC.equals(key)) { + Object value = properties.get(key); + p.put((String) key, value); + } + } + } + // safely publish the map + this.properties = Collections.unmodifiableMap(p); + } + + /** + * This method throws {@link UnsupportedOperationException}. + * + * @throws UnsupportedOperationException if called. + */ + public void clear() { + properties.clear(); + } + + /** + * Indicates if the specified property is present. + * + * @param name The property name. + * @return {@code true} If the property is present, {@code false} + * otherwise. + */ + public boolean containsKey(Object name) { + return properties.containsKey(name); + } + + /** + * Indicates if the specified value is present. + * + * @param value The property value. + * @return {@code true} If the value is present, {@code false} + * otherwise. + */ + public boolean containsValue(Object value) { + return properties.containsValue(value); + } + + /** + * Return the property entries. + * + * @return A set containing the property name/value pairs. + */ + public Set> entrySet() { + return properties.entrySet(); + } + + /** + * Return the value of the specified property. + * + * @param name The name of the specified property. + * @return The value of the specified property. + */ + public Object get(Object name) { + return properties.get(name); + } + + /** + * Indicate if this properties is empty. + * + * @return {@code true} If this properties is empty, {@code false} + * otherwise. + */ + public boolean isEmpty() { + return properties.isEmpty(); + } + + /** + * Return the names of the properties. + * + * @return The names of the properties. + */ + public Set keySet() { + return properties.keySet(); + } + + /** + * This method throws {@link UnsupportedOperationException}. + * + * @throws UnsupportedOperationException if called. + */ + public Object put(String key, Object value) { + return properties.put(key, value); + } + + /** + * This method throws {@link UnsupportedOperationException}. + * + * @throws UnsupportedOperationException if called. + */ + public void putAll(Map< ? extends String, ? extends Object> map) { + properties.putAll(map); + } + + /** + * This method throws {@link UnsupportedOperationException}. + * + * @throws UnsupportedOperationException if called. + */ + public Object remove(Object key) { + return properties.remove(key); + } + + /** + * Return the number of properties. + * + * @return The number of properties. + */ + public int size() { + return properties.size(); + } + + /** + * Return the properties values. + * + * @return The values of the properties. + */ + public Collection values() { + return properties.values(); + } + + /** + * Compares this {@code EventProperties} object to another object. + * + *

    + * The properties are compared using the {@code java.util.Map.equals()} + * rules which includes identity comparison for array values. + * + * @param object The {@code EventProperties} object to be compared. + * @return {@code true} if {@code object} is a + * {@code EventProperties} and is equal to this object; + * {@code false} otherwise. + */ + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (!(object instanceof EventProperties)) { + return false; + } + EventProperties other = (EventProperties) object; + return properties.equals(other.properties); + } + + /** + * Returns a hash code value for this object. + * + * @return An integer which is a hash code value for this object. + */ + public int hashCode() { + return properties.hashCode(); + } + + /** + * Returns the string representation of this object. + * + * @return The string representation of this object. + */ + public String toString() { + return properties.toString(); + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/package.html osgi-compendium-4.3.0/src/org/osgi/service/event/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/event/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

    Event 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. -For example: -

    -Import-Package: org.osgi.service.event; version="[1.2,2.0)"
    -
    - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/event/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/event/packageinfo 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/packageinfo 2010-06-15 15:44:04.000000000 +0000 @@ -1 +1 @@ -version 1.2 +version 1.3 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/event/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/event/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Event Admin Package Version 1.3. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.event; version="[1.3,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.event; version="[1.3,1.4)"} + * + * @version $Id: ce0d325e118d7610d5eea38f021525f4855b85c6 $ + */ + +package org.osgi.service.event; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/event/TopicPermission.java osgi-compendium-4.3.0/src/org/osgi/service/event/TopicPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/event/TopicPermission.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/event/TopicPermission.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2009). All Rights Reserved. + * 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. @@ -17,10 +17,18 @@ package org.osgi.service.event; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamField; import java.security.Permission; import java.security.PermissionCollection; +import java.util.ArrayList; +import java.util.Collections; import java.util.Enumeration; +import java.util.HashMap; import java.util.Hashtable; +import java.util.List; +import java.util.Map; /** * A bundle's authority to publish or subscribe to event on a topic. @@ -35,20 +43,20 @@ * * *

    - * TopicPermission has two actions: publish and - * subscribe. + * {@code TopicPermission} has two actions: {@code publish} and + * {@code subscribe}. * * @ThreadSafe - * @version $Revision: 6381 $ + * @version $Id: c5e3452781547a63cb4984d3c7e9f166b6abbd42 $ */ public final class TopicPermission extends Permission { static final long serialVersionUID = -5855563886961618300L; /** - * The action string publish. + * The action string {@code publish}. */ public final static String PUBLISH = "publish"; /** - * The action string subscribe. + * The action string {@code subscribe}. */ public final static String SUBSCRIBE = "subscribe"; private final static int ACTION_PUBLISH = 0x00000001; @@ -88,13 +96,13 @@ * *

    * A bundle that needs to publish events on a topic must have the - * appropriate TopicPermission for that topic; similarly, a + * appropriate {@code TopicPermission} for that topic; similarly, a * bundle that needs to subscribe to events on a topic must have the - * appropriate TopicPermssion for that topic. + * appropriate {@code TopicPermssion} for that topic. *

    * * @param name Topic name. - * @param actions publish,subscribe (canonical + * @param actions {@code publish},{@code subscribe} (canonical * order). */ public TopicPermission(String name, String actions) { @@ -240,9 +248,9 @@ * *

    * This method checks that the topic name of the target is implied by the - * topic name of this object. The list of TopicPermission + * topic name of this object. The list of {@code TopicPermission} * actions must either match or allow for the list of the target object to - * imply the target TopicPermission action. + * imply the target {@code TopicPermission} action. * *

     	 *    x/y/*,"publish" -> x/y/z,"publish" is true
    @@ -252,8 +260,8 @@
     	 * 
    * * @param p The target permission to interrogate. - * @return true if the specified TopicPermission - * action is implied by this object; false otherwise. + * @return {@code true} if the specified {@code TopicPermission} + * action is implied by this object; {@code false} otherwise. */ public boolean implies(Permission p) { if (p instanceof TopicPermission) { @@ -274,14 +282,14 @@ /** * Returns the canonical string representation of the - * TopicPermission actions. + * {@code TopicPermission} actions. * *

    - * Always returns present TopicPermission actions in the - * following order: publish,subscribe. + * Always returns present {@code TopicPermission} actions in the + * following order: {@code publish},{@code subscribe}. * * @return Canonical string representation of the - * TopicPermission actions. + * {@code TopicPermission} actions. */ public String getActions() { String result = actions; @@ -304,27 +312,27 @@ } /** - * Returns a new PermissionCollection object suitable for - * storing TopicPermission objects. + * Returns a new {@code PermissionCollection} object suitable for + * storing {@code TopicPermission} objects. * - * @return A new PermissionCollection object. + * @return A new {@code PermissionCollection} object. */ public PermissionCollection newPermissionCollection() { return new TopicPermissionCollection(); } /** - * Determines the equality of two TopicPermission objects. + * Determines the equality of two {@code TopicPermission} objects. * - * This method checks that specified TopicPermission has the - * same topic name and actions as this TopicPermission object. + * This method checks that specified {@code TopicPermission} has the + * same topic name and actions as this {@code TopicPermission} object. * * @param obj The object to test for equality with this - * TopicPermission object. - * @return true if obj is a - * TopicPermission, and has the same topic name and - * actions as this TopicPermission object; - * false otherwise. + * {@code TopicPermission} object. + * @return {@code true} if {@code obj} is a + * {@code TopicPermission}, and has the same topic name and + * actions as this {@code TopicPermission} object; + * {@code false} otherwise. */ public boolean equals(Object obj) { if (obj == this) { @@ -376,7 +384,7 @@ } /** - * Stores a set of TopicPermission permissions. + * Stores a set of {@code TopicPermission} permissions. * * @see java.security.Permission * @see java.security.Permissions @@ -387,10 +395,9 @@ /** * Table of permissions. * - * @serial * @GuardedBy this */ - private final Hashtable permissions; + private transient Map permissions; /** * Boolean saying if "*" is in the collection. * @@ -404,20 +411,20 @@ * */ public TopicPermissionCollection() { - permissions = new Hashtable(); + permissions = new HashMap(); all_allowed = false; } /** - * Adds a permission to the TopicPermission objects. The key + * Adds a permission to the {@code TopicPermission} objects. The key * for the hash is the name. * - * @param permission The TopicPermission object to add. + * @param permission The {@code TopicPermission} object to add. * * @throws IllegalArgumentException If the permission is not a - * TopicPermission instance. + * {@code TopicPermission} instance. * - * @throws SecurityException If this TopicPermissionCollection + * @throws SecurityException If this {@code TopicPermissionCollection} * object has been marked read-only. */ public void add(final Permission permission) { @@ -434,7 +441,7 @@ final int newMask = tp.getActionsMask(); synchronized (this) { - final TopicPermission existing = (TopicPermission) permissions + final TopicPermission existing = permissions .get(name); if (existing != null) { final int oldMask = existing.getActionsMask(); @@ -455,13 +462,13 @@ /** * Determines if the specified permissions implies the permissions expressed - * in permission. + * in {@code permission}. * * @param permission The Permission object to compare with this - * TopicPermission object. + * {@code TopicPermission} object. * - * @return true if permission is a proper subset - * of a permission in the set; false otherwise. + * @return {@code true} if {@code permission} is a proper subset + * of a permission in the set; {@code false} otherwise. */ public boolean implies(final Permission permission) { if (!(permission instanceof TopicPermission)) { @@ -476,7 +483,7 @@ // short circuit if the "*" Permission was added synchronized (this) { if (all_allowed) { - x = (TopicPermission) permissions.get("*"); + x = permissions.get("*"); if (x != null) { effective |= x.getActionsMask(); if ((effective & desired) == desired) { @@ -484,7 +491,7 @@ } } } - x = (TopicPermission) permissions.get(name); + x = permissions.get(name); } // strategy: // Check for full match first. Then work our way up the @@ -502,7 +509,7 @@ while ((last = name.lastIndexOf("/", offset)) != -1) { name = name.substring(0, last + 1) + "*"; synchronized (this) { - x = (TopicPermission) permissions.get(name); + x = permissions.get(name); } if (x != null) { effective |= x.getActionsMask(); @@ -518,12 +525,37 @@ } /** - * Returns an enumeration of all TopicPermission objects in the + * Returns an enumeration of all {@code TopicPermission} objects in the * container. * - * @return Enumeration of all TopicPermission objects. + * @return Enumeration of all {@code TopicPermission} objects. */ - public Enumeration elements() { - return permissions.elements(); + public synchronized Enumeration elements() { + List all = new ArrayList(permissions.values()); + return Collections.enumeration(all); + } + + /* serialization logic */ + private static final ObjectStreamField[] serialPersistentFields = { + new ObjectStreamField("permissions", Hashtable.class), + new ObjectStreamField("all_allowed", Boolean.TYPE) }; + + private synchronized void writeObject(ObjectOutputStream out) + throws IOException { + Hashtable hashtable = new Hashtable( + permissions); + ObjectOutputStream.PutField pfields = out.putFields(); + pfields.put("permissions", hashtable); + pfields.put("all_allowed", all_allowed); + out.writeFields(); + } + + private synchronized void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gfields = in.readFields(); + Hashtable hashtable = (Hashtable) gfields + .get("permissions", null); + permissions = new HashMap(hashtable); + all_allowed = gfields.get("all_allowed", false); } } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/http/HttpContext.java osgi-compendium-4.3.0/src/org/osgi/service/http/HttpContext.java --- osgi-compendium-4.2.0/src/org/osgi/service/http/HttpContext.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/http/HttpContext.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -26,43 +26,43 @@ * information about a registration. * *

    - * Servlets and resources may be registered with an HttpContext - * object; if no HttpContext object is specified, a default - * HttpContext object is used. Servlets that are registered using the - * same HttpContext object will share the same - * ServletContext object. + * Servlets and resources may be registered with an {@code HttpContext} + * object; if no {@code HttpContext} object is specified, a default + * {@code HttpContext} object is used. Servlets that are registered using the + * same {@code HttpContext} object will share the same + * {@code ServletContext} object. * *

    - * This interface is implemented by users of the HttpService. + * This interface is implemented by users of the {@code HttpService}. * - * @version $Revision: 5673 $ + * @version $Id: 59a9fe552260fa80620a82563b0970bfa1f87ef5 $ */ public interface HttpContext { /** - * HttpServletRequest attribute specifying the name of the + * {@code HttpServletRequest} attribute specifying the name of the * authenticated user. The value of the attribute can be retrieved by - * HttpServletRequest.getRemoteUser. This attribute name is - * org.osgi.service.http.authentication.remote.user. + * {@code HttpServletRequest.getRemoteUser}. This attribute name is + * {@code org.osgi.service.http.authentication.remote.user}. * * @since 1.1 */ public static final String REMOTE_USER = "org.osgi.service.http.authentication.remote.user"; /** - * HttpServletRequest attribute specifying the scheme used in + * {@code HttpServletRequest} attribute specifying the scheme used in * authentication. The value of the attribute can be retrieved by - * HttpServletRequest.getAuthType. This attribute name is - * org.osgi.service.http.authentication.type. + * {@code HttpServletRequest.getAuthType}. This attribute name is + * {@code org.osgi.service.http.authentication.type}. * * @since 1.1 */ public static final String AUTHENTICATION_TYPE = "org.osgi.service.http.authentication.type"; /** - * HttpServletRequest attribute specifying the - * Authorization object obtained from the - * org.osgi.service.useradmin.UserAdmin service. The value of the + * {@code HttpServletRequest} attribute specifying the + * {@code Authorization} object obtained from the + * {@code org.osgi.service.useradmin.UserAdmin} service. The value of the * attribute can be retrieved by - * HttpServletRequest.getAttribute(HttpContext.AUTHORIZATION). - * This attribute name is org.osgi.service.useradmin.authorization. + * {@code HttpServletRequest.getAttribute(HttpContext.AUTHORIZATION)}. + * This attribute name is {@code org.osgi.service.useradmin.authorization}. * * @since 1.1 */ @@ -80,20 +80,20 @@ * If the request requires authentication and the Authorization header in * the request is missing or not acceptable, then this method should set the * WWW-Authenticate header in the response object, set the status in the - * response object to Unauthorized(401) and return false. See + * response object to Unauthorized(401) and return {@code false}. See * also RFC 2617: HTTP Authentication: Basic and Digest Access * Authentication (available at http://www.ietf.org/rfc/rfc2617.txt). * *

    - * If the request requires a secure connection and the getScheme + * If the request requires a secure connection and the {@code getScheme} * method in the request does not return 'https' or some other acceptable * secure protocol, then this method should set the status in the response - * object to Forbidden(403) and return false. + * object to Forbidden(403) and return {@code false}. * *

    - * When this method returns false, the Http Service will send + * When this method returns {@code false}, the Http Service will send * the response back to the client, thereby completing the request. When - * this method returns true, the Http Service will proceed with + * this method returns {@code true}, the Http Service will proceed with * servicing the request. * *

    @@ -101,24 +101,24 @@ * {@link #AUTHENTICATION_TYPE} request attribute to the type of * authentication used, and the {@link #REMOTE_USER} request attribute to * the remote user (request attributes are set using the - * setAttribute method on the request). If this method does not + * {@code setAttribute} method on the request). If this method does not * perform any authentication, it must not set these attributes. * *

    * If the authenticated user is also authorized to access certain resources, * this method must set the {@link #AUTHORIZATION} request attribute to the - * Authorization object obtained from the - * org.osgi.service.useradmin.UserAdmin service. + * {@code Authorization} object obtained from the + * {@code org.osgi.service.useradmin.UserAdmin} service. * *

    * The servlet responsible for servicing the specified request determines * the authentication type and remote user by calling the - * getAuthType and getRemoteUser methods, + * {@code getAuthType} and {@code getRemoteUser} methods, * respectively, on the request. * * @param request the HTTP request * @param response the HTTP response - * @return true if the request should be serviced, false + * @return {@code true} if the request should be serviced, {@code false} * if the request should not be serviced and Http Service will send * the response back to the client. * @throws java.io.IOException may be thrown by this method. If this @@ -134,17 +134,17 @@ *

    * Called by the Http Service to map a resource name to a URL. For servlet * registrations, Http Service will call this method to support the - * ServletContext methods getResource and - * getResourceAsStream. For resource registrations, Http Service + * {@code ServletContext} methods {@code getResource} and + * {@code getResourceAsStream}. For resource registrations, Http Service * will call this method to locate the named resource. The context can * control from where resources come. For example, the resource can be * mapped to a file in the bundle's persistent storage area via - * bundleContext.getDataFile(name).toURL() or to a resource in - * the context's bundle via getClass().getResource(name) + * {@code bundleContext.getDataFile(name).toURL()} or to a resource in + * the context's bundle via {@code getClass().getResource(name)} * * @param name the name of the requested resource * @return URL that Http Service can use to read the resource or - * null if the resource does not exist. + * {@code null} if the resource does not exist. */ public URL getResource(String name); @@ -153,12 +153,12 @@ * * Called by the Http Service to determine the MIME type for the name. For * servlet registrations, the Http Service will call this method to support - * the ServletContext method getMimeType. For + * the {@code ServletContext} method {@code getMimeType}. For * resource registrations, the Http Service will call this method to * determine the MIME type for the Content-Type header in the response. * * @param name determine the MIME type for this name. - * @return MIME type (e.g. text/html) of the name or null to + * @return MIME type (e.g. text/html) of the name or {@code null} to * indicate that the Http Service should determine the MIME type * itself. */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/http/HttpService.java osgi-compendium-4.3.0/src/org/osgi/service/http/HttpService.java --- osgi-compendium-4.2.0/src/org/osgi/service/http/HttpService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/http/HttpService.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2011). 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. @@ -25,7 +25,8 @@ * register resources and servlets into the URI namespace of Http Service. A * bundle may later unregister its resources or servlets. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: b8b63fd2e0e8661fe37856ba71f90b370abf8389 $ * @see HttpContext */ public interface HttpService { @@ -43,7 +44,7 @@ * requests are mapped to servlet and resource registrations. * *

    - * The Http Service will call the servlet's init method before + * The Http Service will call the servlet's {@code init} method before * returning. * *

    @@ -51,30 +52,29 @@
     	 * 
    * *

    - * Servlets registered with the same HttpContext object will - * share the same ServletContext. The Http Service will call the - * context argument to support the ServletContext - * methods getResource,getResourceAsStream and - * getMimeType, and to handle security for requests. If the - * context argument is null, a default - * HttpContext object is used (see - * {@link #createDefaultHttpContext}). + * Servlets registered with the same {@code HttpContext} object will share + * the same {@code ServletContext}. The Http Service will call the + * {@code context} argument to support the {@code ServletContext} methods + * {@code getResource},{@code getResourceAsStream} and {@code getMimeType}, + * and to handle security for requests. If the {@code context} argument is + * {@code null}, a default {@code HttpContext} object is used (see + * {@link #createDefaultHttpContext()}). * * @param alias name in the URI namespace at which the servlet is registered * @param servlet the servlet object to register * @param initparams initialization arguments for the servlet or - * null if there are none. This argument is used by the - * servlet's ServletConfig object. - * @param context the HttpContext object for the registered - * servlet, or null if a default HttpContext is - * to be created and used. - * @throws NamespaceException if the registration fails because the alias - * is already in use. - * @throws javax.servlet.ServletException if the servlet's init - * method throws an exception, or the given servlet object has - * already been registered at a different alias. + * {@code null} if there are none. This argument is used by the + * servlet's {@code ServletConfig} object. + * @param context the {@code HttpContext} object for the registered servlet, + * or {@code null} if a default {@code HttpContext} is to be created + * and used. + * @throws NamespaceException if the registration fails because the alias is + * already in use. + * @throws javax.servlet.ServletException if the servlet's {@code init} + * method throws an exception, or the given servlet object has + * already been registered at a different alias. * @throws java.lang.IllegalArgumentException if any of the arguments are - * invalid + * invalid */ public void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) @@ -101,18 +101,17 @@ * httpservice.registerResources("/files", "/tmp", context); * * - * The Http Service will call the HttpContext argument to map + * The Http Service will call the {@code HttpContext} argument to map * resource names to URLs and MIME types and to handle security for - * requests. If the HttpContext argument is null, - * a default HttpContext is used (see - * {@link #createDefaultHttpContext}). + * requests. If the {@code HttpContext} argument is {@code null}, a default + * {@code HttpContext} is used (see {@link #createDefaultHttpContext()}). * * @param alias name in the URI namespace at which the resources are * registered * @param name the base name of the resources that will be registered - * @param context the HttpContext object for the registered - * resources, or null if a default - * HttpContext is to be created and used. + * @param context the {@code HttpContext} object for the registered + * resources, or {@code null} if a default {@code HttpContext} is to + * be created and used. * @throws NamespaceException if the registration fails because the alias is * already in use. * @throws java.lang.IllegalArgumentException if any of the parameters are @@ -122,55 +121,55 @@ HttpContext context) throws NamespaceException; /** - * Unregisters a previous registration done by registerServlet or - * registerResources methods. + * Unregisters a previous registration done by {@code registerServlet} or + * {@code registerResources} methods. * *

    * After this call, the registered alias in the URI name-space will no * longer be available. If the registration was for a servlet, the Http - * Service must call the destroy method of the servlet before + * Service must call the {@code destroy} method of the servlet before * returning. *

    * If the bundle which performed the registration is stopped or otherwise - * "unget"s the Http Service without calling {@link #unregister} then Http - * Service must automatically unregister the registration. However, if the - * registration was for a servlet, the destroy method of the - * servlet will not be called in this case since the bundle may be stopped. - * {@link #unregister} must be explicitly called to cause the - * destroy method of the servlet to be called. This can be done - * in the BundleActivator.stop method of the - * bundle registering the servlet. + * "unget"s the Http Service without calling {@link #unregister(String)} + * then Http Service must automatically unregister the registration. + * However, if the registration was for a servlet, the {@code destroy} + * method of the servlet will not be called in this case since the bundle + * may be stopped. {@link #unregister(String)} must be explicitly called to + * cause the {@code destroy} method of the servlet to be called. This can be + * done in the {@code BundleActivator.stop} method of the bundle registering + * the servlet. * * @param alias name in the URI name-space of the registration to unregister * @throws java.lang.IllegalArgumentException if there is no registration - * for the alias or the calling bundle was not the bundle which - * registered the alias. + * for the alias or the calling bundle was not the bundle which + * registered the alias. */ public void unregister(String alias); /** - * Creates a default HttpContext for registering servlets or - * resources with the HttpService, a new HttpContext object is + * Creates a default {@code HttpContext} for registering servlets or + * resources with the HttpService, a new {@code HttpContext} object is * created each time this method is called. * *

    - * The behavior of the methods on the default HttpContext is + * The behavior of the methods on the default {@code HttpContext} is * defined as follows: *

      - *
    • getMimeType- Does not define any customized MIME types + *
    • {@code getMimeType}- Does not define any customized MIME types * for the Content-Type header in the response, and always returns - * null. - *
    • handleSecurity- Performs implementation-defined + * {@code null}. + *
    • {@code handleSecurity}- Performs implementation-defined * authentication on the request. - *
    • getResource- Assumes the named resource is in the + *
    • {@code getResource}- Assumes the named resource is in the * context bundle; this method calls the context bundle's - * Bundle.getResource method, and returns the appropriate URL to + * {@code Bundle.getResource} method, and returns the appropriate URL to * access the resource. On a Java runtime environment that supports * permissions, the Http Service needs to be granted - * org.osgi.framework.AdminPermission[*,RESOURCE]. + * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}. *
    * - * @return a default HttpContext object. + * @return a default {@code HttpContext} object. * @since 1.1 */ public HttpContext createDefaultHttpContext(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/http/NamespaceException.java osgi-compendium-4.3.0/src/org/osgi/service/http/NamespaceException.java --- osgi-compendium-4.2.0/src/org/osgi/service/http/NamespaceException.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/http/NamespaceException.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -20,13 +20,13 @@ * to register a servlet or resources into the URI namespace of the Http * Service. This exception indicates that the requested alias already is in use. * - * @version $Revision: 6083 $ + * @version $Id: 9093cd6ea6e0532fe624424738ea720993c1a31b $ */ public class NamespaceException extends Exception { static final long serialVersionUID = 7235606031147877747L; /** - * Construct a NamespaceException object with a detail message. + * Construct a {@code NamespaceException} object with a detail message. * * @param message the detail message */ @@ -35,7 +35,7 @@ } /** - * Construct a NamespaceException object with a detail message + * Construct a {@code NamespaceException} object with a detail message * and a nested exception. * * @param message The detail message. @@ -50,20 +50,20 @@ * *

    * This method predates the general purpose exception chaining mechanism. - * The getCause() method is now the preferred means of + * The {@code getCause()} method is now the preferred means of * obtaining this information. * - * @return The result of calling getCause(). + * @return The result of calling {@code getCause()}. */ public Throwable getException() { return getCause(); } /** - * Returns the cause of this exception or null if no cause was + * Returns the cause of this exception or {@code null} if no cause was * set. * - * @return The cause of this exception or null if no cause was + * @return The cause of this exception or {@code null} if no cause was * set. * @since 1.2 */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/http/package.html osgi-compendium-4.3.0/src/org/osgi/service/http/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/http/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/http/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

    Http Service Package Version 1.2. -

    Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

    -Import-Package: org.osgi.service.http; version="[1.2,2.0)"
    -
    - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/http/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/http/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/http/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/http/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Http Service Package Version 1.2. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.http; version="[1.2,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.http; version="[1.2,1.3)"} + * + * @version $Id: 13acc6dd84bdca96a441e96c7b76557daac72cb6 $ + */ + +package org.osgi.service.http; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/io/ConnectionFactory.java osgi-compendium-4.3.0/src/org/osgi/service/io/ConnectionFactory.java --- osgi-compendium-4.2.0/src/org/osgi/service/io/ConnectionFactory.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/io/ConnectionFactory.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -21,38 +21,38 @@ /** * A Connection Factory service is called by the implementation of the Connector - * Service to create javax.microedition.io.Connection objects which - * implement the scheme named by IO_SCHEME. + * Service to create {@code javax.microedition.io.Connection} objects which + * implement the scheme named by {@code IO_SCHEME}. * - * When a ConnectorService.open method is called, the implementation - * of the Connector Service will examine the specified name for a scheme. The + * When a {@code ConnectorService.open} method is called, the implementation of + * the Connector Service will examine the specified name for a scheme. The * Connector Service will then look for a Connection Factory service which is - * registered with the service property IO_SCHEME which matches the - * scheme. The {@link #createConnection} method of the selected Connection - * Factory will then be called to create the actual Connection - * object. + * registered with the service property {@code IO_SCHEME} which matches the + * scheme. The {@link #createConnection(String, int, boolean)} method of the + * selected Connection Factory will then be called to create the actual + * {@code Connection} object. * - * @version $Revision: 7337 $ + * @version $Id: 8c03ed99afb1365db3fc74d8f662de1e812273ee $ */ public interface ConnectionFactory { /** * Service property containing the scheme(s) for which this Connection - * Factory can create Connection objects. This property is of - * type String[]. + * Factory can create {@code Connection} objects. This property is of + * type {@code String[]}. */ public static final String IO_SCHEME = "io.scheme"; /** - * Create a new Connection object for the specified URI. + * Create a new {@code Connection} object for the specified URI. * - * @param name The full URI passed to the ConnectorService.open + * @param name The full URI passed to the {@code ConnectorService.open} * method * @param mode The mode parameter passed to the - * ConnectorService.open method + * {@code ConnectorService.open} method * @param timeouts The timeouts parameter passed to the - * ConnectorService.open method - * @return A new javax.microedition.io.Connection object. - * @throws IOException If a javax.microedition.io.Connection + * {@code ConnectorService.open} method + * @return A new {@code javax.microedition.io.Connection} object. + * @throws IOException If a {@code javax.microedition.io.Connection} * object can not not be created. */ public Connection createConnection(String name, int mode, boolean timeouts) diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/io/ConnectorService.java osgi-compendium-4.3.0/src/org/osgi/service/io/ConnectorService.java --- osgi-compendium-4.2.0/src/org/osgi/service/io/ConnectorService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/io/ConnectorService.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -22,25 +22,25 @@ /** * The Connector Service should be called to create and open - * javax.microedition.io.Connection objects. + * {@code javax.microedition.io.Connection} objects. * - * When an open* method is called, the implementation of the + * When an {@code open*} method is called, the implementation of the * Connector Service will examine the specified name for a scheme. The Connector * Service will then look for a Connection Factory service which is registered - * with the service property IO_SCHEME which matches the scheme. The - * createConnection method of the selected Connection Factory will - * then be called to create the actual Connection object. + * with the service property {@code IO_SCHEME} which matches the scheme. The + * {@code createConnection} method of the selected Connection Factory will + * then be called to create the actual {@code Connection} object. * *

    * If more than one Connection Factory service is registered for a particular * scheme, the service with the highest ranking (as specified in its - * service.ranking property) is called. If there is a tie in ranking, + * {@code service.ranking} property) is called. If there is a tie in ranking, * the service with the lowest service ID (as specified in its - * service.id property), that is the service that was registered + * {@code service.id} property), that is the service that was registered * first, is called. This is the same algorithm used by - * BundleContext.getServiceReference. + * {@code BundleContext.getServiceReference}. * - * @version $Revision: 5673 $ + * @version $Id: 0532872ebea40c8058c65b7fb0f4251fe6b67ce0 $ */ public interface ConnectorService { /** @@ -63,10 +63,10 @@ public static final int READ_WRITE = Connector.READ_WRITE; /** - * Create and open a Connection object for the specified name. + * Create and open a {@code Connection} object for the specified name. * * @param name The URI for the connection. - * @return A new javax.microedition.io.Connection object. + * @return A new {@code javax.microedition.io.Connection} object. * @throws IllegalArgumentException If a parameter is invalid. * @throws javax.microedition.io.ConnectionNotFoundException If the * connection cannot be found. @@ -76,12 +76,12 @@ public Connection open(String name) throws IOException; /** - * Create and open a Connection object for the specified name and + * Create and open a {@code Connection} object for the specified name and * access mode. * * @param name The URI for the connection. * @param mode The access mode. - * @return A new javax.microedition.io.Connection object. + * @return A new {@code javax.microedition.io.Connection} object. * @throws IllegalArgumentException If a parameter is invalid. * @throws javax.microedition.io.ConnectionNotFoundException If the * connection cannot be found. @@ -91,28 +91,28 @@ public Connection open(String name, int mode) throws IOException; /** - * Create and open a Connection object for the specified name, + * Create and open a {@code Connection} object for the specified name, * access mode and timeouts. * * @param name The URI for the connection. * @param mode The access mode. * @param timeouts A flag to indicate that the caller wants timeout * exceptions. - * @return A new javax.microedition.io.Connection object. + * @return A new {@code javax.microedition.io.Connection} object. * @throws IllegalArgumentException If a parameter is invalid. * @throws javax.microedition.io.ConnectionNotFoundException If the * connection cannot be found. * @throws IOException If some other kind of I/O error occurs. - * @see "javax.microedition.io.Connector.open" + * @see "{@code javax.microedition.io.Connector.open}" */ public Connection open(String name, int mode, boolean timeouts) throws IOException; /** - * Create and open an InputStream object for the specified name. + * Create and open an {@code InputStream} object for the specified name. * * @param name The URI for the connection. - * @return An InputStream object. + * @return An {@code InputStream} object. * @throws IllegalArgumentException If a parameter is invalid. * @throws javax.microedition.io.ConnectionNotFoundException If the * connection cannot be found. @@ -122,11 +122,11 @@ public InputStream openInputStream(String name) throws IOException; /** - * Create and open a DataInputStream object for the specified + * Create and open a {@code DataInputStream} object for the specified * name. * * @param name The URI for the connection. - * @return A DataInputStream object. + * @return A {@code DataInputStream} object. * @throws IllegalArgumentException If a parameter is invalid. * @throws javax.microedition.io.ConnectionNotFoundException If the * connection cannot be found. @@ -136,10 +136,10 @@ public DataInputStream openDataInputStream(String name) throws IOException; /** - * Create and open an OutputStream object for the specified name. + * Create and open an {@code OutputStream} object for the specified name. * * @param name The URI for the connection. - * @return An OutputStream object. + * @return An {@code OutputStream} object. * @throws IllegalArgumentException If a parameter is invalid. * @throws javax.microedition.io.ConnectionNotFoundException If the * connection cannot be found. @@ -149,11 +149,11 @@ public OutputStream openOutputStream(String name) throws IOException; /** - * Create and open a DataOutputStream object for the specified + * Create and open a {@code DataOutputStream} object for the specified * name. * * @param name The URI for the connection. - * @return A DataOutputStream object. + * @return A {@code DataOutputStream} object. * @throws IllegalArgumentException If a parameter is invalid. * @throws javax.microedition.io.ConnectionNotFoundException If the * connection cannot be found. diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/io/package.html osgi-compendium-4.3.0/src/org/osgi/service/io/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/io/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/io/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

    IO Connector Package Version 1.0. -

    Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

    -Import-Package: org.osgi.service.io; version="[1.0,2.0)", javax.microedition.io
    -
    - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/io/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/io/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/io/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/io/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * IO Connector Package Version 1.0. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.io; version="[1.0,2.0)", javax.microedition.io} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.io; version="[1.0,1.1)", javax.microedition.io} + * + * @version $Id: 40377d63fd5ef9e12349a23f6b3a5fc83ae5fd75 $ + */ + +package org.osgi.service.io; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jdbc/DataSourceFactory.java osgi-compendium-4.3.0/src/org/osgi/service/jdbc/DataSourceFactory.java --- osgi-compendium-4.2.0/src/org/osgi/service/jdbc/DataSourceFactory.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jdbc/DataSourceFactory.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,229 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.jdbc; + +import java.sql.Driver; +import java.sql.SQLException; +import java.util.Properties; + +import javax.sql.ConnectionPoolDataSource; +import javax.sql.DataSource; +import javax.sql.XADataSource; + +/** + * A factory for JDBC connection factories. There are 3 preferred connection + * factories for getting JDBC connections: {@code javax.sql.DataSource}, + * {@code javax.sql.ConnectionPoolDataSource}, and + * {@code javax.sql.XADataSource}. + * + * DataSource providers should implement this interface and register it as an + * OSGi service with the JDBC driver class name in the + * {@link #OSGI_JDBC_DRIVER_CLASS} property. + * + * @version $Id: dc3ae0d203ac25792bdae5f5880e270904a47fb6 $ + * @ThreadSafe + */ +public interface DataSourceFactory { + /** + * Service property used by a JDBC driver to declare the driver class when + * registering a JDBC DataSourceFactory service. Clients may filter or test + * this property to determine if the driver is suitable, or the desired one. + */ + public static final String OSGI_JDBC_DRIVER_CLASS = "osgi.jdbc.driver.class"; + + /** + * Service property used by a JDBC driver to declare the driver name when + * registering a JDBC DataSourceFactory service. Clients may filter or test + * this property to determine if the driver is suitable, or the desired one. + */ + public static final String OSGI_JDBC_DRIVER_NAME = "osgi.jdbc.driver.name"; + + /** + * Service property used by a JDBC driver to declare the driver version when + * registering a JDBC DataSourceFactory service. Clients may filter or test + * this property to determine if the driver is suitable, or the desired one. + */ + public static final String OSGI_JDBC_DRIVER_VERSION = "osgi.jdbc.driver.version"; + + /** + * The "databaseName" property that DataSource clients should supply a value + * for when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_DATABASE_NAME = "databaseName"; + + /** + * The "dataSourceName" property that DataSource clients should supply a + * value for when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_DATASOURCE_NAME = "dataSourceName"; + + /** + * The "description" property that DataSource clients should supply a value + * for when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_DESCRIPTION = "description"; + + /** + * The "networkProtocol" property that DataSource clients should supply a + * value for when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_NETWORK_PROTOCOL = "networkProtocol"; + + /** + * The "password" property that DataSource clients should supply a value for + * when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_PASSWORD = "password"; + + /** + * The "portNumber" property that DataSource clients should supply a value + * for when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_PORT_NUMBER = "portNumber"; + + /** + * The "roleName" property that DataSource clients should supply a value for + * when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_ROLE_NAME = "roleName"; + + /** + * The "serverName" property that DataSource clients should supply a value + * for when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_SERVER_NAME = "serverName"; + + /** + * The "user" property that DataSource clients should supply a value for + * when calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_USER = "user"; + + /** + * The "url" property that DataSource clients should supply a value for when + * calling {@link #createDataSource(Properties)}. + */ + public static final String JDBC_URL = "url"; + + /** + * The "initialPoolSize" property that ConnectionPoolDataSource and + * XADataSource clients may supply a value for when calling + * {@link #createConnectionPoolDataSource(Properties)} or + * {@link #createXADataSource(Properties)} on drivers that support + * this property. + */ + public static final String JDBC_INITIAL_POOL_SIZE = "initialPoolSize"; + + /** + * The "maxIdleTime" property that ConnectionPoolDataSource and + * XADataSource clients may supply a value for when calling + * {@link #createConnectionPoolDataSource(Properties)} or + * {@link #createXADataSource(Properties)} on drivers that support + * this property. + */ + public static final String JDBC_MAX_IDLE_TIME = "maxIdleTime"; + + /** + * The "maxPoolSize" property that ConnectionPoolDataSource and + * XADataSource clients may supply a value for when calling + * {@link #createConnectionPoolDataSource(Properties)} or + * {@link #createXADataSource(Properties)} on drivers that support + * this property. + */ + public static final String JDBC_MAX_POOL_SIZE = "maxPoolSize"; + + /** + * The "maxStatements" property that ConnectionPoolDataSource and + * XADataSource clients may supply a value for when calling + * {@link #createConnectionPoolDataSource(Properties)} or + * {@link #createXADataSource(Properties)} on drivers that support + * this property. + */ + public static final String JDBC_MAX_STATEMENTS = "maxStatements"; + + /** + * The "minPoolSize" property that ConnectionPoolDataSource and + * XADataSource clients may supply a value for when calling + * {@link #createConnectionPoolDataSource(Properties)} or + * {@link #createXADataSource(Properties)} on drivers that support + * this property. + */ + public static final String JDBC_MIN_POOL_SIZE = "minPoolSize"; + + /** + * The "propertyCycle" property that ConnectionPoolDataSource and + * XADataSource clients may supply a value for when calling + * {@link #createConnectionPoolDataSource(Properties)} or + * {@link #createXADataSource(Properties)} on drivers that support + * this property. + */ + public static final String JDBC_PROPERTY_CYCLE = "propertyCycle"; + + /** + * Create a new {@code DataSource} using the given properties. + * + * @param props The properties used to configure the {@code DataSource} + * . {@code null} indicates no properties. If the property + * cannot be set on the {@code DataSource} being created then a + * {@code SQLException} must be thrown. + * @return A configured {@code DataSource}. + * @throws SQLException If the {@code DataSource} cannot be created. + */ + public DataSource createDataSource(Properties props) throws SQLException; + + /** + * Create a new {@code ConnectionPoolDataSource} using the given + * properties. + * + * @param props The properties used to configure the + * {@code ConnectionPoolDataSource}. {@code null} indicates + * no properties. If the property cannot be set on the + * {@code ConnectionPoolDataSource} being created then a + * {@code SQLException} must be thrown. + * @return A configured {@code ConnectionPoolDataSource}. + * @throws SQLException If the {@code ConnectionPoolDataSource} cannot + * be created. + */ + public ConnectionPoolDataSource createConnectionPoolDataSource( + Properties props) throws SQLException; + + /** + * Create a new {@code XADataSource} using the given properties. + * + * @param props The properties used to configure the + * {@code XADataSource}. {@code null} indicates no + * properties. If the property cannot be set on the + * {@code XADataSource} being created then a + * {@code SQLException} must be thrown. + * @return A configured {@code XADataSource}. + * @throws SQLException If the {@code XADataSource} cannot be created. + */ + public XADataSource createXADataSource(Properties props) + throws SQLException; + + /** + * Create a new {@code Driver} using the given properties. + * + * @param props The properties used to configure the {@code Driver}. + * {@code null} indicates no properties. If the property cannot + * be set on the {@code Driver} being created then a + * {@code SQLException} must be thrown. + * @return A configured {@code Driver}. + * @throws SQLException If the {@code Driver} cannot be created. + */ + public Driver createDriver(Properties props) throws SQLException; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jdbc/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/jdbc/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/jdbc/packageinfo 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jdbc/packageinfo 2010-06-15 15:44:04.000000000 +0000 @@ -0,0 +1 @@ +version 1.0 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jdbc/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/jdbc/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/jdbc/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jdbc/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * JDBC Service Package Version 1.0. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.jdbc; version="[1.0,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.jdbc; version="[1.0,1.1)"} + * + * @version $Id: 411479758718416ee6810084a6b38a3f0a4b1b99 $ + */ + +package org.osgi.service.jdbc; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jndi/JNDIConstants.java osgi-compendium-4.3.0/src/org/osgi/service/jndi/JNDIConstants.java --- osgi-compendium-4.2.0/src/org/osgi/service/jndi/JNDIConstants.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jndi/JNDIConstants.java 2010-06-15 15:44:04.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.jndi; + +/** + * Constants for the JNDI implementation. + * + * @version $Id: 5577cfdf182d7c6b24f110821413cb5af484d283 $ + * @Immutable + */ +public class JNDIConstants { + /** + * This service property is set by JNDI Providers that publish URL Context + * Factories as OSGi Services. The value of this property should be the URL + * scheme that is supported by the published service. + */ + public static final String JNDI_URLSCHEME = "osgi.jndi.url.scheme"; + + /** + * This service property is set on an OSGi service to provide a name that + * can be used to locate the service other than the service interface name. + */ + public static final String JNDI_SERVICENAME = "osgi.jndi.service.name"; + + /** + * This JNDI environment property can be used by a JNDI client to indicate + * the caller's BundleContext. This property can be set and passed to an + * InitialContext constructor. This property is only useful in the + * "traditional" mode of JNDI. + */ + public static final String BUNDLE_CONTEXT = "osgi.service.jndi.bundleContext"; + + private JNDIConstants() { + // non-instantiable + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jndi/JNDIContextManager.java osgi-compendium-4.3.0/src/org/osgi/service/jndi/JNDIContextManager.java --- osgi-compendium-4.2.0/src/org/osgi/service/jndi/JNDIContextManager.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jndi/JNDIContextManager.java 2010-06-15 15:44:04.000000000 +0000 @@ -0,0 +1,78 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.jndi; + +import java.util.Map; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; + +/** + * This interface defines the OSGi service interface for the JNDIContextManager. + * + * This service provides the ability to create new JNDI Context instances + * without relying on the InitialContext constructor. + * + * @version $Id: 8c2585aa84315b96aff14ffda869ddb8b1357ea0 $ + * @ThreadSafe + */ +public interface JNDIContextManager { + + /** + * Creates a new JNDI initial context with the default JNDI environment + * properties. + * + * @return an instance of javax.naming.Context + * @throws NamingException upon any error that occurs during context + * creation + */ + public Context newInitialContext() throws NamingException; + + /** + * Creates a new JNDI initial context with the specified JNDI environment + * properties. + * + * @param environment JNDI environment properties specified by caller + * @return an instance of javax.naming.Context + * @throws NamingException upon any error that occurs during context + * creation + */ + public Context newInitialContext(Map environment) throws NamingException; + + /** + * Creates a new initial DirContext with the default JNDI environment + * properties. + * + * @return an instance of javax.naming.directory.DirContext + * @throws NamingException upon any error that occurs during context + * creation + */ + public DirContext newInitialDirContext() throws NamingException; + + /** + * Creates a new initial DirContext with the specified JNDI environment + * properties. + * + * @param environment JNDI environment properties specified by the caller + * @return an instance of javax.naming.directory.DirContext + * @throws NamingException upon any error that occurs during context + * creation + */ + public DirContext newInitialDirContext(Map environment) + throws NamingException; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jndi/JNDIProviderAdmin.java osgi-compendium-4.3.0/src/org/osgi/service/jndi/JNDIProviderAdmin.java --- osgi-compendium-4.2.0/src/org/osgi/service/jndi/JNDIProviderAdmin.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jndi/JNDIProviderAdmin.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,73 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.jndi; + +import java.util.Map; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.directory.Attributes; + +/** + * This interface defines the OSGi service interface for the JNDIProviderAdmin + * service. + * + * This service provides the ability to resolve JNDI References in a dynamic + * fashion that does not require calls to + * {@code NamingManager.getObjectInstance()}. The methods of this service + * provide similar reference resolution, but rely on the OSGi Service Registry + * in order to find {@code ObjectFactory} instances that can convert a + * Reference to an Object. + * + * This service will typically be used by OSGi-aware JNDI Service Providers. + * + * @version $Id: 54655bb9ec473bf2848e3f16e4bf83db9c8871b0 $ + * @ThreadSafe + */ +public interface JNDIProviderAdmin { + + /** + * Resolve the object from the given reference. + * + * @param refInfo Reference info + * @param name the JNDI name associated with this reference + * @param context the JNDI context associated with this reference + * @param environment the JNDI environment associated with this JNDI context + * @return an Object based on the reference passed in, or the original + * reference object if the reference could not be resolved. + * @throws Exception in the event that an error occurs while attempting to + * resolve the JNDI reference. + */ + public Object getObjectInstance(Object refInfo, Name name, Context context, + Map environment) throws Exception; + + /** + * Resolve the object from the given reference. + * + * @param refInfo Reference info + * @param name the JNDI name associated with this reference + * @param context the JNDI context associated with this reference + * @param environment the JNDI environment associated with this JNDI context + * @param attributes the naming attributes to use when resolving this object + * @return an Object based on the reference passed in, or the original + * reference object if the reference could not be resolved. + * @throws Exception in the event that an error occurs while attempting to + * resolve the JNDI reference. + */ + public Object getObjectInstance(Object refInfo, Name name, Context context, + Map environment, Attributes attributes) throws Exception; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jndi/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/jndi/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/jndi/packageinfo 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jndi/packageinfo 2010-06-15 15:44:04.000000000 +0000 @@ -0,0 +1 @@ +version 1.0 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jndi/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/jndi/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/jndi/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jndi/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * JNDI Package Version 1.0. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.jndi; version="[1.0,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.jndi; version="[1.0,1.1)"} + * + * @version $Id: 4ff46835683e4c2132a830e178143c72eeff7daf $ + */ + +package org.osgi.service.jndi; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jpa/EntityManagerFactoryBuilder.java osgi-compendium-4.3.0/src/org/osgi/service/jpa/EntityManagerFactoryBuilder.java --- osgi-compendium-4.2.0/src/org/osgi/service/jpa/EntityManagerFactoryBuilder.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jpa/EntityManagerFactoryBuilder.java 2010-06-15 15:44:04.000000000 +0000 @@ -0,0 +1,62 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.jpa; + +import java.util.Map; + +import javax.persistence.EntityManagerFactory; + +/** + * This service interface offers JPA clients the ability to create instances of + * EntityManagerFactory for a given named persistence unit. A service instance + * will be created for each named persistence unit and can be filtered by + * comparing the value of the osgi.unit.name property containing the persistence + * unit name. + * + * This service is used specifically when the caller wants to pass in factory-scoped + * properties as arguments. If no properties are being used in the creation of the + * EntityManagerFactory then the basic EntityManagerFactory service should be used. + */ +public interface EntityManagerFactoryBuilder { + + /** + * The name of the persistence unit. + */ + public static final String JPA_UNIT_NAME = "osgi.unit.name"; + + /** + * The version of the persistence unit bundle. + */ + public static final String JPA_UNIT_VERSION = "osgi.unit.version"; + + /** + * The class name of the provider that registered the service and implements + * the JPA javax.persistence.PersistenceProvider interface. + */ + public static final String JPA_UNIT_PROVIDER = "osgi.unit.provider"; + + /** + * Return an EntityManagerFactory instance configured according to the properties + * defined in the corresponding persistence descriptor, as well as the properties + * passed into the method. + * + * @param props Properties to be used, in addition to those in the persistence descriptor, + * for configuring the EntityManagerFactory for the persistence unit. + * + * @return An EntityManagerFactory for the persistence unit associated with this service. Must not be null. + */ + EntityManagerFactory createEntityManagerFactory(Map props); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jpa/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/jpa/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/jpa/packageinfo 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jpa/packageinfo 2010-06-15 15:44:04.000000000 +0000 @@ -0,0 +1 @@ +version 1.0 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/jpa/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/jpa/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/jpa/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/jpa/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * JPA Package Version 1.0. + * + *

    + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

    + * Example import for consumers using the API in this package: + *

    + * {@code Import-Package: org.osgi.service.jpa; version="[1.0,2.0)"} + *

    + * Example import for providers implementing the API in this package: + *

    + * {@code Import-Package: org.osgi.service.jpa; version="[1.0,1.1)"} + * + * @version $Id: a7961ce3cfda4cc2a28a58e8eae276a7ab8f74ce $ + */ + +package org.osgi.service.jpa; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/log/LogEntry.java osgi-compendium-4.3.0/src/org/osgi/service/log/LogEntry.java --- osgi-compendium-4.2.0/src/org/osgi/service/log/LogEntry.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/log/LogEntry.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -23,43 +23,44 @@ * Service log entry. * *

    - * A LogEntry object may be acquired from the - * LogReaderService.getLog method or by registering a - * LogListener object. + * A {@code LogEntry} object may be acquired from the + * {@code LogReaderService.getLog} method or by registering a + * {@code LogListener} object. * * @ThreadSafe - * @version $Revision: 5654 $ + * @noimplement + * @version $Id: e20fd66ff9e0264d77f7b7ea19212b305d1b3a40 $ * @see LogReaderService#getLog * @see LogListener */ public interface LogEntry { /** - * Returns the bundle that created this LogEntry object. + * Returns the bundle that created this {@code LogEntry} object. * - * @return The bundle that created this LogEntry object; - * null if no bundle is associated with this - * LogEntry object. + * @return The bundle that created this {@code LogEntry} object; + * {@code null} if no bundle is associated with this + * {@code LogEntry} object. */ public Bundle getBundle(); /** - * Returns the ServiceReference object for the service associated - * with this LogEntry object. + * Returns the {@code ServiceReference} object for the service associated + * with this {@code LogEntry} object. * - * @return ServiceReference object for the service associated - * with this LogEntry object; null if no - * ServiceReference object was provided. + * @return {@code ServiceReference} object for the service associated + * with this {@code LogEntry} object; {@code null} if no + * {@code ServiceReference} object was provided. */ public ServiceReference getServiceReference(); /** - * Returns the severity level of this LogEntry object. + * Returns the severity level of this {@code LogEntry} object. * *

    - * This is one of the severity levels defined by the LogService + * This is one of the severity levels defined by the {@code LogService} * interface. * - * @return Severity level of this LogEntry object. + * @return Severity level of this {@code LogEntry} object. * * @see LogService#LOG_ERROR * @see LogService#LOG_WARNING @@ -69,16 +70,16 @@ public int getLevel(); /** - * Returns the human readable message associated with this LogEntry + * Returns the human readable message associated with this {@code LogEntry} * object. * - * @return String containing the message associated with this - * LogEntry object. + * @return {@code String} containing the message associated with this + * {@code LogEntry} object. */ public String getMessage(); /** - * Returns the exception object associated with this LogEntry + * Returns the exception object associated with this {@code LogEntry} * object. * *

    @@ -90,17 +91,17 @@ * information as possible from the original exception object such as the * message and stack trace. * - * @return Throwable object of the exception associated with this - * LogEntry;null if no exception is - * associated with this LogEntry object. + * @return {@code Throwable} object of the exception associated with this + * {@code LogEntry};{@code null} if no exception is + * associated with this {@code LogEntry} object. */ public Throwable getException(); /** - * Returns the value of currentTimeMillis() at the time this - * LogEntry object was created. + * Returns the value of {@code currentTimeMillis()} at the time this + * {@code LogEntry} object was created. * - * @return The system time in milliseconds when this LogEntry + * @return The system time in milliseconds when this {@code LogEntry} * object was created. * @see "System.currentTimeMillis()" */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/log/LogListener.java osgi-compendium-4.3.0/src/org/osgi/service/log/LogListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/log/LogListener.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/log/LogListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -18,18 +18,18 @@ import java.util.EventListener; /** - * Subscribes to LogEntry objects from the LogReaderService. + * Subscribes to {@code LogEntry} objects from the {@code LogReaderService}. * *

    - * A LogListener object may be registered with the Log Reader Service - * using the LogReaderService.addLogListener method. After the - * listener is registered, the logged method will be called for each - * LogEntry object created. The LogListener object may be - * unregistered by calling the LogReaderService.removeLogListener + * A {@code LogListener} object may be registered with the Log Reader Service + * using the {@code LogReaderService.addLogListener} method. After the + * listener is registered, the {@code logged} method will be called for each + * {@code LogEntry} object created. The {@code LogListener} object may be + * unregistered by calling the {@code LogReaderService.removeLogListener} * method. * * @ThreadSafe - * @version $Revision: 5654 $ + * @version $Id: 9b1ea6645e00027d03684b74745f47a42fb9ad30 $ * @see LogReaderService * @see LogEntry * @see LogReaderService#addLogListener(LogListener) @@ -43,7 +43,7 @@ * As with all event listeners, this method should return to its caller as * soon as possible. * - * @param entry A LogEntry object containing log information. + * @param entry A {@code LogEntry} object containing log information. * @see LogEntry */ public void logged(LogEntry entry); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/log/LogReaderService.java osgi-compendium-4.3.0/src/org/osgi/service/log/LogReaderService.java --- osgi-compendium-4.2.0/src/org/osgi/service/log/LogReaderService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/log/LogReaderService.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -18,44 +18,44 @@ import java.util.Enumeration; /** - * Provides methods to retrieve LogEntry objects from the log. + * Provides methods to retrieve {@code LogEntry} objects from the log. *

    - * There are two ways to retrieve LogEntry objects: + * There are two ways to retrieve {@code LogEntry} objects: *

      - *
    • The primary way to retrieve LogEntry objects is to register a - * LogListener object whose LogListener.logged method will + *
    • The primary way to retrieve {@code LogEntry} objects is to register a + * {@code LogListener} object whose {@code LogListener.logged} method will * be called for each entry added to the log. - *
    • To retrieve past LogEntry objects, the getLog - * method can be called which will return an Enumeration of all - * LogEntry objects in the log. + *
    • To retrieve past {@code LogEntry} objects, the {@code getLog} + * method can be called which will return an {@code Enumeration} of all + * {@code LogEntry} objects in the log. * * @ThreadSafe - * @version $Revision: 5654 $ + * @version $Id: bb22587248982a76202b77d03550515b3205f935 $ * @see LogEntry * @see LogListener * @see LogListener#logged(LogEntry) */ public interface LogReaderService { /** - * Subscribes to LogEntry objects. + * Subscribes to {@code LogEntry} objects. * *

      - * This method registers a LogListener object with the Log Reader - * Service. The LogListener.logged(LogEntry) method will be - * called for each LogEntry object placed into the log. + * This method registers a {@code LogListener} object with the Log Reader + * Service. The {@code LogListener.logged(LogEntry)} method will be + * called for each {@code LogEntry} object placed into the log. * *

      - * When a bundle which registers a LogListener object is stopped + * When a bundle which registers a {@code LogListener} object is stopped * or otherwise releases the Log Reader Service, the Log Reader Service must * remove all of the bundle's listeners. * *

      * If this Log Reader Service's list of listeners already contains a - * listener l such that (l==listener), this method + * listener {@code l} such that {@code (l==listener)}, this method * does nothing. * - * @param listener A LogListener object to register; the - * LogListener object is used to receive LogEntry + * @param listener A {@code LogListener} object to register; the + * {@code LogListener} object is used to receive {@code LogEntry} * objects. * @see LogListener * @see LogEntry @@ -64,33 +64,33 @@ public void addLogListener(LogListener listener); /** - * Unsubscribes to LogEntry objects. + * Unsubscribes to {@code LogEntry} objects. * *

      - * This method unregisters a LogListener object from the Log + * This method unregisters a {@code LogListener} object from the Log * Reader Service. * *

      - * If listener is not contained in this Log Reader Service's list + * If {@code listener} is not contained in this Log Reader Service's list * of listeners, this method does nothing. * - * @param listener A LogListener object to unregister. + * @param listener A {@code LogListener} object to unregister. * @see LogListener */ public void removeLogListener(LogListener listener); /** - * Returns an Enumeration of all LogEntry objects in + * Returns an {@code Enumeration} of all {@code LogEntry} objects in * the log. * *

      - * Each element of the enumeration is a LogEntry object, ordered + * Each element of the enumeration is a {@code LogEntry} object, ordered * with the most recent entry first. Whether the enumeration is of all - * LogEntry objects since the Log Service was started or some + * {@code LogEntry} objects since the Log Service was started or some * recent past is implementation-specific. Also implementation-specific is - * whether informational and debug LogEntry objects are included + * whether informational and debug {@code LogEntry} objects are included * in the enumeration. - * @return An Enumeration of all LogEntry objects in + * @return An {@code Enumeration} of all {@code LogEntry} objects in * the log. */ public Enumeration getLog(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/log/LogService.java osgi-compendium-4.3.0/src/org/osgi/service/log/LogService.java --- osgi-compendium-4.2.0/src/org/osgi/service/log/LogService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/log/LogService.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -21,8 +21,8 @@ * Provides methods for bundles to write messages to the log. * *

      - * LogService methods are provided to log messages; optionally with a - * ServiceReference object or an exception. + * {@code LogService} methods are provided to log messages; optionally with a + * {@code ServiceReference} object or an exception. * *

      * Bundles must log messages in the OSGi environment with a severity level @@ -35,7 +35,8 @@ * * * @ThreadSafe - * @version $Revision: 5654 $ + * @noimplement + * @version $Id: 3f44517702a7c759054adbd7bdcc561ace624af9 $ */ public interface LogService { /** @@ -74,14 +75,14 @@ * Logs a message. * *

      - * The ServiceReference field and the Throwable field - * of the LogEntry object will be set to null. + * The {@code ServiceReference} field and the {@code Throwable} field + * of the {@code LogEntry} object will be set to {@code null}. * * @param level The severity of the message. This should be one of the * defined log levels but may be any integer that is interpreted in a * user defined way. * @param message Human readable string describing the condition or - * null. + * {@code null}. * @see #LOG_ERROR * @see #LOG_WARNING * @see #LOG_INFO @@ -93,16 +94,16 @@ * Logs a message with an exception. * *

      - * The ServiceReference field of the LogEntry object - * will be set to null. + * The {@code ServiceReference} field of the {@code LogEntry} object + * will be set to {@code null}. * * @param level The severity of the message. This should be one of the * defined log levels but may be any integer that is interpreted in a * user defined way. * @param message The human readable string describing the condition or - * null. + * {@code null}. * @param exception The exception that reflects the condition or - * null. + * {@code null}. * @see #LOG_ERROR * @see #LOG_WARNING * @see #LOG_INFO @@ -111,20 +112,20 @@ public void log(int level, String message, Throwable exception); /** - * Logs a message associated with a specific ServiceReference + * Logs a message associated with a specific {@code ServiceReference} * object. * *

      - * The Throwable field of the LogEntry will be set to - * null. + * The {@code Throwable} field of the {@code LogEntry} will be set to + * {@code null}. * - * @param sr The ServiceReference object of the service that this - * message is associated with or null. + * @param sr The {@code ServiceReference} object of the service that this + * message is associated with or {@code null}. * @param level The severity of the message. This should be one of the * defined log levels but may be any integer that is interpreted in a * user defined way. * @param message Human readable string describing the condition or - * null. + * {@code null}. * @see #LOG_ERROR * @see #LOG_WARNING * @see #LOG_INFO @@ -134,17 +135,17 @@ /** * Logs a message with an exception associated and a - * ServiceReference object. + * {@code ServiceReference} object. * - * @param sr The ServiceReference object of the service that this + * @param sr The {@code ServiceReference} object of the service that this * message is associated with. * @param level The severity of the message. This should be one of the * defined log levels but may be any integer that is interpreted in a * user defined way. * @param message Human readable string describing the condition or - * null. + * {@code null}. * @param exception The exception that reflects the condition or - * null. + * {@code null}. * @see #LOG_ERROR * @see #LOG_WARNING * @see #LOG_INFO diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/log/package.html osgi-compendium-4.3.0/src/org/osgi/service/log/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/log/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/log/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - -

      Log Service Package Version 1.3. -

      Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

      -Import-Package: org.osgi.service.log; version="[1.3,2.0)"
      -
      - - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/log/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/log/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/log/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/log/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Log Service Package Version 1.3. + * + *

      + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.log; version="[1.3,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.log; version="[1.3,1.4)"} + * + * @version $Id: 5c4120fc17628d242e1641557eacb9581b08c920 $ + */ + +package org.osgi.service.log; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/AttributeDefinition.java osgi-compendium-4.3.0/src/org/osgi/service/metatype/AttributeDefinition.java --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/AttributeDefinition.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/AttributeDefinition.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -19,132 +19,145 @@ * An interface to describe an attribute. * *

      - * An AttributeDefinition object defines a description of the data - * type of a property/attribute. + * An {@code AttributeDefinition} object defines a description of the data type + * of a property/attribute. * - * @version $Revision: 5673 $ + * @version $Id: e04e0895e678fe739e1b789a189d2ddce1ef8f01 $ */ public interface AttributeDefinition { /** - * The STRING (1) type. + * The {@code STRING} (1) type. * *

      - * Attributes of this type should be stored as String, - * Vector with String or String[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code String}, + * {@code Vector} with {@code String} or {@code String[]} objects, depending + * on the {@code getCardinality()} value. */ - public static final int STRING = 1; + int STRING = 1; /** - * The LONG (2) type. + * The {@code LONG} (2) type. * - * Attributes of this type should be stored as Long, - * Vector with Long or long[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code Long}, {@code Vector} + * with {@code Long} or {@code long[]} objects, depending on the + * {@code getCardinality()} value. */ - public static final int LONG = 2; + int LONG = 2; /** - * The INTEGER (3) type. + * The {@code INTEGER} (3) type. * - * Attributes of this type should be stored as Integer, - * Vector with Integer or int[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code Integer}, + * {@code Vector} with {@code Integer} or {@code int[]} objects, depending + * on the {@code getCardinality()} value. */ - public static final int INTEGER = 3; + int INTEGER = 3; /** - * The SHORT (4) type. + * The {@code SHORT} (4) type. * - * Attributes of this type should be stored as Short, - * Vector with Short or short[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code Short}, {@code Vector} + * with {@code Short} or {@code short[]} objects, depending on the + * {@code getCardinality()} value. */ - public static final int SHORT = 4; + int SHORT = 4; /** - * The CHARACTER (5) type. + * The {@code CHARACTER} (5) type. * - * Attributes of this type should be stored as Character, - * Vector with Character or char[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code Character}, + * {@code Vector} with {@code Character} or {@code char[]} objects, + * depending on the {@code getCardinality()} value. */ - public static final int CHARACTER = 5; + int CHARACTER = 5; /** - * The BYTE (6) type. + * The {@code BYTE} (6) type. * - * Attributes of this type should be stored as Byte, - * Vector with Byte or byte[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code Byte}, {@code Vector} + * with {@code Byte} or {@code byte[]} objects, depending on the + * {@code getCardinality()} value. */ - public static final int BYTE = 6; + int BYTE = 6; /** - * The DOUBLE (7) type. + * The {@code DOUBLE} (7) type. * - * Attributes of this type should be stored as Double, - * Vector with Double or double[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code Double}, + * {@code Vector} with {@code Double} or {@code double[]} objects, depending + * on the {@code getCardinality()} value. */ - public static final int DOUBLE = 7; + int DOUBLE = 7; /** - * The FLOAT (8) type. + * The {@code FLOAT} (8) type. * - * Attributes of this type should be stored as Float, - * Vector with Float or float[] objects, - * depending on the getCardinality() value. + * Attributes of this type should be stored as {@code Float}, {@code Vector} + * with {@code Float} or {@code float[]} objects, depending on the + * {@code getCardinality()} value. */ - public static final int FLOAT = 8; + int FLOAT = 8; /** - * The BIGINTEGER (9) type. + * The {@code BIGINTEGER} (9) type. * - * Attributes of this type should be stored as BigInteger, - * Vector with BigInteger or BigInteger[] - * objects, depending on the getCardinality() value. + * Attributes of this type should be stored as {@code BigInteger}, + * {@code Vector} with {@code BigInteger} or {@code BigInteger[]} objects, + * depending on the {@code getCardinality()} value. * * @deprecated As of 1.1. */ - public static final int BIGINTEGER = 9; + int BIGINTEGER = 9; /** - * The BIGDECIMAL (10) type. + * The {@code BIGDECIMAL} (10) type. * - * Attributes of this type should be stored as BigDecimal, - * Vector with BigDecimal or BigDecimal[] - * objects depending on getCardinality(). + * Attributes of this type should be stored as {@code BigDecimal}, + * {@code Vector} with {@code BigDecimal} or {@code BigDecimal[]} objects + * depending on {@code getCardinality()}. * * @deprecated As of 1.1. */ - public static final int BIGDECIMAL = 10; + int BIGDECIMAL = 10; /** - * The BOOLEAN (11) type. + * The {@code BOOLEAN} (11) type. * - * Attributes of this type should be stored as Boolean, - * Vector with Boolean or boolean[] objects - * depending on getCardinality(). + * Attributes of this type should be stored as {@code Boolean}, + * {@code Vector} with {@code Boolean} or {@code boolean[]} objects + * depending on {@code getCardinality()}. */ - public static final int BOOLEAN = 11; + int BOOLEAN = 11; + + /** + * The {@code PASSWORD} (12) type. + * + * Attributes of this type must be stored as {@code String}, {@code Vector} + * with {@code String} or {@code String[]} objects depending on {link + * getCardinality()}. A {@code PASSWORD} must be treated as a string but the + * type can be used to disguise the information when displayed to a user to + * prevent others from seeing it. + * + * @since 1.2 + */ + int PASSWORD = 12; /** * Get the name of the attribute. This name may be localized. * * @return The localized name of the definition. */ - public String getName(); + String getName(); /** * Unique identity for this attribute. * * Attributes share a global namespace in the registry. E.g. an attribute - * cn or commonName must always be a String - * and the semantics are always a name of some object. They share this - * aspect with LDAP/X.500 attributes. In these standards the OSI Object - * Identifier (OID) is used to uniquely identify an attribute. If such an - * OID exists, (which can be requested at several standard organisations and - * many companies already have a node in the tree) it can be returned here. - * Otherwise, a unique id should be returned which can be a Java class name - * (reverse domain name) or generated with a GUID algorithm. Note that all - * LDAP defined attributes already have an OID. It is strongly advised to - * define the attributes from existing LDAP schemes which will give the OID. - * Many such schemes exist ranging from postal addresses to DHCP parameters. + * {@code cn} or {@code commonName} must always be a {@code String} and the + * semantics are always a name of some object. They share this aspect with + * LDAP/X.500 attributes. In these standards the OSI Object Identifier (OID) + * is used to uniquely identify an attribute. If such an OID exists, (which + * can be requested at several standard organisations and many companies + * already have a node in the tree) it can be returned here. Otherwise, a + * unique id should be returned which can be a Java class name (reverse + * domain name) or generated with a GUID algorithm. Note that all LDAP + * defined attributes already have an OID. It is strongly advised to define + * the attributes from existing LDAP schemes which will give the OID. Many + * such schemes exist ranging from postal addresses to DHCP parameters. * * @return The id or oid */ - public String getID(); + String getID(); /** * Return a description of this attribute. @@ -154,13 +167,13 @@ * * @return The localized description of the definition. */ - public String getDescription(); + String getDescription(); /** * Return the cardinality of this attribute. * * The OSGi environment handles multi valued attributes in arrays ([]) or in - * Vector objects. The return value is defined as follows: + * {@code Vector} objects. The return value is defined as follows: * *

       	 * 
      @@ -169,42 +182,41 @@
       	 *    x > 0                     x = max occurrences, store in array []
       	 *    x = Integer.MAX_VALUE    no limit, but use array []
       	 *    x = 0                     1 occurrence required
      -	 *  
      +	 * 
       	 * 
      * - * @return The cardinality of this attribute. + * @return The cardinality of this attribute. */ - public int getCardinality(); + int getCardinality(); /** * Return the type for this attribute. * *

      * Defined in the following constants which map to the appropriate Java - * type. STRING,LONG,INTEGER, - * CHAR,BYTE,DOUBLE,FLOAT, - * BOOLEAN. - * + * type. {@code STRING},{@code LONG},{@code INTEGER}, {@code CHAR}, + * {@code BYTE},{@code DOUBLE},{@code FLOAT}, {@code BOOLEAN}. + * * @return The type for this attribute. */ - public int getType(); + int getType(); /** * Return a list of option values that this attribute can take. * *

      - * If the function returns null, there are no option values + * If the function returns {@code null}, there are no option values * available. * *

      * Each value must be acceptable to validate() (return "") and must be a - * String object that can be converted to the data type defined - * by getType() for this attribute. + * {@code String} object that can be converted to the data type defined by + * getType() for this attribute. * *

      - * This list must be in the same sequence as getOptionLabels(). - * I.e. for each index i in getOptionValues, i in - * getOptionLabels() should be the label. + * This list must be in the same sequence as {@code getOptionLabels()}. I.e. + * for each index i in {@code getOptionValues}, i in + * {@code getOptionLabels()} should be the label. * *

      * For example, if an attribute can have the value male, female, unknown, @@ -213,23 +225,23 @@ * * @return A list values */ - public String[] getOptionValues(); + String[] getOptionValues(); /** * Return a list of labels of option values. * *

      * The purpose of this method is to allow menus with localized labels. It is - * associated with getOptionValues. The labels returned here are + * associated with {@code getOptionValues}. The labels returned here are * ordered in the same way as the values in that method. * *

      - * If the function returns null, there are no option labels + * If the function returns {@code null}, there are no option labels * available. *

      - * This list must be in the same sequence as the getOptionValues() - * method. I.e. for each index i in getOptionLabels, i in - * getOptionValues() should be the associated value. + * This list must be in the same sequence as the {@code getOptionValues()} + * method. I.e. for each index i in {@code getOptionLabels}, i in + * {@code getOptionValues()} should be the associated value. * *

      * For example, if an attribute can have the value male, female, unknown, @@ -238,10 +250,10 @@ * * @return A list values */ - public String[] getOptionLabels(); + String[] getOptionLabels(); /** - * Validate an attribute in String form. + * Validate an attribute in {@code String} form. * * An attribute might be further constrained in value. This method will * attempt to validate the attribute according to these constraints. It can @@ -253,16 +265,29 @@ * "..." A localized description of why the value is wrong * * - * @param value The value before turning it into the basic data type - * @return null, "", or another string + * If the cardinality of this attribute is multi-valued then this string + * must be interpreted as a comma delimited string. The complete value must + * be trimmed from white space as well as spaces around commas. Commas (',' + * \u002C) and spaces (' ' ) and back-slashes ('\' \u005C) can be escaped + * with another back-slash. Escaped spaces must not be trimmed. For example: + * + *

      +	 * value="  a\,b,b\,c,\ c\\,d   " =>	[ "a,b", "b,c", " c\", "d" ]
      +	 * 
      + * + * @param value + * The value before turning it into the basic data type. If the + * cardinality indicates a multi valued attribute then the given + * string must be escap + * @return {@code null}, "", or another string */ - public String validate(String value); + String validate(String value); /** * Return a default for this attribute. * * The object must be of the appropriate type as defined by the cardinality - * and getType(). The return type is a list of String + * and {@code getType()}. The return type is a list of {@code String} * objects that can be converted to the appropriate type. The cardinality of * the return array must follow the absolute cardinality of this type. E.g. * if the cardinality = 0, the array must contain 1 element. If the @@ -271,7 +296,7 @@ * cardinality, meaning a single value, does not allow arrays or vectors of * 0 elements. * - * @return Return a default value or null if no default exists. + * @return Return a default value or {@code null} if no default exists. */ - public String[] getDefaultValue(); + String[] getDefaultValue(); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/MetaTypeInformation.java osgi-compendium-4.3.0/src/org/osgi/service/metatype/MetaTypeInformation.java --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/MetaTypeInformation.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/MetaTypeInformation.java 2011-06-13 14:57:30.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -21,7 +21,8 @@ * A MetaType Information object is created by the MetaTypeService to return * meta type information for a specific bundle. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: e9f2197c7ff1475c73b847fb1a6f2157bc99cbf8 $ * @since 1.1 */ public interface MetaTypeInformation extends MetaTypeProvider { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/MetaTypeProvider.java osgi-compendium-4.3.0/src/org/osgi/service/metatype/MetaTypeProvider.java --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/MetaTypeProvider.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/MetaTypeProvider.java 2011-06-13 14:57:30.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -16,40 +16,65 @@ package org.osgi.service.metatype; /** - * Provides access to metatypes. + * Provides access to metatypes. This interface can be implemented on a Managed + * Service or Managed Service Factory as well as registered as a service. When + * registered as a service, it must be registered with a + * {@link #METATYPE_FACTORY_PID} or {@link #METATYPE_PID} service property (or + * both). Any PID mentioned in either of these factories must be a valid argument + * to the {@link #getObjectClassDefinition(String, String)} method. * - * @version $Revision: 5673 $ + * @version $Id: c9ac9ae0403544906652ac97ddc87ed8c9900c78 $ */ public interface MetaTypeProvider { + + /** + * Service property to signal that this service has + * {@link ObjectClassDefinition} objects for the given PIDs. The type of + * this service property is {@code String+}. + * + * @since 1.2 + */ + String METATYPE_PID = "metatype.pid"; + + /** + * Service property to signal that this service has + * {@link ObjectClassDefinition} objects for the given factory PIDs. The + * type of this service property is {@code String+}. + * + * @since 1.2 + */ + String METATYPE_FACTORY_PID = "metatype.factory.pid"; + /** * Returns an object class definition for the specified id localized to the * specified locale. * *

      - * The locale parameter must be a name that consists of language[ - * "_" country[ "_" variation] ] as is customary in - * the Locale class. This Locale class is not used - * because certain profiles do not contain it. + * The locale parameter must be a name that consists of {@code language}[ + * "_" {@code country}[ "_" {@code variation}] ] as is customary in the + * {@code Locale} class. This {@code Locale} class is not used because + * certain profiles do not contain it. * * @param id The ID of the requested object class. This can be a pid or * factory pid returned by getPids or getFactoryPids. - * @param locale The locale of the definition or null for default + * @param locale The locale of the definition or {@code null} for default * locale. - * @return A ObjectClassDefinition object. + * @return A {@code ObjectClassDefinition} object. * @throws IllegalArgumentException If the id or locale arguments are not * valid */ - public ObjectClassDefinition getObjectClassDefinition(String id, String locale); + public ObjectClassDefinition getObjectClassDefinition(String id, + String locale); /** * Return a list of available locales. * * The results must be names that consists of language [ _ country [ _ - * variation ]] as is customary in the Locale class. + * variation ]] as is customary in the {@code Locale} class. + * + * @return An array of locale strings or {@code null} if there is no locale + * specific localization can be found. * - * @return An array of locale strings or null if there is no - * locale specific localization can be found. - * */ public String[] getLocales(); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/MetaTypeService.java osgi-compendium-4.3.0/src/org/osgi/service/metatype/MetaTypeService.java --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/MetaTypeService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/MetaTypeService.java 2011-06-13 14:57:30.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -20,18 +20,19 @@ /** * The MetaType Service can be used to obtain meta type information for a * bundle. The MetaType Service will examine the specified bundle for meta type - * documents to create the returned MetaTypeInformation object. + * documents to create the returned {@code MetaTypeInformation} object. * *

      * If the specified bundle does not contain any meta type documents, then a - * MetaTypeInformation object will be returned that wrappers any - * ManagedService or ManagedServiceFactory + * {@code MetaTypeInformation} object will be returned that wrappers any + * {@code ManagedService} or {@code ManagedServiceFactory} * services registered by the specified bundle that implement - * MetaTypeProvider. Thus the MetaType Service can be used to + * {@code MetaTypeProvider}. Thus the MetaType Service can be used to * retrieve meta type information for bundles which contain a meta type - * documents or which provide their own MetaTypeProvider objects. + * documents or which provide their own {@code MetaTypeProvider} objects. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 2324451e73130e2c8dde2aa1595997a05c77ab5b $ * @since 1.1 */ public interface MetaTypeService { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/ObjectClassDefinition.java osgi-compendium-4.3.0/src/org/osgi/service/metatype/ObjectClassDefinition.java --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/ObjectClassDefinition.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/ObjectClassDefinition.java 2011-06-13 14:57:30.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -21,27 +21,27 @@ /** * Description for the data type information of an objectclass. * - * @version $Revision: 5673 $ + * @version $Id: 944028508b3b88cef2e1996567d0d946fba8b9bb $ */ public interface ObjectClassDefinition { /** - * Argument for getAttributeDefinitions(int). + * Argument for {@code getAttributeDefinitions(int)}. *

      - * REQUIRED indicates that only the required definitions are + * {@code REQUIRED} indicates that only the required definitions are * returned. The value is 1. */ public static final int REQUIRED = 1; /** - * Argument for getAttributeDefinitions(int). + * Argument for {@code getAttributeDefinitions(int)}. *

      - * OPTIONAL indicates that only the optional definitions are + * {@code OPTIONAL} indicates that only the optional definitions are * returned. The value is 2. */ public static final int OPTIONAL = 2; /** - * Argument for getAttributeDefinitions(int). + * Argument for {@code getAttributeDefinitions(int)}. *

      - * ALL indicates that all the definitions are returned. The value + * {@code ALL} indicates that all the definitions are returned. The value * is -1. */ public static final int ALL = 0xFFFFFFFF; @@ -59,7 +59,7 @@ * Return the id of this object class. * *

      - * ObjectDefintion objects share a global namespace in the + * {@code ObjectDefintion} objects share a global namespace in the * registry. They share this aspect with LDAP/X.500 attributes. In these * standards the OSI Object Identifier (OID) is used to uniquely identify * object classes. If such an OID exists, (which can be requested at several @@ -89,21 +89,21 @@ * *

      * Return a set of attributes. The filter parameter can distinguish between - * ALL,REQUIRED or the OPTIONAL + * {@code ALL},{@code REQUIRED} or the {@code OPTIONAL} * attributes. * - * @param filter ALL,REQUIRED,OPTIONAL - * @return An array of attribute definitions or null if no + * @param filter {@code ALL},{@code REQUIRED},{@code OPTIONAL} + * @return An array of attribute definitions or {@code null} if no * attributes are selected */ public AttributeDefinition[] getAttributeDefinitions(int filter); /** - * Return an InputStream object that can be used to create an + * Return an {@code InputStream} object that can be used to create an * icon from. * *

      - * Indicate the size and return an InputStream object containing + * Indicate the size and return an {@code InputStream} object containing * an icon. The returned icon maybe larger or smaller than the indicated * size. * @@ -112,8 +112,8 @@ * * @param size Requested size of an icon, e.g. a 16x16 pixels icon then size = * 16 - * @return An InputStream representing an icon or null - * @throws IOException If the InputStream cannot be returned. + * @return An InputStream representing an icon or {@code null} + * @throws IOException If the {@code InputStream} cannot be returned. */ public InputStream getIcon(int size) throws IOException; } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/package.html osgi-compendium-4.3.0/src/org/osgi/service/metatype/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - -

      Metatype Package Version 1.1. -

      Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

      -Import-Package: org.osgi.service.metatype; version="[1.1,2.0)"
      -
      - - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/metatype/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/packageinfo 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/packageinfo 2011-06-13 14:57:30.000000000 +0000 @@ -1 +1 @@ -version 1.1 +version 1.2 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/metatype/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/metatype/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/metatype/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/metatype/package-info.java 2011-06-13 14:57:30.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Metatype Package Version 1.2. + * + *

      + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.metatype; version="[1.2,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.metatype; version="[1.2,1.3)"} + * + * @version $Id: 8ca1bb1dade823a7e80a6f8d26f47997774b88ff $ + */ + +package org.osgi.service.metatype; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/Monitorable.java osgi-compendium-4.3.0/src/org/osgi/service/monitor/Monitorable.java --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/Monitorable.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/Monitorable.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -17,124 +17,123 @@ package org.osgi.service.monitor; /** - * A Monitorable can provide information about itself in the form - * of StatusVariables. Instances of this interface should register - * themselves at the OSGi Service Registry. The MonitorAdmin - * listens to the registration of Monitorable services, and makes + * A {@code Monitorable} can provide information about itself in the form + * of {@code StatusVariables}. Instances of this interface should register + * themselves at the OSGi Service Registry. The {@code MonitorAdmin} + * listens to the registration of {@code Monitorable} services, and makes * the information they provide available also through the Device Management * Tree (DMT) for remote access. *

      * The monitorable service is identified by its PID string which must be a non- - * null, non-empty string that conforms to the "symbolic-name" + * {@code null}, non-empty string that conforms to the "symbolic-name" * definition in the OSGi core specification. This means that only the * characters [-_.a-zA-Z0-9] may be used. The length of the PID must not exceed * 20 characters. *

      - * A Monitorable may optionally support sending notifications when - * the status of its StatusVariables change. Support for change - * notifications can be defined per StatusVariable. + * A {@code Monitorable} may optionally support sending notifications when + * the status of its {@code StatusVariables} change. Support for change + * notifications can be defined per {@code StatusVariable}. *

      - * Publishing StatusVariables requires the presence of the - * MonitorPermission with the publish action string. + * Publishing {@code StatusVariables} requires the presence of the + * {@code MonitorPermission} with the {@code publish} action string. * This permission, however, is not checked during registration of the - * Monitorable service. Instead, the MonitorAdmin - * implementation must make sure that when a StatusVariable is - * queried, it is shown only if the Monitorable is authorized to - * publish the given StatusVariable. + * {@code Monitorable} service. Instead, the {@code MonitorAdmin} + * implementation must make sure that when a {@code StatusVariable} is + * queried, it is shown only if the {@code Monitorable} is authorized to + * publish the given {@code StatusVariable}. * - * @version $Revision: 7940 $ + * @version $Id: 575bb0add2cfea32c4008106b3ee2943c7c73e25 $ */ public interface Monitorable { - /** - * Returns the list of StatusVariable identifiers published - * by this Monitorable. A StatusVariable name - * is unique within the scope of a Monitorable. The array - * contains the elements in no particular order. The returned value must not - * be null. - * - * @return the StatusVariable identifiers published by this - * object, or an empty array if none are published - */ + /** + * Returns the list of {@code StatusVariable} identifiers published by this + * {@code Monitorable}. A {@code StatusVariable} name is unique within the + * scope of a {@code Monitorable}. The array contains the elements in no + * particular order. The returned value must not be {@code null}. + * + * @return the {@code StatusVariable} identifiers published by this object, + * or an empty array if none are published + */ public String[] getStatusVariableNames(); /** - * Returns the StatusVariable object addressed by its - * identifier. The StatusVariable will hold the value taken + * Returns the {@code StatusVariable} object addressed by its + * identifier. The {@code StatusVariable} will hold the value taken * at the time of this method call. *

      * The given identifier does not contain the Monitorable PID, i.e. it * specifies the name and not the path of the Status Variable. * - * @param id the identifier of the StatusVariable, cannot be - * null - * @return the StatusVariable object - * @throws java.lang.IllegalArgumentException if id points to a - * non-existing StatusVariable + * @param id the identifier of the {@code StatusVariable}, cannot be + * {@code null} + * @return the {@code StatusVariable} object + * @throws java.lang.IllegalArgumentException if {@code id} points to a + * non-existing {@code StatusVariable} */ public StatusVariable getStatusVariable(String id) throws IllegalArgumentException; /** - * Tells whether the StatusVariable provider is able to send - * instant notifications when the given StatusVariable - * changes. If the Monitorable supports sending change - * updates it must notify the MonitorListener when the value - * of the StatusVariable changes. The - * Monitorable finds the MonitorListener + * Tells whether the {@code StatusVariable} provider is able to send + * instant notifications when the given {@code StatusVariable} + * changes. If the {@code Monitorable} supports sending change + * updates it must notify the {@code MonitorListener} when the value + * of the {@code StatusVariable} changes. The + * {@code Monitorable} finds the {@code MonitorListener} * service through the Service Registry. *

      * The given identifier does not contain the Monitorable PID, i.e. it * specifies the name and not the path of the Status Variable. * - * @param id the identifier of the StatusVariable, cannot be - * null - * @return true if the Monitorable can send - * notification when the given StatusVariable - * changes, false otherwise - * @throws java.lang.IllegalArgumentException if id points to a - * non-existing StatusVariable + * @param id the identifier of the {@code StatusVariable}, cannot be + * {@code null} + * @return {@code true} if the {@code Monitorable} can send + * notification when the given {@code StatusVariable} + * changes, {@code false} otherwise + * @throws java.lang.IllegalArgumentException if {@code id} points to a + * non-existing {@code StatusVariable} */ public boolean notifiesOnChange(String id) throws IllegalArgumentException; /** - * Issues a request to reset a given StatusVariable. + * Issues a request to reset a given {@code StatusVariable}. * Depending on the semantics of the actual Status Variable this call may or * may not succeed: it makes sense to reset a counter to its starting value, - * but for example a StatusVariable of type String + * but for example a {@code StatusVariable} of type {@code String} * might not have a meaningful default value. Note that for numeric - * StatusVariables the starting value may not necessarily be - * 0. Resetting a StatusVariable must trigger a monitor event. + * {@code StatusVariables} the starting value may not necessarily be + * 0. Resetting a {@code StatusVariable} must trigger a monitor event. *

      * The given identifier does not contain the Monitorable PID, i.e. it * specifies the name and not the path of the Status Variable. * - * @param id the identifier of the StatusVariable, cannot be - * null - * @return true if the Monitorable could - * successfully reset the given StatusVariable, - * false otherwise - * @throws java.lang.IllegalArgumentException if id points to a - * non-existing StatusVariable + * @param id the identifier of the {@code StatusVariable}, cannot be + * {@code null} + * @return {@code true} if the {@code Monitorable} could + * successfully reset the given {@code StatusVariable}, + * {@code false} otherwise + * @throws java.lang.IllegalArgumentException if {@code id} points to a + * non-existing {@code StatusVariable} */ public boolean resetStatusVariable(String id) throws IllegalArgumentException; /** - * Returns a human readable description of a StatusVariable. + * Returns a human readable description of a {@code StatusVariable}. * This can be used by management systems on their GUI. The - * null return value is allowed if there is no description for + * {@code null} return value is allowed if there is no description for * the specified Status Variable. *

      * The given identifier does not contain the Monitorable PID, i.e. it * specifies the name and not the path of the Status Variable. * - * @param id the identifier of the StatusVariable, cannot be - * null + * @param id the identifier of the {@code StatusVariable}, cannot be + * {@code null} * @return the human readable description of this - * StatusVariable or null if it is not + * {@code StatusVariable} or {@code null} if it is not * set - * @throws java.lang.IllegalArgumentException if id points to a - * non-existing StatusVariable + * @throws java.lang.IllegalArgumentException if {@code id} points to a + * non-existing {@code StatusVariable} */ public String getDescription(String id) throws IllegalArgumentException; } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitorAdmin.java osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitorAdmin.java --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitorAdmin.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitorAdmin.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -17,213 +17,213 @@ package org.osgi.service.monitor; /** - * The MonitorAdmin service is a singleton service that handles - * StatusVariable query requests and measurement job control + * The {@code MonitorAdmin} service is a singleton service that handles + * {@code StatusVariable} query requests and measurement job control * requests. *

      * Note that an alternative but not recommended way of obtaining - * StatusVariables is that applications having the required - * ServicePermissions can query the list of - * Monitorable services from the service registry and then query - * the list of StatusVariable names from the - * Monitorable services. This way all services which publish - * StatusVariables will be returned regardless of whether they do - * or do not hold the necessary MonitorPermission for publishing - * StatusVariables. By using the MonitorAdmin to - * obtain the StatusVariables it is guaranteed that only those - * Monitorable services will be accessed who are authorized to - * publish StatusVariables. It is the responsibility of the - * MonitorAdmin implementation to check the required permissions + * {@code StatusVariable}s is that applications having the required + * {@code ServicePermissions} can query the list of + * {@code Monitorable} services from the service registry and then query + * the list of {@code StatusVariable} names from the + * {@code Monitorable} services. This way all services which publish + * {@code StatusVariable}s will be returned regardless of whether they do + * or do not hold the necessary {@code MonitorPermission} for publishing + * {@code StatusVariable}s. By using the {@code MonitorAdmin} to + * obtain the {@code StatusVariable}s it is guaranteed that only those + * {@code Monitorable} services will be accessed who are authorized to + * publish {@code StatusVariable}s. It is the responsibility of the + * {@code MonitorAdmin} implementation to check the required permissions * and show only those variables which pass this check. *

      - * The events posted by MonitorAdmin contain the following + * The events posted by {@code MonitorAdmin} contain the following * properties: *

        - *
      • mon.monitorable.pid: The identifier of the - * Monitorable - *
      • mon.statusvariable.name: The identifier of the - * StatusVariable within the given Monitorable - *
      • mon.statusvariable.value: The value of the - * StatusVariable, represented as a String - *
      • mon.listener.id: The identifier of the initiator of the + *
      • {@code mon.monitorable.pid}: The identifier of the + * {@code Monitorable} + *
      • {@code mon.statusvariable.name}: The identifier of the + * {@code StatusVariable} within the given {@code Monitorable} + *
      • {@code mon.statusvariable.value}: The value of the + * {@code StatusVariable}, represented as a {@code String} + *
      • {@code mon.listener.id}: The identifier of the initiator of the * monitoring job (only present if the event was generated due to a monitoring * job) *
      *

      * Most of the methods require either a Monitorable ID or a Status Variable path * parameter, the latter in [Monitorable_ID]/[StatusVariable_ID] format. These - * parameters must not be null, and the IDs they contain must + * parameters must not be {@code null}, and the IDs they contain must * conform to their respective definitions in {@link Monitorable} and * {@link StatusVariable}. If any of the restrictions are violated, the method - * must throw an IllegalArgumentException. + * must throw an {@code IllegalArgumentException}. * - * @version $Revision: 7940 $ + * @version $Id: 05377a99a1425f8b57ba8e647f81719b9031d0f7 $ */ public interface MonitorAdmin { /** - * Returns a StatusVariable addressed by its full path. - * The entity which queries a StatusVariable needs to hold - * MonitorPermission for the given target with the - * read action present. + * Returns a {@code StatusVariable} addressed by its full path. + * The entity which queries a {@code StatusVariable} needs to hold + * {@code MonitorPermission} for the given target with the + * {@code read} action present. * - * @param path the full path of the StatusVariable in + * @param path the full path of the {@code StatusVariable} in * [Monitorable_ID]/[StatusVariable_ID] format - * @return the StatusVariable object - * @throws java.lang.IllegalArgumentException if path is - * null or otherwise invalid, or points to a - * non-existing StatusVariable + * @return the {@code StatusVariable} object + * @throws java.lang.IllegalArgumentException if {@code path} is + * {@code null} or otherwise invalid, or points to a + * non-existing {@code StatusVariable} * @throws java.lang.SecurityException if the caller does not hold a - * MonitorPermission for the - * StatusVariable specified by path - * with the read action present + * {@code MonitorPermission} for the + * {@code StatusVariable} specified by {@code path} + * with the {@code read} action present */ public StatusVariable getStatusVariable(String path) throws IllegalArgumentException, SecurityException; /** - * Returns the names of the Monitorable services that are - * currently registered. The Monitorable instances are not - * accessible through the MonitorAdmin, so that requests to + * Returns the names of the {@code Monitorable} services that are + * currently registered. The {@code Monitorable} instances are not + * accessible through the {@code MonitorAdmin}, so that requests to * individual status variables can be filtered with respect to the - * publishing rights of the Monitorable and the reading + * publishing rights of the {@code Monitorable} and the reading * rights of the caller. *

      * The returned array contains the names in alphabetical order. It cannot be - * null, an empty array is returned if no - * Monitorable services are registered. + * {@code null}, an empty array is returned if no + * {@code Monitorable} services are registered. * - * @return the array of Monitorable names + * @return the array of {@code Monitorable} names */ public String[] getMonitorableNames(); /** - * Returns the StatusVariable objects published by a - * Monitorable instance. The StatusVariables + * Returns the {@code StatusVariable} objects published by a + * {@code Monitorable} instance. The {@code StatusVariables} * will hold the values taken at the time of this method call. Only those * status variables are returned where the following two conditions are met: *

        - *
      • the specified Monitorable holds a - * MonitorPermission for the status variable with the - * publish action present - *
      • the caller holds a MonitorPermission for the status - * variable with the read action present + *
      • the specified {@code Monitorable} holds a + * {@code MonitorPermission} for the status variable with the + * {@code publish} action present + *
      • the caller holds a {@code MonitorPermission} for the status + * variable with the {@code read} action present *
      * All other status variables are silently ignored, they are omitted from * the result. *

      * The elements in the returned array are in no particular order. The return - * value cannot be null, an empty array is returned if no + * value cannot be {@code null}, an empty array is returned if no * (authorized and readable) Status Variables are provided by the given - * Monitorable. + * {@code Monitorable}. * - * @param monitorableId the identifier of a Monitorable + * @param monitorableId the identifier of a {@code Monitorable} * instance - * @return a list of StatusVariable objects published - * by the specified Monitorable - * @throws java.lang.IllegalArgumentException if monitorableId - * is null or otherwise invalid, or points to a - * non-existing Monitorable + * @return a list of {@code StatusVariable} objects published + * by the specified {@code Monitorable} + * @throws java.lang.IllegalArgumentException if {@code monitorableId} + * is {@code null} or otherwise invalid, or points to a + * non-existing {@code Monitorable} */ public StatusVariable[] getStatusVariables(String monitorableId) throws IllegalArgumentException; /** - * Returns the list of StatusVariable names published by a - * Monitorable instance. Only those status variables are + * Returns the list of {@code StatusVariable} names published by a + * {@code Monitorable} instance. Only those status variables are * listed where the following two conditions are met: *

        - *
      • the specified Monitorable holds a - * MonitorPermission for the status variable with the - * publish action present - *
      • the caller holds a MonitorPermission for - * the status variable with the read action present + *
      • the specified {@code Monitorable} holds a + * {@code MonitorPermission} for the status variable with the + * {@code publish} action present + *
      • the caller holds a {@code MonitorPermission} for + * the status variable with the {@code read} action present *
      * All other status variables are silently ignored, their names are omitted * from the list. *

      * The returned array does not contain duplicates, and the elements are in - * alphabetical order. It cannot be null, an empty array is + * alphabetical order. It cannot be {@code null}, an empty array is * returned if no (authorized and readable) Status Variables are provided - * by the given Monitorable. + * by the given {@code Monitorable}. * - * @param monitorableId the identifier of a Monitorable + * @param monitorableId the identifier of a {@code Monitorable} * instance - * @return a list of StatusVariable objects names - * published by the specified Monitorable - * @throws java.lang.IllegalArgumentException if monitorableId - * is null or otherwise invalid, or points to a - * non-existing Monitorable + * @return a list of {@code StatusVariable} objects names + * published by the specified {@code Monitorable} + * @throws java.lang.IllegalArgumentException if {@code monitorableId} + * is {@code null} or otherwise invalid, or points to a + * non-existing {@code Monitorable} */ public String[] getStatusVariableNames(String monitorableId) throws IllegalArgumentException; /** * Switches event sending on or off for the specified - * StatusVariables. When the MonitorAdmin is - * notified about a StatusVariable being updated it sends an + * {@code StatusVariable}s. When the {@code MonitorAdmin} is + * notified about a {@code StatusVariable} being updated it sends an * event unless this feature is switched off. Note that events within a * monitoring job can not be switched off. The event sending state of the - * StatusVariables must not be persistently stored. When a - * StatusVariable is registered for the first time in a + * {@code StatusVariables} must not be persistently stored. When a + * {@code StatusVariable} is registered for the first time in a * framework session, its event sending state is set to ON by default. *

      * Usage of the "*" wildcard is allowed in the path argument of this method * as a convenience feature. The wildcard can be used in either or both path * fragments, but only at the end of the fragments. The semantics of the - * wildcard is that it stands for any matching StatusVariable + * wildcard is that it stands for any matching {@code StatusVariable} * at the time of the method call, it does not affect the event sending - * status of StatusVariables which are not yet registered. As - * an example, when the switchEvents("MyMonitorable/*", false) - * method is executed, event sending from all StatusVariables + * status of {@code StatusVariable}s which are not yet registered. As + * an example, when the {@code switchEvents("MyMonitorable/*", false)} + * method is executed, event sending from all {@code StatusVariables} * of the MyMonitorable service are switched off. However, if the - * MyMonitorable service starts to publish a new StatusVariable + * MyMonitorable service starts to publish a new {@code StatusVariable} * later, it's event sending status is on by default. * - * @param path the identifier of the StatusVariable(s) in + * @param path the identifier of the {@code StatusVariable}(s) in * [Monitorable_id]/[StatusVariable_id] format, possibly with the * "*" wildcard at the end of either path fragment - * @param on false if event sending should be switched off, - * true if it should be switched on for the given path + * @param on {@code false} if event sending should be switched off, + * {@code true} if it should be switched on for the given path * @throws java.lang.SecurityException if the caller does not hold - * MonitorPermission with the - * switchevents action or if there is any - * StatusVariable in the path field for + * {@code MonitorPermission} with the + * {@code switchevents} action or if there is any + * {@code StatusVariable} in the {@code path} field for * which it is not allowed to switch event sending on or off as per * the target field of the permission - * @throws java.lang.IllegalArgumentException if path is - * null or otherwise invalid, or points to a - * non-existing StatusVariable + * @throws java.lang.IllegalArgumentException if {@code path} is + * {@code null} or otherwise invalid, or points to a + * non-existing {@code StatusVariable} */ public void switchEvents(String path, boolean on) throws IllegalArgumentException, SecurityException; /** - * Issues a request to reset a given StatusVariable. - * Depending on the semantics of the StatusVariable this call + * Issues a request to reset a given {@code StatusVariable}. + * Depending on the semantics of the {@code StatusVariable} this call * may or may not succeed: it makes sense to reset a counter to its starting - * value, but e.g. a StatusVariable of type String might not + * value, but e.g. a {@code StatusVariable} of type String might not * have a meaningful default value. Note that for numeric - * StatusVariables the starting value may not necessarily be - * 0. Resetting a StatusVariable triggers a monitor event if - * the StatusVariable supports update notifications. + * {@code StatusVariable}s the starting value may not necessarily be + * 0. Resetting a {@code StatusVariable} triggers a monitor event if + * the {@code StatusVariable} supports update notifications. *

      - * The entity that wants to reset the StatusVariable needs to - * hold MonitorPermission with the reset + * The entity that wants to reset the {@code StatusVariable} needs to + * hold {@code MonitorPermission} with the {@code reset} * action present. The target field of the permission must match the - * StatusVariable name to be reset. + * {@code StatusVariable} name to be reset. * - * @param path the identifier of the StatusVariable in + * @param path the identifier of the {@code StatusVariable} in * [Monitorable_id]/[StatusVariable_id] format - * @return true if the Monitorable could - * successfully reset the given StatusVariable, - * false otherwise - * @throws java.lang.IllegalArgumentException if path is - * null or otherwise invalid, or points to a - * non-existing StatusVariable + * @return {@code true} if the {@code Monitorable} could + * successfully reset the given {@code StatusVariable}, + * {@code false} otherwise + * @throws java.lang.IllegalArgumentException if {@code path} is + * {@code null} or otherwise invalid, or points to a + * non-existing {@code StatusVariable} * @throws java.lang.SecurityException if the caller does not hold - * MonitorPermission with the reset - * action or if the specified StatusVariable is not + * {@code MonitorPermission} with the {@code reset} + * action or if the specified {@code StatusVariable} is not * allowed to be reset as per the target field of the permission */ public boolean resetStatusVariable(String path) @@ -231,70 +231,70 @@ /** * Returns a human readable description of the given - * StatusVariable. The null value may be returned - * if there is no description for the given StatusVariable. + * {@code StatusVariable}. The {@code null} value may be returned + * if there is no description for the given {@code StatusVariable}. *

      - * The entity that queries a StatusVariable needs to hold - * MonitorPermission for the given target with the - * read action present. + * The entity that queries a {@code StatusVariable} needs to hold + * {@code MonitorPermission} for the given target with the + * {@code read} action present. * - * @param path the full path of the StatusVariable in + * @param path the full path of the {@code StatusVariable} in * [Monitorable_ID]/[StatusVariable_ID] format * @return the human readable description of this - * StatusVariable or null if it is not + * {@code StatusVariable} or {@code null} if it is not * set - * @throws java.lang.IllegalArgumentException if path is - * null or otherwise invalid, or points to a - * non-existing StatusVariable + * @throws java.lang.IllegalArgumentException if {@code path} is + * {@code null} or otherwise invalid, or points to a + * non-existing {@code StatusVariable} * @throws java.lang.SecurityException if the caller does not hold a - * MonitorPermission for the - * StatusVariable specified by path - * with the read action present + * {@code MonitorPermission} for the + * {@code StatusVariable} specified by {@code path} + * with the {@code read} action present */ public String getDescription(String path) throws IllegalArgumentException, SecurityException; /** - * Starts a time based MonitoringJob with the parameters + * Starts a time based {@code MonitoringJob} with the parameters * provided. Monitoring events will be sent according to the specified - * schedule. All specified StatusVariables must exist when the + * schedule. All specified {@code StatusVariable}s must exist when the * job is started. The initiator string is used in the - * mon.listener.id field of all events triggered by the job, + * {@code mon.listener.id} field of all events triggered by the job, * to allow filtering the events based on the initiator. *

      - * The schedule parameter specifies the time in seconds + * The {@code schedule} parameter specifies the time in seconds * between two measurements, it must be greater than 0. The first * measurement will be taken when the timer expires for the first time, not * when this method is called. *

      - * The count parameter defines the number of measurements to be + * The {@code count} parameter defines the number of measurements to be * taken, and must either be a positive integer, or 0 if the measurement is * to run until explicitly stopped. *

      - * The entity which initiates a MonitoringJob needs to hold - * MonitorPermission for all the specified target - * StatusVariables with the startjob action + * The entity which initiates a {@code MonitoringJob} needs to hold + * {@code MonitorPermission} for all the specified target + * {@code StatusVariable}s with the {@code startjob} action * present. If the permission's action string specifies a minimal sampling - * interval then the schedule parameter should be at least as + * interval then the {@code schedule} parameter should be at least as * great as the value in the action string. * * @param initiator the identifier of the entity that initiated the job - * @param statusVariables the list of StatusVariables to be - * monitored, with each StatusVariable name given in + * @param statusVariables the list of {@code StatusVariable}s to be + * monitored, with each {@code StatusVariable} name given in * [Monitorable_PID]/[StatusVariable_ID] format * @param schedule the time in seconds between two measurements * @param count the number of measurements to be taken, or 0 for the * measurement to run until explicitly stopped - * @return the successfully started job object, cannot be null + * @return the successfully started job object, cannot be {@code null} * @throws java.lang.IllegalArgumentException if the list of - * StatusVariable names contains an invalid or - * non-existing StatusVariable; if - * initiator is null or empty; or if the - * schedule or count parameters are + * {@code StatusVariable} names contains an invalid or + * non-existing {@code StatusVariable}; if + * {@code initiator} is {@code null} or empty; or if the + * {@code schedule} or {@code count} parameters are * invalid * @throws java.lang.SecurityException if the caller does not hold - * MonitorPermission for all the specified - * StatusVariables, with the startjob + * {@code MonitorPermission} for all the specified + * {@code StatusVariable}s, with the {@code startjob} * action present, or if the permission does not allow starting the * job with the given frequency */ @@ -303,53 +303,53 @@ throws IllegalArgumentException, SecurityException; /** - * Starts a change based MonitoringJob with the parameters + * Starts a change based {@code MonitoringJob} with the parameters * provided. Monitoring events will be sent when the - * StatusVariables of this job are updated. All specified - * StatusVariables must exist when the job is started, and + * {@code StatusVariable}s of this job are updated. All specified + * {@code StatusVariable}s must exist when the job is started, and * all must support update notifications. The initiator string is used in - * the mon.listener.id field of all events triggered by the + * the {@code mon.listener.id} field of all events triggered by the * job, to allow filtering the events based on the initiator. *

      - * The count parameter specifies the number of changes that - * must happen to a StatusVariable before a new notification is + * The {@code count} parameter specifies the number of changes that + * must happen to a {@code StatusVariable} before a new notification is * sent, this must be a positive integer. *

      - * The entity which initiates a MonitoringJob needs to hold - * MonitorPermission for all the specified target - * StatusVariables with the startjob action + * The entity which initiates a {@code MonitoringJob} needs to hold + * {@code MonitorPermission} for all the specified target + * {@code StatusVariable}s with the {@code startjob} action * present. * * @param initiator the identifier of the entity that initiated the job - * @param statusVariables the list of StatusVariables to be - * monitored, with each StatusVariable name given in + * @param statusVariables the list of {@code StatusVariable}s to be + * monitored, with each {@code StatusVariable} name given in * [Monitorable_PID]/[StatusVariable_ID] format * @param count the number of changes that must happen to a - * StatusVariable before a new notification is sent - * @return the successfully started job object, cannot be null + * {@code StatusVariable} before a new notification is sent + * @return the successfully started job object, cannot be {@code null} * @throws java.lang.IllegalArgumentException if the list of - * StatusVariable names contains an invalid or - * non-existing StatusVariable, or one that does not - * support notifications; if the initiator is - * null or empty; or if count is invalid + * {@code StatusVariable} names contains an invalid or + * non-existing {@code StatusVariable}, or one that does not + * support notifications; if the {@code initiator} is + * {@code null} or empty; or if {@code count} is invalid * @throws java.lang.SecurityException if the caller does not hold - * MonitorPermission for all the specified - * StatusVariables, with the startjob + * {@code MonitorPermission} for all the specified + * {@code StatusVariable}s, with the {@code startjob} * action present */ public MonitoringJob startJob(String initiator, String[] statusVariables, int count) throws IllegalArgumentException, SecurityException; /** - * Returns the list of currently running MonitoringJobs. + * Returns the list of currently running {@code MonitoringJob}s. * Jobs are only visible to callers that have the necessary permissions: to * receive a Monitoring Job in the returned list, the caller must hold all * permissions required for starting the job. This means that if the caller - * does not have MonitorPermission with the proper - * startjob action for all the Status Variables monitored by a + * does not have {@code MonitorPermission} with the proper + * {@code startjob} action for all the Status Variables monitored by a * job, then that job will be silently omitted from the results. *

      - * The returned array cannot be null, an empty array is + * The returned array cannot be {@code null}, an empty array is * returned if there are no running jobs visible to the caller at the time * of the call. * diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitoringJob.java osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitoringJob.java --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitoringJob.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitoringJob.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2011). 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. @@ -18,29 +18,29 @@ /** * A Monitoring Job is a request for scheduled or event based notifications on - * update of a set of StatusVariables. The job is a data structure - * that holds a non-empty list of StatusVariable names, an + * update of a set of {@code StatusVariable}s. The job is a data structure + * that holds a non-empty list of {@code StatusVariable} names, an * identification of the initiator of the job, and the sampling parameters. * There are two kinds of monitoring jobs: time based and change based. Time - * based jobs take samples of all StatusVariables with a specified + * based jobs take samples of all {@code StatusVariable}s with a specified * frequency. The number of samples to be taken before the job finishes may be * specified. Change based jobs are only interested in the changes of the - * monitored StatusVariables. In this case, the number of changes + * monitored {@code StatusVariable}s. In this case, the number of changes * that must take place between two notifications can be specified. *

      - * The job can be started on the MonitorAdmin interface. Running - * the job (querying the StatusVariables, listening to changes, and + * The job can be started on the {@code MonitorAdmin} interface. Running + * the job (querying the {@code StatusVariable}s, listening to changes, and * sending out notifications on updates) is the task of the - * MonitorAdmin implementation. + * {@code MonitorAdmin} implementation. *

      * Whether a monitoring job keeps track dynamically of the - * StatusVariables it monitors is not specified. This means that if - * we monitor a StatusVariable of a Monitorable + * {@code StatusVariable}s it monitors is not specified. This means that if + * we monitor a {@code StatusVariable} of a {@code Monitorable} * service which disappears and later reappears then it is implementation - * specific whether we still receive updates of the StatusVariable + * specific whether we still receive updates of the {@code StatusVariable} * changes or not. * - * @version $Revision: 7940 $ + * @version $Id: 3a217c8fa525fa9f892badae8468a7ae529c189d $ */ public interface MonitoringJob { /** @@ -49,35 +49,35 @@ */ public void stop(); - /** - * Returns the identifier of the principal who initiated the job. This is - * set at the time when - * {@link MonitorAdmin#startJob MonitorAdmin.startJob()} method is called. - * This string holds the ServerID if the operation was initiated from a - * remote manager, or an arbitrary ID of the initiator entity in the local - * case (used for addressing notification events). - * - * @return the ID of the initiator, cannot be null - */ + /** + * Returns the identifier of the principal who initiated the job. This is + * set at the time when {@link MonitorAdmin#startJob(String, String[], int) + * MonitorAdmin.startJob} method is called. This string holds the ServerID + * if the operation was initiated from a remote manager, or an arbitrary ID + * of the initiator entity in the local case (used for addressing + * notification events). + * + * @return the ID of the initiator, cannot be {@code null} + */ public String getInitiator(); /** - * Returns the list of StatusVariable names that are the + * Returns the list of {@code StatusVariable} names that are the * targets of this measurement job. For time based jobs, the - * MonitorAdmin will iterate through this list and query all - * StatusVariables when its timer set by the job's frequency + * {@code MonitorAdmin} will iterate through this list and query all + * {@code StatusVariable}s when its timer set by the job's frequency * rate expires. * * @return the target list of the measurement job in * [Monitorable_ID]/[StatusVariable_ID] format, cannot be - * null + * {@code null} */ public String[] getStatusVariableNames(); /** * Returns the delay (in seconds) between two samples. If this call returns - * N (greater than 0) then the MonitorAdmin queries each - * StatusVariable that belongs to this job every N seconds. + * N (greater than 0) then the {@code MonitorAdmin} queries each + * {@code StatusVariable} that belongs to this job every N seconds. * The value 0 means that the job is not scheduled but event based: in this * case instant notification on changes is requested (at every n-th change of * the value, as specified by the report count parameter). @@ -87,19 +87,18 @@ */ public int getSchedule(); - /** - * Returns the number of times MonitorAdmin will query the - * StatusVariables (for time based jobs), or the number of - * changes of a StatusVariable between notifications (for - * change based jobs). Time based jobs with non-zero report count will take - * getReportCount()*getSchedule() time to - * finish. Time based jobs with 0 report count and change based jobs do not - * stop automatically, but all jobs can be stopped with the {@link #stop} - * method. - * - * @return the number of measurements to be taken, or the number of changes - * between notifications - */ + /** + * Returns the number of times {@code MonitorAdmin} will query the + * {@code StatusVariable}s (for time based jobs), or the number of changes + * of a {@code StatusVariable} between notifications (for change based + * jobs). Time based jobs with non-zero report count will take + * {@code getReportCount()}*{@code getSchedule()} time to finish. Time based + * jobs with 0 report count and change based jobs do not stop automatically, + * but all jobs can be stopped with the {@link #stop()} method. + * + * @return the number of measurements to be taken, or the number of changes + * between notifications + */ public int getReportCount(); /** @@ -107,8 +106,8 @@ * the clients of this API are always local, remote jobs can only be started * using the Device Management Tree. * - * @return true if the job was started from the local device, - * false if the job was initiated from a management + * @return {@code true} if the job was started from the local device, + * {@code false} if the job was initiated from a management * server through the device management tree */ public boolean isLocal(); @@ -118,7 +117,7 @@ * explicitly stopped, or, in case of time based jobs with a finite report * count, until the given number of measurements have been made. * - * @return true if the job is still running, false + * @return {@code true} if the job is still running, {@code false} * if it has finished */ public boolean isRunning(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitorListener.java osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitorListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitorListener.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitorListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -17,25 +17,25 @@ package org.osgi.service.monitor; /** - * The MonitorListener is used by Monitorable services - * to send notifications when a StatusVariable value is changed. - * The MonitorListener should register itself as a service at the + * The {@code MonitorListener} is used by {@code Monitorable} services + * to send notifications when a {@code StatusVariable} value is changed. + * The {@code MonitorListener} should register itself as a service at the * OSGi Service Registry. This interface must (only) be implemented by the * Monitor Admin component. * - * @version $Revision: 5673 $ + * @version $Id: a3378152d876cfaf4b41a26596f1cfbaff2afa48 $ */ public interface MonitorListener { /** - * Callback for notification of a StatusVariable change. + * Callback for notification of a {@code StatusVariable} change. * - * @param monitorableId the identifier of the Monitorable + * @param monitorableId the identifier of the {@code Monitorable} * instance reporting the change - * @param statusVariable the StatusVariable that has changed + * @param statusVariable the {@code StatusVariable} that has changed * @throws java.lang.IllegalArgumentException if the specified monitorable - * ID is invalid (null, empty, or contains illegal - * characters) or points to a non-existing Monitorable, - * or if statusVariable is null + * ID is invalid ({@code null}, empty, or contains illegal + * characters) or points to a non-existing {@code Monitorable}, + * or if {@code statusVariable} is {@code null} */ public void updated(String monitorableId, StatusVariable statusVariable) throws IllegalArgumentException; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitorPermission.java osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitorPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/MonitorPermission.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/MonitorPermission.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2011). 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. @@ -22,20 +22,19 @@ /** * Indicates the callers authority to publish, read or reset - * StatusVariables, to switch event sending on or off or to start + * {@code StatusVariable}s, to switch event sending on or off or to start * monitoring jobs. The target of the permission is the identifier of the - * StatusVariable, the action can be read, - * publish, reset, startjob, - * switchevents, or the combination of these separated by commas. - * Action names are interpreted case-insensitively, but the canonical action - * string returned by {@link #getActions} uses the forms defined by the action - * constants. + * {@code StatusVariable}, the action can be {@code read}, {@code publish}, + * {@code reset}, {@code startjob}, {@code switchevents}, or the combination of + * these separated by commas. Action names are interpreted case-insensitively, + * but the canonical action string returned by {@link #getActions()} uses the + * forms defined by the action constants. *

      - * If the wildcard * appears in the actions field, all legal - * monitoring commands are allowed on the designated target(s) by the owner of - * the permission. + * If the wildcard {@code *} appears in the actions field, all legal monitoring + * commands are allowed on the designated target(s) by the owner of the + * permission. * - * @version $Revision: 7941 $ + * @version $Id: 5080b409276c750ce22c00aa1749f97cf9fb1fa7 $ */ public class MonitorPermission extends Permission { @@ -45,51 +44,51 @@ private static final long serialVersionUID = -9084425194463274314L; /** - * Holders of MonitorPermission with the read + * Holders of {@code MonitorPermission} with the {@code read} * action present are allowed to read the value of the - * StatusVariables specified in the permission's target field. + * {@code StatusVariable}s specified in the permission's target field. */ public static final String READ = "read"; /** - * Holders of MonitorPermission with the reset + * Holders of {@code MonitorPermission} with the {@code reset} * action present are allowed to reset the value of the - * StatusVariables specified in the permission's target field. + * {@code StatusVariable}s specified in the permission's target field. */ public static final String RESET = "reset"; /** - * Holders of MonitorPermission with the publish - * action present are Monitorable services that are allowed - * to publish the StatusVariables specified in the + * Holders of {@code MonitorPermission} with the {@code publish} + * action present are {@code Monitorable} services that are allowed + * to publish the {@code StatusVariable}s specified in the * permission's target field. Note, that this permission cannot be enforced - * when a Monitorable registers to the framework, because the + * when a {@code Monitorable} registers to the framework, because the * Service Registry does not know about this permission. Instead, any - * StatusVariables published by a Monitorable - * without the corresponding publish permission are silently - * ignored by MonitorAdmin, and are therefore invisible to the + * {@code StatusVariable}s published by a {@code Monitorable} + * without the corresponding {@code publish} permission are silently + * ignored by {@code MonitorAdmin}, and are therefore invisible to the * users of the monitoring service. */ public static final String PUBLISH = "publish"; /** - * Holders of MonitorPermission with the startjob + * Holders of {@code MonitorPermission} with the {@code startjob} * action present are allowed to initiate monitoring jobs involving the - * StatusVariables specified in the permission's target field. + * {@code StatusVariable}s specified in the permission's target field. *

      * A minimal sampling interval can be optionally defined in the following - * form: startjob:n. This allows the holder of the permission + * form: {@code startjob:n}. This allows the holder of the permission * to initiate time based jobs with a measurement interval of at least - * n seconds. If n is not specified or 0 then the + * {@code n} seconds. If {@code n} is not specified or 0 then the * holder of this permission is allowed to start monitoring jobs specifying * any frequency. */ public static final String STARTJOB = "startjob"; /** - * Holders of MonitorPermission with the - * switchevents action present are allowed to switch event - * sending on or off for the value of the StatusVariables + * Holders of {@code MonitorPermission} with the + * {@code switchevents} action present are allowed to switch event + * sending on or off for the value of the {@code StatusVariable}s * specified in the permission's target field. */ public static final String SWITCHEVENTS = "switchevents"; @@ -111,38 +110,38 @@ private int minJobInterval; /** - * Create a MonitorPermission object, specifying the target + * Create a {@code MonitorPermission} object, specifying the target * and actions. *

      - * The statusVariable parameter is the target of the + * The {@code statusVariable} parameter is the target of the * permission, defining one or more status variable names to which the * specified actions apply. Multiple status variable names can be selected - * by using the wildcard * in the target string. The wildcard + * by using the wildcard {@code *} in the target string. The wildcard * is allowed in both fragments, but only at the end of the fragments. *

      * For example, the following targets are valid: - * com.mycomp.myapp/queue_length, - * com.mycomp.myapp/*, com.mycomp.*/*, - * */*, */queue_length, - * */queue*. + * {@code com.mycomp.myapp/queue_length}, + * {@code com.mycomp.myapp/*}, {@code com.mycomp.*/*}, + * {@code */*}, {@code */queue_length}, + * {@code */queue*}. *

      * The following targets are invalid: - * *.myapp/queue_length, com.*.myapp/*, - * *. + * {@code *.myapp/queue_length}, {@code com.*.myapp/*}, + * {@code *}. *

      - * The actions parameter specifies the allowed action(s): - * read, publish, startjob, - * reset, switchevents, or the combination of + * The {@code actions} parameter specifies the allowed action(s): + * {@code read}, {@code publish}, {@code startjob}, + * {@code reset}, {@code switchevents}, or the combination of * these separated by commas. String constants are defined in this class for - * each valid action. Passing "*" as the action + * each valid action. Passing {@code "*"} as the action * string is equivalent to listing all actions. * - * @param statusVariable the identifier of the StatusVariable + * @param statusVariable the identifier of the {@code StatusVariable} * in [Monitorable_id]/[StatusVariable_id] format * @param actions the list of allowed actions separated by commas, or - * * for all actions + * {@code *} for all actions * @throws java.lang.IllegalArgumentException if either parameter is - * null, or invalid with regard to the constraints + * {@code null}, or invalid with regard to the constraints * defined above and in the documentation of the used actions */ public MonitorPermission(String statusVariable, String actions) @@ -254,8 +253,8 @@ /** * Create an integer hash of the object. The hash codes of - * MonitorPermissions p1 and p2 are - * the same if p1.equals(p2). + * {@code MonitorPermission}s {@code p1} and {@code p2} are + * the same if {@code p1.equals(p2)}. * * @return the hash of the object */ @@ -268,13 +267,13 @@ } /** - * Determines the equality of two MonitorPermission objects. - * Two MonitorPermission objects are equal if their target + * Determines the equality of two {@code MonitorPermission} objects. + * Two {@code MonitorPermission} objects are equal if their target * strings are equal and the same set of actions are listed in their action * strings. * * @param o the object being compared for equality with this object - * @return true if the two permissions are equal + * @return {@code true} if the two permissions are equal */ public boolean equals(Object o) { if (!(o instanceof MonitorPermission)) @@ -291,11 +290,11 @@ /** * Get the action string associated with this permission. The actions are - * returned in the following order: read, reset, - * publish, startjob, switchevents. + * returned in the following order: {@code read}, {@code reset}, + * {@code publish}, {@code startjob}, {@code switchevents}. * * @return the allowed actions separated by commas, cannot be - * null + * {@code null} */ public String getActions() { StringBuffer sb = new StringBuffer(); @@ -323,22 +322,22 @@ /** * Determines if the specified permission is implied by this permission. *

      - * This method returns false if and only if at least one of the + * This method returns {@code false} if and only if at least one of the * following conditions are fulfilled for the specified permission: *

        - *
      • it is not a MonitorPermission + *
      • it is not a {@code MonitorPermission} *
      • it has a broader set of actions allowed than this one *
      • it allows initiating time based monitoring jobs with a lower minimal * sampling interval - *
      • the target set of Monitorables is not the same nor a - * subset of the target set of Monitorables of this permission - *
      • the target set of StatusVariables is not the same - * nor a subset of the target set of StatusVariables of this + *
      • the target set of {@code Monitorable}s is not the same nor a + * subset of the target set of {@code Monitorable}s of this permission + *
      • the target set of {@code StatusVariable}s is not the same + * nor a subset of the target set of {@code StatusVariable}s of this * permission *
      * * @param p the permission to be checked - * @return true if the given permission is implied by this + * @return {@code true} if the given permission is implied by this * permission */ public boolean implies(Permission p) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/package.html osgi-compendium-4.3.0/src/org/osgi/service/monitor/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

      Monitor Admin Package Version 1.0. -

      Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

      -Import-Package: org.osgi.service.monitor; version="[1.0,2.0)"
      -
      - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/monitor/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Monitor Admin Package Version 1.0. + * + *

      + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.monitor; version="[1.0,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.monitor; version="[1.0,1.1)"} + * + * @version $Id: 5794533b273e5c4994718c46950146fd0befddd5 $ + */ + +package org.osgi.service.monitor; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/monitor/StatusVariable.java osgi-compendium-4.3.0/src/org/osgi/service/monitor/StatusVariable.java --- osgi-compendium-4.2.0/src/org/osgi/service/monitor/StatusVariable.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/monitor/StatusVariable.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2011). 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. @@ -20,39 +20,39 @@ import java.util.Date; /** - * A StatusVariable object represents the value of a status + * A {@code StatusVariable} object represents the value of a status * variable taken with a certain collection method at a certain point of time. - * The type of the StatusVariable can be int, - * float, boolean or String. + * The type of the {@code StatusVariable} can be {@code int}, + * {@code float}, {@code boolean} or {@code String}. *

      - * A StatusVariable is identified by an ID string that is unique - * within the scope of a Monitorable. The ID must be a non- - * null, non-empty string that conforms to the "symbolic-name" + * A {@code StatusVariable} is identified by an ID string that is unique + * within the scope of a {@code Monitorable}. The ID must be a non- + * {@code null}, non-empty string that conforms to the "symbolic-name" * definition in the OSGi core specification. This means that only the * characters [-_.a-zA-Z0-9] may be used. The length of the ID must not exceed * 32 bytes when UTF-8 encoded. * - * @version $Revision: 5673 $ + * @version $Id: 637f5f827f34da9c9743385701f517dc2f5e763d $ */ public final class StatusVariable { //----- Public constants -----// /** - * Constant for identifying int data type. + * Constant for identifying {@code int} data type. */ public static final int TYPE_INTEGER = 0; /** - * Constant for identifying float data type. + * Constant for identifying {@code float} data type. */ public static final int TYPE_FLOAT = 1; /** - * Constant for identifying String data type. + * Constant for identifying {@code String} data type. */ public static final int TYPE_STRING = 2; /** - * Constant for identifying boolean data type. + * Constant for identifying {@code boolean} data type. */ public static final int TYPE_BOOLEAN = 3; @@ -99,18 +99,18 @@ //----- Constructors -----// /** - * Constructor for a StatusVariable of int + * Constructor for a {@code StatusVariable} of {@code int} * type. * - * @param id the identifier of the StatusVariable - * @param cm the collection method, one of the CM_ constants - * @param data the int value of the - * StatusVariable - * @throws java.lang.IllegalArgumentException if the given id - * is not a valid StatusVariable name, or if - * cm is not one of the collection method constants - * @throws java.lang.NullPointerException if the id - * parameter is null + * @param id the identifier of the {@code StatusVariable} + * @param cm the collection method, one of the {@code CM_} constants + * @param data the {@code int} value of the + * {@code StatusVariable} + * @throws java.lang.IllegalArgumentException if the given {@code id} + * is not a valid {@code StatusVariable} name, or if + * {@code cm} is not one of the collection method constants + * @throws java.lang.NullPointerException if the {@code id} + * parameter is {@code null} */ public StatusVariable(String id, int cm, int data) { setCommon(id, cm); @@ -119,18 +119,18 @@ } /** - * Constructor for a StatusVariable of float + * Constructor for a {@code StatusVariable} of {@code float} * type. * - * @param id the identifier of the StatusVariable - * @param cm the collection method, one of the CM_ constants - * @param data the float value of the - * StatusVariable - * @throws java.lang.IllegalArgumentException if the given id - * is not a valid StatusVariable name, or if - * cm is not one of the collection method constants - * @throws java.lang.NullPointerException if the id parameter - * is null + * @param id the identifier of the {@code StatusVariable} + * @param cm the collection method, one of the {@code CM_} constants + * @param data the {@code float} value of the + * {@code StatusVariable} + * @throws java.lang.IllegalArgumentException if the given {@code id} + * is not a valid {@code StatusVariable} name, or if + * {@code cm} is not one of the collection method constants + * @throws java.lang.NullPointerException if the {@code id} parameter + * is {@code null} */ public StatusVariable(String id, int cm, float data) { setCommon(id, cm); @@ -139,18 +139,18 @@ } /** - * Constructor for a StatusVariable of boolean + * Constructor for a {@code StatusVariable} of {@code boolean} * type. * - * @param id the identifier of the StatusVariable - * @param cm the collection method, one of the CM_ constants - * @param data the boolean value of the - * StatusVariable - * @throws java.lang.IllegalArgumentException if the given id - * is not a valid StatusVariable name, or if - * cm is not one of the collection method constants - * @throws java.lang.NullPointerException if the id parameter - * is null + * @param id the identifier of the {@code StatusVariable} + * @param cm the collection method, one of the {@code CM_} constants + * @param data the {@code boolean} value of the + * {@code StatusVariable} + * @throws java.lang.IllegalArgumentException if the given {@code id} + * is not a valid {@code StatusVariable} name, or if + * {@code cm} is not one of the collection method constants + * @throws java.lang.NullPointerException if the {@code id} parameter + * is {@code null} */ public StatusVariable(String id, int cm, boolean data) { setCommon(id, cm); @@ -159,18 +159,18 @@ } /** - * Constructor for a StatusVariable of String + * Constructor for a {@code StatusVariable} of {@code String} * type. * - * @param id the identifier of the StatusVariable - * @param cm the collection method, one of the CM_ constants - * @param data the String value of the - * StatusVariable, can be null - * @throws java.lang.IllegalArgumentException if the given id - * is not a valid StatusVariable name, or if - * cm is not one of the collection method constants - * @throws java.lang.NullPointerException if the id parameter - * is null + * @param id the identifier of the {@code StatusVariable} + * @param cm the collection method, one of the {@code CM_} constants + * @param data the {@code String} value of the + * {@code StatusVariable}, can be {@code null} + * @throws java.lang.IllegalArgumentException if the given {@code id} + * is not a valid {@code StatusVariable} name, or if + * {@code cm} is not one of the collection method constants + * @throws java.lang.NullPointerException if the {@code id} parameter + * is {@code null} */ public StatusVariable(String id, int cm, String data) { setCommon(id, cm); @@ -181,46 +181,46 @@ // ----- Public methods -----// /** - * Returns the ID of this StatusVariable. The ID is unique - * within the scope of a Monitorable. + * Returns the ID of this {@code StatusVariable}. The ID is unique + * within the scope of a {@code Monitorable}. * - * @return the ID of this StatusVariable + * @return the ID of this {@code StatusVariable} */ public String getID() { return id; } /** - * Returns information on the data type of this StatusVariable. + * Returns information on the data type of this {@code StatusVariable}. * - * @return one of the TYPE_ constants indicating the type of - * this StatusVariable + * @return one of the {@code TYPE_} constants indicating the type of + * this {@code StatusVariable} */ public int getType() { return type; } - /** - * Returns the timestamp associated with the StatusVariable. - * The timestamp is stored when the StatusVariable instance is - * created, generally during the {@link Monitorable#getStatusVariable} - * method call. - * - * @return the time when the StatusVariable value was - * queried, cannot be null - * - */ + /** + * Returns the timestamp associated with the {@code StatusVariable}. The + * timestamp is stored when the {@code StatusVariable} instance is created, + * generally during the {@link Monitorable#getStatusVariable(String)} method + * call. + * + * @return the time when the {@code StatusVariable} value was queried, + * cannot be {@code null} + * + */ public Date getTimeStamp() { return timeStamp; } /** - * Returns the StatusVariable value if its type is - * String. + * Returns the {@code StatusVariable} value if its type is + * {@code String}. * - * @return the StatusVariable value as a String + * @return the {@code StatusVariable} value as a {@code String} * @throws java.lang.IllegalStateException if the type of the - * StatusVariable is not String + * {@code StatusVariable} is not {@code String} */ public String getString() throws IllegalStateException { if (type != TYPE_STRING) @@ -230,12 +230,12 @@ } /** - * Returns the StatusVariable value if its type is - * int. + * Returns the {@code StatusVariable} value if its type is + * {@code int}. * - * @return the StatusVariable value as an int + * @return the {@code StatusVariable} value as an {@code int} * @throws java.lang.IllegalStateException if the type of this - * StatusVariable is not int + * {@code StatusVariable} is not {@code int} */ public int getInteger() throws IllegalStateException { if (type != TYPE_INTEGER) @@ -245,12 +245,12 @@ } /** - * Returns the StatusVariable value if its type is - * float. + * Returns the {@code StatusVariable} value if its type is + * {@code float}. * - * @return the StatusVariable value as a float + * @return the {@code StatusVariable} value as a {@code float} * @throws java.lang.IllegalStateException if the type of this - * StatusVariable is not float + * {@code StatusVariable} is not {@code float} */ public float getFloat() throws IllegalStateException { if (type != TYPE_FLOAT) @@ -260,12 +260,12 @@ } /** - * Returns the StatusVariable value if its type is - * boolean. + * Returns the {@code StatusVariable} value if its type is + * {@code boolean}. * - * @return the StatusVariable value as a boolean + * @return the {@code StatusVariable} value as a {@code boolean} * @throws java.lang.IllegalStateException if the type of this - * StatusVariable is not boolean + * {@code StatusVariable} is not {@code boolean} */ public boolean getBoolean() throws IllegalStateException { if (type != TYPE_BOOLEAN) @@ -275,24 +275,24 @@ } /** - * Returns the collection method of this StatusVariable. See + * Returns the collection method of this {@code StatusVariable}. See * section 3.3 b) in [ETSI TS 132 403] * - * @return one of the CM_ constants + * @return one of the {@code CM_} constants */ public int getCollectionMethod() { return cm; } /** - * Compares the specified object with this StatusVariable. - * Two StatusVariable objects are considered equal if their + * Compares the specified object with this {@code StatusVariable}. + * Two {@code StatusVariable} objects are considered equal if their * full path, collection method and type are identical, and the data * (selected by their type) is equal. * - * @param obj the object to compare with this StatusVariable - * @return true if the argument represents the same - * StatusVariable as this object + * @param obj the object to compare with this {@code StatusVariable} + * @return {@code true} if the argument represents the same + * {@code StatusVariable} as this object */ public boolean equals(Object obj) { if (!(obj instanceof StatusVariable)) @@ -314,9 +314,9 @@ } /** - * Returns the hash code value for this StatusVariable. The + * Returns the hash code value for this {@code StatusVariable}. The * hash code is calculated based on the full path, collection method and - * value of the StatusVariable. + * value of the {@code StatusVariable}. * * @return the hash code of this object */ @@ -335,20 +335,20 @@ // String representation: StatusVariable(path, cm, time, type, value) /** - * Returns a String representation of this - * StatusVariable. The returned String + * Returns a {@code String} representation of this + * {@code StatusVariable}. The returned {@code String} * contains the full path, collection method, timestamp, type and value - * parameters of the StatusVariable in the following format: + * parameters of the {@code StatusVariable} in the following format: *

      StatusVariable(<path>, <cm>, <timestamp>, <type>, <value>)
      * The collection method identifiers used in the string representation are * "CC", "DER", "GAUGE" and "SI" (without the quotes). The format of the - * timestamp is defined by the Date.toString method, while the + * timestamp is defined by the {@code Date.toString} method, while the * type is identified by one of the strings "INTEGER", "FLOAT", "STRING" and * "BOOLEAN". The final field contains the string representation of the * value of the status variable. * - * @return the String representation of this - * StatusVariable + * @return the {@code String} representation of this + * {@code StatusVariable} */ public String toString() { String cmName = null; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/prefs/BackingStoreException.java osgi-compendium-4.3.0/src/org/osgi/service/prefs/BackingStoreException.java --- osgi-compendium-4.2.0/src/org/osgi/service/prefs/BackingStoreException.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/prefs/BackingStoreException.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -19,13 +19,13 @@ * Thrown to indicate that a preferences operation could not complete because of * a failure in the backing store, or a failure to contact the backing store. * - * @version $Revision: 6083 $ + * @version $Id: 86f6e3cc926b2ea3875e000e90b0700a75f2a7c7 $ */ public class BackingStoreException extends Exception { static final long serialVersionUID = -1415637364122829574L; /** - * Constructs a BackingStoreException with the specified detail + * Constructs a {@code BackingStoreException} with the specified detail * message. * * @param message The detail message. @@ -35,11 +35,11 @@ } /** - * Constructs a BackingStoreException with the specified detail + * Constructs a {@code BackingStoreException} with the specified detail * message. * * @param message The detail message. - * @param cause The cause of the exception. May be null. + * @param cause The cause of the exception. May be {@code null}. * @since 1.1 */ public BackingStoreException(String message, Throwable cause) { @@ -47,10 +47,10 @@ } /** - * Returns the cause of this exception or null if no cause was + * Returns the cause of this exception or {@code null} if no cause was * set. * - * @return The cause of this exception or null if no cause was + * @return The cause of this exception or {@code null} if no cause was * set. * @since 1.1 */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/prefs/package.html osgi-compendium-4.3.0/src/org/osgi/service/prefs/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/prefs/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/prefs/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - -

      Preferences Service Package Version 1.1. -

      Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

      -Import-Package: org.osgi.service.prefs; version="[1.1,2.0)"
      -
      - - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/prefs/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/prefs/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/prefs/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/prefs/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Preferences Service Package Version 1.1. + * + *

      + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.prefs; version="[1.1,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.prefs; version="[1.1,1.2)"} + * + * @version $Id: 38fc16ac58979748bcd6cf394b0d6d71aa374515 $ + */ + +package org.osgi.service.prefs; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/prefs/Preferences.java osgi-compendium-4.3.0/src/org/osgi/service/prefs/Preferences.java --- osgi-compendium-4.2.0/src/org/osgi/service/prefs/Preferences.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/prefs/Preferences.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2001, 2011). 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. @@ -40,16 +40,16 @@ * and a path name relative to each ancestor including itself. * *

      - * The root node has a node name of the empty String object (""). + * The root node has a node name of the empty {@code String} object (""). * Every other node has an arbitrary node name, specified at the time it is * created. The only restrictions on this name are that it cannot be the empty * string, and it cannot contain the slash character ('/'). * *

      - * The root node has an absolute path name of "/". Children of the - * root node have absolute path names of "/" + <node name> + * The root node has an absolute path name of {@code "/"}. Children of the + * root node have absolute path names of {@code "/" + } <node name> * . All other nodes have absolute path names of <parent's absolute - * path name> + "/" + <node name> . Note that + * path name> {@code + "/" + } <node name> . Note that * all absolute path names begin with the slash character. * *

      @@ -76,12 +76,12 @@ *

    * *

    - * Each Preference node has zero or more properties associated with + * Each {@code Preference} node has zero or more properties associated with * it, where a property consists of a name and a value. The bundle writer is * free to choose any appropriate names for properties. Their values can be of - * type String,long,int,boolean, - * byte[],float, or double but they can - * always be accessed as if they were String objects. + * type {@code String},{@code long},{@code int},{@code boolean}, + * {@code byte[]},{@code float}, or {@code double} but they can + * always be accessed as if they were {@code String} objects. * *

    * All node name and property name comparisons are case-sensitive. @@ -90,7 +90,7 @@ * All of the methods that modify preference data are permitted to operate * asynchronously; they may return immediately, and changes will eventually * propagate to the persistent backing store, with an implementation-dependent - * delay. The flush method may be used to synchronously force updates + * delay. The {@code flush} method may be used to synchronously force updates * to the backing store. * *

    @@ -107,8 +107,8 @@ * corrupted, but no other guarantees are made concerning the consistency of the * preference data. * - * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 4560e5f4056911d618ca257084befd972c16bbd7 $ */ public interface Preferences { /** @@ -116,33 +116,33 @@ * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. - * @throws NullPointerException if key or value is - * null. + * @throws NullPointerException if {@code key} or {@code value} is + * {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. */ public void put(String key, String value); /** - * Returns the value associated with the specified key in this + * Returns the value associated with the specified {@code key} in this * node. Returns the specified default if there is no value associated with - * the key, or the backing store is inaccessible. + * the {@code key}, or the backing store is inaccessible. * * @param key key whose associated value is to be returned. * @param def the value to be returned in the event that this node has no - * value associated with key or the backing store is + * value associated with {@code key} or the backing store is * inaccessible. - * @return the value associated with key, or def if - * no value is associated with key. + * @return the value associated with {@code key}, or {@code def} if + * no value is associated with {@code key}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. - * @throws NullPointerException if key is null. (A - * null default is permitted.) + * @throws NullPointerException if {@code key} is {@code null}. (A + * {@code null} default is permitted.) */ public String get(String key, String def); /** - * Removes the value associated with the specified key in this + * Removes the value associated with the specified {@code key} in this * node, if any. * * @param key key whose mapping is to be removed from this node. @@ -166,25 +166,25 @@ public void clear() throws BackingStoreException; /** - * Associates a String object representing the specified - * int value with the specified key in this node. The - * associated string is the one that would be returned if the int - * value were passed to Integer.toString(int). This method is - * intended for use in conjunction with {@link #getInt} method. + * Associates a {@code String} object representing the specified {@code int} + * value with the specified {@code key} in this node. The associated string + * is the one that would be returned if the {@code int} value were passed to + * {@code Integer.toString(int)}. This method is intended for use in + * conjunction with {@link #getInt(String, int)} method. * *

    * Implementor's note: it is not necessary that the property value - * be represented by a String object in the backing store. If the + * be represented by a {@code String} object in the backing store. If the * backing store supports integer values, it is not unreasonable to use * them. This implementation detail is not visible through the - * Preferences API, which allows the value to be read as an - * int (with getInt or a String (with - * get) type. + * {@code Preferences} API, which allows the value to be read as an + * {@code int} (with {@code getInt} or a {@code String} (with {@code get}) + * type. * * @param key key with which the string form of value is to be associated. - * @param value value whose string form is to be associated with - * key. - * @throws NullPointerException if key is null. + * @param value {@code value} whose string form is to be associated with + * {@code key}. + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #getInt(String,int) @@ -192,27 +192,27 @@ public void putInt(String key, int value); /** - * Returns the int value represented by the String - * object associated with the specified key in this node. The - * String object is converted to an int as by - * Integer.parseInt(String). Returns the specified default if - * there is no value associated with the key, the backing store - * is inaccessible, or if Integer.parseInt(String) would throw a - * NumberFormatException if the associated value were + * Returns the {@code int} value represented by the {@code String} object + * associated with the specified {@code key} in this node. The + * {@code String} object is converted to an {@code int} as by + * {@code Integer.parseInt(String)}. Returns the specified default if there + * is no value associated with the {@code key}, the backing store is + * inaccessible, or if {@code Integer.parseInt(String)} would throw a + * {@code NumberFormatException} if the associated {@code value} were * passed. This method is intended for use in conjunction with the - * {@link #putInt} method. + * {@link #putInt(String, int)} method. * - * @param key key whose associated value is to be returned as an - * int. + * @param key key whose associated value is to be returned as an {@code int} + * . * @param def the value to be returned in the event that this node has no - * value associated with key or the associated value - * cannot be interpreted as an int or the backing store is + * value associated with {@code key} or the associated value cannot + * be interpreted as an {@code int} or the backing store is * inaccessible. - * @return the int value represented by the String - * object associated with key in this node, or - * def if the associated value does not exist or cannot - * be interpreted as an int type. - * @throws NullPointerException if key is null. + * @return the {@code int} value represented by the {@code String} object + * associated with {@code key} in this node, or {@code def} if the + * associated value does not exist or cannot be interpreted as an + * {@code int} type. + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #putInt(String,int) @@ -221,27 +221,26 @@ public int getInt(String key, int def); /** - * Associates a String object representing the specified - * long value with the specified key in this node. The - * associated String object is the one that would be returned if - * the long value were passed to Long.toString(long). - * This method is intended for use in conjunction with the {@link #getLong} - * method. - * - *

    - * Implementor's note: it is not necessary that the value - * be represented by a String type in the backing store. If the - * backing store supports long values, it is not unreasonable to - * use them. This implementation detail is not visible through the - * Preferences API, which allows the value to be read as a - * long (with getLong or a String (with - * get) type. - * - * @param key key with which the string form of value - * is to be associated. - * @param value value whose string form is to be associated with - * key. - * @throws NullPointerException if key is null. + * Associates a {@code String} object representing the specified + * {@code long} value with the specified {@code key} in this node. The + * associated {@code String} object is the one that would be returned if the + * {@code long} value were passed to {@code Long.toString(long)}. This + * method is intended for use in conjunction with the + * {@link #getLong(String, long)} method. + * + *

    + * Implementor's note: it is not necessary that the {@code value} be + * represented by a {@code String} type in the backing store. If the backing + * store supports {@code long} values, it is not unreasonable to use them. + * This implementation detail is not visible through the {@code Preferences} + * API, which allows the value to be read as a {@code long} (with + * {@code getLong} or a {@code String} (with {@code get}) type. + * + * @param key {@code key} with which the string form of {@code value} is to + * be associated. + * @param value {@code value} whose string form is to be associated with + * {@code key}. + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #getLong(String,long) @@ -249,27 +248,27 @@ public void putLong(String key, long value); /** - * Returns the long value represented by the String - * object associated with the specified key in this node. The - * String object is converted to a long as by - * Long.parseLong(String). Returns the specified default if - * there is no value associated with the key, the backing store - * is inaccessible, or if Long.parseLong(String) would throw a - * NumberFormatException if the associated value were + * Returns the {@code long} value represented by the {@code String} object + * associated with the specified {@code key} in this node. The + * {@code String} object is converted to a {@code long} as by + * {@code Long.parseLong(String)}. Returns the specified default if there is + * no value associated with the {@code key}, the backing store is + * inaccessible, or if {@code Long.parseLong(String)} would throw a + * {@code NumberFormatException} if the associated {@code value} were * passed. This method is intended for use in conjunction with the - * {@link #putLong} method. + * {@link #putLong(String, long)} method. * - * @param key key whose associated value is to be returned as a - * long value. + * @param key {@code key} whose associated value is to be returned as a + * {@code long} value. * @param def the value to be returned in the event that this node has no - * value associated with key or the associated value - * cannot be interpreted as a long type or the backing - * store is inaccessible. - * @return the long value represented by the String - * object associated with key in this node, or - * def if the associated value does not exist or cannot - * be interpreted as a long type. - * @throws NullPointerException if key is null. + * value associated with {@code key} or the associated value cannot + * be interpreted as a {@code long} type or the backing store is + * inaccessible. + * @return the {@code long} value represented by the {@code String} object + * associated with {@code key} in this node, or {@code def} if the + * associated value does not exist or cannot be interpreted as a + * {@code long} type. + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #putLong(String,long) @@ -278,26 +277,26 @@ public long getLong(String key, long def); /** - * Associates a String object representing the specified - * boolean value with the specified key in this node. The - * associated string is "true" if the value is true, and "false" - * if it is false. This method is intended for use in - * conjunction with the {@link #getBoolean} method. + * Associates a {@code String} object representing the specified + * {@code boolean} value with the specified key in this node. The associated + * string is "true" if the value is {@code true}, and "false" if it is + * {@code false}. This method is intended for use in conjunction with the + * {@link #getBoolean(String, boolean)} method. * *

    * Implementor's note: it is not necessary that the value be * represented by a string in the backing store. If the backing store - * supports boolean values, it is not unreasonable to use them. - * This implementation detail is not visible through the Preferences - * API, which allows the value to be read as a boolean - * (with getBoolean) or a String (with get) - * type. + * supports {@code boolean} values, it is not unreasonable to use them. This + * implementation detail is not visible through the {@code Preferences + * } API, which + * allows the value to be read as a {@code boolean} (with {@code getBoolean} + * ) or a {@code String} (with {@code get}) type. * - * @param key key with which the string form of value is to be + * @param key {@code key} with which the string form of value is to be * associated. - * @param value value whose string form is to be associated with - * key. - * @throws NullPointerException if key is null. + * @param value value whose string form is to be associated with {@code key} + * . + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #getBoolean(String,boolean) @@ -306,29 +305,29 @@ public void putBoolean(String key, boolean value); /** - * Returns the boolean value represented by the String - * object associated with the specified key in this node. Valid - * strings are "true", which represents true, and "false", which - * represents false. Case is ignored, so, for example, "TRUE" - * and "False" are also valid. This method is intended for use in - * conjunction with the {@link #putBoolean} method. + * Returns the {@code boolean} value represented by the {@code String} + * object associated with the specified {@code key} in this node. Valid + * strings are "true", which represents {@code true}, and "false", which + * represents {@code false}. Case is ignored, so, for example, "TRUE" and + * "False" are also valid. This method is intended for use in conjunction + * with the {@link #putBoolean(String, boolean)} method. * *

    * Returns the specified default if there is no value associated with the - * key, the backing store is inaccessible, or if the associated + * {@code key}, the backing store is inaccessible, or if the associated * value is something other than "true" or "false", ignoring case. * - * @param key key whose associated value is to be returned as a - * boolean. + * @param key {@code key} whose associated value is to be returned as a + * {@code boolean}. * @param def the value to be returned in the event that this node has no - * value associated with key or the associated value - * cannot be interpreted as a boolean or the backing store - * is inaccessible. - * @return the boolean value represented by the String - * object associated with key in this node, or - * null if the associated value does not exist or cannot - * be interpreted as a boolean. - * @throws NullPointerException if key is null. + * value associated with {@code key} or the associated value cannot + * be interpreted as a {@code boolean} or the backing store is + * inaccessible. + * @return the {@code boolean} value represented by the {@code String} + * object associated with {@code key} in this node, or {@code null} + * if the associated value does not exist or cannot be interpreted + * as a {@code boolean}. + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #get(String,String) @@ -337,26 +336,27 @@ public boolean getBoolean(String key, boolean def); /** - * Associates a String object representing the specified - * float value with the specified key in this node. - * The associated String object is the one that would be returned - * if the float value were passed to - * Float.toString(float). This method is intended for use in - * conjunction with the {@link #getFloat} method. + * Associates a {@code String} object representing the specified + * {@code float} value with the specified {@code key} in this node. The + * associated {@code String} object is the one that would be returned if the + * {@code float} value were passed to {@code Float.toString(float)}. This + * method is intended for use in conjunction with the + * {@link #getFloat(String, float)} method. * *

    * Implementor's note: it is not necessary that the value be * represented by a string in the backing store. If the backing store - * supports float values, it is not unreasonable to use them. - * This implementation detail is not visible through the Preferences - * API, which allows the value to be read as a float (with - * getFloat) or a String (with get) type. + * supports {@code float} values, it is not unreasonable to use them. This + * implementation detail is not visible through the {@code Preferences + * } API, which + * allows the value to be read as a {@code float} (with {@code getFloat}) or + * a {@code String} (with {@code get}) type. * - * @param key key with which the string form of value is to be + * @param key {@code key} with which the string form of value is to be * associated. - * @param value value whose string form is to be associated with - * key. - * @throws NullPointerException if key is null. + * @param value value whose string form is to be associated with {@code key} + * . + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #getFloat(String,float) @@ -364,56 +364,55 @@ public void putFloat(String key, float value); /** - * Returns the float value represented by the String - * object associated with the specified key in this node. The - * String object is converted to a float value as by - * Float.parseFloat(String). Returns the specified default if - * there is no value associated with the key, the backing store - * is inaccessible, or if Float.parseFloat(String) would throw a - * NumberFormatException if the associated value were passed. - * This method is intended for use in conjunction with the {@link #putFloat} - * method. + * Returns the float {@code value} represented by the {@code String} object + * associated with the specified {@code key} in this node. The + * {@code String} object is converted to a {@code float} value as by + * {@code Float.parseFloat(String)}. Returns the specified default if there + * is no value associated with the {@code key}, the backing store is + * inaccessible, or if {@code Float.parseFloat(String)} would throw a + * {@code NumberFormatException} if the associated value were passed. This + * method is intended for use in conjunction with the + * {@link #putFloat(String, float)} method. * - * @param key key whose associated value is to be returned as a - * float value. + * @param key {@code key} whose associated value is to be returned as a + * {@code float} value. * @param def the value to be returned in the event that this node has no - * value associated with key or the associated value - * cannot be interpreted as a float type or the backing - * store is inaccessible. - * @return the float value represented by the string associated - * with key in this node, or def if the - * associated value does not exist or cannot be interpreted as a - * float type. + * value associated with {@code key} or the associated value cannot + * be interpreted as a {@code float} type or the backing store is + * inaccessible. + * @return the {@code float} value represented by the string associated with + * {@code key} in this node, or {@code def} if the associated value + * does not exist or cannot be interpreted as a {@code float} type. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. - * @throws NullPointerException if key is null. + * @throws NullPointerException if {@code key} is {@code null}. * @see #putFloat(String,float) * @see #get(String,String) */ public float getFloat(String key, float def); /** - * Associates a String object representing the specified - * double value with the specified key in this node. - * The associated String object is the one that would be returned - * if the double value were passed to - * Double.toString(double). This method is intended for use in - * conjunction with the {@link #getDouble} method + * Associates a {@code String} object representing the specified + * {@code double} value with the specified {@code key} in this node. The + * associated {@code String} object is the one that would be returned if the + * {@code double} value were passed to {@code Double.toString(double)}. This + * method is intended for use in conjunction with the + * {@link #getDouble(String, double)} method * *

    * Implementor's note: it is not necessary that the value be * represented by a string in the backing store. If the backing store - * supports double values, it is not unreasonable to use them. - * This implementation detail is not visible through the Preferences - * API, which allows the value to be read as a double (with - * getDouble) or a String (with get) - * type. + * supports {@code double} values, it is not unreasonable to use them. This + * implementation detail is not visible through the {@code Preferences + * } API, which + * allows the value to be read as a {@code double} (with {@code getDouble}) + * or a {@code String} (with {@code get}) type. * - * @param key key with which the string form of value is to be + * @param key {@code key} with which the string form of value is to be * associated. - * @param value value whose string form is to be associated with - * key. - * @throws NullPointerException if key is null. + * @param value value whose string form is to be associated with {@code key} + * . + * @throws NullPointerException if {@code key} is {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #getDouble(String,double) @@ -421,60 +420,60 @@ public void putDouble(String key, double value); /** - * Returns the double value represented by the String - * object associated with the specified key in this node. The - * String object is converted to a double value as by - * Double.parseDouble(String). Returns the specified default if - * there is no value associated with the key, the backing store - * is inaccessible, or if Double.parseDouble(String) would throw - * a NumberFormatException if the associated value were passed. + * Returns the {@code double} value represented by the {@code String} + * object associated with the specified {@code key} in this node. The + * {@code String} object is converted to a {@code double} value as by + * {@code Double.parseDouble(String)}. Returns the specified default if + * there is no value associated with the {@code key}, the backing store + * is inaccessible, or if {@code Double.parseDouble(String)} would throw + * a {@code NumberFormatException} if the associated value were passed. * This method is intended for use in conjunction with the * {@link #putDouble} method. * - * @param key key whose associated value is to be returned as a - * double value. + * @param key {@code key} whose associated value is to be returned as a + * {@code double} value. * @param def the value to be returned in the event that this node has no - * value associated with key or the associated value - * cannot be interpreted as a double type or the backing + * value associated with {@code key} or the associated value + * cannot be interpreted as a {@code double} type or the backing * store is inaccessible. - * @return the double value represented by the String - * object associated with key in this node, or - * def if the associated value does not exist or cannot - * be interpreted as a double type. + * @return the {@code double} value represented by the {@code String} + * object associated with {@code key} in this node, or + * {@code def} if the associated value does not exist or cannot + * be interpreted as a {@code double} type. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the the {@link #removeNode()} method. - * @throws NullPointerException if key is null. + * @throws NullPointerException if {@code key} is {@code null}. * @see #putDouble(String,double) * @see #get(String,String) */ public double getDouble(String key, double def); /** - * Associates a String object representing the specified - * byte[] with the specified key in this node. The - * associated String object the Base64 encoding of the - * byte[], as defined in Base64 encoding of the + * {@code byte[]}, as defined in RFC 2045 , Section 6.8, * with one minor change: the string will consist solely of characters from * the Base64 Alphabet ; it will not contain any newline characters. * This method is intended for use in conjunction with the - * {@link #getByteArray} method. + * {@link #getByteArray(String, byte[])} method. * *

    * Implementor's note: it is not necessary that the value be - * represented by a String type in the backing store. If the - * backing store supports byte[] values, it is not unreasonable - * to use them. This implementation detail is not visible through the - * Preferences API, which allows the value to be read as an a - * byte[] object (with getByteArray) or a - * String object (with get). - * - * @param key key with which the string form of value - * is to be associated. - * @param value value whose string form is to be associated with - * key. - * @throws NullPointerException if key or value is - * null. + * represented by a {@code String} type in the backing store. If the backing + * store supports {@code byte[]} values, it is not unreasonable to use them. + * This implementation detail is not visible through the {@code Preferences} + * API, which allows the value to be read as an a {@code byte[]} object + * (with {@code getByteArray}) or a {@code String} object (with {@code get} + * ). + * + * @param key {@code key} with which the string form of {@code value} is to + * be associated. + * @param value {@code value} whose string form is to be associated with + * {@code key}. + * @throws NullPointerException if {@code key} or {@code value} is + * {@code null}. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #getByteArray(String,byte[]) @@ -483,32 +482,32 @@ public void putByteArray(String key, byte[] value); /** - * Returns the byte[] value represented by the String - * object associated with the specified key in this node. Valid - * String objects are Base64 encoded binary data, as - * defined in RFC 2045 , - * Section 6.8, with one minor change: the string must consist solely of - * characters from the Base64 Alphabet ; no newline characters or - * extraneous characters are permitted. This method is intended for use in - * conjunction with the {@link #putByteArray} method. + * Returns the {@code byte[]} value represented by the {@code String} object + * associated with the specified {@code key} in this node. Valid + * {@code String} objects are Base64 encoded binary data, as defined + * in RFC 2045 , Section + * 6.8, with one minor change: the string must consist solely of characters + * from the Base64 Alphabet ; no newline characters or extraneous + * characters are permitted. This method is intended for use in conjunction + * with the {@link #putByteArray(String, byte[])} method. * *

    * Returns the specified default if there is no value associated with the - * key, the backing store is inaccessible, or if the associated + * {@code key}, the backing store is inaccessible, or if the associated * value is not a valid Base64 encoded byte array (as defined above). * - * @param key key whose associated value is to be returned as a - * byte[] object. + * @param key {@code key} whose associated value is to be returned as a + * {@code byte[]} object. * @param def the value to be returned in the event that this node has no - * value associated with key or the associated value - * cannot be interpreted as a byte[] type, or the backing - * store is inaccessible. - * @return the byte[] value represented by the String - * object associated with key in this node, or - * def if the associated value does not exist or cannot - * be interpreted as a byte[]. - * @throws NullPointerException if key is null. (A - * null value for def is permitted.) + * value associated with {@code key} or the associated value cannot + * be interpreted as a {@code byte[]} type, or the backing store is + * inaccessible. + * @return the {@code byte[]} value represented by the {@code String} object + * associated with {@code key} in this node, or {@code def} if the + * associated value does not exist or cannot be interpreted as a + * {@code byte[]}. + * @throws NullPointerException if {@code key} is {@code null}. (A + * {@code null} value for {@code def} is permitted.) * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. * @see #get(String,String) @@ -519,7 +518,7 @@ /** * Returns all of the keys that have an associated value in this node. (The * returned array will be of size zero if this node has no preferences and - * not null!) + * not {@code null}!) * * @return an array of the keys that have an associated value in this node. * @throws BackingStoreException if this operation cannot be completed due @@ -532,7 +531,7 @@ /** * Returns the names of the children of this node. (The returned array will - * be of size zero if this node has no children and not null!) + * be of size zero if this node has no children and not {@code null}!) * * @return the names of the children of this node. * @throws BackingStoreException if this operation cannot be completed due @@ -544,7 +543,7 @@ public String[] childrenNames() throws BackingStoreException; /** - * Returns the parent of this node, or null if this is the root. + * Returns the parent of this node, or {@code null} if this is the root. * * @return the parent of this node. * @throws IllegalStateException if this node (or an ancestor) has been @@ -553,45 +552,45 @@ public Preferences parent(); /** - * Returns a named Preferences object (node), creating it and any + * Returns a named {@code Preferences} object (node), creating it and any * of its ancestors if they do not already exist. Accepts a relative or - * absolute pathname. Absolute pathnames (which begin with '/') + * absolute pathname. Absolute pathnames (which begin with {@code '/'}) * are interpreted relative to the root of this node. Relative pathnames - * (which begin with any character other than '/') are - * interpreted relative to this node itself. The empty string ("") + * (which begin with any character other than {@code '/'}) are + * interpreted relative to this node itself. The empty string ({@code ""}) * is a valid relative pathname, referring to this node itself. * *

    * If the returned node did not exist prior to this call, this node and any * ancestors that were created by this call are not guaranteed to become - * persistent until the flush method is called on the returned + * persistent until the {@code flush} method is called on the returned * node (or one of its descendants). * - * @param pathName the path name of the Preferences object to + * @param pathName the path name of the {@code Preferences} object to * return. - * @return the specified Preferences object. + * @return the specified {@code Preferences} object. * @throws IllegalArgumentException if the path name is invalid. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method. - * @throws NullPointerException if path name is null. + * @throws NullPointerException if path name is {@code null}. * @see #flush() */ public Preferences node(String pathName); /** * Returns true if the named node exists. Accepts a relative or absolute - * pathname. Absolute pathnames (which begin with '/') are + * pathname. Absolute pathnames (which begin with {@code '/'}) are * interpreted relative to the root of this node. Relative pathnames (which - * begin with any character other than '/') are interpreted - * relative to this node itself. The pathname "" is valid, and + * begin with any character other than {@code '/'}) are interpreted + * relative to this node itself. The pathname {@code ""} is valid, and * refers to this node itself. * *

    * If this node (or an ancestor) has already been removed with the * {@link #removeNode()} method, it is legal to invoke this method, - * but only with the pathname ""; the invocation will return - * false. Thus, the idiom p.nodeExists("") may be - * used to test whether p has been removed. + * but only with the pathname {@code ""}; the invocation will return + * {@code false}. Thus, the idiom {@code p.nodeExists("")} may be + * used to test whether {@code p} has been removed. * * @param pathName the path name of the node whose existence is to be * checked. @@ -601,7 +600,7 @@ * with it. * @throws IllegalStateException if this node (or an ancestor) has been * removed with the {@link #removeNode()} method and - * pathname is not the empty string (""). + * {@code pathname} is not the empty string ({@code ""}). * @throws IllegalArgumentException if the path name is invalid (i.e., it * contains multiple consecutive slash characters, or ends with a * slash character and is more than one character long). @@ -612,14 +611,14 @@ /** * Removes this node and all of its descendants, invalidating any properties * contained in the removed nodes. Once a node has been removed, attempting - * any method other than name(),absolutePath() or - * nodeExists("") on the corresponding Preferences - * instance will fail with an IllegalStateException. (The - * methods defined on Object can still be invoked on a node after - * it has been removed; they will not throw IllegalStateException.) + * any method other than {@code name()},{@code absolutePath()} or + * {@code nodeExists("")} on the corresponding {@code Preferences} + * instance will fail with an {@code IllegalStateException}. (The + * methods defined on {@code Object} can still be invoked on a node after + * it has been removed; they will not throw {@code IllegalStateException}.) * *

    - * The removal is not guaranteed to be persistent until the flush + * The removal is not guaranteed to be persistent until the {@code flush} * method is called on the parent of this node. * * @throws IllegalStateException if this node (or an ancestor) has already @@ -641,10 +640,10 @@ /** * Returns this node's absolute path name. Note that: *

      - *
    • Root node - The path name of the root node is "/". + *
    • Root node - The path name of the root node is {@code "/"}. *
    • Slash at end - Path names other than that of the root node may not - * end in slash ('/'). - *
    • Unusual names -"." and ".." have no + * end in slash ({@code '/'}). + *
    • Unusual names -{@code "."} and {@code ".."} have no * special significance in path names. *
    • Illegal names - The only illegal path names are those that contain * multiple consecutive slashes, or that end in slash and are not the root. @@ -685,9 +684,9 @@ /** * Ensures that future reads from this node and its descendants reflect any * changes that were committed to the persistent store (from any VM) prior - * to the sync invocation. As a side-effect, forces any changes + * to the {@code sync} invocation. As a side-effect, forces any changes * in the contents of this node and its descendants to the persistent store, - * as if the flush method had been invoked on this node. + * as if the {@code flush} method had been invoked on this node. * * @throws BackingStoreException if this operation cannot be completed due * to a failure in the backing store, or inability to communicate diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/prefs/PreferencesService.java osgi-compendium-4.3.0/src/org/osgi/service/prefs/PreferencesService.java --- osgi-compendium-4.2.0/src/org/osgi/service/prefs/PreferencesService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/prefs/PreferencesService.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -23,11 +23,13 @@ * system preferences, and one for each user. * *

      - * A PreferencesService object is specific to the bundle which + * A {@code PreferencesService} object is specific to the bundle which * obtained it from the service registry. If a bundle wishes to allow another * bundle to access its preferences, it should pass its - * PreferencesService object to that bundle. + * {@code PreferencesService} object to that bundle. * + * @noimplement + * @version $Id: bcb430ac769863b4239575c1edeedc23fc5ab097 $ */ public interface PreferencesService { /** diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/provisioning/package.html osgi-compendium-4.3.0/src/org/osgi/service/provisioning/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/provisioning/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/provisioning/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

      Provisioning Package Version 1.2. -

      Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

      -Import-Package: org.osgi.service.provisioning; version="[1.2,2.0)"
      -
      - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/provisioning/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/provisioning/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/provisioning/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/provisioning/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Provisioning Package Version 1.2. + * + *

      + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.provisioning; version="[1.2,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.provisioning; version="[1.2,1.3)"} + * + * @version $Id: 6c38e491df3cbc37cfad465c0298d642463c9c3a $ + */ + +package org.osgi.service.provisioning; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/provisioning/ProvisioningService.java osgi-compendium-4.3.0/src/org/osgi/service/provisioning/ProvisioningService.java --- osgi-compendium-4.2.0/src/org/osgi/service/provisioning/ProvisioningService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/provisioning/ProvisioningService.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -29,13 +29,13 @@ * these bundles to exchange information. It also provides a means for the * initial Management Bundle to get its initial configuration information. *

      - * The provisioning information is collected in a Dictionary + * The provisioning information is collected in a {@code Dictionary} * object, called the Provisioning Dictionary. Any bundle that can access the * service can get a reference to this object and read and update provisioning - * information. The key of the dictionary is a String object and - * the value is a String or byte[] object. The + * information. The key of the dictionary is a {@code String} object and + * the value is a {@code String} or {@code byte[]} object. The * single exception is the PROVISIONING_UPDATE_COUNT value which is an Integer. - * The provisioning prefix is reserved for keys defined by OSGi, + * The {@code provisioning} prefix is reserved for keys defined by OSGi, * other key names may be used for implementation dependent provisioning * systems. *

      @@ -51,31 +51,32 @@ * The provisioning information has the potential to contain sensitive * information. Also, the ability to modify provisioning information can have * drastic consequences. Thus, only trusted bundles should be allowed to - * register and get the Provisioning Service. The ServicePermission + * register and get the Provisioning Service. The {@code ServicePermission} * is used to limit the bundles that can gain access to the Provisioning - * Service. There is no check of Permission objects to read or + * Service. There is no check of {@code Permission} objects to read or * modify the provisioning information, so care must be taken not to leak the - * Provisioning Dictionary received from getInformation method. + * Provisioning Dictionary received from {@code getInformation} method. * - * @version $Revision: 7347 $ + * @noimplement + * @version $Id: b60b95d058ae1ac8498de17dceab9c21c712859b $ */ public interface ProvisioningService { /** * The key to the provisioning information that uniquely identifies the - * Service Platform. The value must be of type String. + * Service Platform. The value must be of type {@code String}. */ public final static String PROVISIONING_SPID = "provisioning.spid"; /** * The key to the provisioning information that contains the location of the - * provision data provider. The value must be of type String. + * provision data provider. The value must be of type {@code String}. */ public final static String PROVISIONING_REFERENCE = "provisioning.reference"; /** * The key to the provisioning information that contains the initial * configuration information of the initial Management Agent. The value will - * be of type byte[]. + * be of type {@code byte[]}. */ public final static String PROVISIONING_AGENT_CONFIG = "provisioning.agent.config"; @@ -83,14 +84,14 @@ * The key to the provisioning information that contains the update count of * the info data. Each set of changes to the provisioning information must * end with this value being incremented. The value must be of type - * Integer. This key/value pair is also reflected in the + * {@code Integer}. This key/value pair is also reflected in the * properties of the ProvisioningService in the service registry. */ public final static String PROVISIONING_UPDATE_COUNT = "provisioning.update.count"; /** * The key to the provisioning information that contains the location of the - * bundle to start with AllPermission. The bundle must have + * bundle to start with {@code AllPermission}. The bundle must have * be previously installed for this entry to have any effect. */ public final static String PROVISIONING_START_BUNDLE = "provisioning.start.bundle"; @@ -108,19 +109,19 @@ public final static String PROVISIONING_RSH_SECRET = "provisioning.rsh.secret"; /** - * MIME type to be stored in the extra field of a ZipEntry + * MIME type to be stored in the extra field of a {@code ZipEntry} * object for String data. */ public final static String MIME_STRING = "text/plain;charset=utf-8"; /** * MIME type to be stored stored in the extra field of a - * ZipEntry object for byte[] data. + * {@code ZipEntry} object for {@code byte[]} data. */ public final static String MIME_BYTE_ARRAY = "application/octet-stream"; /** - * MIME type to be stored in the extra field of a ZipEntry + * MIME type to be stored in the extra field of a {@code ZipEntry} * object for an installable bundle file. Zip entries of this type will be * installed in the framework, but not started. The entry will also not be * put into the information dictionary. @@ -129,11 +130,11 @@ /** * Alternative MIME type to be stored in the extra field of a - * ZipEntry object for an installable bundle file. Zip entries + * {@code ZipEntry} object for an installable bundle file. Zip entries * of this type will be installed in the framework, but not started. The * entry will also not be put into the information dictionary. This * alternative entry is only for backward compatibility, new applications - * are recommended to use MIME_BUNDLE, which is an official + * are recommended to use {@code MIME_BUNDLE}, which is an official * IANA MIME type. * * @since 1.2 @@ -159,9 +160,9 @@ /** * Returns a reference to the Provisioning Dictionary. Any change operations * (put and remove) to the dictionary will cause an - * UnsupportedOperationException to be thrown. Changes must - * be done using the setInformation and - * addInformation methods of this service. + * {@code UnsupportedOperationException} to be thrown. Changes must + * be done using the {@code setInformation} and + * {@code addInformation} methods of this service. * * @return A reference to the Provisioning Dictionary. */ @@ -169,9 +170,9 @@ /** * Replaces the Provisioning Information dictionary with the key/value pairs - * contained in info. Any key/value pairs not in - * info will be removed from the Provisioning Information - * dictionary. This method causes the PROVISIONING_UPDATE_COUNT + * contained in {@code info}. Any key/value pairs not in + * {@code info} will be removed from the Provisioning Information + * dictionary. This method causes the {@code PROVISIONING_UPDATE_COUNT} * to be incremented. * * @param info the new set of Provisioning Information key/value pairs. Any @@ -181,9 +182,9 @@ public void setInformation(Dictionary info); /** - * Adds the key/value pairs contained in info to the + * Adds the key/value pairs contained in {@code info} to the * Provisioning Information dictionary. This method causes the - * PROVISIONING_UPDATE_COUNT to be incremented. + * {@code PROVISIONING_UPDATE_COUNT} to be incremented. * * @param info the set of Provisioning Information key/value pairs to add to * the Provisioning Information dictionary. Any keys are values that @@ -192,18 +193,18 @@ public void addInformation(Dictionary info); /** - * Processes the ZipInputStream and extracts information to + * Processes the {@code ZipInputStream} and extracts information to * add to the Provisioning Information dictionary, as well as, * install/update and start bundles. This method causes the - * PROVISIONING_UPDATE_COUNT to be incremented. + * {@code PROVISIONING_UPDATE_COUNT} to be incremented. * - * @param zis the ZipInputStream that will be used to add + * @param zis the {@code ZipInputStream} that will be used to add * key/value pairs to the Provisioning Information dictionary and - * install and start bundles. If a ZipEntry does not - * have an Extra field that corresponds to one of the - * four defined MIME types (MIME_STRING, - * MIME_BYTE_ARRAY,MIME_BUNDLE, and - * MIME_BUNDLE_URL) in will be silently ignored. + * install and start bundles. If a {@code ZipEntry} does not + * have an {@code Extra} field that corresponds to one of the + * four defined MIME types ({@code MIME_STRING}, + * {@code MIME_BYTE_ARRAY},{@code MIME_BUNDLE}, and + * {@code MIME_BUNDLE_URL}) in will be silently ignored. * @throws IOException if an error occurs while processing the * ZipInputStream. No additions will be made to the Provisioning * Information dictionary and no bundles must be started or diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/EndpointDescription.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/EndpointDescription.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/EndpointDescription.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/EndpointDescription.java 2011-05-16 12:29:18.000000000 +0000 @@ -0,0 +1,711 @@ +/* + * Copyright (c) OSGi Alliance (2008, 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.remoteserviceadmin; + +import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID; +import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID; +import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_PACKAGE_VERSION_; +import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID; +import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED; +import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS; +import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.osgi.framework.Constants; +import org.osgi.framework.Filter; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.Version; + +/** + * A description of an endpoint that provides sufficient information for a + * compatible distribution provider to create a connection to this endpoint + * + * An Endpoint Description is easy to transfer between different systems because + * it is property based where the property keys are strings and the values are + * simple types. This allows it to be used as a communications device to convey + * available endpoint information to nodes in a network. + * + * An Endpoint Description reflects the perspective of an importer. That + * is, the property keys have been chosen to match filters that are created by + * client bundles that need a service. Therefore the map must not contain any + * {@code service.exported.*} property and must contain the corresponding + * {@code service.imported.*} ones. + * + * The {@code service.intents} property must contain the intents provided + * by the service itself combined with the intents added by the exporting + * distribution provider. Qualified intents appear fully expanded on this + * property. + * + * @Immutable + * @version $Id: 5eee827d56c59f61ee7c7b2e07601e20e97813b5 $ + */ + +public class EndpointDescription { + private final Map properties; + private final List interfaces; + private final long serviceId; + private final String frameworkUUID; + private final String id; + + /** + * Create an Endpoint Description from a Map. + * + *

      + * The {@link RemoteConstants#ENDPOINT_ID endpoint.id}, + * {@link RemoteConstants#SERVICE_IMPORTED_CONFIGS service.imported.configs} + * and {@code objectClass} properties must be set. + * + * @param properties The map from which to create the Endpoint Description. + * The keys in the map must be type {@code String} and, since + * the keys are case insensitive, there must be no duplicates with + * case variation. + * @throws IllegalArgumentException When the properties are not proper for + * an Endpoint Description. + */ + + public EndpointDescription(Map properties) { + Map props = new TreeMap( + String.CASE_INSENSITIVE_ORDER); + try { + props.putAll(properties); + } + catch (ClassCastException e) { + IllegalArgumentException iae = new IllegalArgumentException( + "non-String key in properties"); + iae.initCause(e); + throw iae; + } + if (props.size() < properties.size()) { + throw new IllegalArgumentException( + "duplicate keys with different cases in properties: " + + new ArrayList(props.keySet()) + .removeAll(properties.keySet())); + } + + conditionProperties(props); + this.properties = Collections.unmodifiableMap(props); + /* properties must be initialized before calling the following methods */ + interfaces = verifyObjectClassProperty(); + serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID); + frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID); + id = verifyStringProperty(ENDPOINT_ID).trim(); + if (id == null) { + throw new IllegalArgumentException(ENDPOINT_ID + + " property must be set"); + } + if (getConfigurationTypes().isEmpty()) { + throw new IllegalArgumentException(SERVICE_IMPORTED_CONFIGS + + " property must be set and non-empty"); + } + } + + /** + * Create an Endpoint Description based on a Service Reference and a Map of + * properties. The properties in the map take precedence over the properties + * in the Service Reference. + * + *

      + * This method will automatically set the + * {@link RemoteConstants#ENDPOINT_FRAMEWORK_UUID endpoint.framework.uuid} + * and {@link RemoteConstants#ENDPOINT_SERVICE_ID endpoint.service.id} + * properties based on the specified Service Reference as well as the + * {@link RemoteConstants#SERVICE_IMPORTED service.imported} property if + * they are not specified as properties. + *

      + * The {@link RemoteConstants#ENDPOINT_ID endpoint.id}, + * {@link RemoteConstants#SERVICE_IMPORTED_CONFIGS service.imported.configs} + * and {@code objectClass} properties must be set. + * + * @param reference A service reference that can be exported. + * @param properties Map of properties. This argument can be + * {@code null}. The keys in the map must be type + * {@code String} and, since the keys are case insensitive, + * there must be no duplicates with case variation. + * @throws IllegalArgumentException When the properties are not proper for + * an Endpoint Description + */ + public EndpointDescription(final ServiceReference reference, + final Map properties) { + Map props = new TreeMap( + String.CASE_INSENSITIVE_ORDER); + + if (properties != null) { + try { + props.putAll(properties); + } + catch (ClassCastException e) { + IllegalArgumentException iae = new IllegalArgumentException( + "non-String key in properties"); + iae.initCause(e); + throw iae; + } + if (props.size() < properties.size()) { + throw new IllegalArgumentException( + "duplicate keys with different cases in properties: " + + new ArrayList(props.keySet()) + .removeAll(properties.keySet())); + } + } + + for (String key : reference.getPropertyKeys()) { + if (!props.containsKey(key)) { + props.put(key, reference.getProperty(key)); + } + } + + if (!props.containsKey(ENDPOINT_SERVICE_ID)) { + props.put(ENDPOINT_SERVICE_ID, reference.getProperty(Constants.SERVICE_ID)); + } + if (!props.containsKey(ENDPOINT_FRAMEWORK_UUID)) { + String uuid = null; + try { + uuid = AccessController + .doPrivileged(new PrivilegedAction() { + public String run() { + return reference.getBundle().getBundleContext() + .getProperty("org.osgi.framework.uuid"); + } + }); + } + catch (SecurityException e) { + // if we don't have permission, we can't get the property + } + if (uuid != null) { + props.put(ENDPOINT_FRAMEWORK_UUID, uuid); + } + } + conditionProperties(props); + this.properties = Collections.unmodifiableMap(props); + /* properties must be initialized before calling the following methods */ + interfaces = verifyObjectClassProperty(); + serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID); + frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID); + id = verifyStringProperty(ENDPOINT_ID).trim(); + if (id == null) { + throw new IllegalArgumentException(ENDPOINT_ID + + " property must be set"); + } + if (getConfigurationTypes().isEmpty()) { + throw new IllegalArgumentException(SERVICE_IMPORTED_CONFIGS + + " property must be set and non-empty"); + } + } + + private static final String SERVICE_EXPORTED_ = "service.exported."; + private static final int SERVICE_EXPORTED_length = SERVICE_EXPORTED_ + .length(); + + /** + * Condition the properties. + * + * @param props Property map to condition. + */ + private void conditionProperties(Map props) { + // ensure service.imported is set + if (!props.containsKey(SERVICE_IMPORTED)) { + props.put(SERVICE_IMPORTED, Boolean.toString(true)); + } + + // remove service.exported.* properties + for (Iterator iter = props.keySet().iterator(); iter.hasNext();) { + String key = iter.next(); + if (SERVICE_EXPORTED_.regionMatches(true, 0, key, 0, + SERVICE_EXPORTED_length)) { + iter.remove(); + } + } + } + + /** + * Verify and obtain the interface list from the properties. + * + * @return A list with the interface names. + * @throws IllegalArgumentException If the objectClass property is not set + * or is empty or if the package version property values are + * malformed. + */ + private List verifyObjectClassProperty() { + Object o = properties.get(Constants.OBJECTCLASS); + if (!(o instanceof String[])) { + throw new IllegalArgumentException( + "objectClass value must be of type String[]"); + } + String[] objectClass = (String[]) o; + if (objectClass.length < 1) { + throw new IllegalArgumentException("objectClass is empty"); + } + for (String interf : objectClass) { + int index = interf.lastIndexOf('.'); + if (index == -1) { + continue; + } + String packageName = interf.substring(0, index); + try { + /* Make sure any package version properties are well formed */ + getPackageVersion(packageName); + } + catch (IllegalArgumentException e) { + IllegalArgumentException iae = new IllegalArgumentException( + "Improper version for package " + packageName); + iae.initCause(e); + throw iae; + } + } + return Collections.unmodifiableList(Arrays.asList(objectClass)); + } + + /** + * Verify and obtain a required String property. + * + * @param propName The name of the property + * @return The value of the property or {@code null} if the property is + * not set. + * @throws IllegalArgumentException when the property doesn't have the + * correct data type. + */ + private String verifyStringProperty(String propName) { + Object r = properties.get(propName); + try { + return (String) r; + } + catch (ClassCastException e) { + IllegalArgumentException iae = new IllegalArgumentException( + "property value is not a String: " + propName); + iae.initCause(e); + throw iae; + } + } + + /** + * Verify and obtain a required long property. + * + * @param propName The name of the property + * @return The value of the property or 0 if the property is not set. + * @throws IllegalArgumentException when the property doesn't have the + * correct data type. + */ + private long verifyLongProperty(String propName) { + Object r = properties.get(propName); + if (r == null) { + return 0l; + } + try { + return ((Long) r).longValue(); + } + catch (ClassCastException e) { + IllegalArgumentException iae = new IllegalArgumentException( + "property value is not a Long: " + propName); + iae.initCause(e); + throw iae; + } + } + + /** + * Returns the endpoint's id. + * + * The id is an opaque id for an endpoint. No two different endpoints must + * have the same id. Two Endpoint Descriptions with the same id must + * represent the same endpoint. + * + * The value of the id is stored in the {@link RemoteConstants#ENDPOINT_ID} + * property. + * + * @return The id of the endpoint, never {@code null}. The returned + * value has leading and trailing whitespace removed. + */ + public String getId() { + return id; + } + + /** + * Provide the list of interfaces implemented by the exported service. + * + * The value of the interfaces is derived from the {@code objectClass} + * property. + * + * @return An unmodifiable list of Java interface names implemented by this + * endpoint. + */ + public List getInterfaces() { + return interfaces; + } + + /** + * Provide the version of the given package name. + * + * The version is encoded by prefixing the given package name with + * {@link RemoteConstants#ENDPOINT_PACKAGE_VERSION_ + * endpoint.package.version.}, and then using this as an endpoint property + * key. For example: + * + *

      +	 * endpoint.package.version.com.acme
      +	 * 
      + * + * The value of this property is in String format and will be converted to a + * {@code Version} object by this method. + * + * @param packageName The name of the package for which a version is + * requested. + * @return The version of the specified package or + * {@code Version.emptyVersion} if the package has no version + * in this Endpoint Description. + * @throws IllegalArgumentException If the version property value is not + * String. + */ + public Version getPackageVersion(String packageName) { + String key = ENDPOINT_PACKAGE_VERSION_ + packageName; + Object value = properties.get(key); + String version; + try { + version = (String) value; + } + catch (ClassCastException e) { + IllegalArgumentException iae = new IllegalArgumentException(key + + " property value is not a String"); + iae.initCause(e); + throw iae; + } + return Version.parseVersion(version); + } + + /** + * Returns the service id for the service exported through this endpoint. + * + * This is the service id under which the framework has registered the + * service. This field together with the Framework UUID is a globally unique + * id for a service. + * + * The value of the remote service id is stored in the + * {@link RemoteConstants#ENDPOINT_SERVICE_ID} endpoint property. + * + * @return Service id of a service or 0 if this Endpoint Description does + * not relate to an OSGi service. + * + */ + public long getServiceId() { + return serviceId; + } + + /** + * Returns the configuration types. + * + * A distribution provider exports a service with an endpoint. This endpoint + * uses some kind of communications protocol with a set of configuration + * parameters. There are many different types but each endpoint is + * configured by only one configuration type. However, a distribution + * provider can be aware of different configuration types and provide + * synonyms to increase the change a receiving distribution provider can + * create a connection to this endpoint. + * + * This value of the configuration types is stored in the + * {@link RemoteConstants#SERVICE_IMPORTED_CONFIGS} service property. + * + * @return An unmodifiable list of the configuration types used for the + * associated endpoint and optionally synonyms. + */ + public List getConfigurationTypes() { + return getStringPlusProperty(SERVICE_IMPORTED_CONFIGS); + } + + /** + * Return the list of intents implemented by this endpoint. + * + * The intents are based on the service.intents on an imported service, + * except for any intents that are additionally provided by the importing + * distribution provider. All qualified intents must have been expanded. + * + * This value of the intents is stored in the + * {@link RemoteConstants#SERVICE_INTENTS} service property. + * + * @return An unmodifiable list of expanded intents that are provided by + * this endpoint. + */ + public List getIntents() { + return getStringPlusProperty(SERVICE_INTENTS); + } + + /** + * Reads a 'String+' property from the properties map, which may be of type + * String, String[] or Collection<String> and returns it as an + * unmodifiable List. + * + * @param key The property + * @return An unmodifiable list + */ + private List getStringPlusProperty(String key) { + Object value = properties.get(key); + if (value == null) { + return Collections.EMPTY_LIST; + } + + if (value instanceof String) { + return Collections.singletonList((String) value); + } + + if (value instanceof String[]) { + String[] values = (String[]) value; + List result = new ArrayList(values.length); + for (String v : values) { + if (v != null) { + result.add(v); + } + } + return Collections.unmodifiableList(result); + } + + if (value instanceof Collection< ? >) { + Collection< ? > values = (Collection< ? >) value; + List result = new ArrayList(values.size()); + for (Iterator< ? > iter = values.iterator(); iter.hasNext();) { + Object v = iter.next(); + if (v instanceof String) { + result.add((String) v); + } + } + return Collections.unmodifiableList(result); + } + + return Collections.EMPTY_LIST; + } + + /** + * Return the framework UUID for the remote service, if present. + * + * The value of the remote framework uuid is stored in the + * {@link RemoteConstants#ENDPOINT_FRAMEWORK_UUID} endpoint property. + * + * @return Remote Framework UUID, or {@code null} if this endpoint is + * not associated with an OSGi framework having a framework uuid. + */ + public String getFrameworkUUID() { + return frameworkUUID; + } + + /** + * Returns all endpoint properties. + * + * @return An unmodifiable map referring to the properties of this Endpoint + * Description. + */ + public Map getProperties() { + return properties; + } + + /** + * Answers if this Endpoint Description refers to the same service instance + * as the given Endpoint Description. + * + * Two Endpoint Descriptions point to the same service if they have the same + * id or their framework UUIDs and remote service ids are equal. + * + * @param other The Endpoint Description to look at + * @return True if this endpoint description points to the same service as + * the other + */ + public boolean isSameService(EndpointDescription other) { + if (this.equals(other)) { + return true; + } + + if (this.getFrameworkUUID() == null) { + return false; + } + + return (this.getServiceId() == other.getServiceId()) + && this.getFrameworkUUID().equals( + other.getFrameworkUUID()); + } + + /** + * Returns a hash code value for the object. + * + * @return An integer which is a hash code value for this object. + */ + public int hashCode() { + return getId().hashCode(); + } + + /** + * Compares this {@code EndpointDescription} object to another object. + * + *

      + * An Endpoint Description is considered to be equal to another + * Endpoint Description if their ids are equal. + * + * @param other The {@code EndpointDescription} object to be compared. + * @return {@code true} if {@code object} is a + * {@code EndpointDescription} and is equal to this object; + * {@code false} otherwise. + */ + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof EndpointDescription)) { + return false; + } + return getId().equals( + ((EndpointDescription) other).getId()); + } + + /** + * Tests the properties of this {@code EndpointDescription} against + * the given filter using a case insensitive match. + * + * @param filter The filter to test. + * @return {@code true} If the properties of this + * {@code EndpointDescription} match the filter, + * {@code false} otherwise. + * @throws IllegalArgumentException If {@code filter} contains an + * invalid filter string that cannot be parsed. + */ + public boolean matches(String filter) { + Filter f; + try { + f = FrameworkUtil.createFilter(filter); + } + catch (InvalidSyntaxException e) { + IllegalArgumentException iae = new IllegalArgumentException(e + .getMessage()); + iae.initCause(e); + throw iae; + } + Dictionary d = new UnmodifiableDictionary( + properties); + /* + * we can use matchCase here since properties already supports case + * insensitive key lookup. + */ + return f.matchCase(d); + } + + /** + * Returns the string representation of this EndpointDescription. + * + * @return String form of this EndpointDescription. + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append('{'); + Iterator> iter = properties.entrySet() + .iterator(); + boolean comma = false; + while (iter.hasNext()) { + Map.Entry entry = iter.next(); + if (comma) { + sb.append(", "); + } + else { + comma = true; + } + sb.append(entry.getKey()); + sb.append('='); + Object value = entry.getValue(); + if (value != null) { + Class< ? > valueType = value.getClass(); + if (Object[].class.isAssignableFrom(valueType)) { + append(sb, (Object[]) value); + continue; + } + } + sb.append(value); + } + sb.append('}'); + return sb.toString(); + } + + /** + * Append the specified Object array to the specified StringBuffer. + * + * @param sb Receiving StringBuffer. + * @param value Object array to append to the specified StringBuffer. + */ + private static void append(StringBuffer sb, Object[] value) { + sb.append('['); + boolean comma = false; + final int length = value.length; + for (int i = 0; i < length; i++) { + if (comma) { + sb.append(", "); + } + else { + comma = true; + } + sb.append(String.valueOf(value[i])); + } + sb.append(']'); + } + + /** + * Unmodifiable Dictionary wrapper for a Map. This class is also used by + * EndpointPermission. + */ + static final class UnmodifiableDictionary extends Dictionary { + private final Map wrapped; + + UnmodifiableDictionary(Map wrapped) { + this.wrapped = wrapped; + } + + public Enumeration elements() { + return Collections.enumeration(wrapped.values()); + } + + public V get(Object key) { + return wrapped.get(key); + } + + public boolean isEmpty() { + return wrapped.isEmpty(); + } + + public Enumeration keys() { + return Collections.enumeration(wrapped.keySet()); + } + + public V put(K key, V value) { + throw new UnsupportedOperationException(); + } + + public V remove(Object key) { + throw new UnsupportedOperationException(); + } + + public int size() { + return wrapped.size(); + } + + public String toString() { + return wrapped.toString(); + } + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/EndpointListener.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/EndpointListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/EndpointListener.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/EndpointListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,125 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +/** + * A white board service that represents a listener for endpoints. + * + * An Endpoint Listener represents a participant in the distributed model that + * is interested in Endpoint Descriptions. + * + * This white board service can be used in many different scenarios. However, + * the primary use case is to allow a remote manager to be informed of Endpoint + * Descriptions available in the network and inform the network about available + * Endpoint Descriptions. + * + * Both the network bundle and the manager bundle register an Endpoint Listener + * service. The manager informs the network bundle about Endpoints that it + * creates. The network bundles then uses a protocol like SLP to announce these + * local end-points to the network. + * + * If the network bundle discovers a new Endpoint through its discovery + * protocol, then it sends an Endpoint Description to all the Endpoint Listener + * services that are registered (except its own) that have specified an interest + * in that endpoint. + * + * Endpoint Listener services can express their scope with the service + * property {@link #ENDPOINT_LISTENER_SCOPE}. This service property is a list of + * filters. An Endpoint Description should only be given to a Endpoint Listener + * when there is at least one filter that matches the Endpoint Description + * properties. + * + * This filter model is quite flexible. For example, a discovery bundle is only + * interested in locally originating Endpoint Descriptions. The following filter + * ensure that it only sees local endpoints. + * + *

      + *   (org.osgi.framework.uuid=72dc5fd9-5f8f-4f8f-9821-9ebb433a5b72)
      + * 
      + * + * In the same vein, a manager that is only interested in remote Endpoint + * Descriptions can use a filter like: + * + *
      + *   (!(org.osgi.framework.uuid=72dc5fd9-5f8f-4f8f-9821-9ebb433a5b72))
      + * 
      + * + * Where in both cases, the given UUID is the UUID of the local framework that + * can be found in the Framework properties. + * + * The Endpoint Listener's scope maps very well to the service hooks. A manager + * can just register all filters found from the Listener Hook as its scope. This + * will automatically provide it with all known endpoints that match the given + * scope, without having to inspect the filter string. + * + * In general, when an Endpoint Description is discovered, it should be + * dispatched to all registered Endpoint Listener services. If a new Endpoint + * Listener is registered, it should be informed about all currently known + * Endpoints that match its scope. If a getter of the Endpoint Listener service + * is unregistered, then all its registered Endpoint Description objects must be + * removed. + * + * The Endpoint Listener models a best effort approach. Participating + * bundles should do their utmost to keep the listeners up to date, but + * implementers should realize that many endpoints come through unreliable + * discovery processes. + * + * @ThreadSafe + * @version $Id: 8feaa377aecc7db74348c2c1b26ce7cd9fe64fea $ + */ +public interface EndpointListener { + /** + * Specifies the interest of this listener with filters. This listener is + * only interested in Endpoint Descriptions where its properties match the + * given filter. The type of this property must be {@code String+}. + */ + String ENDPOINT_LISTENER_SCOPE = "endpoint.listener.scope"; + + /** + * Register an endpoint with this listener. + * + * If the endpoint matches one of the filters registered with the + * {@link #ENDPOINT_LISTENER_SCOPE} service property then this filter should + * be given as the {@code matchedFilter} parameter. + * + * When this service is first registered or it is modified, it should + * receive all known endpoints matching the filter. + * + * @param endpoint The Endpoint Description to be published + * @param matchedFilter The filter from the {@link #ENDPOINT_LISTENER_SCOPE} + * that matched the endpoint, must not be {@code null}. + */ + void endpointAdded(EndpointDescription endpoint, String matchedFilter); + + /** + * Remove the registration of an endpoint. + * + * If an endpoint that was registered with the + * {@link #endpointAdded(EndpointDescription, String)} method is no longer + * available then this method should be called. This will remove the + * endpoint from the listener. + * + * It is not necessary to remove endpoints when the service is unregistered + * or modified in such a way that not all endpoints match the interest + * filter anymore. + * + * @param endpoint The Endpoint Description that is no longer valid. + * @param matchedFilter The filter from the {@link #ENDPOINT_LISTENER_SCOPE} + * that matched the endpoint, must not be {@code null}. + */ + void endpointRemoved(EndpointDescription endpoint, String matchedFilter); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/EndpointPermission.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/EndpointPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/EndpointPermission.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/EndpointPermission.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,692 @@ +/* + * Copyright (c) OSGi Alliance (2000, 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.remoteserviceadmin; + +import static org.osgi.service.remoteserviceadmin.RemoteConstants.*; + +import java.io.IOException; +import java.io.NotSerializableException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamField; +import java.security.Permission; +import java.security.PermissionCollection; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.osgi.framework.Filter; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; + +/** + * A bundle's authority to export, import or read an Endpoint. + *
        + *
      • The {@code export} action allows a bundle to export a service as an + * Endpoint.
      • + *
      • The {@code import} action allows a bundle to import a service from + * an Endpoint.
      • + *
      • The {@code read} action allows a bundle to read references to an + * Endpoint.
      • + *
      + * Permission to read an Endpoint is required in order to detect events + * regarding an Endpoint. Untrusted bundles should not be able to detect the + * presence of certain Endpoints unless they have the appropriate + * {@code EndpointPermission} to read the specific service. + * + * @ThreadSafe + * @version $Id: a7565f494a3d68772eaca2707221f7c8eca88e20 $ + */ + +public final class EndpointPermission extends Permission { + static final long serialVersionUID = -7662148639076511574L; + /** + * The action string {@code read}. + */ + public final static String READ = "read"; + /** + * The action string {@code import}. The {@code import} action + * implies the {@code read} action. + */ + public final static String IMPORT = "import"; + /** + * The action string {@code export}. The {@code export} action + * implies the {@code read} action. + */ + public final static String EXPORT = "export"; + + private final static int ACTION_READ = 0x00000001; + private final static int ACTION_IMPORT = 0x00000002; + private final static int ACTION_EXPORT = 0x00000004; + private final static int ACTION_ALL = ACTION_EXPORT + | ACTION_IMPORT + | ACTION_READ; + final static int ACTION_NONE = 0; + + /** + * The actions mask. + */ + transient int action_mask; + + /** + * The actions in canonical form. + * + * @serial + */ + private volatile String actions = null; + + /** + * The endpoint used by this EndpointPermission. Must be {@code null} + * if not constructed with a endpoint. + */ + transient final EndpointDescription endpoint; + + /** + * This dictionary holds the properties of the permission, used to match a + * filter in implies. + */ + private transient final Dictionary properties; + + /** + * If this EndpointPermission was not constructed with an + * EndpointDescription, this holds a Filter matching object used to evaluate + * the filter in implies or {@code null} for wildcard. + */ + transient Filter filter; + + /** + * Create a new EndpointPermission with the specified filter. + * + *

      + * The filter will be evaluated against the endpoint properties of a + * requested EndpointPermission. + * + *

      + * There are three possible actions: {@code read}, {@code import} + * and {@code export}. The {@code read} action allows the owner of + * this permission to see the presence of distributed services. The + * {@code import} action allows the owner of this permission to import + * an endpoint. The {@code export} action allows the owner of this + * permission to export a service. + * + * @param filterString The filter string or "*" to match all + * endpoints. + * @param actions The actions {@code read}, {@code import}, or + * {@code export}. + * @throws IllegalArgumentException If the filter has an invalid syntax or + * the actions are not valid. + */ + public EndpointPermission(String filterString, String actions) { + this(filterString, parseActions(actions)); + } + + /** + * Creates a new requested {@code EndpointPermission} object to be used + * by code that must perform {@code checkPermission}. + * {@code EndpointPermission} objects created with this constructor + * cannot be added to an {@code EndpointPermission} permission + * collection. + * + * @param endpoint The requested endpoint. + * @param localFrameworkUUID The UUID of the local framework. This is used + * to support matching the + * {@link RemoteConstants#ENDPOINT_FRAMEWORK_UUID + * endpoint.framework.uuid} endpoint property to the + * {@code <<LOCAL>>} value in the filter expression. + * @param actions The actions {@code read}, {@code import}, or + * {@code export}. + * @throws IllegalArgumentException If the endpoint is {@code null} or + * the actions are not valid. + */ + public EndpointPermission(EndpointDescription endpoint, + String localFrameworkUUID, String actions) { + super(createName(endpoint)); + setTransients(null, parseActions(actions)); + Map props; + if ((localFrameworkUUID != null) + && localFrameworkUUID.equals(endpoint.getFrameworkUUID())) { + props = new TreeMap(String.CASE_INSENSITIVE_ORDER); + props.putAll(endpoint.getProperties()); + props.put(ENDPOINT_FRAMEWORK_UUID, new String[] { + endpoint.getFrameworkUUID(), "<>"}); + } + else { + props = endpoint.getProperties(); + } + this.endpoint = endpoint; + this.properties = new EndpointDescription.UnmodifiableDictionary( + props); + } + + /** + * Create a permission name from a EndpointDescription. + * + * @param endpoint EndpointDescription to use to create permission name. + * @return permission name. + */ + private static String createName(EndpointDescription endpoint) { + if (endpoint == null) { + throw new IllegalArgumentException("invalid endpoint: null"); + } + StringBuffer sb = new StringBuffer("(" + ENDPOINT_ID + "="); + sb.append(endpoint.getId()); + sb.append(")"); + return sb.toString(); + } + + /** + * Package private constructor used by EndpointPermissionCollection. + * + * @param name class name + * @param mask action mask + */ + EndpointPermission(String name, int mask) { + super(name); + setTransients(parseFilter(name), mask); + this.endpoint = null; + this.properties = null; + } + + /** + * Called by constructors and when deserialized. + * + * @param mask action mask + */ + private void setTransients(Filter f, int mask) { + if ((mask == ACTION_NONE) || ((mask & ACTION_ALL) != mask)) { + throw new IllegalArgumentException("invalid action string"); + } + action_mask = mask; + filter = f; + } + + /** + * Parse action string into action mask. + * + * @param actions Action string. + * @return action mask. + */ + private static int parseActions(String actions) { + boolean seencomma = false; + + int mask = ACTION_NONE; + + if (actions == null) { + return mask; + } + + char[] a = actions.toCharArray(); + + int i = a.length - 1; + if (i < 0) + return mask; + + while (i != -1) { + char c; + + // skip whitespace + while ((i != -1) + && ((c = a[i]) == ' ' || c == '\r' || c == '\n' + || c == '\f' || c == '\t')) + i--; + + // check for the known strings + int matchlen; + + if (i >= 5 && (a[i - 5] == 'i' || a[i - 5] == 'I') + && (a[i - 4] == 'm' || a[i - 4] == 'M') + && (a[i - 3] == 'p' || a[i - 3] == 'P') + && (a[i - 2] == 'o' || a[i - 2] == 'O') + && (a[i - 1] == 'r' || a[i - 1] == 'R') + && (a[i] == 't' || a[i] == 'T')) { + matchlen = 6; + mask |= ACTION_IMPORT | ACTION_READ; + + } + else + if (i >= 5 && (a[i - 5] == 'e' || a[i - 5] == 'E') + && (a[i - 4] == 'x' || a[i - 4] == 'X') + && (a[i - 3] == 'p' || a[i - 3] == 'P') + && (a[i - 2] == 'o' || a[i - 2] == 'O') + && (a[i - 1] == 'r' || a[i - 1] == 'R') + && (a[i] == 't' || a[i] == 'T')) { + matchlen = 6; + mask |= ACTION_EXPORT | ACTION_READ; + + } + else { + if (i >= 3 && (a[i - 3] == 'r' || a[i - 3] == 'R') + && (a[i - 2] == 'e' || a[i - 2] == 'E') + && (a[i - 1] == 'a' || a[i - 1] == 'A') + && (a[i] == 'd' || a[i] == 'D')) { + matchlen = 4; + mask |= ACTION_READ; + + } + else { + // parse error + throw new IllegalArgumentException( + "invalid permission: " + actions); + } + } + + // make sure we didn't just match the tail of a word + // like "ackbarfread". Also, skip to the comma. + seencomma = false; + while (i >= matchlen && !seencomma) { + switch (a[i - matchlen]) { + case ',' : + seencomma = true; + /* FALLTHROUGH */ + case ' ' : + case '\r' : + case '\n' : + case '\f' : + case '\t' : + break; + default : + throw new IllegalArgumentException( + "invalid permission: " + actions); + } + i--; + } + + // point i at the location of the comma minus one (or -1). + i -= matchlen; + } + + if (seencomma) { + throw new IllegalArgumentException("invalid permission: " + actions); + } + + return mask; + } + + /** + * Parse filter string into a Filter object. + * + * @param filterString The filter string to parse. + * @return a Filter for this bundle. + * @throws IllegalArgumentException If the filter syntax is invalid. + */ + private static Filter parseFilter(String filterString) { + if (filterString == null) { + throw new IllegalArgumentException("invalid filter: null"); + } + filterString = filterString.trim(); + if (filterString.equals("*")) { + return null; // wildcard + } + try { + return FrameworkUtil.createFilter(filterString); + } + catch (InvalidSyntaxException e) { + IllegalArgumentException iae = new IllegalArgumentException( + "invalid filter"); + iae.initCause(e); + throw iae; + } + } + + /** + * Determines if a {@code EndpointPermission} object "implies" the + * specified permission. + * + * @param p The target permission to check. + * @return {@code true} if the specified permission is implied by this + * object; {@code false} otherwise. + */ + public boolean implies(Permission p) { + if (!(p instanceof EndpointPermission)) { + return false; + } + EndpointPermission requested = (EndpointPermission) p; + if (endpoint != null) { + return false; + } + // if requested permission has a filter, then it is an invalid argument + if (requested.filter != null) { + return false; + } + return implies0(requested, ACTION_NONE); + } + + /** + * Internal implies method. Used by the implies and the permission + * collection implies methods. + * + * @param requested The requested EndpointPermission which has already be + * validated as a proper argument. The requested EndpointPermission + * must not have a filter expression. + * @param effective The effective actions with which to start. + * @return {@code true} if the specified permission is implied by this + * object; {@code false} otherwise. + */ + boolean implies0(EndpointPermission requested, int effective) { + /* check actions first - much faster */ + effective |= action_mask; + final int desired = requested.action_mask; + if ((effective & desired) != desired) { + return false; + } + /* if we have no filter */ + Filter f = filter; + if (f == null) { + // it's "*" + return true; + } + return f.matchCase(requested.getProperties()); + } + + /** + * Returns the canonical string representation of the actions. Always + * returns present actions in the following canonical order: + * {@code read}, {@code import}, {@code export}. + * + * @return The canonical string representation of the actions. + */ + public String getActions() { + String result = actions; + if (result == null) { + StringBuffer sb = new StringBuffer(); + boolean comma = false; + + int mask = action_mask; + if ((mask & ACTION_READ) == ACTION_READ) { + sb.append(READ); + comma = true; + } + + if ((mask & ACTION_IMPORT) == ACTION_IMPORT) { + if (comma) + sb.append(','); + sb.append(IMPORT); + } + + if ((mask & ACTION_EXPORT) == ACTION_EXPORT) { + if (comma) + sb.append(','); + sb.append(EXPORT); + } + + actions = result = sb.toString(); + } + + return result; + } + + /** + * Returns a new {@code PermissionCollection} object for storing + * {@code EndpointPermission} objects. + * + * @return A new {@code PermissionCollection} object suitable for storing + * {@code EndpointPermission} objects. + */ + public PermissionCollection newPermissionCollection() { + return new EndpointPermissionCollection(); + } + + /** + * Determines the equality of two EndpointPermission objects. + * + * Checks that specified object has the same name, actions and endpoint as + * this {@code EndpointPermission}. + * + * @param obj The object to test for equality. + * @return true If obj is a {@code EndpointPermission}, and has the + * same name, actions and endpoint as this + * {@code EndpointPermission} object; {@code false} + * otherwise. + */ + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (!(obj instanceof EndpointPermission)) { + return false; + } + + EndpointPermission ep = (EndpointPermission) obj; + + return (action_mask == ep.action_mask) + && getName().equals(ep.getName()) + && ((endpoint == ep.endpoint) || ((endpoint != null) + && (ep.endpoint != null) && endpoint + .equals(ep.endpoint))); + } + + /** + * Returns the hash code value for this object. + * + * @return Hash code value for this object. + */ + public int hashCode() { + int h = 31 * 17 + getName().hashCode(); + h = 31 * h + getActions().hashCode(); + if (endpoint != null) { + h = 31 * h + endpoint.hashCode(); + } + return h; + } + + /** + * WriteObject is called to save the state of this permission to a stream. + * The actions are serialized, and the superclass takes care of the name. + */ + private synchronized void writeObject(java.io.ObjectOutputStream s) + throws IOException { + if (endpoint != null) { + throw new NotSerializableException("cannot serialize"); + } + // Write out the actions. The superclass takes care of the name + // call getActions to make sure actions field is initialized + if (actions == null) { + getActions(); + } + s.defaultWriteObject(); + } + + /** + * readObject is called to restore the state of this permission from a + * stream. + */ + private synchronized void readObject(java.io.ObjectInputStream s) + throws IOException, ClassNotFoundException { + // Read in the action, then initialize the rest + s.defaultReadObject(); + setTransients(parseFilter(getName()), parseActions(actions)); + } + + /** + * Called by {@code <@link EndpointPermission#implies(Permission)>}. + * + * @return a dictionary of properties for this permission. + */ + private Dictionary getProperties() { + return properties; + } +} + +/** + * Stores a set of EndpointPermission permissions. + * + * @see java.security.Permission + * @see java.security.Permissions + * @see java.security.PermissionCollection + */ +final class EndpointPermissionCollection extends PermissionCollection { + static final long serialVersionUID = 662615640374640621L; + /** + * Table of permissions. + * + * @serial + * @GuardedBy this + */ + private Map permissions; + + /** + * Boolean saying if "*" is in the collection. + * + * @serial + * @GuardedBy this + */ + private boolean all_allowed; + + /** + * Creates an empty EndpointPermissions object. + */ + public EndpointPermissionCollection() { + permissions = new HashMap(); + all_allowed = false; + } + + /** + * Adds a permission to this permission collection. + * + * @param permission The Permission object to add. + * @throws IllegalArgumentException If the specified permission is not a + * EndpointPermission object. + * @throws SecurityException If this + * {@code EndpointPermissionCollection} object has been marked + * read-only. + */ + public void add(final Permission permission) { + if (!(permission instanceof EndpointPermission)) { + throw new IllegalArgumentException("invalid permission: " + + permission); + } + if (isReadOnly()) { + throw new SecurityException("attempt to add a Permission to a " + + "readonly PermissionCollection"); + } + + final EndpointPermission ep = (EndpointPermission) permission; + if (ep.endpoint != null) { + throw new IllegalArgumentException("cannot add to collection: " + + ep); + } + + final String name = ep.getName(); + synchronized (this) { + /* select the bucket for the permission */ + Map pc = permissions; + final EndpointPermission existing = pc.get(name); + + if (existing != null) { + final int oldMask = existing.action_mask; + final int newMask = ep.action_mask; + if (oldMask != newMask) { + pc.put(name, + new EndpointPermission(name, oldMask | newMask)); + } + } + else { + pc.put(name, ep); + } + + if (!all_allowed) { + if (name.equals("*")) { + all_allowed = true; + } + } + } + } + + /** + * Determines if a set of permissions implies the permissions expressed in + * {@code permission}. + * + * @param permission The Permission object to compare. + * @return {@code true} if {@code permission} is a proper subset + * of a permission in the set; {@code false} otherwise. + */ + public boolean implies(final Permission permission) { + if (!(permission instanceof EndpointPermission)) { + return false; + } + final EndpointPermission requested = (EndpointPermission) permission; + /* if requested permission has a filter, then it is an invalid argument */ + if (requested.filter != null) { + return false; + } + int effective = EndpointPermission.ACTION_NONE; + Collection perms; + synchronized (this) { + final int desired = requested.action_mask; + /* short circuit if the "*" Permission was added */ + if (all_allowed) { + EndpointPermission ep = permissions.get("*"); + if (ep != null) { + effective |= ep.action_mask; + if ((effective & desired) == desired) { + return true; + } + } + } + perms = permissions.values(); + } + + /* iterate one by one over permissions */ + for (Iterator iter = perms.iterator(); iter + .hasNext();) { + if (iter.next().implies0(requested, effective)) { + return true; + } + } + return false; + } + + /** + * Returns an enumeration of all the {@code EndpointPermission} objects + * in the container. + * + * @return Enumeration of all the EndpointPermission objects. + */ + public synchronized Enumeration elements() { + List all = new ArrayList(permissions.values()); + return Collections.enumeration(all); + } + + /* serialization logic */ + private static final ObjectStreamField[] serialPersistentFields = { + new ObjectStreamField("permissions", HashMap.class), + new ObjectStreamField("all_allowed", Boolean.TYPE) }; + + private synchronized void writeObject(ObjectOutputStream out) + throws IOException { + ObjectOutputStream.PutField pfields = out.putFields(); + pfields.put("permissions", permissions); + pfields.put("all_allowed", all_allowed); + out.writeFields(); + } + + private synchronized void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { + ObjectInputStream.GetField gfields = in.readFields(); + permissions = (HashMap) gfields.get( + "permissions", new HashMap()); + all_allowed = gfields.get("all_allowed", false); + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ExportReference.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ExportReference.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ExportReference.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ExportReference.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +import org.osgi.framework.ServiceReference; + +/** + * An Export Reference associates a service with a local endpoint. + * + * The Export Reference can be used to reference an exported service. When the + * service is no longer exported, all methods must return {@code null}. + * + * @ThreadSafe + * @noimplement + * @version $Id: 282839133c0934b5b636098f96994a95674e0f24 $ + */ +public interface ExportReference { + /** + * Return the service being exported. + * + * @return The service being exported. Must be {@code null} when the + * service is no longer exported. + */ + ServiceReference getExportedService(); + + /** + * Return the Endpoint Description for the local endpoint. + * + * @return The Endpoint Description for the local endpoint. Must be + * {@code null} when the service is no longer exported. + */ + EndpointDescription getExportedEndpoint(); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ExportRegistration.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ExportRegistration.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ExportRegistration.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ExportRegistration.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,71 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +import java.util.Map; + +import org.osgi.framework.ServiceReference; + +/** + * An Export Registration associates a service to a local endpoint. + * + * The Export Registration can be used to delete the endpoint associated with an + * this registration. It is created with the + * {@link RemoteServiceAdmin#exportService(ServiceReference,Map)} method. + * + * When this Export Registration has been closed, all methods must return + * {@code null}. + * + * @ThreadSafe + * @noimplement + * @version $Id: d215ae704a94dd944d2311c81fa32a4647351713 $ + */ +public interface ExportRegistration { + /** + * Return the Export Reference for the exported service. + * + * @return The Export Reference for this registration. + * @throws IllegalStateException When this registration was not properly + * initialized. See {@link #getException()}. + */ + ExportReference getExportReference(); + + /** + * Delete the local endpoint and disconnect any remote distribution + * providers. After this method returns, all methods must return + * {@code null}. + * + * This method has no effect when this registration has already been closed + * or is being closed. + */ + void close(); + + /** + * Return the exception for any error during the export process. + * + * If the Remote Service Admin for some reasons is unable to properly + * initialize this registration, then it must return an exception from this + * method. If no error occurred, this method must return {@code null}. + * + * The error must be set before this Export Registration is returned. + * Asynchronously occurring errors must be reported to the log. + * + * @return The exception that occurred during the initialization of this + * registration or {@code null} if no exception occurred. + */ + Throwable getException(); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ImportReference.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ImportReference.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ImportReference.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ImportReference.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +import org.osgi.framework.ServiceReference; + +/** + * An Import Reference associates an active proxy service to a remote endpoint. + * + * The Import Reference can be used to reference an imported service. When the + * service is no longer imported, all methods must return {@code null}. + * + * @ThreadSafe + * @noimplement + * @version $Id: 943a38c0869cbe8cb9e04af62d4ac8169ad807ce $ + */ +public interface ImportReference { + /** + * Return the Service Reference for the proxy for the endpoint. + * + * @return The Service Reference to the proxy for the endpoint. Must be + * {@code null} when the service is no longer imported. + */ + ServiceReference getImportedService(); + + /** + * Return the Endpoint Description for the remote endpoint. + * + * @return The Endpoint Description for the remote endpoint. Must be + * {@code null} when the service is no longer imported. + */ + EndpointDescription getImportedEndpoint(); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ImportRegistration.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ImportRegistration.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/ImportRegistration.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/ImportRegistration.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +/** + * An Import Registration associates an active proxy service to a remote + * endpoint. + * + * The Import Registration can be used to delete the proxy associated with an + * endpoint. It is created with the + * {@link RemoteServiceAdmin#importService(EndpointDescription)} method. + * + * When this Import Registration has been closed, all methods must return + * {@code null}. + * + * @ThreadSafe + * @noimplement + * @version $Id: e8a83aa65f535311cde90a8e7e1667540f887440 $ + */ +public interface ImportRegistration { + /** + * Return the Import Reference for the imported service. + * + * @return The Import Reference for this registration. + * @throws IllegalStateException When this registration was not properly + * initialized. See {@link #getException()}. + */ + ImportReference getImportReference(); + + /** + * Close this Import Registration. This must close the connection to the + * endpoint and unregister the proxy. After this method returns, all other + * methods must return {@code null}. + * + * This method has no effect when this registration has already been closed + * or is being closed. + */ + void close(); + + /** + * Return the exception for any error during the import process. + * + * If the Remote Service Admin for some reasons is unable to properly + * initialize this registration, then it must return an exception from this + * method. If no error occurred, this method must return {@code null}. + * + * The error must be set before this Import Registration is returned. + * Asynchronously occurring errors must be reported to the log. + * + * @return The exception that occurred during the initialization of this + * registration or {@code null} if no exception occurred. + */ + Throwable getException(); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/packageinfo 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/packageinfo 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1 @@ +version 1.0.1 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Remote Service Admin Package Version 1.0. + * + *

      + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.remoteserviceadmin; version="[1.0,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.remoteserviceadmin; version="[1.0,1.1)"} + * + * @version $Id: 2df93207eb7823d0b80b99275312519a7cb635e8 $ + */ + +package org.osgi.service.remoteserviceadmin; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteConstants.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteConstants.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteConstants.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteConstants.java 2011-04-19 13:24:46.000000000 +0000 @@ -0,0 +1,238 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +import org.osgi.framework.Constants; + +/** + * Provide the definition of the constants used in the Remote Service Admin + * specification. + * + * @Immutable + * @version $Id: 03766065c89cec9d6b51caf9617d024fd18e4bc4 $ + */ +public class RemoteConstants { + private RemoteConstants() { + // non-instantiable + } + + /** + * Service property identifying the configuration types supported by a + * distribution provider. Registered by the distribution provider on one of + * its services to indicate the supported configuration types. + * + *

      + * The value of this property must be of type {@code String}, + * {@code String[]}, or {@code Collection} of {@code String}. + * + * @see "Remote Services Specification" + */ + public static final String REMOTE_CONFIGS_SUPPORTED = Constants.REMOTE_CONFIGS_SUPPORTED; + + /** + * Service property identifying the intents supported by a distribution + * provider. Registered by the distribution provider on one of its services + * to indicate the vocabulary of implemented intents. + * + *

      + * The value of this property must be of type {@code String}, + * {@code String[]}, or {@code Collection} of {@code String}. + * + * @see "Remote Services Specification" + */ + public static final String REMOTE_INTENTS_SUPPORTED = Constants.REMOTE_INTENTS_SUPPORTED; + + /** + * Service property identifying the configuration types that should be used + * to export the service. Each configuration type represents the + * configuration parameters for an endpoint. A distribution provider should + * create an endpoint for each configuration type that it supports. + * + *

      + * This property may be supplied in the {@code properties} + * {@code Dictionary} object passed to the + * {@code BundleContext.registerService} method. The value of this property + * must be of type {@code String}, {@code String[]}, or {@code Collection} + * of {@code String}. + * + * @see "Remote Services Specification" + */ + public static final String SERVICE_EXPORTED_CONFIGS = Constants.SERVICE_EXPORTED_CONFIGS; + + /** + * Service property identifying the intents that the distribution provider + * must implement to distribute the service. Intents listed in this property + * are reserved for intents that are critical for the code to function + * correctly, for example, ordering of messages. These intents should not be + * configurable. + * + *

      + * This property may be supplied in the {@code properties} + * {@code Dictionary} object passed to the + * {@code BundleContext.registerService} method. The value of this property + * must be of type {@code String}, {@code String[]}, or {@code Collection} + * of {@code String}. + * + * @see "Remote Services Specification" + */ + public static final String SERVICE_EXPORTED_INTENTS = Constants.SERVICE_EXPORTED_INTENTS; + + /** + * Service property identifying the extra intents that the distribution + * provider must implement to distribute the service. This property is + * merged with the {@code service.exported.intents} property before the + * distribution provider interprets the listed intents; it has therefore the + * same semantics but the property should be configurable so the + * administrator can choose the intents based on the topology. Bundles + * should therefore make this property configurable, for example through the + * Configuration Admin service. + * + *

      + * This property may be supplied in the {@code properties} + * {@code Dictionary} object passed to the + * {@code BundleContext.registerService} method. The value of this property + * must be of type {@code String}, {@code String[]}, or {@code Collection} + * of {@code String}. + * + * @see "Remote Services Specification" + */ + public static final String SERVICE_EXPORTED_INTENTS_EXTRA = Constants.SERVICE_EXPORTED_INTENTS_EXTRA; + + /** + * Service property marking the service for export. It defines the + * interfaces under which this service can be exported. This list must be a + * subset of the types under which the service was registered. The single + * value of an asterisk ("*", \u002A) indicates all the + * interface types under which the service was registered excluding the + * non-interface types. It is strongly recommended to only export interface + * types and not concrete classes due to the complexity of creating proxies + * for some type of concrete classes. + * + *

      + * This property may be supplied in the {@code properties} + * {@code Dictionary} object passed to the + * {@code BundleContext.registerService} method. The value of this property + * must be of type {@code String}, {@code String[]}, or {@code Collection} + * of {@code String}. + * + * @see "Remote Services Specification" + */ + public static final String SERVICE_EXPORTED_INTERFACES = Constants.SERVICE_EXPORTED_INTERFACES; + + /** + * Service property identifying the service as imported. This service + * property must be set by a distribution provider to any value when it + * registers the endpoint proxy as an imported service. A bundle can use + * this property to filter out imported services. + * + *

      + * The value of this property may be of any type. + * + * @see "Remote Services Specification" + */ + public static final String SERVICE_IMPORTED = Constants.SERVICE_IMPORTED; + + /** + * Service property identifying the configuration types used to import the + * service. Any associated properties for this configuration types must be + * properly mapped to the importing system. For example, a URL in these + * properties must point to a valid resource when used in the importing + * framework. If multiple configuration types are listed in this property, + * then they must be synonyms for exactly the same remote endpoint that is + * used to export this service. + * + *

      + * The value of this property must be of type {@code String}, + * {@code String[]}, or {@code Collection} of {@code String}. + * + * @see "Remote Services Specification" + * @see #SERVICE_EXPORTED_CONFIGS + */ + public static final String SERVICE_IMPORTED_CONFIGS = Constants.SERVICE_IMPORTED_CONFIGS; + + /** + * Service property identifying the intents that this service implement. + * This property has a dual purpose: + *

        + *
      • A bundle can use this service property to notify the distribution + * provider that these intents are already implemented by the exported + * service object.
      • + *
      • A distribution provider must use this property to convey the combined + * intents of: The exporting service, and the intents that the exporting + * distribution provider adds, and the intents that the importing + * distribution provider adds.
      • + *
      + * + * To export a service, a distribution provider must expand any qualified + * intents. Both the exporting and importing distribution providers must + * recognize all intents before a service can be distributed. + * + * The value of this property must be of type {@code String}, + * {@code String[]}, or {@code Collection} of {@code String}. + * + * @see "Remote Services Specification" + */ + public static final String SERVICE_INTENTS = Constants.SERVICE_INTENTS; + + /* The above are from Ch. 13 Remote Services specification. */ + + /** + * Endpoint property identifying the id for this endpoint. This service + * property must always be set. + * + *

      + * The value of this property must be of type {@code String}. + */ + public final static String ENDPOINT_ID = "endpoint.id"; + + /** + * Endpoint property identifying the service id of the exported service. Can + * be absent or 0 if the corresponding endpoint is not for an OSGi service. + * + *

      + * The value of this property must be of type {@code Long}. + */ + public final static String ENDPOINT_SERVICE_ID = "endpoint.service.id"; + + /** + * Endpoint property identifying the universally unique id of the exporting + * framework. Can be absent if the corresponding endpoint is not for an OSGi + * service. + * + *

      + * The value of this property must be of type {@code String}. + */ + public final static String ENDPOINT_FRAMEWORK_UUID = "endpoint.framework.uuid"; + + /** + * Prefix for an endpoint property identifying the interface Java package + * version for an interface. For example, the property + * {@code endpoint.package.version.com.acme=1.3} describes the version + * of the package for the {@code com.acme.Foo} interface. This endpoint + * property for an interface package does not have to be set. If not set, + * the value must be assumed to be 0. + * + *

      + * Since endpoint properties are stored in a case insensitive map, case + * variants of a package name are folded together. + * + *

      + * The value of properties having this prefix must be of type + * {@code String}. + */ + public final static String ENDPOINT_PACKAGE_VERSION_ = "endpoint.package.version."; +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,178 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +import org.osgi.framework.Bundle; + +/** + * Provides the event information for a Remote Service Admin event. + * + * @Immutable + * @version $Id: 3b212dcbb7822a3312e20cd967f46bf49b3bb82a $ + */ +public class RemoteServiceAdminEvent { + /** + * Add an import registration. The Remote Service Admin will call this + * method when it imports a service. When this service is registered, the + * Remote Service Admin must notify the listener of all existing Import + * Registrations. + * + */ + public static final int IMPORT_REGISTRATION = 1; + + /** + * Add an export registration. The Remote Service Admin will call this + * method when it exports a service. When this service is registered, the + * Remote Service Admin must notify the listener of all existing Export + * Registrations. + */ + public static final int EXPORT_REGISTRATION = 2; + + /** + * Remove an export registration. The Remote Service Admin will call this + * method when it removes the export of a service. + * + */ + public static final int EXPORT_UNREGISTRATION = 3; + + /** + * Remove an import registration. The Remote Service Admin will call this + * method when it removes the import of a service. + * + */ + public static final int IMPORT_UNREGISTRATION = 4; + + /** + * A fatal importing error occurred. The Import Registration has been + * closed. + */ + public static final int IMPORT_ERROR = 5; + + /** + * A fatal exporting error occurred. The Export Registration has been + * closed. + */ + public static final int EXPORT_ERROR = 6; + + /** + * A problematic situation occurred, the export is still active. + */ + public static final int EXPORT_WARNING = 7; + /** + * A problematic situation occurred, the import is still active. + */ + public static final int IMPORT_WARNING = 8; + + private final ImportReference importReference; + private final ExportReference exportReference; + private final Throwable exception; + private final int type; + private final Bundle source; + + /** + * Private constructor. + * + * @param type The event type + * @param source The source bundle, must not be {@code null}. + * @param importReference The importReference, can be {@code null}. + * @param exportReference The exportReference, can be {@code null}. + * @param exception Any exceptions encountered, can be {@code null} + */ + private RemoteServiceAdminEvent(int type, Bundle source, + ImportReference importReference, ExportReference exportReference, + Throwable exception) { + if (source == null) { + throw new NullPointerException("source must not be null"); + } + this.type = type; + this.source = source; + this.importReference = importReference; + this.exportReference = exportReference; + this.exception = exception; + } + + /** + * Create a Remote Service Admin Event for an export notification. + * + * @param type The event type. + * @param source The source bundle, must not be {@code null}. + * @param exportReference The exportReference, can not be {@code null}. + * @param exception Any exceptions encountered, can be {@code null}. + */ + public RemoteServiceAdminEvent(int type, Bundle source, + ExportReference exportReference, Throwable exception) { + this(type, source, null, exportReference, exception); + } + + /** + * Create a Remote Service Admin Event for an import notification. + * + * @param type The event type. + * @param source The source bundle, must not be {@code null}. + * @param importReference The importReference, can not be {@code null}. + * @param exception Any exceptions encountered, can be {@code null}. + */ + public RemoteServiceAdminEvent(int type, Bundle source, + ImportReference importReference, Throwable exception) { + this(type, source, importReference, null, exception); + } + + /** + * Return the Import Reference for this event. + * + * @return The Import Reference or {@code null}. + */ + public ImportReference getImportReference() { + return importReference; + } + + /** + * Return the Export Reference for this event. + * + * @return The Export Reference or {@code null}. + */ + public ExportReference getExportReference() { + return exportReference; + } + + /** + * Return the exception for this event. + * + * @return The exception or {@code null}. + */ + public Throwable getException() { + return exception; + } + + /** + * Return the type of this event. + * + * @return The type of this event. + */ + public int getType() { + return type; + } + + /** + * Return the bundle source of this event. + * + * @return The bundle source of this event. + */ + public Bundle getSource() { + return source; + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,131 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +import java.util.Collection; +import java.util.Map; + +import org.osgi.framework.ServiceReference; + +/** + * A Remote Service Admin manages the import and export of services. + * + * A Distribution Provider can expose a control interface. This interface allows + * a Topology Manager to control the export and import of services. + * + * The API allows a Topology Manager to export a service, to import a service, + * and find out about the current imports and exports. + * + * @ThreadSafe + * @noimplement + * @version $Id: 7b2e01c324cc2d04a06f7d7addfe9ea1af1dc7ad $ + */ +public interface RemoteServiceAdmin { + + /** + * Export a service to a given Endpoint. The Remote Service Admin must + * create an Endpoint from the given description that can be used by other + * Distribution Providers to connect to this Remote Service Admin and use + * the exported service. + * + * The property keys of a Service Reference are case insensitive while the + * property keys of the specified {@code properties} map are case + * sensitive. A property key in the specified {@code properties} map + * must therefore override any case variant property key in the properties + * of the specified Service Reference. + * + *

      + * If the caller does not have the appropriate + * {@code EndpointPermission[endpoint,EXPORT]} for an Endpoint, and the + * Java Runtime Environment supports permissions, then the + * {@link ExportRegistration#getException() getException} method on the + * corresponding returned {@link ExportRegistration} will return a + * {@code SecurityException}. + * + * @param reference The Service Reference to export. + * @param properties The properties to create a local Endpoint that can be + * implemented by this Remote Service Admin. If this is + * {@code null}, the Endpoint will be determined by the + * properties on the service. The properties are the same as given + * for an exported service. They override any properties in the + * specified Service Reference (case insensitive). The properties + * {@code objectClass} and {@code service.id}, in any case + * variant, are ignored. Those properties in the Service Reference + * cannot be overridden. This parameter can be {@code null}, + * this should be treated as an empty map. + * @return A {@code Collection} of {@link ExportRegistration}s for the + * specified Service Reference and properties. Multiple Export + * Registrations may be returned because a single service can be + * exported to multiple Endpoints depending on the available + * configuration type properties. The result is never + * {@code null} but may be empty if this Remove Service Admin + * does not recognize any of the configuration types. + * @throws IllegalArgumentException If any of the properties has a value + * that is not syntactically correct or if the service properties + * and the overlaid properties do not contain a + * {@link RemoteConstants#SERVICE_EXPORTED_INTERFACES} entry. + * @throws UnsupportedOperationException If any of the intents expressed + * through the properties is not supported by the distribution + * provider. + */ + Collection exportService(ServiceReference reference, + Map properties); + + /** + * Import a service from an Endpoint. The Remote Service Admin must use the + * given Endpoint to create a proxy. This method can return + * {@code null} if the service could not be imported. + * + * @param endpoint The Endpoint Description to be used for import. + * @return An Import Registration that combines the Endpoint Description and + * the Service Reference or {@code null} if the Endpoint could + * not be imported. + * @throws SecurityException If the caller does not have the appropriate + * {@code EndpointPermission[endpoint,IMPORT]} for the + * Endpoint, and the Java Runtime Environment supports permissions. + */ + ImportRegistration importService(EndpointDescription endpoint); + + /** + * Return the currently active Export References. + * + *

      + * If the caller does not have the appropriate + * {@code EndpointPermission[endpoint,READ]} for an Endpoint, and the + * Java Runtime Environment supports permissions, then returned collection + * will not contain a reference to the exported Endpoint. + * + * @return A {@code Collection} of {@link ExportReference}s that are + * currently active. + */ + Collection getExportedServices(); + + /** + * Return the currently active Import References. + * + *

      + * If the caller does not have the appropriate + * {@code EndpointPermission[endpoint,READ]} for an Endpoint, and the + * Java Runtime Environment supports permissions, then returned collection + * will not contain a reference to the imported Endpoint. + * + * @return A {@code Collection} of {@link ImportReference}s that are + * currently active. + */ + Collection getImportedEndpoints(); + +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) OSGi Alliance (2009, 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.remoteserviceadmin; + +/** + * A {@link RemoteServiceAdminEvent} listener is notified synchronously of any + * export or import registrations and unregistrations. + * + *

      + * If the Java Runtime Environment supports permissions, then filtering is done. + * {@code RemoteServiceAdminEvent} objects are only delivered to the + * listener if the bundle which defines the listener object's class has the + * appropriate {@code EndpointPermission[endpoint,READ]} for the endpoint + * referenced by the event. + * + * + * @see RemoteServiceAdminEvent + * @ThreadSafe + * @version $Id: 824fb19364804de5ecd00695547134044847600d $ + */ + +public interface RemoteServiceAdminListener { + /** + * Receive notification of any export or import registrations and + * unregistrations as well as errors and warnings. + * + * @param event The {@link RemoteServiceAdminEvent} object. + */ + void remoteAdminEvent(RemoteServiceAdminEvent event); +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/package.html osgi-compendium-4.3.0/src/org/osgi/service/upnp/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

      UPnP Package Version 1.1. -

      Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

      -Import-Package: org.osgi.service.upnp; version="[1.1,2.0)"
      -
      - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/package-info.java 2011-05-17 09:55:04.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * UPnP Package Version 1.1. + * + *

      + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.upnp; version="[1.1,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.upnp; version="[1.1,1.2)"} + * + * @version $Id: f278e12d61cb7c24aad9ece612882dfbdbd97566 $ + */ + +package org.osgi.service.upnp; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPAction.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPAction.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPAction.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPAction.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -23,19 +23,19 @@ * Each UPnP service contains zero or more actions. Each action may have zero or * more UPnP state variables as arguments. * - * @version $Revision: 5673 $ + * @version $Id: c2a6803411defc79ce59fe2e93828158355cb1e0 $ */ public interface UPnPAction { /** * Returns the action name. * - * The action name corresponds to the name field in the - * actionList of the service description. + * The action name corresponds to the {@code name} field in the + * {@code actionList} of the service description. *

        *
      • For standard actions defined by a UPnP Forum working committee, - * action names must not begin with X_ nor A_.
      • + * action names must not begin with {@code X_ } nor {@code A_}. *
      • For non-standard actions specified by a UPnP vendor and added to a - * standard service, action names must begin with X_.
      • + * standard service, action names must begin with {@code X_}. *
      * * @return Name of action, must not contain a hyphen character or a hash @@ -49,7 +49,7 @@ * One of the output arguments can be flagged as a designated return * argument. * - * @return The name of the designated return argument or null if + * @return The name of the designated return argument or {@code null} if * none is marked. */ String getReturnArgumentName(); @@ -59,7 +59,7 @@ *

      * Each action may have zero or more input arguments. * - * @return Array of input argument names or null if no input + * @return Array of input argument names or {@code null} if no input * arguments. * * @see UPnPStateVariable @@ -69,7 +69,7 @@ /** * List all output arguments for this action. * - * @return Array of output argument names or null if there are no + * @return Array of output argument names or {@code null} if there are no * output arguments. * * @see UPnPStateVariable @@ -84,7 +84,7 @@ * * @param argumentName The name of the UPnP action argument. * @return State variable associated with the named argument or - * null if there is no such argument. + * {@code null} if there is no such argument. * * @see UPnPStateVariable */ @@ -93,23 +93,23 @@ /** * Invokes the action. * - * The input and output arguments are both passed as Dictionary - * objects. Each entry in the Dictionary object has a - * String object as key representing the argument name and the + * The input and output arguments are both passed as {@code Dictionary} + * objects. Each entry in the {@code Dictionary} object has a + * {@code String} object as key representing the argument name and the * value is the argument itself. The class of an argument value must be * assignable from the class of the associated UPnP state variable. * - * The input argument Dictionary object must contain exactly - * those arguments listed by getInputArguments method. The output - * argument Dictionary object will contain exactly those - * arguments listed by getOutputArguments method. + * The input argument {@code Dictionary} object must contain exactly + * those arguments listed by {@code getInputArguments} method. The output + * argument {@code Dictionary} object will contain exactly those + * arguments listed by {@code getOutputArguments} method. * - * @param args A Dictionary of arguments. Must contain the correct set and - * type of arguments for this action. May be null if no + * @param args A {@code Dictionary} of arguments. Must contain the correct set and + * type of arguments for this action. May be {@code null} if no * input arguments exist. * - * @return A Dictionary with the output arguments. - * null if the action has no output arguments. + * @return A {@code Dictionary} with the output arguments. + * {@code null} if the action has no output arguments. * * @throws UPnPException A UPnP error has occured. * @throws Exception The execution fails for some reason. diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPDevice.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPDevice.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPDevice.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPDevice.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -21,11 +21,11 @@ * Represents a UPnP device. * * For each UPnP root and embedded device, an object is registered with the - * framework under the UPnPDevice interface. + * framework under the {@code UPnPDevice} interface. *

      * The relationship between a root device and its embedded devices can be - * deduced using the UPnPDevice.CHILDREN_UDN and - * UPnPDevice.PARENT_UDN service registration properties. + * deduced using the {@code UPnPDevice.CHILDREN_UDN} and + * {@code UPnPDevice.PARENT_UDN} service registration properties. *

      * The values of the UPnP property names are defined by the UPnP Forum. *

      @@ -33,9 +33,9 @@ * device's default locale. *

      * If an application wants to query for a set of localized property values, it - * has to use the method UPnPDevice.getDescriptions(String locale). + * has to use the method {@code UPnPDevice.getDescriptions(String locale)}. * - * @version $Revision: 5673 $ + * @version $Id: 0ab66605c59e61ce1dd1d807e45beceef5d44f67 $ */ public interface UPnPDevice { /* @@ -67,14 +67,14 @@ */ int MATCH_MANUFACTURER_MODEL_REVISION_SERIAL = 31; /** - * Constant for the value of the service property DEVICE_CATEGORY + * Constant for the value of the service property {@code DEVICE_CATEGORY} * used for all UPnP devices. Value is "UPnP". * - * @see "org.osgi.service.device.Constants.DEVICE_CATEGORY" + * @see "{@code org.osgi.service.device.Constants.DEVICE_CATEGORY}" */ String DEVICE_CATEGORY = "UPnP"; /** - * The UPnP.export service property is a hint that marks a device + * The {@code UPnP.export} service property is a hint that marks a device * to be picked up and exported by the UPnP Service. Imported devices do not * have this property set. The registered property requires no value. *

      @@ -83,16 +83,16 @@ String UPNP_EXPORT = "UPnP.export"; /** * Property key for the Unique Device Name (UDN) property. It is the unique - * identifier of an instance of a UPnPDevice. The value of the - * property is a String object of the Device UDN. Value of the + * identifier of an instance of a {@code UPnPDevice}. The value of the + * property is a {@code String} object of the Device UDN. Value of the * key is "UPnP.device.UDN". This property must be set. */ String UDN = "UPnP.device.UDN"; /** * Property key for the Unique Device ID property. This property is an alias - * to UPnPDevice.UDN. It is merely provided for reasons of - * symmetry with the UPnPService.ID property. The value of the - * property is a String object of the Device UDN. The value of + * to {@code UPnPDevice.UDN}. It is merely provided for reasons of + * symmetry with the {@code UPnPService.ID} property. The value of the + * property is a {@code String} object of the Device UDN. The value of * the key is "UPnP.device.UDN". */ String ID = UDN; @@ -106,18 +106,18 @@ * consist of the following components in the given order separated by * colons: *

        - *
      • urn
      • + *
      • {@code urn}
      • *
      • schemas-upnp-org
      • - *
      • device
      • + *
      • {@code device}
      • *
      • a device type suffix
      • *
      • an integer device version
      • *
      * For non-standard devices specified by UPnP vendors following components * must be specified in the given order separated by colons: *
        - *
      • urn
      • + *
      • {@code urn}
      • *
      • an ICANN domain name owned by the vendor
      • - *
      • device
      • + *
      • {@code device}
      • *
      • a device type suffix
      • *
      • an integer device version
      • *
      @@ -131,7 +131,7 @@ * In the case of exporting a UPnPDevice, the highest available version must * be announced on the network. *

      - * Syntax Example: urn:schemas-upnp-org:device:deviceType:v + * Syntax Example: {@code urn:schemas-upnp-org:device:deviceType:v} *

      * The value is "UPnP.device.type". */ @@ -144,53 +144,53 @@ String MANUFACTURER = "UPnP.device.manufacturer"; /** * Mandatory property key for the device model name. The property value - * holds a String object giving more information about the device + * holds a {@code String} object giving more information about the device * model. Value is "UPnP.device.modelName". */ String MODEL_NAME = "UPnP.device.modelName"; /** * Mandatory property key for a short user friendly version of the device - * name. The property value holds a String object with the user + * name. The property value holds a {@code String} object with the user * friendly name of the device. Value is "UPnP.device.friendlyName". */ String FRIENDLY_NAME = "UPnP.device.friendlyName"; /** * Optional property key for a URL to the device manufacturers Web site. The - * value of the property is a String object representing the URL. + * value of the property is a {@code String} object representing the URL. * Value is "UPnP.device.manufacturerURL". */ String MANUFACTURER_URL = "UPnP.device.manufacturerURL"; /** - * Optional (but recommended) property key for a String object + * Optional (but recommended) property key for a {@code String} object * with a long description of the device for the end user. The value is * "UPnP.device.modelDescription". */ String MODEL_DESCRIPTION = "UPnP.device.modelDescription"; /** - * Optional (but recommended) property key for a String class + * Optional (but recommended) property key for a {@code String} class * typed property holding the model number of the device. Value is * "UPnP.device.modelNumber". */ String MODEL_NUMBER = "UPnP.device.modelNumber"; /** - * Optional property key for a String typed property holding a + * Optional property key for a {@code String} typed property holding a * string representing the URL to the Web site for this model. Value is * "UPnP.device.modelURL". */ String MODEL_URL = "UPnP.device.modelURL"; /** - * Optional (but recommended) property key for a String typed + * Optional (but recommended) property key for a {@code String} typed * property holding the serial number of the device. Value is * "UPnP.device.serialNumber". */ String SERIAL_NUMBER = "UPnP.device.serialNumber"; /** - * Optional property key for a String typed property holding the + * Optional property key for a {@code String} typed property holding the * Universal Product Code (UPC) of the device. Value is "UPnP.device.UPC". */ String UPC = "UPnP.device.UPC"; /** - * Optional (but recommended) property key for a String typed + * Optional (but recommended) property key for a {@code String} typed * property holding a string representing the URL to a device representation * Web page. Value is "UPnP.presentationURL". */ @@ -206,7 +206,7 @@ * embedded devices. *

      * The value is an array of UDNs for each of the device's children ( - * String[]). The array contains UDNs for the immediate + * {@code String[]}). The array contains UDNs for the immediate * descendants only. *

      *

      @@ -218,7 +218,7 @@ *

      * The property is not set if the device does not contain embedded devices. *

      - * The property is of type String[]. Value is + * The property is of type {@code String[]}. Value is * "UPnP.device.childrenUDN" */ String CHILDREN_UDN = "UPnP.device.childrenUDN"; @@ -234,7 +234,7 @@ /** * Lists all services provided by this device. * - * @return Array of services or null if no services are + * @return Array of services or {@code null} if no services are * available. */ UPnPService[] getServices(); @@ -246,9 +246,9 @@ * on the client's locale. * * @param locale A language tag as defined by RFC 1766 and maintained by ISO - * 639. Examples include "de", "en" or " - * en-US". The default locale of the device is specified - * by passing a null argument. + * 639. Examples include "{@code de}", "{@code en}" or " + * {@code en-US}". The default locale of the device is specified + * by passing a {@code null} argument. * * @return Array of icons or null if no icons are available. */ @@ -269,9 +269,9 @@ *

      * * @param locale A language tag as defined by RFC 1766 and maintained by ISO - * 639. Examples include "de", "en" or " - * en-US". The default locale of the device is specified - * by passing a null argument. + * 639. Examples include "{@code de}", "{@code en}" or " + * {@code en-US}". The default locale of the device is specified + * by passing a {@code null} argument. * @return Dictionary mapping property name Strings to property value * Strings * diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPEventListener.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPEventListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPEventListener.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPEventListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -24,7 +24,7 @@ * interface. *

      * The notification call from the UPnP Service to any - * UPnPEventListener object must be done asynchronous with respect + * {@code UPnPEventListener} object must be done asynchronous with respect * to the originator (in a separate thread). *

      * Upon registration of the UPnP Event Listener service with the Framework, the @@ -37,30 +37,30 @@ * when the listener service is registered. *

      * The filter is specified in a property named "upnp.filter" and has as a value - * an object of type org.osgi.framework.Filter. + * an object of type {@code org.osgi.framework.Filter}. *

      * When the Filter is evaluated, the folowing keywords are recognized as defined - * as literal constants in the UPnPDevice class. + * as literal constants in the {@code UPnPDevice} class. *

      * The valid subset of properties for the registration of UPnP Event Listener * services are: *

        - *
      • UPnPDevice.TYPE-- Which type of device to listen for events. + *
      • {@code UPnPDevice.TYPE}-- Which type of device to listen for events. *
      • - *
      • UPnPDevice.ID-- The ID of a specific device to listen for + *
      • {@code UPnPDevice.ID}-- The ID of a specific device to listen for * events.
      • - *
      • UPnPService.TYPE-- The type of a specific service to listen + *
      • {@code UPnPService.TYPE}-- The type of a specific service to listen * for events.
      • - *
      • UPnPService.ID-- The ID of a specific service to listen for + *
      • {@code UPnPService.ID}-- The ID of a specific service to listen for * events.
      • *
      * - * @version $Revision: 5673 $ + * @version $Id: 9b3521a5da0f062c4bcbd6ffb4039c140c093ea5 $ */ public interface UPnPEventListener { /** * Key for a service property having a value that is an object of type - * org.osgi.framework.Filter and that is used to limit received + * {@code org.osgi.framework.Filter} and that is used to limit received * events. */ static final String UPNP_FILTER = "upnp.filter"; @@ -68,15 +68,15 @@ /** * Callback method that is invoked for received events. * - * The events are collected in a Dictionary object. Each entry - * has a String key representing the event name (= state variable + * The events are collected in a {@code Dictionary} object. Each entry + * has a {@code String} key representing the event name (= state variable * name) and the new value of the state variable. The class of the value * object must match the class specified by the UPnP State Variable * associated with the event. This method must be called asynchronously * * @param deviceId ID of the device sending the events * @param serviceId ID of the service sending the events - * @param events Dictionary object containing the new values for + * @param events {@code Dictionary} object containing the new values for * the state variables that have changed. * * diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPException.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPException.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPException.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPException.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -20,7 +20,7 @@ * control point invokes actions to UPnPDevices. * * @since 1.1 - * @version $Revision: 5673 $ + * @version $Id: 04d60e47fb9f2b70e2236253bcfffb9445089953 $ */ public class UPnPException extends Exception { static final long serialVersionUID = -262013318122195146L; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPIcon.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPIcon.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPIcon.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPIcon.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -23,14 +23,14 @@ * * Each UPnP device can contain zero or more icons. * - * @version $Revision: 5673 $ + * @version $Id: c8d78fcf357a283d6d1999912ffa5f67d03b75a8 $ */ public interface UPnPIcon { /** * Returns the MIME type of the icon. * * This method returns the format in which the icon graphics, read from the - * InputStream object obtained by the getInputStream() + * {@code InputStream} object obtained by the {@code getInputStream()} * method, is encoded. *

      * The format of the returned string is in accordance to RFC2046. A list of @@ -65,8 +65,8 @@ * Returns the size of the icon in bytes. * * This method returns the number of bytes of the icon available to read - * from the InputStream object obtained by the - * getInputStream() method. If the actual size can not be + * from the {@code InputStream} object obtained by the + * {@code getInputStream()} method. If the actual size can not be * determined, -1 is returned. * * @return The icon size in bytes, or -1 if the size is unknown. @@ -82,17 +82,17 @@ int getDepth(); /** - * Returns an InputStream object for the icon data. + * Returns an {@code InputStream} object for the icon data. * - * The InputStream object provides a way for a client to read the + * The {@code InputStream} object provides a way for a client to read the * actual icon graphics data. The number of bytes available from this - * InputStream object can be determined via the - * getSize() method. The format of the data encoded can be - * determined by the MIME type availble via the getMimeType() + * {@code InputStream} object can be determined via the + * {@code getSize()} method. The format of the data encoded can be + * determined by the MIME type availble via the {@code getMimeType()} * method. * * @return An InputStream to read the icon graphics data from. - * @throws IOException If the InputStream cannot be returned. + * @throws IOException If the {@code InputStream} cannot be returned. * @see UPnPIcon#getMimeType() */ InputStream getInputStream() throws IOException; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPLocalStateVariable.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPLocalStateVariable.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPLocalStateVariable.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPLocalStateVariable.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + * 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. @@ -28,7 +28,7 @@ * * @since 1.1 * - * @version $Revision: 5673 $ + * @version $Id: 6ae0a918b04ba50b9782148ac784ea76d9379ace $ */ public interface UPnPLocalStateVariable extends UPnPStateVariable { /** @@ -36,7 +36,7 @@ * UPnPDevice whenever UPnPStateVariable's value is changed , this method * must be called. * - * @return Object current value of UPnPStateVariable. if the + * @return {@code Object} current value of UPnPStateVariable. if the * current value is initialized with the default value defined UPnP * service description. */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPService.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPService.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPService.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPService.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -21,19 +21,19 @@ * Each UPnP device contains zero or more services. The UPnP description for a * service defines actions, their arguments, and event characteristics. * - * @version $Revision: 5673 $ + * @version $Id: 3ba6780294dc8596281eea937a3e80409d2e722c $ */ public interface UPnPService { /** * Property key for the optional service type uri. * * The service type property is used when registering UPnP Device services - * and UPnP Event Listener services. The property contains a String - * array (String[]) of service types. A UPnP Device service can + * and UPnP Event Listener services. The property contains a {@code String} + * array ({@code String[]}) of service types. A UPnP Device service can * thus announce what types of services it contains. A UPnP Event Listener * service can announce for what type of UPnP services it wants * notifications. The service version is encoded in the type string as - * specified in the UPnP specification. A null value is a + * specified in the UPnP specification. A {@code null} value is a * wildcard, matching all service types. Value is * "UPnP.service.type". * @@ -45,32 +45,32 @@ * * The service id property is used when registering UPnP Device services or * UPnP Event Listener services. The value of the property contains a - * String array (String[]) of service ids. A UPnP + * {@code String} array ({@code String[]}) of service ids. A UPnP * Device service can thus announce what service ids it contains. A UPnP * Event Listener service can announce for what UPnP service ids it wants * notifications. A service id does not have to be universally - * unique. It must be unique only within a device. A null value + * unique. It must be unique only within a device. A {@code null} value * is a wildcard, matching all services. The value is * "UPnP.service.id". */ String ID = "UPnP.service.id"; /** - * Returns the serviceId field in the UPnP service description. + * Returns the {@code serviceId} field in the UPnP service description. * * *

      * For standard services defined by a UPnP Forum working committee, the * serviceId must contain the following components in the indicated order: *

        - *
      • urn:upnp-org:serviceId:
      • + *
      • {@code urn:upnp-org:serviceId:}
      • *
      • service ID suffix
      • *
      - * Example: urn:upnp-org:serviceId:serviceID. + * Example: {@code urn:upnp-org:serviceId:serviceID}. * *

      - * Note that upnp-org is used instead of - * schemas-upnp-org in this example because an XML schema is not + * Note that {@code upnp-org} is used instead of + * {@code schemas-upnp-org} in this example because an XML schema is not * defined for each serviceId. *

      * @@ -78,12 +78,12 @@ * For non-standard services specified by UPnP vendors, the serviceId must * contain the following components in the indicated order: *
        - *
      • urn:
      • + *
      • {@code urn:}
      • *
      • ICANN domain name owned by the vendor
      • - *
      • :serviceId:
      • + *
      • {@code :serviceId:}
      • *
      • service ID suffix
      • *
      - * Example: urn:domain-name:serviceId:serviceID. + * Example: {@code urn:domain-name:serviceId:serviceID}. * * @return The service ID suffix defined by a UPnP Forum working committee * or specified by a UPnP vendor. Must be <= 64 characters. @@ -92,30 +92,30 @@ String getId(); /** - * Returns the serviceType field in the UPnP service description. + * Returns the {@code serviceType} field in the UPnP service description. * *

      * For standard services defined by a UPnP Forum working committee, the * serviceType must contain the following components in the indicated order: *

        - *
      • urn:schemas-upnp-org:service:
      • + *
      • {@code urn:schemas-upnp-org:service:}
      • *
      • service type suffix:
      • *
      • integer service version
      • *
      - * Example: urn:schemas-upnp-org:service:serviceType:v. + * Example: {@code urn:schemas-upnp-org:service:serviceType:v}. * *

      * For non-standard services specified by UPnP vendors, the - * serviceType must contain the following components in the + * {@code serviceType} must contain the following components in the * indicated order: *

        - *
      • urn:
      • + *
      • {@code urn:}
      • *
      • ICANN domain name owned by the vendor
      • - *
      • :service:
      • + *
      • {@code :service:}
      • *
      • service type suffix:
      • *
      • integer service version
      • *
      - * Example: urn:domain-name:service:serviceType:v. + * Example: {@code urn:domain-name:service:serviceType:v}. * * @return The service type suffix defined by a UPnP Forum working committee * or specified by a UPnP vendor. Must be <= 64 characters, not @@ -124,7 +124,7 @@ String getType(); /** - * Returns the version suffix encoded in the serviceType field in + * Returns the version suffix encoded in the {@code serviceType} field in * the UPnP service description. * * @return The integer service version defined by a UPnP Forum working @@ -140,33 +140,33 @@ * @param name Name of action. Must not contain hyphen or hash characters. * Should be < 32 characters. * - * @return The requested action or null if no action is found. + * @return The requested action or {@code null} if no action is found. */ UPnPAction getAction(String name); /** * Lists all actions provided by this service. * - * @return Array of actions (UPnPAction[] )or null if + * @return Array of actions ({@code UPnPAction[]} )or {@code null} if * no actions are defined for this service. */ UPnPAction[] getActions(); /** - * Lists all UPnPStateVariable objects provided by this service. + * Lists all {@code UPnPStateVariable} objects provided by this service. * - * @return Array of state variables or null if none are defined + * @return Array of state variables or {@code null} if none are defined * for this service. */ UPnPStateVariable[] getStateVariables(); /** - * Gets a UPnPStateVariable objects provided by this service by + * Gets a {@code UPnPStateVariable} objects provided by this service by * name * * @param name Name of the State Variable * - * @return State variable or null if no such state variable + * @return State variable or {@code null} if no such state variable * exists for this service. */ UPnPStateVariable getStateVariable(String name); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPStateVariable.java osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPStateVariable.java --- osgi-compendium-4.2.0/src/org/osgi/service/upnp/UPnPStateVariable.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/upnp/UPnPStateVariable.java 2011-05-17 09:55:04.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -20,44 +20,44 @@ * service state table (SST). *

      * Method calls to interact with a device (e.g. - * UPnPAction.invoke(...);) use this class to encapsulate meta + * {@code UPnPAction.invoke(...);}) use this class to encapsulate meta * information about the input and output arguments. *

      * The actual values of the arguments are passed as Java objects. The mapping of * types from UPnP data types to Java data types is described with the field * definitions. * - * @version $Revision: 5673 $ + * @version $Id: 01f68f7e5d51feaaee83d39544d27d0e7a6abbcd $ */ public interface UPnPStateVariable { /** - * Unsigned 1 Byte int. + * Unsigned 1 {@code Byte} int. *

      - * Mapped to an Integer object. + * Mapped to an {@code Integer} object. */ static final String TYPE_UI1 = "ui1"; /** * Unsigned 2 Byte int. *

      - * Mapped to Integer object. + * Mapped to {@code Integer} object. */ static final String TYPE_UI2 = "ui2"; /** * Unsigned 4 Byte int. *

      - * Mapped to Long object. + * Mapped to {@code Long} object. */ static final String TYPE_UI4 = "ui4"; /** * 1 Byte int. *

      - * Mapped to Integer object. + * Mapped to {@code Integer} object. */ static final String TYPE_I1 = "i1"; /** * 2 Byte int. *

      - * Mapped to Integer object. + * Mapped to {@code Integer} object. */ static final String TYPE_I2 = "i2"; /** @@ -65,13 +65,13 @@ *

      * Must be between -2147483648 and 2147483647 *

      - * Mapped to Integer object. + * Mapped to {@code Integer} object. */ static final String TYPE_I4 = "i4"; /** * Integer number. *

      - * Mapped to Integer object. + * Mapped to {@code Integer} object. */ static final String TYPE_INT = "int"; /** @@ -79,7 +79,7 @@ *

      * Same format as float. Must be between 3.40282347E+38 to 1.17549435E-38. *

      - * Mapped to Float object. + * Mapped to {@code Float} object. */ static final String TYPE_R4 = "r4"; /** @@ -90,20 +90,20 @@ * 4.94065645841247E-324 and 1.79769313486232E308 for positive values, i.e., * IEEE 64-bit (8-Byte) double. *

      - * Mapped to Double object. + * Mapped to {@code Double} object. */ static final String TYPE_R8 = "r8"; /** * Same as r8. *

      - * Mapped to Double object. + * Mapped to {@code Double} object. */ static final String TYPE_NUMBER = "number"; /** * Same as r8 but no more than 14 digits to the left of the decimal point * and no more than 4 to the right. *

      - * Mapped to Double object. + * Mapped to {@code Double} object. */ static final String TYPE_FIXED_14_4 = "fixed.14.4"; /** @@ -116,7 +116,7 @@ * currency symbol.) (No grouping of digits in the mantissa, e.g., no * commas.) *

      - * Mapped to Float object. + * Mapped to {@code Float} object. */ static final String TYPE_FLOAT = "float"; /** @@ -124,7 +124,7 @@ *

      * One character long. *

      - * Mapped to Character object. + * Mapped to {@code Character} object. */ static final String TYPE_CHAR = "char"; /** @@ -132,7 +132,7 @@ *

      * No limit on length. *

      - * Mapped to String object. + * Mapped to {@code String} object. */ static final String TYPE_STRING = "string"; /** @@ -144,7 +144,7 @@ * href="http://www.w3.org/TR/xmlschema-2/#date">http://www.w3.org/TR/xmlschema-2/#date * . *

      - * Mapped to java.util.Date object. Always 00:00 hours. + * Mapped to {@code java.util.Date} object. Always 00:00 hours. */ static final String TYPE_DATE = "date"; /** @@ -156,7 +156,7 @@ * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime * . *

      - * Mapped to java.util.Date object using default time zone. + * Mapped to {@code java.util.Date} object using default time zone. */ static final String TYPE_DATETIME = "dateTime"; /** @@ -168,7 +168,7 @@ * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime * . *

      - * Mapped to java.util.Date object adjusted to default time zone. + * Mapped to {@code java.util.Date} object adjusted to default time zone. */ static final String TYPE_DATETIME_TZ = "dateTime.tz"; /** @@ -180,7 +180,7 @@ * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#time * . *

      - * Mapped to Long. Converted to milliseconds since midnight. + * Mapped to {@code Long}. Converted to milliseconds since midnight. */ static final String TYPE_TIME = "time"; /** @@ -192,7 +192,7 @@ * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#time * . *

      - * Mapped to Long object. Converted to milliseconds since + * Mapped to {@code Long} object. Converted to milliseconds since * midnight and adjusted to default time zone, wrapping at 0 and * 24*60*60*1000. */ @@ -200,7 +200,7 @@ /** * True or false. *

      - * Mapped to Boolean object. + * Mapped to {@code Boolean} object. */ static final String TYPE_BOOLEAN = "boolean"; /** @@ -209,7 +209,7 @@ * Takes 3 Bytes, splits them into 4 parts, and maps each 6 bit piece to an * octet. (3 octets are encoded as 4.) No limit on size. *

      - * Mapped to byte[] object. The Java byte array will hold the + * Mapped to {@code byte[]} object. The Java byte array will hold the * decoded content of the BLOB. */ static final String TYPE_BIN_BASE64 = "bin.base64"; @@ -219,14 +219,14 @@ * Treats each nibble as a hex digit and encodes as a separate Byte. (1 * octet is encoded as 2.) No limit on size. *

      - * Mapped to byte[] object. The Java byte array will hold the + * Mapped to {@code byte[]} object. The Java byte array will hold the * decoded content of the BLOB. */ static final String TYPE_BIN_HEX = "bin.hex"; /** * Universal Resource Identifier. *

      - * Mapped to String object. + * Mapped to {@code String} object. */ static final String TYPE_URI = "uri"; /** @@ -235,7 +235,7 @@ * Hexadecimal digits representing octets. Optional embedded hyphens are * ignored. *

      - * Mapped to String object. + * Mapped to {@code String} object. */ static final String TYPE_UUID = "uuid"; @@ -244,9 +244,9 @@ * *

        *
      • All standard variables defined by a UPnP Forum working committee - * must not begin with X_ nor A_.
      • + * must not begin with {@code X_} nor {@code A_}. *
      • All non-standard variables specified by a UPnP vendor and added to a - * standard service must begin with X_.
      • + * standard service must begin with {@code X_}. *
      * * @return Name of state variable. Must not contain a hyphen character nor a @@ -291,8 +291,8 @@ /** * Returns the default value, if defined. * - * @return The default value or null if not defined. The type of - * the returned object can be determined by getJavaDataType. + * @return The default value or {@code null} if not defined. The type of + * the returned object can be determined by {@code getJavaDataType}. */ Object getDefaultValue(); @@ -300,7 +300,7 @@ * Returns the allowed values, if defined. Allowed values can be defined * only for String types. * - * @return The allowed values or null if not defined. Should be + * @return The allowed values or {@code null} if not defined. Should be * less than 32 characters. */ String[] getAllowedValues(); @@ -309,7 +309,7 @@ * Returns the minimum value, if defined. Minimum values can only be defined * for numeric types. * - * @return The minimum value or null if not defined. + * @return The minimum value or {@code null} if not defined. */ Number getMinimum(); @@ -317,7 +317,7 @@ * Returns the maximum value, if defined. Maximum values can only be defined * for numeric types. * - * @return The maximum value or null if not defined. + * @return The maximum value or {@code null} if not defined. */ Number getMaximum(); @@ -335,8 +335,8 @@ * If the StateVariable is eventable, an event listener service can be * registered to be notified when changes to the variable appear. * - * @return true if the StateVariable generates events, - * false otherwise. + * @return {@code true} if the {@code StateVariable} generates events, + * {@code false} otherwise. */ boolean sendsEvents(); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/Authorization.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/Authorization.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/Authorization.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/Authorization.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2001, 2011). 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. @@ -16,37 +16,36 @@ package org.osgi.service.useradmin; /** - * The Authorization interface encapsulates an authorization context - * on which bundles can base authorization decisions, where appropriate. + * The {@code Authorization} interface encapsulates an authorization context on + * which bundles can base authorization decisions, where appropriate. *

      * Bundles associate the privilege to access restricted resources or operations * with roles. Before granting access to a restricted resource or operation, a - * bundle will check if the Authorization object passed to it possess - * the required role, by calling its hasRole method. + * bundle will check if the {@code Authorization} object passed to it possess + * the required role, by calling its {@code hasRole} method. *

      * Authorization contexts are instantiated by calling the - * {@link UserAdmin#getAuthorization} method. + * {@link UserAdmin#getAuthorization(User)} method. * *

      * Trusting Authorization objects *

      - * There are no restrictions regarding the creation of Authorization - * objects. Hence, a service must only accept Authorization objects - * from bundles that has been authorized to use the service using code based (or - * Java 2) permissions. + * There are no restrictions regarding the creation of {@code Authorization} + * objects. Hence, a service must only accept {@code Authorization} objects from + * bundles that has been authorized to use the service using code based (or Java + * 2) permissions. * *

      - * In some cases it is useful to use ServicePermission to do the code + * In some cases it is useful to use {@code ServicePermission} to do the code * based access control. A service basing user access control on - * Authorization objects passed to it, will then require that a - * calling bundle has the ServicePermission to get the service in - * question. This is the most convenient way. The OSGi environment will do the - * code based permission check when the calling bundle attempts to get the - * service from the service registry. + * {@code Authorization} objects passed to it, will then require that a calling + * bundle has the {@code ServicePermission} to get the service in question. This + * is the most convenient way. The OSGi environment will do the code based + * permission check when the calling bundle attempts to get the service from the + * service registry. *

      * Example: A servlet using a service on a user's behalf. The bundle with the - * servlet must be given the ServicePermission to get the Http - * Service. + * servlet must be given the {@code ServicePermission} to get the Http Service. *

      * However, in some cases the code based permission checks need to be more * fine-grained. A service might allow all bundles to get it, but require @@ -55,26 +54,27 @@ * Example: A servlet using a service on a user's behalf, where some service * functionality is open to anyone, and some is restricted by code based * permissions. When a restricted method is called (e.g., one handing over an - * Authorization object), the service explicitly checks that the - * calling bundle has permission to make the call. + * {@code Authorization} object), the service explicitly checks that the calling + * bundle has permission to make the call. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 726ef81945fbcda2edf402885bce634bc136b744 $ */ public interface Authorization { /** - * Gets the name of the {@link User} that this Authorization + * Gets the name of the {@link User} that this {@code Authorization} * context was created for. * * @return The name of the {@link User} object that this - * Authorization context was created for, or - * null if no user was specified when this - * Authorization context was created. + * {@code Authorization} context was created for, or + * {@code null} if no user was specified when this + * {@code Authorization} context was created. */ public String getName(); /** * Checks if the role with the specified name is implied by this - * Authorization context. + * {@code Authorization} context. *

      * * Bundles must define globally unique role names that are associated with @@ -84,18 +84,18 @@ * * @param name The name of the role to check for. * - * @return true if this Authorization context implies - * the specified role, otherwise false. + * @return {@code true} if this {@code Authorization} context implies + * the specified role, otherwise {@code false}. */ public boolean hasRole(String name); /** - * Gets the names of all roles implied by this Authorization + * Gets the names of all roles implied by this {@code Authorization} * context. * * @return The names of all roles implied by this - * Authorization context, or null if no roles - * are in the context. The predefined role user.anyone + * {@code Authorization} context, or {@code null} if no roles + * are in the context. The predefined role {@code user.anyone} * will not be included in this list. */ public String[] getRoles(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/Group.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/Group.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/Group.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/Group.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -16,30 +16,30 @@ package org.osgi.service.useradmin; /** - * A named grouping of roles (Role objects). + * A named grouping of roles ({@code Role} objects). *

      - * Whether or not a given Authorization context implies a - * Group object depends on the members of that Group + * Whether or not a given {@code Authorization} context implies a + * {@code Group} object depends on the members of that {@code Group} * object. *

      - * A Group object can have two kinds of members: basic and - * required . A Group object is implied by an - * Authorization context if all of its required members are implied + * A {@code Group} object can have two kinds of members: basic and + * required . A {@code Group} object is implied by an + * {@code Authorization} context if all of its required members are implied * and at least one of its basic members is implied. *

      - * A Group object must contain at least one basic member in order to - * be implied. In other words, a Group object without any basic - * member roles is never implied by any Authorization context. + * A {@code Group} object must contain at least one basic member in order to + * be implied. In other words, a {@code Group} object without any basic + * member roles is never implied by any {@code Authorization} context. *

      - * A User object always implies itself. + * A {@code User} object always implies itself. *

      - * No loop detection is performed when adding members to Group + * No loop detection is performed when adding members to {@code Group} * objects, which means that it is possible to create circular implications. * Loop detection is instead done when roles are checked. The semantics is that * if a role depends on itself (i.e., there is an implication loop), the role is * not implied. *

      - * The rule that a Group object must have at least one basic member + * The rule that a {@code Group} object must have at least one basic member * to be implied is motivated by the following example: * *

      @@ -55,10 +55,10 @@
        * 

      * If "alice" and "bob" ever transfer to a different department, anybody in * marketing will be able to assume the "foo" role, which certainly must be - * prevented. Requiring that "foo" (or any Group object for that + * prevented. Requiring that "foo" (or any {@code Group} object for that * matter) must have at least one basic member accomplishes that. *

      - * However, this would make it impossible for a Group object to be + * However, this would make it impossible for a {@code Group} object to be * implied by just its required members. An example where this implication might * be useful is the following declaration: "Any citizen who is an adult is * allowed to vote." An intuitive configuration of "voter" would be: @@ -85,73 +85,74 @@ * *

      * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: b9b52c17de69d7b8a908a7cca84d02eec3c9e609 $ */ public interface Group extends User { /** - * Adds the specified Role object as a basic member to this - * Group object. + * Adds the specified {@code Role} object as a basic member to this + * {@code Group} object. * * @param role The role to add as a basic member. * - * @return true if the given role could be added as a basic - * member, and false if this Group object - * already contains a Role object whose name matches that + * @return {@code true} if the given role could be added as a basic + * member, and {@code false} if this {@code Group} object + * already contains a {@code Role} object whose name matches that * of the specified role. * * @throws SecurityException If a security manager exists and the caller - * does not have the UserAdminPermission with name - * admin. + * does not have the {@code UserAdminPermission} with name + * {@code admin}. */ public boolean addMember(Role role); /** - * Adds the specified Role object as a required member to this - * Group object. + * Adds the specified {@code Role} object as a required member to this + * {@code Group} object. * - * @param role The Role object to add as a required member. + * @param role The {@code Role} object to add as a required member. * - * @return true if the given Role object could be - * added as a required member, and false if this - * Group object already contains a Role object + * @return {@code true} if the given {@code Role} object could be + * added as a required member, and {@code false} if this + * {@code Group} object already contains a {@code Role} object * whose name matches that of the specified role. * * @throws SecurityException If a security manager exists and the caller - * does not have the UserAdminPermission with name - * admin. + * does not have the {@code UserAdminPermission} with name + * {@code admin}. */ public boolean addRequiredMember(Role role); /** - * Removes the specified Role object from this Group + * Removes the specified {@code Role} object from this {@code Group} * object. * - * @param role The Role object to remove from this Group + * @param role The {@code Role} object to remove from this {@code Group} * object. * - * @return true if the Role object could be removed, - * otherwise false. + * @return {@code true} if the {@code Role} object could be removed, + * otherwise {@code false}. * * @throws SecurityException If a security manager exists and the caller - * does not have the UserAdminPermission with name - * admin. + * does not have the {@code UserAdminPermission} with name + * {@code admin}. */ public boolean removeMember(Role role); /** - * Gets the basic members of this Group object. + * Gets the basic members of this {@code Group} object. * - * @return The basic members of this Group object, or - * null if this Group object does not contain + * @return The basic members of this {@code Group} object, or + * {@code null} if this {@code Group} object does not contain * any basic members. */ public Role[] getMembers(); /** - * Gets the required members of this Group object. + * Gets the required members of this {@code Group} object. * - * @return The required members of this Group object, or - * null if this Group object does not contain + * @return The required members of this {@code Group} object, or + * {@code null} if this {@code Group} object does not contain * any required members. */ public Role[] getRequiredMembers(); diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/package.html osgi-compendium-4.3.0/src/org/osgi/service/useradmin/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

      User 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. -For example: -

      -Import-Package: org.osgi.service.useradmin; version="[1.1,2.0)"
      -
      - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * User 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. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

      + * Example import for consumers using the API in this package: + *

      + * {@code Import-Package: org.osgi.service.useradmin; version="[1.1,2.0)"} + *

      + * Example import for providers implementing the API in this package: + *

      + * {@code Import-Package: org.osgi.service.useradmin; version="[1.1,1.2)"} + * + * @version $Id: 0a74b78291403f3c7cfa647c77bba084f3015196 $ + */ + +package org.osgi.service.useradmin; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/Role.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/Role.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/Role.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/Role.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -18,34 +18,35 @@ import java.util.Dictionary; /** - * The base interface for Role objects managed by the User Admin + * The base interface for {@code Role} objects managed by the User Admin * service. * *

      - * This interface exposes the characteristics shared by all Role + * This interface exposes the characteristics shared by all {@code Role} * classes: a name, a type, and a set of properties. *

      - * Properties represent public information about the Role object that + * Properties represent public information about the {@code Role} object that * can be read by anyone. Specific {@link UserAdminPermission} objects are - * required to change a Role object's properties. + * required to change a {@code Role} object's properties. *

      - * Role object properties are Dictionary objects. Changes + * {@code Role} object properties are {@code Dictionary} objects. Changes * to these objects are propagated to the User Admin service and made * persistent. *

      - * Every User Admin service contains a set of predefined Role objects - * that are always present and cannot be removed. All predefined Role - * objects are of type ROLE. This version of the - * org.osgi.service.useradmin package defines a single predefined + * Every User Admin service contains a set of predefined {@code Role} objects + * that are always present and cannot be removed. All predefined {@code Role} + * objects are of type {@code ROLE}. This version of the + * {@code org.osgi.service.useradmin} package defines a single predefined * role named "user.anyone", which is inherited by any other role. * Other predefined roles may be added in the future. Since - * "user.anyone" is a Role object that has properties + * "user.anyone" is a {@code Role} object that has properties * associated with it that can be read and modified. Access to these properties * and their use is application specific and is controlled using - * UserAdminPermission in the same way that properties for other - * Role objects are. + * {@code UserAdminPermission} in the same way that properties for other + * {@code Role} objects are. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 880594a6887dda5a3e089a8b8ce7546976367a92 $ */ public interface Role { /** @@ -58,21 +59,21 @@ * The type of a predefined role. * *

      - * The value of ROLE is 0. + * The value of {@code ROLE} is 0. */ public static final int ROLE = 0; /** * The type of a {@link User} role. * *

      - * The value of USER is 1. + * The value of {@code USER} is 1. */ public static final int USER = 1; /** * The type of a {@link Group} role. * *

      - * The value of GROUP is 2. + * The value of {@code GROUP} is 2. */ public static final int GROUP = 2; @@ -91,27 +92,27 @@ public int getType(); /** - * Returns a Dictionary of the (public) properties of this - * Role object. Any changes to the returned Dictionary - * will change the properties of this Role object. This will - * cause a UserAdminEvent object of type + * Returns a {@code Dictionary} of the (public) properties of this + * {@code Role} object. Any changes to the returned {@code Dictionary} + * will change the properties of this {@code Role} object. This will + * cause a {@code UserAdminEvent} object of type * {@link UserAdminEvent#ROLE_CHANGED} to be broadcast to any - * UserAdminListener objects. + * {@code UserAdminListener} objects. * *

      - * Only objects of type String may be used as property keys, and - * only objects of type String or byte[] may be used + * Only objects of type {@code String} may be used as property keys, and + * only objects of type {@code String} or {@code byte[]} may be used * as property values. Any other types will cause an exception of type - * IllegalArgumentException to be raised. + * {@code IllegalArgumentException} to be raised. * *

      * In order to add, change, or remove a property in the returned - * Dictionary, a {@link UserAdminPermission} named after the - * property name (or a prefix of it) with action changeProperty + * {@code Dictionary}, a {@link UserAdminPermission} named after the + * property name (or a prefix of it) with action {@code changeProperty} * is required. * - * @return Dictionary containing the properties of this - * Role object. + * @return {@code Dictionary} containing the properties of this + * {@code Role} object. */ public Dictionary getProperties(); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdminEvent.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdminEvent.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdminEvent.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdminEvent.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -18,11 +18,11 @@ import org.osgi.framework.ServiceReference; /** - * Role change event. + * {@code Role} change event. *

      - * UserAdminEvent objects are delivered asynchronously to any - * UserAdminListener objects when a change occurs in any of the - * Role objects managed by a User Admin service. + * {@code UserAdminEvent} objects are delivered asynchronously to any + * {@code UserAdminListener} objects when a change occurs in any of the + * {@code Role} objects managed by a User Admin service. * *

      * A type code is used to identify the event. The following event types are @@ -33,43 +33,43 @@ * @see UserAdmin * @see UserAdminListener * - * @version $Revision: 5673 $ + * @version $Id: f4a18b25cc305bcdd8308c742129e893d72d2ae4 $ */ public class UserAdminEvent { private ServiceReference ref; private int type; private Role role; /** - * A Role object has been created. + * A {@code Role} object has been created. * *

      - * The value of ROLE_CREATED is 0x00000001. + * The value of {@code ROLE_CREATED} is 0x00000001. */ public static final int ROLE_CREATED = 0x00000001; /** - * A Role object has been modified. + * A {@code Role} object has been modified. * *

      - * The value of ROLE_CHANGED is 0x00000002. + * The value of {@code ROLE_CHANGED} is 0x00000002. */ public static final int ROLE_CHANGED = 0x00000002; /** - * A Role object has been removed. + * A {@code Role} object has been removed. * *

      - * The value of ROLE_REMOVED is 0x00000004. + * The value of {@code ROLE_REMOVED} is 0x00000004. */ public static final int ROLE_REMOVED = 0x00000004; /** - * Constructs a UserAdminEvent object from the given - * ServiceReference object, event type, and Role + * Constructs a {@code UserAdminEvent} object from the given + * {@code ServiceReference} object, event type, and {@code Role} * object. * - * @param ref The ServiceReference object of the User Admin + * @param ref The {@code ServiceReference} object of the User Admin * service that generated this event. * @param type The event type. - * @param role The Role object on which this event occurred. + * @param role The {@code Role} object on which this event occurred. */ public UserAdminEvent(ServiceReference ref, int type, Role role) { this.ref = ref; @@ -78,10 +78,10 @@ } /** - * Gets the ServiceReference object of the User Admin service + * Gets the {@code ServiceReference} object of the User Admin service * that generated this event. * - * @return The User Admin service's ServiceReference object. + * @return The User Admin service's {@code ServiceReference} object. */ public ServiceReference getServiceReference() { return ref; @@ -101,9 +101,9 @@ } /** - * Gets the Role object this event was generated for. + * Gets the {@code Role} object this event was generated for. * - * @return The Role object this event was generated for. + * @return The {@code Role} object this event was generated for. */ public Role getRole() { return role; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdmin.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdmin.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdmin.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdmin.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -18,13 +18,13 @@ import org.osgi.framework.InvalidSyntaxException; /** - * This interface is used to manage a database of named Role objects, + * This interface is used to manage a database of named {@code Role} objects, * which can be used for authentication and authorization purposes. * *

      - * This version of the User Admin service defines two types of Role + * This version of the User Admin service defines two types of {@code Role} * objects: "User" and "Group". Each type of role is represented by an - * int constant and an interface. The range of positive integers is + * {@code int} constant and an interface. The range of positive integers is * reserved for new types of roles that may be added in the future. When * defining proprietary role types, negative constant values must be used. * @@ -36,96 +36,97 @@ * and properties (e.g., a street address, phone number, etc.). *

      * A {@link Group} object represents an aggregation of {@link User} and - * {@link Group} objects. In other words, the members of a Group + * {@link Group} objects. In other words, the members of a {@code Group} * object are roles themselves. *

      * Every User Admin service manages and maintains its own namespace of - * Role objects, in which each Role object has a unique + * {@code Role} objects, in which each {@code Role} object has a unique * name. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 66973d897c8f3fc69fadd42836441f4ad726069a $ */ public interface UserAdmin { /** - * Creates a Role object with the given name and of the given + * Creates a {@code Role} object with the given name and of the given * type. * *

      - * If a Role object was created, a UserAdminEvent + * If a {@code Role} object was created, a {@code UserAdminEvent} * object of type {@link UserAdminEvent#ROLE_CREATED} is broadcast to any - * UserAdminListener object. + * {@code UserAdminListener} object. * - * @param name The name of the Role object to create. - * @param type The type of the Role object to create. Must be + * @param name The {@code name} of the {@code Role} object to create. + * @param type The type of the {@code Role} object to create. Must be * either a {@link Role#USER} type or {@link Role#GROUP} type. * - * @return The newly created Role object, or null if a + * @return The newly created {@code Role} object, or {@code null} if a * role with the given name already exists. * - * @throws IllegalArgumentException if type is invalid. + * @throws IllegalArgumentException if {@code type} is invalid. * * @throws SecurityException If a security manager exists and the caller - * does not have the UserAdminPermission with name - * admin. + * does not have the {@code UserAdminPermission} with name + * {@code admin}. */ public Role createRole(String name, int type); /** - * Removes the Role object with the given name from this User + * Removes the {@code Role} object with the given name from this User * Admin service and all groups it is a member of. * *

      - * If the Role object was removed, a UserAdminEvent + * If the {@code Role} object was removed, a {@code UserAdminEvent} * object of type {@link UserAdminEvent#ROLE_REMOVED} is broadcast to any - * UserAdminListener object. + * {@code UserAdminListener} object. * - * @param name The name of the Role object to remove. + * @param name The name of the {@code Role} object to remove. * - * @return true If a Role object with the given name + * @return {@code true} If a {@code Role} object with the given name * is present in this User Admin service and could be removed, - * otherwise false. + * otherwise {@code false}. * * @throws SecurityException If a security manager exists and the caller - * does not have the UserAdminPermission with name - * admin. + * does not have the {@code UserAdminPermission} with name + * {@code admin}. */ public boolean removeRole(String name); /** - * Gets the Role object with the given name from this + * Gets the {@code Role} object with the given {@code name} from this * User Admin service. * - * @param name The name of the Role object to get. + * @param name The name of the {@code Role} object to get. * - * @return The requested Role object, or null if this - * User Admin service does not have a Role object with - * the given name. + * @return The requested {@code Role} object, or {@code null} if this + * User Admin service does not have a {@code Role} object with + * the given {@code name}. */ public Role getRole(String name); /** - * Gets the Role objects managed by this User Admin service that + * Gets the {@code Role} objects managed by this User Admin service that * have properties matching the specified LDAP filter criteria. See - * org.osgi.framework.Filter for a description of the filter - * syntax. If a null filter is specified, all Role objects + * {@code org.osgi.framework.Filter} for a description of the filter + * syntax. If a {@code null} filter is specified, all Role objects * managed by this User Admin service are returned. * * @param filter The filter criteria to match. * - * @return The Role objects managed by this User Admin service + * @return The {@code Role} objects managed by this User Admin service * whose properties match the specified filter criteria, or all - * Role objects if a null filter is specified. - * If no roles match the filter, null will be returned. + * {@code Role} objects if a {@code null} filter is specified. + * If no roles match the filter, {@code null} will be returned. * @throws InvalidSyntaxException If the filter is not well formed. * */ public Role[] getRoles(String filter) throws InvalidSyntaxException; /** - * Gets the user with the given property key-value + * Gets the user with the given property {@code key}-{@code value} * pair from the User Admin service database. This is a convenience method - * for retrieving a User object based on a property for which - * every User object is supposed to have a unique value (within + * for retrieving a {@code User} object based on a property for which + * every {@code User} object is supposed to have a unique value (within * the scope of this User Admin service), such as for example a X.500 * distinguished name. * @@ -133,25 +134,25 @@ * @param value The property value to compare with. * * @return A matching user, if exactly one is found. If zero or - * more than one matching users are found, null is + * more than one matching users are found, {@code null} is * returned. */ public User getUser(String key, String value); /** - * Creates an Authorization object that encapsulates the - * specified User object and the Role objects it - * possesses. The null user is interpreted as the anonymous user. + * Creates an {@code Authorization} object that encapsulates the + * specified {@code User} object and the {@code Role} objects it + * possesses. The {@code null} user is interpreted as the anonymous user. * The anonymous user represents a user that has not been authenticated. An - * Authorization object for an anonymous user will be unnamed, + * {@code Authorization} object for an anonymous user will be unnamed, * and will only imply groups that user.anyone implies. * - * @param user The User object to create an - * Authorization object for, or null for the + * @param user The {@code User} object to create an + * {@code Authorization} object for, or {@code null} for the * anonymous user. * - * @return the Authorization object for the specified - * User object. + * @return the {@code Authorization} object for the specified + * {@code User} object. */ public Authorization getAuthorization(User user); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdminListener.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdminListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdminListener.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdminListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -19,25 +19,25 @@ * Listener for UserAdminEvents. * *

      - * UserAdminListener objects are registered with the Framework - * service registry and notified with a UserAdminEvent object when a - * Role object has been created, removed, or modified. + * {@code UserAdminListener} objects are registered with the Framework + * service registry and notified with a {@code UserAdminEvent} object when a + * {@code Role} object has been created, removed, or modified. *

      - * UserAdminListener objects can further inspect the received - * UserAdminEvent object to determine its type, the Role + * {@code UserAdminListener} objects can further inspect the received + * {@code UserAdminEvent} object to determine its type, the {@code Role} * object it occurred on, and the User Admin service that generated it. * * @see UserAdmin * @see UserAdminEvent * - * @version $Revision: 5673 $ + * @version $Id: f9a8c4675bd9486ef22c99250f8ee24f412967e4 $ */ public interface UserAdminListener { /** - * Receives notification that a Role object has been created, + * Receives notification that a {@code Role} object has been created, * removed, or modified. * - * @param event The UserAdminEvent object. + * @param event The {@code UserAdminEvent} object. */ public void roleChanged(UserAdminEvent event); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdminPermission.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdminPermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/UserAdminPermission.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/UserAdminPermission.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2009). All Rights Reserved. + * 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. @@ -27,7 +27,7 @@ * Admin service. * *

      - * This class represents access to the Role objects managed by a + * This class represents access to the {@code Role} objects managed by a * User Admin service and their properties and credentials (in the case of * {@link User} objects). *

      @@ -39,18 +39,18 @@ * "*protocol" or "a*b" are not valid. * *

      - * The UserAdminPermission with the reserved name "admin" + * The {@code UserAdminPermission} with the reserved name "admin" * represents the permission required for creating and removing - * Role objects in the User Admin service, as well as adding and - * removing members in a Group object. This - * UserAdminPermission does not have any actions associated with + * {@code Role} objects in the User Admin service, as well as adding and + * removing members in a {@code Group} object. This + * {@code UserAdminPermission} does not have any actions associated with * it. * *

      * The actions to be granted are passed to the constructor in a string * containing a list of one or more comma-separated keywords. The possible - * keywords are: changeProperty,changeCredential, and - * getCredential. Their meaning is defined as follows: + * keywords are: {@code changeProperty},{@code changeCredential}, and + * {@code getCredential}. Their meaning is defined as follows: * *

        * 
      @@ -72,7 +72,7 @@
        * 
        * 

      * Following is a PermissionInfo style policy entry which grants a user - * administration bundle a number of UserAdminPermission object: + * administration bundle a number of {@code UserAdminPermission} object: * *

        * 
      @@ -84,16 +84,16 @@
        * 
        * The first permission statement grants the bundle the permission to perform
        * any User Admin service operations of type "admin", that is, create and remove
      - * roles and configure Group objects.
      + * roles and configure {@code Group} objects.
        * 
        * 

      * The second permission statement grants the bundle the permission to change * any properties as well as get and change any credentials whose names start - * with com.foo.. + * with {@code com.foo.}. * *

      * The third permission statement grants the bundle the permission to change any - * properties and credentials whose names start with user.. This + * properties and credentials whose names start with {@code user.}. This * means that the bundle is allowed to change, but not retrieve any credentials * with the given prefix. * @@ -116,7 +116,7 @@ * bundle is not allowed to change any properties or credentials. * * @ThreadSafe - * @version $Revision: 6381 $ + * @version $Id: ee66dbf80d6e146ef7fe9f95088bdd06c640e3c6 $ */ public final class UserAdminPermission extends BasicPermission { static final long serialVersionUID = -1179971692401603789L; @@ -161,19 +161,19 @@ private transient int action_mask; /** - * Creates a new UserAdminPermission with the specified name - * and actions. name is either the reserved string + * Creates a new {@code UserAdminPermission} with the specified name + * and actions. {@code name} is either the reserved string * "admin" or the name of a credential or property, and - * actions contains a comma-separated list of the actions + * {@code actions} contains a comma-separated list of the actions * granted on the specified name. Valid actions are - * changeProperty,changeCredential, and + * {@code changeProperty},{@code changeCredential}, and * getCredential. * - * @param name the name of this UserAdminPermission + * @param name the name of this {@code UserAdminPermission} * @param actions the action string. * - * @throws IllegalArgumentException If name equals - * "admin" and actions are specified. + * @throws IllegalArgumentException If {@code name} equals + * "admin" and {@code actions} are specified. */ public UserAdminPermission(String name, String actions) { this(name, parseActions(actions)); @@ -181,7 +181,7 @@ /** * Package private constructor used by - * UserAdminPermissionCollection. + * {@code UserAdminPermissionCollection}. * * @param name class name * @param mask action mask @@ -332,13 +332,13 @@ } /** - * Checks if this UserAdminPermission object + * Checks if this {@code UserAdminPermission} object * "implies" the specified permission. *

      - * More specifically, this method returns true if: + * More specifically, this method returns {@code true} if: *

      *

        - *
      • p is an instanceof UserAdminPermission, + *
      • p is an instanceof {@code UserAdminPermission}, *
      • p 's actions are a proper subset of this object's actions, and *
      • p 's name is implied by this object's name. For example, * "java.*" implies "java.home". @@ -346,8 +346,8 @@ * * @param p the permission to check against. * - * @return true if the specified permission is implied by this - * object; false otherwise. + * @return {@code true} if the specified permission is implied by this + * object; {@code false} otherwise. */ public boolean implies(Permission p) { if (p instanceof UserAdminPermission) { @@ -398,26 +398,26 @@ } /** - * Returns a new PermissionCollection object for storing - * UserAdminPermission objects. + * Returns a new {@code PermissionCollection} object for storing + * {@code UserAdminPermission} objects. * - * @return a new PermissionCollection object suitable for - * storing UserAdminPermission objects. + * @return a new {@code PermissionCollection} object suitable for + * storing {@code UserAdminPermission} objects. */ public PermissionCollection newPermissionCollection() { return new UserAdminPermissionCollection(); } /** - * Checks two UserAdminPermission objects for equality. Checks - * that obj is a UserAdminPermission, and has the + * Checks two {@code UserAdminPermission} objects for equality. Checks + * that {@code obj} is a {@code UserAdminPermission}, and has the * same name and actions as this object. * * @param obj the object to be compared for equality with this object. * - * @return true if obj is a - * UserAdminPermission object, and has the same name - * and actions as this UserAdminPermission object. + * @return {@code true} if {@code obj} is a + * {@code UserAdminPermission} object, and has the same name + * and actions as this {@code UserAdminPermission} object. */ public boolean equals(Object obj) { if (obj == this) { @@ -468,12 +468,12 @@ } /** - * Returns a string describing this UserAdminPermission object. - * This string must be in PermissionInfo encoded format. + * Returns a string describing this {@code UserAdminPermission} object. + * This string must be in {@code PermissionInfo} encoded format. * - * @return The PermissionInfo encoded string for this - * UserAdminPermission object. - * @see "org.osgi.service.permissionadmin.PermissionInfo.getEncoded" + * @return The {@code PermissionInfo} encoded string for this + * {@code UserAdminPermission} object. + * @see "{@code org.osgi.service.permissionadmin.PermissionInfo.getEncoded}" */ public String toString() { StringBuffer sb = new StringBuffer(); @@ -492,8 +492,8 @@ } /** - * A UserAdminPermissionCollection stores a set of - * UserAdminPermission permissions. + * A {@code UserAdminPermissionCollection} stores a set of + * {@code UserAdminPermission} permissions. */ final class UserAdminPermissionCollection extends PermissionCollection { @@ -514,7 +514,7 @@ private boolean all_allowed; /** - * Creates an empty UserAdminPermissionCollection object. + * Creates an empty {@code UserAdminPermissionCollection} object. */ public UserAdminPermissionCollection() { permissions = new Hashtable(); @@ -523,15 +523,15 @@ /** * Adds the given permission to this - * UserAdminPermissionCollection. The key for the hash is the + * {@code UserAdminPermissionCollection}. The key for the hash is the * name. * - * @param permission the Permission object to add. + * @param permission the {@code Permission} object to add. * * @throws IllegalArgumentException If the given permission is not a - * UserAdminPermission + * {@code UserAdminPermission} * @throws SecurityException If this - * UserAdminPermissionCollection object has been marked + * {@code UserAdminPermissionCollection} object has been marked * readonly */ public void add(Permission permission) { @@ -567,13 +567,13 @@ } /** - * Checks to see if this PermissionCollection implies the given + * Checks to see if this {@code PermissionCollection} implies the given * permission. * - * @param permission the Permission object to check against + * @param permission the {@code Permission} object to check against * * @return true if the given permission is implied by this - * PermissionCollection, false otherwise. + * {@code PermissionCollection}, false otherwise. */ public boolean implies(Permission permission) { if (!(permission instanceof UserAdminPermission)) { @@ -631,10 +631,10 @@ } /** - * Returns an enumeration of all the UserAdminPermission + * Returns an enumeration of all the {@code UserAdminPermission} * objects in the container. * - * @return an enumeration of all the UserAdminPermission + * @return an enumeration of all the {@code UserAdminPermission} * objects. */ public Enumeration elements() { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/useradmin/User.java osgi-compendium-4.3.0/src/org/osgi/service/useradmin/User.java --- osgi-compendium-4.2.0/src/org/osgi/service/useradmin/User.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/useradmin/User.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. + * 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. @@ -18,77 +18,78 @@ import java.util.Dictionary; /** - * A User role managed by a User Admin service. + * A {@code User} role managed by a User Admin service. * *

        * In this context, the term "user" is not limited to just human * beings. Instead, it refers to any entity that may have any number of * credentials associated with it that it may use to authenticate itself. *

        - * In general, User objects are associated with a specific User Admin + * In general, {@code User} objects are associated with a specific User Admin * service (namely the one that created them), and cannot be used with other * User Admin services. *

        - * A User object may have credentials (and properties, inherited from + * A {@code User} object may have credentials (and properties, inherited from * the {@link Role} class) associated with it. Specific * {@link UserAdminPermission} objects are required to read or change a - * User object's credentials. + * {@code User} object's credentials. *

        - * Credentials are Dictionary objects and have semantics that are - * similar to the properties in the Role class. + * Credentials are {@code Dictionary} objects and have semantics that are + * similar to the properties in the {@code Role} class. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 1db8d1efd3c0875d94b90b413552c5263019130a $ */ public interface User extends Role { /** - * Returns a Dictionary of the credentials of this User - * object. Any changes to the returned Dictionary object will - * change the credentials of this User object. This will cause a - * UserAdminEvent object of type + * Returns a {@code Dictionary} of the credentials of this {@code User} + * object. Any changes to the returned {@code Dictionary} object will + * change the credentials of this {@code User} object. This will cause a + * {@code UserAdminEvent} object of type * {@link UserAdminEvent#ROLE_CHANGED} to be broadcast to any - * UserAdminListeners objects. + * {@code UserAdminListeners} objects. * *

        - * Only objects of type String may be used as credential keys, - * and only objects of type String or of type byte[] + * Only objects of type {@code String} may be used as credential keys, + * and only objects of type {@code String} or of type {@code byte[]} * may be used as credential values. Any other types will cause an exception - * of type IllegalArgumentException to be raised. + * of type {@code IllegalArgumentException} to be raised. * *

        - * In order to retrieve a credential from the returned Dictionary + * In order to retrieve a credential from the returned {@code Dictionary} * object, a {@link UserAdminPermission} named after the credential name (or - * a prefix of it) with action getCredential is required. + * a prefix of it) with action {@code getCredential} is required. *

        * In order to add or remove a credential from the returned - * Dictionary object, a {@link UserAdminPermission} named after + * {@code Dictionary} object, a {@link UserAdminPermission} named after * the credential name (or a prefix of it) with action - * changeCredential is required. + * {@code changeCredential} is required. * - * @return Dictionary object containing the credentials of this - * User object. + * @return {@code Dictionary} object containing the credentials of this + * {@code User} object. */ public Dictionary getCredentials(); /** - * Checks to see if this User object has a credential with the - * specified key set to the specified value. + * Checks to see if this {@code User} object has a credential with the + * specified {@code key} set to the specified {@code value}. * *

        - * If the specified credential value is not of type - * String or byte[], it is ignored, that is, - * false is returned (as opposed to an - * IllegalArgumentException being raised). + * If the specified credential {@code value} is not of type + * {@code String} or {@code byte[]}, it is ignored, that is, + * {@code false} is returned (as opposed to an + * {@code IllegalArgumentException} being raised). * - * @param key The credential key. - * @param value The credential value. + * @param key The credential {@code key}. + * @param value The credential {@code value}. * - * @return true if this user has the specified credential; - * false otherwise. + * @return {@code true} if this user has the specified credential; + * {@code false} otherwise. * * @throws SecurityException If a security manager exists and the caller - * does not have the UserAdminPermission named after the + * does not have the {@code UserAdminPermission} named after the * credential key (or a prefix of it) with action - * getCredential. + * {@code getCredential}. */ public boolean hasCredential(String key, Object value); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/BasicEnvelope.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/BasicEnvelope.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/BasicEnvelope.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/BasicEnvelope.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -16,23 +16,23 @@ package org.osgi.service.wireadmin; /** - * BasicEnvelope is an implementation of the {@link Envelope} - * interface + * {@code BasicEnvelope} is an implementation of the {@link Envelope} interface * - * @version $Revision: 5673 $ + * @Immutable + * @version $Id: 634c9f701f7d4ad7257d55e876a65fdc68be6c48 $ */ public class BasicEnvelope implements Envelope { - Object value; - Object identification; - String scope; + private final Object value; + private final Object identification; + private final String scope; /** * Constructor. * - * @param value Content of this envelope, may be null. - * @param identification Identifying object for this Envelope - * object, must not be null - * @param scope Scope name for this object, must not be null + * @param value Content of this envelope, may be {@code null}. + * @param identification Identifying object for this {@code Envelope} + * object, must not be {@code null} + * @param scope Scope name for this object, must not be {@code null} * @see Envelope */ public BasicEnvelope(Object value, Object identification, String scope) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Consumer.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Consumer.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Consumer.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Consumer.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -20,70 +20,70 @@ * {@link Producer} services. * *

        - * Service objects registered under the Consumer interface are - * expected to consume values from a Producer service via a Wire - * object. A Consumer service may poll the Producer service by calling the - * {@link Wire#poll} method. The Consumer service will also receive an updated - * value when called at it's {@link #updated} method. The Producer service - * should have coerced the value to be an instance of one of the types specified - * by the {@link Wire#getFlavors} method, or one of their subclasses. + * Service objects registered under the {@code Consumer} interface are expected + * to consume values from a Producer service via a {@code Wire} object. A + * Consumer service may poll the Producer service by calling the + * {@link Wire#poll()} method. The Consumer service will also receive an updated + * value when called at it's {@link #updated(Wire, Object)} method. The Producer + * service should have coerced the value to be an instance of one of the types + * specified by the {@link Wire#getFlavors()} method, or one of their + * subclasses. * *

        - * Consumer service objects must register with a service.pid and a + * Consumer service objects must register with a {@code service.pid} and a * {@link WireConstants#WIREADMIN_CONSUMER_FLAVORS} property. It is recommended * that Consumer service objects also register with a - * service.description property. + * {@code service.description} property. * *

        - * If an Exception is thrown by any of the Consumer - * methods, a WireAdminEvent of type - * {@link WireAdminEvent#CONSUMER_EXCEPTION} is broadcast by the Wire Admin - * service. + * If an {@code Exception} is thrown by any of the {@code Consumer} methods, a + * {@code WireAdminEvent} of type {@link WireAdminEvent#CONSUMER_EXCEPTION} is + * broadcast by the Wire Admin service. * *

        * Security Considerations - Data consuming bundles will require - * ServicePermission[Consumer,REGISTER]. In general, only the Wire - * Admin service bundle should have this permission. Thus only the Wire Admin - * service may directly call a Consumer service. Care must be taken in the - * sharing of Wire objects with other bundles. + * {@code ServicePermission[Consumer,REGISTER]}. In general, only the Wire Admin + * service bundle should have this permission. Thus only the Wire Admin service + * may directly call a Consumer service. Care must be taken in the sharing of + * {@code Wire} objects with other bundles. *

        * Consumer services must be registered with their scope when they can receive * different types of objects from the Producer service. The Consumer service - * should have WirePermission for each of these scope names. + * should have {@code WirePermission} for each of these scope names. * - * @version $Revision: 5673 $ + * @version $Id: c7920390d21e6ecf3c6569a3d7ec2aa62d8c1adb $ */ public interface Consumer { /** - * Update the value. This Consumer service is called by the Wire + * Update the value. This Consumer service is called by the {@code Wire} * object with an updated value from the Producer service. * *

        - * Note: This method may be called by a Wire object prior to this - * object being notified that it is connected to that Wire object - * (via the {@link #producersConnected} method). + * Note: This method may be called by a {@code Wire} object prior to this + * object being notified that it is connected to that {@code Wire} object + * (via the {@link #producersConnected(Wire[])} method). *

        - * When the Consumer service can receive Envelope objects, it - * must have registered all scope names together with the service object, - * and each of those names must be permitted by the bundle's - * WirePermission. If an Envelope object is delivered - * with the updated method, then the Consumer service should - * assume that the security check has been performed. + * When the Consumer service can receive {@code Envelope} objects, it must + * have registered all scope names together with the service object, and + * each of those names must be permitted by the bundle's + * {@code WirePermission}. If an {@code Envelope} object is delivered with + * the {@code updated} method, then the Consumer service should assume that + * the security check has been performed. * - * @param wire The Wire object which is delivering the updated + * @param wire The {@code Wire} object which is delivering the updated * value. * @param value The updated value. The value should be an instance of one of - * the types specified by the {@link Wire#getFlavors} method. + * the types specified by the {@link Wire#getFlavors()} method. */ public void updated(Wire wire, Object value); /** - * Update the list of Wire objects to which this Consumer service + * Update the list of {@code Wire} objects to which this Consumer service * is connected. * *

        * This method is called when the Consumer service is first registered and - * subsequently whenever a Wire associated with this Consumer + * subsequently whenever a {@code Wire} associated with this Consumer * service becomes connected, is modified or becomes disconnected. * *

        @@ -92,10 +92,10 @@ * take place during registration when they execute the registration in a * synchronized method. * - * @param wires An array of the current and complete list of Wire + * @param wires An array of the current and complete list of {@code Wire} * objects to which this Consumer service is connected. May be - * null if the Consumer service is not currently connected - * to any Wire objects. + * {@code null} if the Consumer service is not currently connected + * to any {@code Wire} objects. */ public void producersConnected(Wire[] wires); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Envelope.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Envelope.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Envelope.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Envelope.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -18,44 +18,44 @@ /** * Identifies a contained value. * - * An Envelope object combines a status value, an identification - * object and a scope name. The Envelope object allows the use of + * An {@code Envelope} object combines a status value, an identification + * object and a scope name. The {@code Envelope} object allows the use of * standard Java types when a Producer service can produce more than one kind of - * object. The Envelope object allows the Consumer service to + * object. The {@code Envelope} object allows the Consumer service to * recognize the kind of object that is received. For example, a door lock could - * be represented by a Boolean object. If the Producer - * service would send such a Boolean object, then the Consumer - * service would not know what door the Boolean object represented. - * The Envelope object contains an identification object so the + * be represented by a {@code Boolean} object. If the {@code Producer} + * service would send such a {@code Boolean} object, then the Consumer + * service would not know what door the {@code Boolean} object represented. + * The {@code Envelope} object contains an identification object so the * Consumer service can discriminate between different kinds of values. The - * identification object may be a simple String object, but it can + * identification object may be a simple {@code String} object, but it can * also be a domain specific object that is mutually agreed by the Producer and * the Consumer service. This object can then contain relevant information that * makes the identification easier. *

        * The scope name of the envelope is used for security. The Wire object must - * verify that any Envelope object send through the update - * method or coming from the poll method has a scope name that + * verify that any {@code Envelope} object send through the {@code update} + * method or coming from the {@code poll} method has a scope name that * matches the permissions of both the Producer service and the Consumer service - * involved. The wireadmin package also contains a class BasicEnvelope + * involved. The wireadmin package also contains a class {@code BasicEnvelope} * that implements the methods of this interface. * * @see WirePermission * @see BasicEnvelope * - * @version $Revision: 5673 $ + * @version $Id: 1b320a1161ba45d1fd6c203663210a47e3588ad2 $ */ public interface Envelope { /** - * Return the value associated with this Envelope object. + * Return the value associated with this {@code Envelope} object. * - * @return the value of the status item, or null when no item is + * @return the value of the status item, or {@code null} when no item is * associated with this object. */ public Object getValue(); /** - * Return the identification of this Envelope object. + * Return the identification of this {@code Envelope} object. * * An identification may be of any Java type. The type must be mutually * agreed between the Consumer and Producer services. @@ -66,12 +66,12 @@ public Object getIdentification(); /** - * Return the scope name of this Envelope object. + * Return the scope name of this {@code Envelope} object. * * Scope names are used to restrict the communication between the Producer - * and Consumer services. Only Envelopes objects with a scope + * and Consumer services. Only {@code Envelopes} objects with a scope * name that is permitted for the Producer and the Consumer services must be - * passed through a Wire object. + * passed through a {@code Wire} object. * * @return the security scope for the status item, must not be null. */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/package.html osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/package.html --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ - - -

        Wire Admin Package Version 1.0. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.service.wireadmin; version="[1.0,2.0)"
        -
        - - diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/packageinfo osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/packageinfo 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/packageinfo 2011-09-08 14:18:36.000000000 +0000 @@ -1 +1 @@ -version 1.0 +version 1.0.1 diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/package-info.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * Wire Admin Package Version 1.0. + * + *

        + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

        + * Example import for consumers using the API in this package: + *

        + * {@code Import-Package: org.osgi.service.wireadmin; version="[1.0,2.0)"} + *

        + * Example import for providers implementing the API in this package: + *

        + * {@code Import-Package: org.osgi.service.wireadmin; version="[1.0,1.1)"} + * + * @version $Id: 69305f027e4729d464462bb9ecd994aca699f43d $ + */ + +package org.osgi.service.wireadmin; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Producer.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Producer.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Producer.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Producer.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -22,90 +22,90 @@ *

        * Service objects registered under the Producer interface are expected to * produce values (internally generated or from external sensors). The value can - * be of different types. When delivering a value to a Wire object, - * the Producer service should coerce the value to be an instance of one of the - * types specified by {@link Wire#getFlavors}. The classes are specified in + * be of different types. When delivering a value to a {@code Wire} object, the + * Producer service should coerce the value to be an instance of one of the + * types specified by {@link Wire#getFlavors()}. The classes are specified in * order of preference. * *

        * When the data represented by the Producer object changes, this object should - * send the updated value by calling the update method on each of - * Wire objects passed in the most recent call to this object's - * {@link #consumersConnected} method. These Wire objects will pass - * the value on to the associated Consumer service object. + * send the updated value by calling the {@code update} method on each of + * {@code Wire} objects passed in the most recent call to this object's + * {@link #consumersConnected(Wire[])} method. These {@code Wire} objects will + * pass the value on to the associated {@code Consumer} service object. * *

        - * The Producer service may use the information in the Wire object's - * properties to schedule the delivery of values to the Wire object. + * The Producer service may use the information in the {@code Wire} object's + * properties to schedule the delivery of values to the {@code Wire} object. * *

        - * Producer service objects must register with a service.pid and a + * Producer service objects must register with a {@code service.pid} and a * {@link WireConstants#WIREADMIN_PRODUCER_FLAVORS} property. It is recommended * that a Producer service object also registers with a - * service.description property. Producer service objects must - * register with a {@link WireConstants#WIREADMIN_PRODUCER_FILTERS} property if - * the Producer service will be performing filtering instead of the - * Wire object. + * {@code service.description} property. Producer service objects must register + * with a {@link WireConstants#WIREADMIN_PRODUCER_FILTERS} property if the + * Producer service will be performing filtering instead of the {@code Wire} + * object. * *

        * If an exception is thrown by a Producer object method, a - * WireAdminEvent of type {@link WireAdminEvent#PRODUCER_EXCEPTION} - * is broadcast by the Wire Admin service. + * {@code WireAdminEvent} of type {@link WireAdminEvent#PRODUCER_EXCEPTION} is + * broadcast by the Wire Admin service. * *

        * Security Considerations. Data producing bundles will require - * ServicePermission[Producer,REGISTER] to register a Producer - * service. In general, only the Wire Admin service should have - * ServicePermission[Producer,GET]. Thus only the Wire Admin service - * may directly call a Producer service. Care must be taken in the sharing of - * Wire objects with other bundles. + * {@code ServicePermission[Producer,REGISTER]} to register a Producer service. + * In general, only the Wire Admin service should have + * {@code ServicePermission[Producer,GET]}. Thus only the Wire Admin service may + * directly call a Producer service. Care must be taken in the sharing of + * {@code Wire} objects with other bundles. *

        * Producer services must be registered with scope names when they can send * different types of objects (composite) to the Consumer service. The Producer - * service should have WirePermission for each of these scope names. + * service should have {@code WirePermission} for each of these scope names. * - * @version $Revision: 5673 $ + * @version $Id: 2c62794df3b56211e6549448eba860caf60f2f38 $ */ public interface Producer { /** - * Return the current value of this Producer object. + * Return the current value of this {@code Producer} object. * *

        - * This method is called by a Wire object in response to the - * Consumer service calling the Wire object's poll - * method. The Producer should coerce the value to be an instance of one of - * the types specified by {@link Wire#getFlavors}. The types are specified - * in order of of preference. The returned value should be as new or newer - * than the last value furnished by this object. + * This method is called by a {@code Wire} object in response to the + * Consumer service calling the {@code Wire} object's {@code poll} method. + * The Producer should coerce the value to be an instance of one of the + * types specified by {@link Wire#getFlavors()}. The types are specified in + * order of of preference. The returned value should be as new or newer than + * the last value furnished by this object. * *

        - * Note: This method may be called by a Wire object prior to this - * object being notified that it is connected to that Wire object - * (via the {@link #consumersConnected} method). + * Note: This method may be called by a {@code Wire} object prior to this + * object being notified that it is connected to that {@code Wire} object + * (via the {@link #consumersConnected(Wire[])} method). *

        - * If the Producer service returns an Envelope object that has an + * If the Producer service returns an {@code Envelope} object that has an * unpermitted scope name, then the Wire object must ignore (or remove) the * transfer. *

        - * If the Wire object has a scope set, the return value must be - * an array of Envelope objects (Envelope[]). The - * Wire object must have removed any Envelope objects - * that have a scope name that is not in the Wire object's scope. - * - * @param wire The Wire object which is polling this service. - * @return The current value of the Producer service or null if - * the value cannot be coerced into a compatible type. Or an array - * of Envelope objects. + * If the {@code Wire} object has a scope set, the return value must be an + * array of {@code Envelope} objects ({@code Envelope[]}). The {@code Wire} + * object must have removed any {@code Envelope} objects that have a scope + * name that is not in the Wire object's scope. + * + * @param wire The {@code Wire} object which is polling this service. + * @return The current value of the Producer service or {@code null} if the + * value cannot be coerced into a compatible type. Or an array of + * {@code Envelope} objects. */ public Object polled(Wire wire); /** - * Update the list of Wire objects to which this - * Producer object is connected. + * Update the list of {@code Wire} objects to which this + * {@code Producer} object is connected. * *

        * This method is called when the Producer service is first registered and - * subsequently whenever a Wire associated with this Producer + * subsequently whenever a {@code Wire} associated with this Producer * becomes connected, is modified or becomes disconnected. * *

        @@ -114,10 +114,10 @@ * will not take place during registration when they execute the * registration in a synchronized method. * - * @param wires An array of the current and complete list of Wire + * @param wires An array of the current and complete list of {@code Wire} * objects to which this Producer service is connected. May be - * null if the Producer is not currently connected to any - * Wire objects. + * {@code null} if the Producer is not currently connected to any + * {@code Wire} objects. */ public void consumersConnected(Wire[] wires); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireAdminEvent.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireAdminEvent.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireAdminEvent.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireAdminEvent.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -21,13 +21,12 @@ * A Wire Admin Event. * *

        - * WireAdminEvent objects are delivered to all registered - * WireAdminListener service objects which specify an interest in the - * WireAdminEvent type. Events must be delivered in chronological - * order with respect to each listener. For example, a WireAdminEvent - * of type {@link #WIRE_CONNECTED} must be delivered before a - * WireAdminEvent of type {@link #WIRE_DISCONNECTED} for a particular - * Wire object. + * {@code WireAdminEvent} objects are delivered to all registered + * {@code WireAdminListener} service objects which specify an interest in the + * {@code WireAdminEvent} type. Events must be delivered in chronological order + * with respect to each listener. For example, a {@code WireAdminEvent} of type + * {@link #WIRE_CONNECTED} must be delivered before a {@code WireAdminEvent} of + * type {@link #WIRE_DISCONNECTED} for a particular {@code Wire} object. * *

        * A type code is used to identify the type of event. The following event types @@ -48,160 +47,162 @@ * Event type values must be unique and disjoint bit values. Event types must be * defined as a bit in a 32 bit integer and can thus be bitwise OR'ed together. *

        - * Security Considerations. WireAdminEvent objects contain - * Wire objects. Care must be taken in the sharing of Wire - * objects with other bundles. + * Security Considerations. {@code WireAdminEvent} objects contain {@code Wire} + * objects. Care must be taken in the sharing of {@code Wire} objects with other + * bundles. * * @see WireAdminListener - * - * @version $Revision: 5673 $ + * @Immutable + * @version $Id: e5a8f8455c0103002b8484568431b7c685390e4e $ */ public class WireAdminEvent { /** * The WireAdmin service which created this event. */ - private ServiceReference reference; + private final ServiceReference reference; /** - * The Wire object associated with this event. + * The {@code Wire} object associated with this event. */ - private Wire wire; + private final Wire wire; /** * Type of this event. * - * @see #getType + * @see #getType() */ - private int type; + private final int type; /** * Exception associates with this the event. */ - private Throwable throwable; + private final Throwable throwable; /** * A Producer service method has thrown an exception. * *

        - * This WireAdminEvent type indicates that a Producer service - * method has thrown an exception. The {@link WireAdminEvent#getThrowable} - * method will return the exception that the Producer service method raised. + * This {@code WireAdminEvent} type indicates that a Producer service method + * has thrown an exception. The {@link WireAdminEvent#getThrowable()} method + * will return the exception that the Producer service method raised. * *

        - * The value of PRODUCER_EXCEPTION is 0x00000001. + * The value of {@code PRODUCER_EXCEPTION} is 0x00000001. */ public final static int PRODUCER_EXCEPTION = 0x00000001; /** * A Consumer service method has thrown an exception. * *

        - * This WireAdminEvent type indicates that a Consumer service - * method has thrown an exception. The {@link WireAdminEvent#getThrowable} - * method will return the exception that the Consumer service method raised. + * This {@code WireAdminEvent} type indicates that a Consumer service method + * has thrown an exception. The {@link WireAdminEvent#getThrowable()} method + * will return the exception that the Consumer service method raised. * *

        - * The value of CONSUMER_EXCEPTION is 0x00000002. + * The value of {@code CONSUMER_EXCEPTION} is 0x00000002. */ public final static int CONSUMER_EXCEPTION = 0x00000002; /** - * A Wire has been created. + * A {@code Wire} has been created. * *

        - * This WireAdminEvent type that indicates that a new - * Wire object has been created. + * This {@code WireAdminEvent} type that indicates that a new {@code Wire} + * object has been created. * - * An event is broadcast when {@link WireAdmin#createWire} is called. The - * {@link WireAdminEvent#getWire} method will return the Wire - * object that has just been created. + * An event is broadcast when + * {@link WireAdmin#createWire(String, String, java.util.Dictionary)} is + * called. The {@link WireAdminEvent#getWire()} method will return the + * {@code Wire} object that has just been created. * *

        - * The value of WIRE_CREATED is 0x00000004. + * The value of {@code WIRE_CREATED} is 0x00000004. */ public final static int WIRE_CREATED = 0x00000004; /** - * A Wire has been updated. + * A {@code Wire} has been updated. * *

        - * This WireAdminEvent type that indicates that an existing - * Wire object has been updated with new properties. + * This {@code WireAdminEvent} type that indicates that an existing + * {@code Wire} object has been updated with new properties. * - * An event is broadcast when {@link WireAdmin#updateWire} is called with a - * valid wire. The {@link WireAdminEvent#getWire} method will return the - * Wire object that has just been updated. + * An event is broadcast when + * {@link WireAdmin#updateWire(Wire, java.util.Dictionary)} is called with a + * valid wire. The {@link WireAdminEvent#getWire()} method will return the + * {@code Wire} object that has just been updated. * *

        - * The value of WIRE_UPDATED is 0x00000008. + * The value of {@code WIRE_UPDATED} is 0x00000008. */ public final static int WIRE_UPDATED = 0x00000008; /** - * A Wire has been deleted. + * A {@code Wire} has been deleted. * *

        - * This WireAdminEvent type that indicates that an existing wire - * has been deleted. + * This {@code WireAdminEvent} type that indicates that an existing wire has + * been deleted. * - * An event is broadcast when {@link WireAdmin#deleteWire} is called with a - * valid wire. {@link WireAdminEvent#getWire} will return the Wire - * object that has just been deleted. + * An event is broadcast when {@link WireAdmin#deleteWire(Wire)} is called + * with a valid wire. {@link WireAdminEvent#getWire()} will return the + * {@code Wire} object that has just been deleted. * *

        - * The value of WIRE_DELETED is 0x00000010. + * The value of {@code WIRE_DELETED} is 0x00000010. */ public final static int WIRE_DELETED = 0x00000010; /** - * The WireAdminEvent type that indicates that an existing - * Wire object has become connected. + * The {@code WireAdminEvent} type that indicates that an existing + * {@code Wire} object has become connected. * * The Consumer object and the Producer object that are associated with the - * Wire object have both been registered and the Wire - * object is connected. See {@link Wire#isConnected} for a description of - * the connected state. This event may come before the - * producersConnected and consumersConnected method - * have returned or called to allow synchronous delivery of the events. Both - * methods can cause other WireAdminEvent s to take place and + * {@code Wire} object have both been registered and the {@code Wire} object + * is connected. See {@link Wire#isConnected()} for a description of the + * connected state. This event may come before the + * {@code producersConnected} and {@code consumersConnected} method have + * returned or called to allow synchronous delivery of the events. Both + * methods can cause other {@code WireAdminEvent} s to take place and * requiring this event to be send before these methods are returned would * mandate asynchronous delivery. * *

        - * The value of WIRE_CONNECTED is 0x00000020. + * The value of {@code WIRE_CONNECTED} is 0x00000020. */ public final static int WIRE_CONNECTED = 0x00000020; /** - * The WireAdminEvent type that indicates that an existing - * Wire object has become disconnected. + * The {@code WireAdminEvent} type that indicates that an existing + * {@code Wire} object has become disconnected. * * The Consumer object or/and Producer object is/are unregistered breaking * the connection between the two. See {@link Wire#isConnected} for a * description of the connected state. * *

        - * The value of WIRE_DISCONNECTED is 0x00000040. + * The value of {@code WIRE_DISCONNECTED} is 0x00000040. */ public final static int WIRE_DISCONNECTED = 0x00000040; /** - * The WireAdminEvent type that indicates that a new value is - * transferred over the Wire object. + * The {@code WireAdminEvent} type that indicates that a new value is + * transferred over the {@code Wire} object. * * This event is sent after the Consumer service has been notified by - * calling the {@link Consumer#updated} method or the Consumer service - * requested a new value with the {@link Wire#poll} method. This is an - * advisory event meaning that when this event is received, another update - * may already have occurred and this the {@link Wire#getLastValue} method - * returns a newer value then the value that was communicated for this - * event. + * calling the {@link Consumer#updated(Wire, Object)} method or the Consumer + * service requested a new value with the {@link Wire#poll()} method. This + * is an advisory event meaning that when this event is received, another + * update may already have occurred and this the {@link Wire#getLastValue()} + * method returns a newer value then the value that was communicated for + * this event. * *

        - * The value of WIRE_TRACE is 0x00000080. + * The value of {@code WIRE_TRACE} is 0x00000080. */ public final static int WIRE_TRACE = 0x00000080; /** - * Constructs a WireAdminEvent object from the given - * ServiceReference object, event type, Wire object - * and exception. + * Constructs a {@code WireAdminEvent} object from the given + * {@code ServiceReference} object, event type, {@code Wire} object and + * exception. * - * @param reference The ServiceReference object of the Wire Admin + * @param reference The {@code ServiceReference} object of the Wire Admin * service that created this event. - * @param type The event type. See {@link #getType}. - * @param wire The Wire object associated with this event. + * @param type The event type. See {@link #getType()}. + * @param wire The {@code Wire} object associated with this event. * @param exception An exception associated with this event. This may be - * null if no exception is associated with this event. + * {@code null} if no exception is associated with this event. */ public WireAdminEvent(ServiceReference reference, int type, Wire wire, Throwable exception) { @@ -212,10 +213,10 @@ } /** - * Return the ServiceReference object of the Wire Admin service + * Return the {@code ServiceReference} object of the Wire Admin service * that created this event. * - * @return The ServiceReference object for the Wire Admin service + * @return The {@code ServiceReference} object for the Wire Admin service * that created this event. */ public ServiceReference getServiceReference() { @@ -223,10 +224,10 @@ } /** - * Return the Wire object associated with this event. + * Return the {@code Wire} object associated with this event. * - * @return The Wire object associated with this event or - * null when no Wire object is associated with + * @return The {@code Wire} object associated with this event or + * {@code null} when no {@code Wire} object is associated with * the event. */ public Wire getWire() { @@ -257,7 +258,7 @@ /** * Returns the exception associated with the event, if any. * - * @return An exception or null if no exception is associated + * @return An exception or {@code null} if no exception is associated * with this event. */ public Throwable getThrowable() { diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireAdmin.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireAdmin.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireAdmin.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireAdmin.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -23,145 +23,143 @@ * Wire Administration service. * *

        - * This service can be used to create Wire objects connecting a - * Producer service and a Consumer service. Wire objects also have - * wire properties that may be specified when a Wire object is - * created. The Producer and Consumer services may use the Wire + * This service can be used to create {@code Wire} objects connecting a + * Producer service and a Consumer service. {@code Wire} objects also have + * wire properties that may be specified when a {@code Wire} object is + * created. The Producer and Consumer services may use the {@code Wire} * object's properties to manage or control their interaction. The use of - * Wire object's properties by a Producer or Consumer services is + * {@code Wire} object's properties by a Producer or Consumer services is * optional. * *

        * Security Considerations. A bundle must have - * ServicePermission[WireAdmin,GET] to get the Wire Admin service to - * create, modify, find, and delete Wire objects. + * {@code ServicePermission[WireAdmin,GET]} to get the Wire Admin service to + * create, modify, find, and delete {@code Wire} objects. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 5389d86155c82114404e0ec0dd99674852fbf5c4 $ */ public interface WireAdmin { /** - * Create a new Wire object that connects a Producer service to a + * Create a new {@code Wire} object that connects a Producer service to a * Consumer service. * * The Producer service and Consumer service do not have to be registered - * when the Wire object is created. + * when the {@code Wire} object is created. * *

        - * The Wire configuration data must be persistently stored. All - * Wire connections are reestablished when the WireAdmin - * service is registered. A Wire can be permanently removed by - * using the {@link #deleteWire} method. + * The {@code Wire} configuration data must be persistently stored. All + * {@code Wire} connections are reestablished when the {@code WireAdmin} + * service is registered. A {@code Wire} can be permanently removed by using + * the {@link #deleteWire(Wire)} method. * *

        - * The Wire object's properties must have case insensitive - * String objects as keys (like the Framework). However, the case - * of the key must be preserved. + * The {@code Wire} object's properties must have case insensitive + * {@code String} objects as keys (like the Framework). However, the case of + * the key must be preserved. * *

        - * The WireAdmin service must automatically add the following - * Wire properties: + * The {@code WireAdmin} service must automatically add the following + * {@code Wire} properties: *

          *
        • {@link WireConstants#WIREADMIN_PID} set to the value of the - * Wire object's persistent identity (PID). This value is - * generated by the Wire Admin service when a Wire object is - * created.
        • + * {@code Wire} object's persistent identity (PID). This value is generated + * by the Wire Admin service when a {@code Wire} object is created. *
        • {@link WireConstants#WIREADMIN_PRODUCER_PID} set to the value of * Producer service's PID.
        • *
        • {@link WireConstants#WIREADMIN_CONSUMER_PID} set to the value of * Consumer service's PID.
        • *
        - * If the properties argument already contains any of these keys, + * If the {@code properties} argument already contains any of these keys, * then the supplied values are replaced with the values assigned by the * Wire Admin service. * *

        - * The Wire Admin service must broadcast a WireAdminEvent of type - * {@link WireAdminEvent#WIRE_CREATED} after the new Wire object - * becomes available from {@link #getWires}. - * - * @param producerPID The service.pid of the Producer service to - * be connected to the Wire object. - * @param consumerPID The service.pid of the Consumer service to - * be connected to the Wire object. - * @param properties The Wire object's properties. This argument - * may be null if the caller does not wish to define any - * Wire object's properties. - * @return The Wire object for this connection. - * - * @throws java.lang.IllegalArgumentException If properties - * contains invalid wire types or case variants of the same key - * name. + * The Wire Admin service must broadcast a {@code WireAdminEvent} of type + * {@link WireAdminEvent#WIRE_CREATED} after the new {@code Wire} object + * becomes available from {@link #getWires(String)}. + * + * @param producerPID The {@code service.pid} of the Producer service to be + * connected to the {@code Wire} object. + * @param consumerPID The {@code service.pid} of the Consumer service to be + * connected to the {@code Wire} object. + * @param properties The {@code Wire} object's properties. This argument may + * be {@code null} if the caller does not wish to define any + * {@code Wire} object's properties. + * @return The {@code Wire} object for this connection. + * + * @throws java.lang.IllegalArgumentException If {@code properties} contains + * invalid wire types or case variants of the same key name. */ public Wire createWire(String producerPID, String consumerPID, Dictionary properties); /** - * Delete a Wire object. + * Delete a {@code Wire} object. * *

        - * The Wire object representing a connection between a Producer + * The {@code Wire} object representing a connection between a Producer * service and a Consumer service must be removed. The persistently stored - * configuration data for the Wire object must destroyed. The - * Wire object's method {@link Wire#isValid} will return - * false after it is deleted. + * configuration data for the {@code Wire} object must destroyed. The + * {@code Wire} object's method {@link Wire#isValid()} will return + * {@code false} after it is deleted. * *

        - * The Wire Admin service must broadcast a WireAdminEvent of type - * {@link WireAdminEvent#WIRE_DELETED} after the Wire object - * becomes invalid. + * The Wire Admin service must broadcast a {@code WireAdminEvent} of type + * {@link WireAdminEvent#WIRE_DELETED} after the {@code Wire} object becomes + * invalid. * - * @param wire The Wire object which is to be deleted. + * @param wire The {@code Wire} object which is to be deleted. */ public void deleteWire(Wire wire); /** - * Update the properties of a Wire object. + * Update the properties of a {@code Wire} object. * - * The persistently stored configuration data for the Wire object - * is updated with the new properties and then the Consumer and Producer + * The persistently stored configuration data for the {@code Wire} object is + * updated with the new properties and then the Consumer and Producer * services will be called at the respective - * {@link Consumer#producersConnected} and - * {@link Producer#consumersConnected} methods. + * {@link Consumer#producersConnected(Wire[])} and + * {@link Producer#consumersConnected(Wire[])} methods. * *

        - * The Wire Admin service must broadcast a WireAdminEvent of type + * The Wire Admin service must broadcast a {@code WireAdminEvent} of type * {@link WireAdminEvent#WIRE_UPDATED} after the updated properties are - * available from the Wire object. + * available from the {@code Wire} object. + * + * @param wire The {@code Wire} object which is to be updated. + * @param properties The new {@code Wire} object's properties or + * {@code null} if no properties are required. * - * @param wire The Wire object which is to be updated. - * @param properties The new Wire object's properties or - * null if no properties are required. - * - * @throws java.lang.IllegalArgumentException If properties - * contains invalid wire types or case variants of the same key - * name. + * @throws java.lang.IllegalArgumentException If {@code properties} contains + * invalid wire types or case variants of the same key name. */ public void updateWire(Wire wire, Dictionary properties); /** - * Return the Wire objects that match the given filter. + * Return the {@code Wire} objects that match the given {@code filter}. * *

        - * The list of available Wire objects is matched against the - * specified filter.Wire objects which match the - * filter must be returned. These Wire objects are not + * The list of available {@code Wire} objects is matched against the + * specified {@code filter}.{@code Wire} objects which match the + * {@code filter} must be returned. These {@code Wire} objects are not * necessarily connected. The Wire Admin service should not return invalid - * Wire objects, but it is possible that a Wire object + * {@code Wire} objects, but it is possible that a {@code Wire} object * is deleted after it was placed in the list. * *

        - * The filter matches against the Wire object's properties + * The filter matches against the {@code Wire} object's properties * including {@link WireConstants#WIREADMIN_PRODUCER_PID}, * {@link WireConstants#WIREADMIN_CONSUMER_PID} and * {@link WireConstants#WIREADMIN_PID}. * - * @param filter Filter string to select Wire objects or - * null to select all Wire objects. - * @return An array of Wire objects which match the - * filter or null if no Wire - * objects match the filter. + * @param filter Filter string to select {@code Wire} objects or + * {@code null} to select all {@code Wire} objects. + * @return An array of {@code Wire} objects which match the + * {@code filter} or {@code null} if no {@code Wire} + * objects match the {@code filter}. * @throws org.osgi.framework.InvalidSyntaxException If the specified - * filter has an invalid syntax. + * {@code filter} has an invalid syntax. * @see org.osgi.framework.Filter */ public Wire[] getWires(String filter) throws InvalidSyntaxException; diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireAdminListener.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireAdminListener.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireAdminListener.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireAdminListener.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -19,17 +19,17 @@ * Listener for Wire Admin Events. * *

        - * WireAdminListener objects are registered with the Framework - * service registry and are notified with a WireAdminEvent object + * {@code WireAdminListener} objects are registered with the Framework + * service registry and are notified with a {@code WireAdminEvent} object * when an event is broadcast. *

        - * WireAdminListener objects can inspect the received - * WireAdminEvent object to determine its type, the Wire + * {@code WireAdminListener} objects can inspect the received + * {@code WireAdminEvent} object to determine its type, the {@code Wire} * object with which it is associated, and the Wire Admin service that * broadcasts the event. * *

        - * WireAdminListener objects must be registered with a service + * {@code WireAdminListener} objects must be registered with a service * property {@link WireConstants#WIREADMIN_EVENTS} whose value is a bitwise OR * of all the event types the listener is interested in receiving. *

        @@ -42,31 +42,31 @@ * context.registerService(WireAdminListener.class.getName(), this, ht); *

      * - * If a WireAdminListener object is registered without a service + * If a {@code WireAdminListener} object is registered without a service * property {@link WireConstants#WIREADMIN_EVENTS}, then the - * WireAdminListener will receive no events. + * {@code WireAdminListener} will receive no events. * *

      - * Security Considerations. Bundles wishing to monitor WireAdminEvent - * objects will require ServicePermission[WireAdminListener,REGISTER] - * to register a WireAdminListener service. Since - * WireAdminEvent objects contain Wire objects, care must - * be taken in assigning permission to register a WireAdminListener + * Security Considerations. Bundles wishing to monitor {@code WireAdminEvent} + * objects will require {@code ServicePermission[WireAdminListener,REGISTER]} + * to register a {@code WireAdminListener} service. Since + * {@code WireAdminEvent} objects contain {@code Wire} objects, care must + * be taken in assigning permission to register a {@code WireAdminListener} * service. * * @see WireAdminEvent * - * @version $Revision: 5673 $ + * @version $Id: 1dc2fe90f2fd938c96bdaf952a68bb0fb12c4db4 $ */ public interface WireAdminListener { /** - * Receives notification of a broadcast WireAdminEvent object. + * Receives notification of a broadcast {@code WireAdminEvent} object. * * The event object will be of an event type specified in this - * WireAdminListener service's + * {@code WireAdminListener} service's * {@link WireConstants#WIREADMIN_EVENTS} service property. * - * @param event The WireAdminEvent object. + * @param event The {@code WireAdminEvent} object. */ void wireAdminEvent(WireAdminEvent event); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireConstants.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireConstants.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WireConstants.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WireConstants.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -16,25 +16,26 @@ package org.osgi.service.wireadmin; /** - * Defines standard names for Wire properties, wire filter + * Defines standard names for {@code Wire} properties, wire filter * attributes, Consumer and Producer service properties. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: 02fa7c680add08c46c2b0667014e22163d6faf6e $ */ public interface WireConstants { /** - * Wire property key (named wireadmin.pid) specifying - * the persistent identity (PID) of this Wire object. + * {@code Wire} property key (named {@code wireadmin.pid}) specifying + * the persistent identity (PID) of this {@code Wire} object. * *

      - * Each Wire object has a PID to allow unique and persistent - * identification of a specific Wire object. The PID must be - * generated by the {@link WireAdmin} service when the Wire + * Each {@code Wire} object has a PID to allow unique and persistent + * identification of a specific {@code Wire} object. The PID must be + * generated by the {@link WireAdmin} service when the {@code Wire} * object is created. * *

      * This wire property is automatically set by the Wire Admin service. The - * value of the property must be of type String. + * value of the property must be of type {@code String}. */ public final static String WIREADMIN_PID = "wireadmin.pid"; /** @@ -42,7 +43,7 @@ * It contains the names of the composite Consumer services it can * inter-operate with. Inter-operability exists when any name in this array * matches any name in the array set by the Consumer service. The type of - * this property must be String[]. + * this property must be {@code String[]}. */ public final static String WIREADMIN_PRODUCER_COMPOSITE = "wireadmin.producer.composite"; /** @@ -50,36 +51,34 @@ * It contains the names of the composite Producer services it can cooperate * with. Inter-operability exists when any name in this array matches any * name in the array set by the Producer service. The type of this property - * must be String[]. + * must be {@code String[]}. */ public final static String WIREADMIN_CONSUMER_COMPOSITE = "wireadmin.consumer.composite"; /** - * Service registration property key (named - * wireadmin.producer.scope) specifying a list of names that may - * be used to define the scope of this Wire object. A Producer - * service should set this service property when it can produce more than - * one kind of value. This property is only used during registration, - * modifying the property must not have any effect of the Wire - * object's scope. Each name in the given list mist have - * WirePermission[name,PRODUCE] or else is ignored. The type of - * this service registration property must be String[]. + * Service registration property key (named {@code wireadmin.producer.scope} + * ) specifying a list of names that may be used to define the scope of this + * {@code Wire} object. A Producer service should set this service property + * when it can produce more than one kind of value. This property is only + * used during registration, modifying the property must not have any effect + * of the {@code Wire} object's scope. Each name in the given list mist have + * {@code WirePermission[name,PRODUCE]} or else is ignored. The type of this + * service registration property must be {@code String[]}. * - * @see Wire#getScope + * @see Wire#getScope() * @see #WIREADMIN_CONSUMER_SCOPE */ public final static String WIREADMIN_PRODUCER_SCOPE = "wireadmin.producer.scope"; /** - * Service registration property key (named - * wireadmin.consumer.scope) specifying a list of names that may - * be used to define the scope of this Wire object. A - * Consumer service should set this service property when it can - * produce more than one kind of value. This property is only used during - * registration, modifying the property must not have any effect of the - * Wire object's scope. Each name in the given list mist have - * WirePermission[name,CONSUME] or else is ignored. The type of this - * service registration property must be String[]. + * Service registration property key (named {@code wireadmin.consumer.scope} + * ) specifying a list of names that may be used to define the scope of this + * {@code Wire} object. A {@code Consumer} service should set this service + * property when it can produce more than one kind of value. This property + * is only used during registration, modifying the property must not have + * any effect of the {@code Wire} object's scope. Each name in the given + * list mist have {@code WirePermission[name,CONSUME]} or else is ignored. + * The type of this service registration property must be {@code String[]}. * - * @see Wire#getScope + * @see Wire#getScope() * @see #WIREADMIN_PRODUCER_SCOPE */ public final static String WIREADMIN_CONSUMER_SCOPE = "wireadmin.consumer.scope"; @@ -88,30 +87,30 @@ */ public final static String WIREADMIN_SCOPE_ALL[] = {"*"}; /** - * Wire property key (named wireadmin.producer.pid) - * specifying the service.pid of the associated Producer service. + * {@code Wire} property key (named {@code wireadmin.producer.pid}) + * specifying the {@code service.pid} of the associated Producer service. * *

      * This wire property is automatically set by the WireAdmin service. The - * value of the property must be of type String. + * value of the property must be of type {@code String}. */ public final static String WIREADMIN_PRODUCER_PID = "wireadmin.producer.pid"; /** - * Wire property key (named wireadmin.consumer.pid) - * specifying the service.pid of the associated Consumer service. + * {@code Wire} property key (named {@code wireadmin.consumer.pid}) + * specifying the {@code service.pid} of the associated Consumer service. * *

      * This wire property is automatically set by the Wire Admin service. The - * value of the property must be of type String. + * value of the property must be of type {@code String}. */ public final static String WIREADMIN_CONSUMER_PID = "wireadmin.consumer.pid"; /** - * Wire property key (named wireadmin.filter) + * {@code Wire} property key (named {@code wireadmin.filter}) * specifying a filter used to control the delivery rate of data between the * Producer and the Consumer service. * *

      - * This property should contain a filter as described in the Filter + * This property should contain a filter as described in the {@code Filter} * class. The filter can be used to specify when an updated value from the * Producer service should be delivered to the Consumer service. In many * cases the Consumer service does not need to receive the data with the @@ -125,8 +124,8 @@ *

      * If the Producer service was registered with the * {@link #WIREADMIN_PRODUCER_FILTERS} service property indicating that the - * Producer service will perform the data filtering then the Wire - * object will not perform data filtering. Otherwise, the Wire + * Producer service will perform the data filtering then the {@code Wire} + * object will not perform data filtering. Otherwise, the {@code Wire} * object must perform basic filtering. Basic filtering includes supporting * the following standard wire filter attributes: *

        @@ -142,45 +141,45 @@ public final static String WIREADMIN_FILTER = "wireadmin.filter"; /* Wire filter attribute names. */ /** - * Wire object's filter attribute (named - * wirevalue.current) representing the current value. + * {@code Wire} object's filter attribute (named + * {@code wirevalue.current}) representing the current value. */ public final static String WIREVALUE_CURRENT = "wirevalue.current"; /** - * Wire object's filter attribute (named - * wirevalue.previous) representing the previous value. + * {@code Wire} object's filter attribute (named + * {@code wirevalue.previous}) representing the previous value. */ public final static String WIREVALUE_PREVIOUS = "wirevalue.previous"; /** - * Wire object's filter attribute (named - * wirevalue.delta.absolute) representing the absolute delta. + * {@code Wire} object's filter attribute (named + * {@code wirevalue.delta.absolute}) representing the absolute delta. * The absolute (always positive) difference between the last update and the * current value (only when numeric). This attribute must not be used when * the values are not numeric. */ public final static String WIREVALUE_DELTA_ABSOLUTE = "wirevalue.delta.absolute"; /** - * Wire object's filter attribute (named - * wirevalue.delta.relative) representing the relative delta. - * The relative difference is |previous-current |/| - * current| (only when numeric). This attribute must not be used + * {@code Wire} object's filter attribute (named + * {@code wirevalue.delta.relative}) representing the relative delta. + * The relative difference is |{@code previous}-{@code current} |/| + * {@code current}| (only when numeric). This attribute must not be used * when the values are not numeric. */ public final static String WIREVALUE_DELTA_RELATIVE = "wirevalue.delta.relative"; /** - * Wire object's filter attribute (named - * wirevalue.elapsed) representing the elapsed time, in ms, + * {@code Wire} object's filter attribute (named + * {@code wirevalue.elapsed}) representing the elapsed time, in ms, * between this filter evaluation and the last update of the - * Consumer service. + * {@code Consumer} service. */ public final static String WIREVALUE_ELAPSED = "wirevalue.elapsed"; /* Service registration property key names. */ /** - * Service Registration property (named wireadmin.producer.filters). - * A Producer service registered with this property indicates to + * Service Registration property (named {@code wireadmin.producer.filters}). + * A {@code Producer} service registered with this property indicates to * the Wire Admin service that the Producer service implements at least the * filtering as described for the {@link #WIREADMIN_FILTER} property. If the - * Producer service is not registered with this property, the Wire + * Producer service is not registered with this property, the {@code Wire} * object must perform the basic filtering as described in * {@link #WIREADMIN_FILTER}. * @@ -190,18 +189,18 @@ */ public final static String WIREADMIN_PRODUCER_FILTERS = "wireadmin.producer.filters"; /** - * Service Registration property (named wireadmin.consumer.flavors) + * Service Registration property (named {@code wireadmin.consumer.flavors}) * specifying the list of data types understood by this Consumer service. * *

        * The Consumer service object must be registered with this service * property. The list must be in the order of preference with the first type * being the most preferred. The value of the property must be of type - * Class[]. + * {@code Class[]}. */ public final static String WIREADMIN_CONSUMER_FLAVORS = "wireadmin.consumer.flavors"; /** - * Service Registration property (named wireadmin.producer.flavors) + * Service Registration property (named {@code wireadmin.producer.flavors}) * specifying the list of data types available from this Producer service. * *

        @@ -209,15 +208,15 @@ * property. * *

        - * The value of the property must be of type Class[]. + * The value of the property must be of type {@code Class[]}. */ public final static String WIREADMIN_PRODUCER_FLAVORS = "wireadmin.producer.flavors"; /** - * Service Registration property (named wireadmin.events) - * specifying the WireAdminEvent type of interest to a Wire Admin + * Service Registration property (named {@code wireadmin.events}) + * specifying the {@code WireAdminEvent} type of interest to a Wire Admin * Listener service. The value of the property is a bitwise OR of all the - * WireAdminEvent types the Wire Admin Listener service wishes to - * receive and must be of type Integer. + * {@code WireAdminEvent} types the Wire Admin Listener service wishes to + * receive and must be of type {@code Integer}. * * @see WireAdminEvent */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Wire.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Wire.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/Wire.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/Wire.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -21,101 +21,102 @@ * A connection between a Producer service and a Consumer service. * *

        - * A Wire object connects a Producer service to a Consumer service. - * Both the Producer and Consumer services are identified by their unique - * service.pid values. The Producer and Consumer services may - * communicate with each other via Wire objects that connect them. - * The Producer service may send updated values to the Consumer service by - * calling the {@link #update} method. The Consumer service may request an - * updated value from the Producer service by calling the {@link #poll} method. + * A {@code Wire} object connects a Producer service to a Consumer service. Both + * the Producer and Consumer services are identified by their unique + * {@code service.pid} values. The Producer and Consumer services may + * communicate with each other via {@code Wire} objects that connect them. The + * Producer service may send updated values to the Consumer service by calling + * the {@link #update(Object)} method. The Consumer service may request an + * updated value from the Producer service by calling the {@link #poll()} + * method. * *

        * A Producer service and a Consumer service may be connected through multiple - * Wire objects. + * {@code Wire} objects. * *

        - * Security Considerations. Wire objects are available to Producer - * and Consumer services connected to a given Wire object and to - * bundles which can access the WireAdmin service. A bundle must have - * ServicePermission[WireAdmin,GET] to get the WireAdmin - * service to access all Wire objects. A bundle registering a - * Producer service or a Consumer service must have the appropriate - * ServicePermission[Consumer|Producer,REGISTER] to register the - * service and will be passed Wire objects when the service object's - * consumersConnected or producersConnected method is - * called. + * Security Considerations. {@code Wire} objects are available to Producer and + * Consumer services connected to a given {@code Wire} object and to bundles + * which can access the {@code WireAdmin} service. A bundle must have + * {@code ServicePermission[WireAdmin,GET]} to get the {@code WireAdmin} service + * to access all {@code Wire} objects. A bundle registering a Producer service + * or a Consumer service must have the appropriate + * {@code ServicePermission[Consumer|Producer,REGISTER]} to register the service + * and will be passed {@code Wire} objects when the service object's + * {@code consumersConnected} or {@code producersConnected} method is called. * *

        - * Scope. Each Wire object can have a scope set with the setScope + * Scope. Each Wire object can have a scope set with the {@code setScope} * method. This method should be called by a Consumer service when it assumes a * Producer service that is composite (supports multiple information items). The - * names in the scope must be verified by the Wire object before it - * is used in communication. The semantics of the names depend on the Producer + * names in the scope must be verified by the {@code Wire} object before it is + * used in communication. The semantics of the names depend on the Producer * service and must not be interpreted by the Wire Admin service. * - * @version $Revision: 5673 $ + * @noimplement + * @version $Id: d27d1d8667491a1a5d30b68ca96a6154494d7b35 $ */ public interface Wire { /** - * Return the state of this Wire object. + * Return the state of this {@code Wire} object. * *

        - * A connected Wire must always be disconnected before becoming + * A connected {@code Wire} must always be disconnected before becoming * invalid. * - * @return false if this Wire object is invalid - * because it has been deleted via {@link WireAdmin#deleteWire}; - * true otherwise. + * @return {@code false} if this {@code Wire} object is invalid because it + * has been deleted via {@link WireAdmin#deleteWire(Wire)}; + * {@code true} otherwise. */ public boolean isValid(); /** - * Return the connection state of this Wire object. + * Return the connection state of this {@code Wire} object. * *

        - * A Wire is connected after the Wire Admin service receives + * A {@code Wire} is connected after the Wire Admin service receives * notification that the Producer service and the Consumer service for this - * Wire object are both registered. This method will return - * true prior to notifying the Producer and Consumer services via - * calls to their respective consumersConnected and - * producersConnected methods. + * {@code Wire} object are both registered. This method will return + * {@code true} prior to notifying the Producer and Consumer services via + * calls to their respective {@code consumersConnected} and + * {@code producersConnected} methods. *

        - * A WireAdminEvent of type {@link WireAdminEvent#WIRE_CONNECTED} - * must be broadcast by the Wire Admin service when the Wire + * A {@code WireAdminEvent} of type {@link WireAdminEvent#WIRE_CONNECTED} + * must be broadcast by the Wire Admin service when the {@code Wire} * becomes connected. * *

        - * A Wire object is disconnected when either the Consumer or - * Producer service is unregistered or the Wire object is + * A {@code Wire} object is disconnected when either the Consumer or + * Producer service is unregistered or the {@code Wire} object is * deleted. *

        - * A WireAdminEvent of type + * A {@code WireAdminEvent} of type * {@link WireAdminEvent#WIRE_DISCONNECTED} must be broadcast by the Wire - * Admin service when the Wire becomes disconnected. + * Admin service when the {@code Wire} becomes disconnected. * - * @return true if both the Producer and Consumer for this - * Wire object are connected to the Wire - * object; false otherwise. + * @return {@code true} if both the Producer and Consumer for this + * {@code Wire} object are connected to the {@code Wire} + * object; {@code false} otherwise. */ public boolean isConnected(); /** * Return the list of data types understood by the Consumer service - * connected to this Wire object. Note that subclasses of the + * connected to this {@code Wire} object. Note that subclasses of the * classes in this list are acceptable data types as well. * *

        * The list is the value of the * {@link WireConstants#WIREADMIN_CONSUMER_FLAVORS} service property of the * Consumer service object connected to this object. If no such property was - * registered or the type of the property value is not Class[], - * this method must return null. + * registered or the type of the property value is not {@code Class[]}, + * this method must return {@code null}. * * @return An array containing the list of classes understood by the - * Consumer service or null if the Wire is not + * Consumer service or {@code null} if the {@code Wire} is not * connected, or the consumer did not register a * {@link WireConstants#WIREADMIN_CONSUMER_FLAVORS} property or the - * value of the property is not of type Class[]. + * value of the property is not of type {@code Class[]}. */ public Class[] getFlavors(); @@ -124,34 +125,34 @@ * *

        * This methods is called by the Producer service to notify the Consumer - * service connected to this Wire object of an updated value. + * service connected to this {@code Wire} object of an updated value. *

        - * If the properties of this Wire object contain a + * If the properties of this {@code Wire} object contain a * {@link WireConstants#WIREADMIN_FILTER} property, then filtering is - * performed. If the Producer service connected to this Wire - * object was registered with the service property + * performed. If the Producer service connected to this {@code Wire} object + * was registered with the service property * {@link WireConstants#WIREADMIN_PRODUCER_FILTERS}, the Producer service * will perform the filtering according to the rules specified for the - * filter. Otherwise, this Wire object will perform the filtering - * of the value. + * filter. Otherwise, this {@code Wire} object will perform the filtering of + * the value. *

        * If no filtering is done, or the filter indicates the updated value should - * be delivered to the Consumer service, then this Wire object - * must call the {@link Consumer#updated} method with the updated value. If - * this Wire object is not connected, then the Consumer service - * must not be called and the value is ignored. + * be delivered to the Consumer service, then this {@code Wire} object must + * call the {@link Consumer#updated(Wire, Object)} method with the updated + * value. If this {@code Wire} object is not connected, then the Consumer + * service must not be called and the value is ignored. *

        - * If the value is an Envelope object, and the scope name is not - * permitted, then the Wire object must ignore this call and not + * If the value is an {@code Envelope} object, and the scope name is not + * permitted, then the {@code Wire} object must ignore this call and not * transfer the object to the Consumer service. * *

        - * A WireAdminEvent of type {@link WireAdminEvent#WIRE_TRACE} - * must be broadcast by the Wire Admin service after the Consumer service - * has been successfully called. + * A {@code WireAdminEvent} of type {@link WireAdminEvent#WIRE_TRACE} must + * be broadcast by the Wire Admin service after the Consumer service has + * been successfully called. * * @param value The updated value. The value should be an instance of one of - * the types returned by {@link #getFlavors}. + * the types returned by {@link #getFlavors()}. * @see WireConstants#WIREADMIN_FILTER */ public void update(Object value); @@ -161,96 +162,97 @@ * *

        * This methods is normally called by the Consumer service to request an - * updated value from the Producer service connected to this Wire - * object. This Wire object will call the {@link Producer#polled} - * method to obtain an updated value. If this Wire object is not - * connected, then the Producer service must not be called. - *

        - * - * If this Wire object has a scope, then this method must return - * an array of Envelope objects. The objects returned must match - * the scope of this object. The Wire object must remove all - * Envelope objects with a scope name that is not in the - * Wire object's scope. Thus, the list of objects returned must - * only contain Envelope objects with a permitted scope name. If - * the array becomes empty, null must be returned. - * - *

        - * A WireAdminEvent of type {@link WireAdminEvent#WIRE_TRACE} - * must be broadcast by the Wire Admin service after the Producer service - * has been successfully called. + * updated value from the Producer service connected to this {@code Wire} + * object. This {@code Wire} object will call the + * {@link Producer#polled(Wire)} method to obtain an updated value. If this + * {@code Wire} object is not connected, then the Producer service must not + * be called. + *

        + * + * If this {@code Wire} object has a scope, then this method must return an + * array of {@code Envelope} objects. The objects returned must match the + * scope of this object. The {@code Wire} object must remove all + * {@code Envelope} objects with a scope name that is not in the + * {@code Wire} object's scope. Thus, the list of objects returned must only + * contain {@code Envelope} objects with a permitted scope name. If the + * array becomes empty, {@code null} must be returned. + * + *

        + * A {@code WireAdminEvent} of type {@link WireAdminEvent#WIRE_TRACE} must + * be broadcast by the Wire Admin service after the Producer service has + * been successfully called. * * @return A value whose type should be one of the types returned by - * {@link #getFlavors},Envelope[], or null - * if the Wire object is not connected, the Producer - * service threw an exception, or the Producer service returned a - * value which is not an instance of one of the types returned by - * {@link #getFlavors}. + * {@link #getFlavors()},{@code Envelope[]}, or {@code null} if the + * {@code Wire} object is not connected, the Producer service threw + * an exception, or the Producer service returned a value which is + * not an instance of one of the types returned by + * {@link #getFlavors()}. */ public Object poll(); /** - * Return the last value sent through this Wire object. + * Return the last value sent through this {@code Wire} object. * *

        * The returned value is the most recent, valid value passed to the - * {@link #update} method or returned by the {@link #poll} method of this - * object. If filtering is performed by this Wire object, this - * methods returns the last value provided by the Producer service. This - * value may be an Envelope[] when the Producer service uses + * {@link #update(Object)} method or returned by the {@link #poll()} method + * of this object. If filtering is performed by this {@code Wire} object, + * this methods returns the last value provided by the Producer service. + * This value may be an {@code Envelope[]} when the Producer service uses * scoping. If the return value is an Envelope object (or array), it must be * verified that the Consumer service has the proper WirePermission to see * it. * - * @return The last value passed though this Wire object or - * null if no valid values have been passed or the - * Consumer service has no permission. + * @return The last value passed though this {@code Wire} object or + * {@code null} if no valid values have been passed or the Consumer + * service has no permission. */ public Object getLastValue(); /** - * Return the wire properties for this Wire object. + * Return the wire properties for this {@code Wire} object. * - * @return The properties for this Wire object. The returned - * Dictionary must be read only. + * @return The properties for this {@code Wire} object. The returned + * {@code Dictionary} must be read only. */ public Dictionary getProperties(); /** - * Return the calculated scope of this Wire object. + * Return the calculated scope of this {@code Wire} object. * - * The purpose of the Wire object's scope is to allow a Producer + * The purpose of the {@code Wire} object's scope is to allow a Producer * and/or Consumer service to produce/consume different types over a single - * Wire object (this was deemed necessary for efficiency + * {@code Wire} object (this was deemed necessary for efficiency * reasons). Both the Consumer service and the Producer service must set an * array of scope names (their scope) with the service registration property - * WIREADMIN_PRODUCER_SCOPE, or - * WIREADMIN_CONSUMER_SCOPE when they can produce multiple types. + * {@code WIREADMIN_PRODUCER_SCOPE}, or + * {@code WIREADMIN_CONSUMER_SCOPE} when they can produce multiple types. * If a Producer service can produce different types, it should set this * property to the array of scope names it can produce, the Consumer service * must set the array of scope names it can consume. The scope of a - * Wire object is defined as the intersection of permitted scope + * {@code Wire} object is defined as the intersection of permitted scope * names of the Producer service and Consumer service. *

        * If neither the Consumer, or the Producer service registers scope names - * with its service registration, then the Wire object's scope - * must be null. + * with its service registration, then the {@code Wire} object's scope + * must be {@code null}. *

        - * The Wire object's scope must not change when a Producer or + * The {@code Wire} object's scope must not change when a Producer or * Consumer services modifies its scope. *

        * A scope name is permitted for a Producer service when the registering - * bundle has WirePermission[name,PRODUCE], and for a Consumer - * service when the registering bundle has WirePermission[name,CONSUME]. + * bundle has {@code WirePermission[name,PRODUCE]}, and for a Consumer + * service when the registering bundle has {@code WirePermission[name,CONSUME]}. *

        * If either Consumer service or Producer service has not set a - * WIREADMIN_*_SCOPE property, then the returned value must be - * null. + * {@code WIREADMIN_*_SCOPE} property, then the returned value must be + * {@code null}. *

        - * If the scope is set, the Wire object must enforce the scope - * names when Envelope objects are used as a parameter to update - * or returned from the poll method. The Wire object - * must then remove all Envelope objects with a scope name that + * If the scope is set, the {@code Wire} object must enforce the scope + * names when {@code Envelope} objects are used as a parameter to update + * or returned from the {@code poll} method. The {@code Wire} object + * must then remove all {@code Envelope} objects with a scope name that * is not permitted. * * @return A list of permitted scope names or null if the Produce or @@ -259,7 +261,7 @@ public String[] getScope(); /** - * Return true if the given name is in this Wire object's scope. + * Return true if the given name is in this {@code Wire} object's scope. * * @param name The scope name * @return true if the name is listed in the permitted scope names diff -Nru osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WirePermission.java osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WirePermission.java --- osgi-compendium-4.2.0/src/org/osgi/service/wireadmin/WirePermission.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/service/wireadmin/WirePermission.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2009). All Rights Reserved. + * 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. @@ -23,29 +23,29 @@ import java.util.Hashtable; /** - * Permission for the scope of a Wire object. When a - * Envelope object is used for communication with the - * poll or update method, and the scope is set, then - * the Wire object must verify that the Consumer service has - * WirePermission[name,CONSUME] and the Producer service has - * WirePermission[name,PRODUCE] for all names in the scope. + * Permission for the scope of a {@code Wire} object. When a + * {@code Envelope} object is used for communication with the + * {@code poll} or {@code update} method, and the scope is set, then + * the {@code Wire} object must verify that the Consumer service has + * {@code WirePermission[name,CONSUME]} and the Producer service has + * {@code WirePermission[name,PRODUCE]} for all names in the scope. *

        * The names are compared with the normal rules for permission names. This means * that they may end with a "*" to indicate wildcards. E.g. Door.* indicates all * scope names starting with the string "Door". The last period is required due - * to the implementations of the BasicPermission class. + * to the implementations of the {@code BasicPermission} class. * * @ThreadSafe - * @version $Revision: 6381 $ + * @version $Id: 2910866cb953b6311421e6d2a33ae1f597be4b95 $ */ final public class WirePermission extends BasicPermission { static final long serialVersionUID = -5583709391516569321L; /** - * The action string for the produce action. + * The action string for the {@code produce} action. */ public static final String PRODUCE = "produce"; /** - * The action string for the consume action. + * The action string for the {@code consume} action. */ public static final String CONSUME = "consume"; private final static int ACTION_PRODUCE = 0x00000001; @@ -69,7 +69,7 @@ * actions. * * @param name Wire name. - * @param actions produce, consume (canonical + * @param actions {@code produce}, {@code consume} (canonical * order). */ public WirePermission(String name, String actions) { @@ -190,22 +190,22 @@ } /** - * Checks if this WirePermission object implies + * Checks if this {@code WirePermission} object {@code implies} * the specified permission. *

        - * More specifically, this method returns true if: + * More specifically, this method returns {@code true} if: *

        *

          - *
        • p is an instanceof the WirePermission class, + *
        • p is an instanceof the {@code WirePermission} class, *
        • p 's actions are a proper subset of this object's actions, and *
        • p 's name is implied by this object's name. For example, - * java.* implies java.home. + * {@code java.*} implies {@code java.home}. *
        * * @param p The permission to check against. * - * @return true if the specified permission is implied by this - * object; false otherwise. + * @return {@code true} if the specified permission is implied by this + * object; {@code false} otherwise. */ public boolean implies(Permission p) { if (p instanceof WirePermission) { @@ -219,8 +219,8 @@ /** * Returns the canonical string representation of the actions. Always - * returns present actions in the following order: produce, - * consume. + * returns present actions in the following order: {@code produce}, + * {@code consume}. * * @return The canonical string representation of the actions. */ @@ -245,26 +245,26 @@ } /** - * Returns a new PermissionCollection object for storing - * WirePermission objects. + * Returns a new {@code PermissionCollection} object for storing + * {@code WirePermission} objects. * - * @return A new PermissionCollection object suitable for - * storing WirePermission objects. + * @return A new {@code PermissionCollection} object suitable for + * storing {@code WirePermission} objects. */ public PermissionCollection newPermissionCollection() { return new WirePermissionCollection(); } /** - * Determines the equalty of two WirePermission objects. + * Determines the equalty of two {@code WirePermission} objects. * * Checks that specified object has the same name and actions as this - * WirePermission object. + * {@code WirePermission} object. * * @param obj The object to test for equality. - * @return true if obj is a WirePermission, and - * has the same name and actions as this WirePermission - * object; false otherwise. + * @return true if {@code obj} is a {@code WirePermission}, and + * has the same name and actions as this {@code WirePermission} + * object; {@code false} otherwise. */ public boolean equals(Object obj) { if (obj == this) { @@ -290,13 +290,13 @@ } /** - * Returns a string describing this WirePermission. The + * Returns a string describing this {@code WirePermission}. The * convention is to specify the class name, the permission name, and the * actions in the following format: * '(org.osgi.service.wireadmin.WirePermission "name" * "actions")'. * - * @return information about this Permission object. + * @return information about this {@code Permission} object. */ public String toString() { StringBuffer sb = new StringBuffer(); @@ -340,8 +340,8 @@ } /** - * A WirePermissionCollection stores a set of - * WirePermission permissions. + * A {@code WirePermissionCollection} stores a set of + * {@code WirePermission} permissions. */ final class WirePermissionCollection extends PermissionCollection { @@ -415,12 +415,12 @@ /** * Determines if a set of permissions implies the permissions expressed in - * permission. + * {@code permission}. * * @param permission The Permission object to compare. * - * @return true if permission is a proper subset - * of a permission in the set; false otherwise. + * @return {@code true} if {@code permission} is a proper subset + * of a permission in the set; {@code false} otherwise. */ public boolean implies(Permission permission) { if (!(permission instanceof WirePermission)) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/cdma/ESNCondition.java osgi-compendium-4.3.0/src/org/osgi/util/cdma/ESNCondition.java --- osgi-compendium-4.2.0/src/org/osgi/util/cdma/ESNCondition.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/cdma/ESNCondition.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,106 +1,106 @@ -/* - * Copyright (c) OSGi Alliance (2007, 2009). 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.util.cdma; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.osgi.framework.Bundle; -import org.osgi.service.condpermadmin.Condition; -import org.osgi.service.condpermadmin.ConditionInfo; - -/** - * Class representing an ESN condition. Instances of this class contain a string - * value that is matched against the ESN of the device. - * - * @ThreadSafe - * @version $Revision: 6439 $ - */ -public class ESNCondition { - private static final String ORG_OSGI_UTIL_CDMA_ESN = "org.osgi.util.cdma.esn"; - private static final String ESN; - private static final int ESN_LENGTH = 8; - - static { - ESN = (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String esn = System.getProperty(ORG_OSGI_UTIL_CDMA_ESN); - if (esn == null) { - return null; - } - return esn.toUpperCase(); - } - }); - } - - private ESNCondition() { - // prevent instances being constructed - } - - /** - * Creates an ESNCondition object. - * - * @param bundle This parameter is ignored, as the ESN number is the - * property of the mobile device, and thus the same for all bundles. - * @param conditionInfo Contains the ESN value against which to match the - * device's ESN. Its {@link ConditionInfo#getArgs()} method should - * return a String array with one value, the ESN string. The ESN is 8 - * hexadecimal digits (32 bits) without hyphens. Limited pattern - * matching is allowed: the string is 0 to 7 digits, followed by an - * asterisk(*). - * @return A Condition object that indicates whether the specified ESN - * number matches that of the device. If the number ends with an - * asterisk ( *), then the beginning of the ESN is - * compared to the pattern. - * @throws IllegalArgumentException If the ESN is not a string of 8 - * hexadecimal digits, or 0 to 7 hexadecimal digits with an - * * at the end. - */ - public static Condition getCondition(Bundle bundle, - ConditionInfo conditionInfo) { - String esn = conditionInfo.getArgs()[0].toUpperCase(); - int length = esn.length(); - if (length > ESN_LENGTH) { - throw new IllegalArgumentException("ESN too long: " + esn); - } - if (esn.endsWith("*")) { - length--; - esn = esn.substring(0, length); - } - else { - if (length < ESN_LENGTH) { - throw new IllegalArgumentException("ESN too short: " + esn); - } - } - for (int i = 0; i < length; i++) { - char c = esn.charAt(i); - if (('0' <= c) && (c <= '9')) { - continue; - } - if (('A' <= c) && (c <= 'F')) { - continue; - } - throw new IllegalArgumentException("not a valid ESN: " + esn); - } - if (ESN == null) { - System.err - .println("The OSGi implementation of org.osgi.util.cdma.ESNCondition needs the system property " - + ORG_OSGI_UTIL_CDMA_ESN + " set."); - return Condition.FALSE; - } - return ESN.startsWith(esn) ? Condition.TRUE : Condition.FALSE; - } -} +/* + * Copyright (c) OSGi Alliance (2007, 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.util.cdma; + +import java.security.AccessController; +import java.security.PrivilegedAction; + +import org.osgi.framework.Bundle; +import org.osgi.service.condpermadmin.Condition; +import org.osgi.service.condpermadmin.ConditionInfo; + +/** + * Class representing an ESN condition. Instances of this class contain a string + * value that is matched against the ESN of the device. + * + * @ThreadSafe + * @version $Id: c3843b29b71c422622611f1961e9aa59aca93286 $ + */ +public class ESNCondition { + private static final String ORG_OSGI_UTIL_CDMA_ESN = "org.osgi.util.cdma.esn"; + private static final String ESN; + private static final int ESN_LENGTH = 8; + + static { + ESN = (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String esn = System.getProperty(ORG_OSGI_UTIL_CDMA_ESN); + if (esn == null) { + return null; + } + return esn.toUpperCase(); + } + }); + } + + private ESNCondition() { + // prevent instances being constructed + } + + /** + * Creates an ESNCondition object. + * + * @param bundle This parameter is ignored, as the ESN number is the + * property of the mobile device, and thus the same for all bundles. + * @param conditionInfo Contains the ESN value against which to match the + * device's ESN. Its {@link ConditionInfo#getArgs()} method should + * return a String array with one value, the ESN string. The ESN is 8 + * hexadecimal digits (32 bits) without hyphens. Limited pattern + * matching is allowed: the string is 0 to 7 digits, followed by an + * asterisk({@code *}). + * @return A Condition object that indicates whether the specified ESN + * number matches that of the device. If the number ends with an + * asterisk ( {@code *}), then the beginning of the ESN is + * compared to the pattern. + * @throws IllegalArgumentException If the ESN is not a string of 8 + * hexadecimal digits, or 0 to 7 hexadecimal digits with an + * {@code *} at the end. + */ + public static Condition getCondition(Bundle bundle, + ConditionInfo conditionInfo) { + String esn = conditionInfo.getArgs()[0].toUpperCase(); + int length = esn.length(); + if (length > ESN_LENGTH) { + throw new IllegalArgumentException("ESN too long: " + esn); + } + if (esn.endsWith("*")) { + length--; + esn = esn.substring(0, length); + } + else { + if (length < ESN_LENGTH) { + throw new IllegalArgumentException("ESN too short: " + esn); + } + } + for (int i = 0; i < length; i++) { + char c = esn.charAt(i); + if (('0' <= c) && (c <= '9')) { + continue; + } + if (('A' <= c) && (c <= 'F')) { + continue; + } + throw new IllegalArgumentException("not a valid ESN: " + esn); + } + if (ESN == null) { + System.err + .println("The OSGi implementation of org.osgi.util.cdma.ESNCondition needs the system property " + + ORG_OSGI_UTIL_CDMA_ESN + " set."); + return Condition.FALSE; + } + return ESN.startsWith(esn) ? Condition.TRUE : Condition.FALSE; + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/cdma/MEIDCondition.java osgi-compendium-4.3.0/src/org/osgi/util/cdma/MEIDCondition.java --- osgi-compendium-4.2.0/src/org/osgi/util/cdma/MEIDCondition.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/cdma/MEIDCondition.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,106 +1,106 @@ -/* - * Copyright (c) OSGi Alliance (2007, 2009). 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.util.cdma; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.osgi.framework.Bundle; -import org.osgi.service.condpermadmin.Condition; -import org.osgi.service.condpermadmin.ConditionInfo; - -/** - * Class representing an MEID condition. Instances of this class contain a - * string value that is matched against the MEID of the device. - * - * @ThreadSafe - * @version $Revision: 6439 $ - */ -public class MEIDCondition { - private static final String ORG_OSGI_UTIL_CDMA_MEID = "org.osgi.util.cdma.meid"; - private static final String MEID; - private static final int MEID_LENGTH = 14; - - static { - MEID = (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String meid = System.getProperty(ORG_OSGI_UTIL_CDMA_MEID); - if (meid == null) { - return null; - } - return meid.toUpperCase(); - } - }); - } - - private MEIDCondition() { - // prevent instances being constructed - } - - /** - * Creates a MEIDCondition object. - * - * @param bundle This parameter is ignored, as the MEID number is the - * property of the mobile device, and thus the same for all bundles. - * @param conditionInfo Contains the MEID value against which to match the - * device's MEID. Its {@link ConditionInfo#getArgs()} method should - * return a String array with one value, the MEID string. The MEID is - * 14 hexadecimal digits (56 bits) without hyphens. Limited pattern - * matching is allowed: the string is 0 to 13 digits, followed by an - * asterisk(*). - * @return A Condition object that indicates whether the specified MEID - * number matches that of the device. If the number ends with an - * asterisk ( *), then the beginning of the MEID is - * compared to the pattern. - * @throws IllegalArgumentException If the MEID is not a string of 14 - * hexadecimal digits, or 0 to 13 hexadecimal digits with an - * * at the end. - */ - public static Condition getCondition(Bundle bundle, - ConditionInfo conditionInfo) { - String meid = conditionInfo.getArgs()[0].toUpperCase(); - int length = meid.length(); - if (length > MEID_LENGTH) { - throw new IllegalArgumentException("MEID too long: " + meid); - } - if (meid.endsWith("*")) { - length--; - meid = meid.substring(0, length); - } - else { - if (length < MEID_LENGTH) { - throw new IllegalArgumentException("MEID too short: " + meid); - } - } - for (int i = 0; i < length; i++) { - char c = meid.charAt(i); - if (('0' <= c) && (c <= '9')) { - continue; - } - if (('A' <= c) && (c <= 'F')) { - continue; - } - throw new IllegalArgumentException("not a valid MEID: " + meid); - } - if (MEID == null) { - System.err - .println("The OSGi implementation of org.osgi.util.cdma.MEIDCondition needs the system property " - + ORG_OSGI_UTIL_CDMA_MEID + " set."); - return Condition.FALSE; - } - return MEID.startsWith(meid) ? Condition.TRUE : Condition.FALSE; - } -} +/* + * Copyright (c) OSGi Alliance (2007, 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.util.cdma; + +import java.security.AccessController; +import java.security.PrivilegedAction; + +import org.osgi.framework.Bundle; +import org.osgi.service.condpermadmin.Condition; +import org.osgi.service.condpermadmin.ConditionInfo; + +/** + * Class representing an MEID condition. Instances of this class contain a + * string value that is matched against the MEID of the device. + * + * @ThreadSafe + * @version $Id: 877d5933cf57f261a45a7b1313e64f2aad699801 $ + */ +public class MEIDCondition { + private static final String ORG_OSGI_UTIL_CDMA_MEID = "org.osgi.util.cdma.meid"; + private static final String MEID; + private static final int MEID_LENGTH = 14; + + static { + MEID = (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String meid = System.getProperty(ORG_OSGI_UTIL_CDMA_MEID); + if (meid == null) { + return null; + } + return meid.toUpperCase(); + } + }); + } + + private MEIDCondition() { + // prevent instances being constructed + } + + /** + * Creates a MEIDCondition object. + * + * @param bundle This parameter is ignored, as the MEID number is the + * property of the mobile device, and thus the same for all bundles. + * @param conditionInfo Contains the MEID value against which to match the + * device's MEID. Its {@link ConditionInfo#getArgs()} method should + * return a String array with one value, the MEID string. The MEID is + * 14 hexadecimal digits (56 bits) without hyphens. Limited pattern + * matching is allowed: the string is 0 to 13 digits, followed by an + * asterisk({@code *}). + * @return A Condition object that indicates whether the specified MEID + * number matches that of the device. If the number ends with an + * asterisk ( {@code *}), then the beginning of the MEID is + * compared to the pattern. + * @throws IllegalArgumentException If the MEID is not a string of 14 + * hexadecimal digits, or 0 to 13 hexadecimal digits with an + * {@code *} at the end. + */ + public static Condition getCondition(Bundle bundle, + ConditionInfo conditionInfo) { + String meid = conditionInfo.getArgs()[0].toUpperCase(); + int length = meid.length(); + if (length > MEID_LENGTH) { + throw new IllegalArgumentException("MEID too long: " + meid); + } + if (meid.endsWith("*")) { + length--; + meid = meid.substring(0, length); + } + else { + if (length < MEID_LENGTH) { + throw new IllegalArgumentException("MEID too short: " + meid); + } + } + for (int i = 0; i < length; i++) { + char c = meid.charAt(i); + if (('0' <= c) && (c <= '9')) { + continue; + } + if (('A' <= c) && (c <= 'F')) { + continue; + } + throw new IllegalArgumentException("not a valid MEID: " + meid); + } + if (MEID == null) { + System.err + .println("The OSGi implementation of org.osgi.util.cdma.MEIDCondition needs the system property " + + ORG_OSGI_UTIL_CDMA_MEID + " set."); + return Condition.FALSE; + } + return MEID.startsWith(meid) ? Condition.TRUE : Condition.FALSE; + } +} diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/cdma/package.html osgi-compendium-4.3.0/src/org/osgi/util/cdma/package.html --- osgi-compendium-4.2.0/src/org/osgi/util/cdma/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/cdma/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

        CDMA Conditions Package Version 1.0. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.util.cdma; version="[1.0,2.0)"
        -
        - diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/cdma/package-info.java osgi-compendium-4.3.0/src/org/osgi/util/cdma/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/util/cdma/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/cdma/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * CDMA Conditions Package Version 1.0. + * + *

        + * 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.util.cdma; version="[1.0,2.0)"} + * + * @version $Id: 9b1502f6f0b4da2b23e0c21592ab7a8d90dcf96c $ + */ + +package org.osgi.util.cdma; diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/gsm/IMEICondition.java osgi-compendium-4.3.0/src/org/osgi/util/gsm/IMEICondition.java --- osgi-compendium-4.2.0/src/org/osgi/util/gsm/IMEICondition.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/gsm/IMEICondition.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved. + * 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. @@ -27,7 +27,7 @@ * string value that is matched against the IMEI of the device. * * @ThreadSafe - * @version $Revision: 6439 $ + * @version $Id: a90a18242f31c6c36e5cdf8def7146ce85f92eaf $ */ public class IMEICondition { private static final String ORG_OSGI_UTIL_GSM_IMEI = "org.osgi.util.gsm.imei"; @@ -56,13 +56,13 @@ * return a String array with one value: the IMEI string. The IMEI is * 15 digits without hyphens. Limited pattern matching is allowed: * the string is 0 to 14 digits, followed by an asterisk ( - * *). + * {@code *}). * @return A Condition object that indicates whether the specified IMEI * number matches that of the device. If the number ends with an - * asterisk ( *), then the beginning of the IMEI is + * asterisk ( {@code *}), then the beginning of the IMEI is * compared to the pattern. * @throws IllegalArgumentException If the IMEI is not a string of 15 - * digits, or 0 to 14 digits with an * at the end. + * digits, or 0 to 14 digits with an {@code *} at the end. */ public static Condition getCondition(Bundle bundle, ConditionInfo conditionInfo) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/gsm/IMSICondition.java osgi-compendium-4.3.0/src/org/osgi/util/gsm/IMSICondition.java --- osgi-compendium-4.2.0/src/org/osgi/util/gsm/IMSICondition.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/gsm/IMSICondition.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved. + * 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. @@ -27,7 +27,7 @@ * string value that is matched against the IMSI of the subscriber. * * @ThreadSafe - * @version $Revision: 6439 $ + * @version $Id: a7f5f41f64a54dd1a9989de9aa7f8df6434322c4 $ */ public class IMSICondition { private static final String ORG_OSGI_UTIL_GSM_IMSI = "org.osgi.util.gsm.imsi"; @@ -56,13 +56,13 @@ * should return a String array with one value: the IMSI string. The * IMSI is 15 digits without hyphens. Limited pattern matching is * allowed: the string is 0 to 14 digits, followed by an asterisk ( - * *). + * {@code *}). * @return A Condition object that indicates whether the specified IMSI * number matches that of the subscriber. If the number ends with an - * asterisk (*), then the beginning of the IMSI is + * asterisk ({@code *}), then the beginning of the IMSI is * compared to the pattern. * @throws IllegalArgumentException If the IMSI is not a string of 15 - * digits, or 0 to 14 digits with an * at the end. + * digits, or 0 to 14 digits with an {@code *} at the end. */ public static Condition getCondition(Bundle bundle, ConditionInfo conditionInfo) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/gsm/package.html osgi-compendium-4.3.0/src/org/osgi/util/gsm/package.html --- osgi-compendium-4.2.0/src/org/osgi/util/gsm/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/gsm/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

        Mobile GSM Conditions Package Version 1.0. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.util.gsm; version="[1.0,2.0)"
        -
        - diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/gsm/package-info.java osgi-compendium-4.3.0/src/org/osgi/util/gsm/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/util/gsm/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/gsm/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * Mobile GSM Conditions Package Version 1.0. + * + *

        + * 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.util.gsm; version="[1.0,2.0)"} + * + * @version $Id: 8e63ad78028f0ec5c63f022ecbfe0fdb83c1b217 $ + */ + +package org.osgi.util.gsm; diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/measurement/Measurement.java osgi-compendium-4.3.0/src/org/osgi/util/measurement/Measurement.java --- osgi-compendium-4.2.0/src/org/osgi/util/measurement/Measurement.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/measurement/Measurement.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -19,7 +19,7 @@ * Represents a value with an error, a unit and a time-stamp. * *

        - * A Measurement object is used for maintaining the tuple of value, + * A {@code Measurement} object is used for maintaining the tuple of value, * error, unit and time-stamp. The value and error are represented as doubles * and the time is measured in milliseconds since midnight, January 1, 1970 UTC. * @@ -37,30 +37,30 @@ * 95% or more of the time. * *

        - * A Measurement object is immutable in order to be easily shared. + * A {@code Measurement} object is immutable in order to be easily shared. * *

        * Note: This class has a natural ordering that is inconsistent with equals. See - * {@link #compareTo}. + * {@link #compareTo(Object)}. * * @Immutable - * @version $Revision: 5715 $ + * @version $Id: 6715f49ff255b277c064308fe9364c0ceabcb7c2 $ */ public class Measurement implements Comparable { - private final double value; - private final double error; - private final long time; - private final Unit unit; - private transient volatile String name; - private transient volatile int hashCode; + private final double value; + private final double error; + private final long time; + private final Unit unit; + private transient String name; + private transient int hashCode; /** - * Create a new Measurement object. - * - * @param value The value of the Measurement. - * @param error The error of the Measurement. - * @param unit The Unit object in which the value is measured. If - * this argument is null, then the unit will be set to + * Create a new {@code Measurement} object. + * + * @param value The value of the {@code Measurement}. + * @param error The error of the {@code Measurement}. + * @param unit The {@code Unit} object in which the value is measured. If + * this argument is {@code null}, then the unit will be set to * {@link Unit#unity}. * @param time The time measured in milliseconds since midnight, January 1, * 1970 UTC. @@ -70,15 +70,17 @@ this.error = Math.abs(error); this.unit = (unit != null) ? unit : Unit.unity; this.time = time; + name = null; + hashCode = 0; } /** - * Create a new Measurement object with a time of zero. + * Create a new {@code Measurement} object with a time of zero. * - * @param value The value of the Measurement. - * @param error The error of the Measurement. - * @param unit The Unit object in which the value is measured. If - * this argument is null, then the unit will be set to + * @param value The value of the {@code Measurement}. + * @param error The error of the {@code Measurement}. + * @param unit The {@code Unit} object in which the value is measured. If + * this argument is {@code null}, then the unit will be set to * {@link Unit#unity}. */ public Measurement(double value, double error, Unit unit) { @@ -86,12 +88,12 @@ } /** - * Create a new Measurement object with an error of 0.0 and a + * Create a new {@code Measurement} object with an error of 0.0 and a * time of zero. * - * @param value The value of the Measurement. - * @param unit The Unit in which the value is measured. If this - * argument is null, then the unit will be set to + * @param value The value of the {@code Measurement}. + * @param unit The {@code Unit} in which the value is measured. If this + * argument is {@code null}, then the unit will be set to * {@link Unit#unity}. */ public Measurement(double value, Unit unit) { @@ -99,38 +101,38 @@ } /** - * Create a new Measurement object with an error of 0.0, a unit + * Create a new {@code Measurement} object with an error of 0.0, a unit * of {@link Unit#unity} and a time of zero. * - * @param value The value of the Measurement. + * @param value The value of the {@code Measurement}. */ public Measurement(double value) { this(value, 0.0d, null, 0l); } /** - * Returns the value of this Measurement object. + * Returns the value of this {@code Measurement} object. * - * @return The value of this Measurement object as a double. + * @return The value of this {@code Measurement} object as a double. */ public final double getValue() { return value; } /** - * Returns the error of this Measurement object. The error is + * Returns the error of this {@code Measurement} object. The error is * always a positive value. * - * @return The error of this Measurement as a double. + * @return The error of this {@code Measurement} as a double. */ public final double getError() { return error; } /** - * Returns the Unit object of this Measurement object. + * Returns the {@code Unit} object of this {@code Measurement} object. * - * @return The Unit object of this Measurement object. + * @return The {@code Unit} object of this {@code Measurement} object. * * @see Unit */ @@ -139,11 +141,11 @@ } /** - * Returns the time at which this Measurement object was taken. + * Returns the time at which this {@code Measurement} object was taken. * The time is measured in milliseconds since midnight, January 1, 1970 UTC, * or zero when not defined. * - * @return The time at which this Measurement object was taken or + * @return The time at which this {@code Measurement} object was taken or * zero. */ public final long getTime() { @@ -151,16 +153,16 @@ } /** - * Returns a new Measurement object that is the product of this + * Returns a new {@code Measurement} object that is the product of this * object multiplied by the specified object. * - * @param m The Measurement object that will be multiplied with + * @param m The {@code Measurement} object that will be multiplied with * this object. - * @return A new Measurement that is the product of this object + * @return A new {@code Measurement} that is the product of this object * multiplied by the specified object. The error and unit of the new * object are computed. The time of the new object is set to the * time of this object. - * @throws ArithmeticException If the Unit objects of this object + * @throws ArithmeticException If the {@code Unit} objects of this object * and the specified object cannot be multiplied. * @see Unit */ @@ -171,12 +173,12 @@ } /** - * Returns a new Measurement object that is the product of this + * Returns a new {@code Measurement} object that is the product of this * object multiplied by the specified value. * * @param d The value that will be multiplied with this object. - * @param u The Unit of the specified value. - * @return A new Measurement object that is the product of this + * @param u The {@code Unit} of the specified value. + * @return A new {@code Measurement} object that is the product of this * object multiplied by the specified value. The error and unit of * the new object are computed. The time of the new object is set to * the time of this object. @@ -190,11 +192,11 @@ } /** - * Returns a new Measurement object that is the product of this + * Returns a new {@code Measurement} object that is the product of this * object multiplied by the specified value. * * @param d The value that will be multiplied with this object. - * @return A new Measurement object that is the product of this + * @return A new {@code Measurement} object that is the product of this * object multiplied by the specified value. The error of the new * object is computed. The unit and time of the new object is set to * the unit and time of this object. @@ -204,16 +206,16 @@ } /** - * Returns a new Measurement object that is the quotient of this + * Returns a new {@code Measurement} object that is the quotient of this * object divided by the specified object. * - * @param m The Measurement object that will be the divisor of + * @param m The {@code Measurement} object that will be the divisor of * this object. - * @return A new Measurement object that is the quotient of this + * @return A new {@code Measurement} object that is the quotient of this * object divided by the specified object. The error and unit of the * new object are computed. The time of the new object is set to the * time of this object. - * @throws ArithmeticException If the Unit objects of this object + * @throws ArithmeticException If the {@code Unit} objects of this object * and the specified object cannot be divided. * @see Unit */ @@ -225,16 +227,16 @@ } /** - * Returns a new Measurement object that is the quotient of this + * Returns a new {@code Measurement} object that is the quotient of this * object divided by the specified value. * * @param d The value that will be the divisor of this object. - * @param u The Unit object of the specified value. - * @return A new Measurement that is the quotient of this object + * @param u The {@code Unit} object of the specified value. + * @return A new {@code Measurement} that is the quotient of this object * divided by the specified value. The error and unit of the new * object are computed. The time of the new object is set to the * time of this object. - * @throws ArithmeticException If the Unit objects of this object + * @throws ArithmeticException If the {@code Unit} objects of this object * and the specified object cannot be divided. * @see Unit */ @@ -244,32 +246,32 @@ } /** - * Returns a new Measurement object that is the quotient of this + * Returns a new {@code Measurement} object that is the quotient of this * object divided by the specified value. * * @param d The value that will be the divisor of this object. - * @return A new Measurement object that is the quotient of this + * @return A new {@code Measurement} object that is the quotient of this * object divided by the specified value. The error of the new * object is computed. The unit and time of the new object is set to - * the Unit and time of this object. + * the {@code Unit} and time of this object. */ public Measurement div(double d) { return new Measurement(value / d, error / Math.abs(d), unit, time); } /** - * Returns a new Measurement object that is the sum of this + * Returns a new {@code Measurement} object that is the sum of this * object added to the specified object. * * The error and unit of the new object are computed. The time of the new * object is set to the time of this object. * - * @param m The Measurement object that will be added with this + * @param m The {@code Measurement} object that will be added with this * object. - * @return A new Measurement object that is the sum of this and + * @return A new {@code Measurement} object that is the sum of this and * m. * @see Unit - * @throws ArithmeticException If the Unit objects of this object + * @throws ArithmeticException If the {@code Unit} objects of this object * and the specified object cannot be added. */ public Measurement add(Measurement m) { @@ -278,16 +280,16 @@ } /** - * Returns a new Measurement object that is the sum of this + * Returns a new {@code Measurement} object that is the sum of this * object added to the specified value. * * @param d The value that will be added with this object. - * @param u The Unit object of the specified value. - * @return A new Measurement object that is the sum of this + * @param u The {@code Unit} object of the specified value. + * @return A new {@code Measurement} object that is the sum of this * object added to the specified value. The unit of the new object * is computed. The error and time of the new object is set to the * error and time of this object. - * @throws ArithmeticException If the Unit objects of this object + * @throws ArithmeticException If the {@code Unit} objects of this object * and the specified value cannot be added. * @see Unit */ @@ -296,13 +298,13 @@ } /** - * Returns a new Measurement object that is the sum of this + * Returns a new {@code Measurement} object that is the sum of this * object added to the specified value. * * @param d The value that will be added with this object. - * @return A new Measurement object that is the sum of this + * @return A new {@code Measurement} object that is the sum of this * object added to the specified value. The error, unit, and time of - * the new object is set to the error, Unit and time of + * the new object is set to the error, {@code Unit} and time of * this object. */ public Measurement add(double d) { @@ -310,16 +312,16 @@ } /** - * Returns a new Measurement object that is the subtraction of + * Returns a new {@code Measurement} object that is the subtraction of * the specified object from this object. * - * @param m The Measurement object that will be subtracted from + * @param m The {@code Measurement} object that will be subtracted from * this object. - * @return A new Measurement object that is the subtraction of + * @return A new {@code Measurement} object that is the subtraction of * the specified object from this object. The error and unit of the * new object are computed. The time of the new object is set to the * time of this object. - * @throws ArithmeticException If the Unit objects of this object + * @throws ArithmeticException If the {@code Unit} objects of this object * and the specified object cannot be subtracted. * @see Unit */ @@ -329,16 +331,16 @@ } /** - * Returns a new Measurement object that is the subtraction of + * Returns a new {@code Measurement} object that is the subtraction of * the specified value from this object. * * @param d The value that will be subtracted from this object. - * @param u The Unit object of the specified value. - * @return A new Measurement object that is the subtraction of + * @param u The {@code Unit} object of the specified value. + * @return A new {@code Measurement} object that is the subtraction of * the specified value from this object. The unit of the new object * is computed. The error and time of the new object is set to the * error and time of this object. - * @throws ArithmeticException If the Unit objects of this object + * @throws ArithmeticException If the {@code Unit} objects of this object * and the specified object cannot be subtracted. * @see Unit */ @@ -347,13 +349,13 @@ } /** - * Returns a new Measurement object that is the subtraction of + * Returns a new {@code Measurement} object that is the subtraction of * the specified value from this object. * * @param d The value that will be subtracted from this object. - * @return A new Measurement object that is the subtraction of + * @return A new {@code Measurement} object that is the subtraction of * the specified value from this object. The error, unit and time of - * the new object is set to the error, Unit object and + * the new object is set to the error, {@code Unit} object and * time of this object. */ public Measurement sub(double d) { @@ -361,10 +363,10 @@ } /** - * Returns a String object representing this Measurement + * Returns a {@code String} object representing this {@code Measurement} * object. * - * @return a String object representing this Measurement + * @return a {@code String} object representing this {@code Measurement} * object. */ public String toString() { @@ -394,23 +396,23 @@ * *

        * Note: This class has a natural ordering that is inconsistent with equals. - * For this method, another Measurement object is considered - * equal if there is some x such that + * For this method, another {@code Measurement} object is considered + * equal if there is some {@code x} such that * *

         	 * getValue() - getError() <= x <= getValue() + getError()
         	 * 
        * - * for both Measurement objects being compared. + * for both {@code Measurement} objects being compared. * * @param obj The object to be compared. * @return A negative integer, zero, or a positive integer if this object is * less than, equal to, or greater than the specified object. * * @throws ClassCastException If the specified object is not of type - * Measurement. + * {@code Measurement}. * @throws ArithmeticException If the unit of the specified - * Measurement object is not equal to the Unit + * {@code Measurement} object is not equal to the {@code Unit} * object of this object. */ public int compareTo(Object obj) { @@ -458,16 +460,16 @@ /** * Returns whether the specified object is equal to this object. Two - * Measurement objects are equal if they have same value, error - * and Unit. + * {@code Measurement} objects are equal if they have same value, error and + * {@code Unit}. * *

        * Note: This class has a natural ordering that is inconsistent with equals. - * See {@link #compareTo}. + * See {@link #compareTo(Object)}. * * @param obj The object to compare with this object. - * @return true if this object is equal to the specified object; - * false otherwise. + * @return {@code true} if this object is equal to the specified object; + * {@code false} otherwise. */ public boolean equals(Object obj) { if (this == obj) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/measurement/package.html osgi-compendium-4.3.0/src/org/osgi/util/measurement/package.html --- osgi-compendium-4.2.0/src/org/osgi/util/measurement/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/measurement/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

        Measurement Package Version 1.0. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.util.measurement; version="[1.0,2.0)"
        -
        - diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/measurement/package-info.java osgi-compendium-4.3.0/src/org/osgi/util/measurement/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/util/measurement/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/measurement/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * Measurement Package Version 1.0. + * + *

        + * 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.util.measurement; version="[1.0,2.0)"} + * + * @version $Id: 55a13a30edfa606fcb43f3ec94b10ba80ec58780 $ + */ + +package org.osgi.util.measurement; diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/measurement/State.java osgi-compendium-4.3.0/src/org/osgi/util/measurement/State.java --- osgi-compendium-4.2.0/src/org/osgi/util/measurement/State.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/measurement/State.java 2011-05-16 12:29:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -23,10 +23,10 @@ * milliseconds since midnight, January 1, 1970 UTC. * *

        - * A State object is immutable so that it may be easily shared. + * A {@code State} object is immutable so that it may be easily shared. * * @Immutable - * @version $Revision: 5715 $ + * @version $Id: ff96b95ce2466f6b5a90daeb07560f6fb8a930cb $ */ public class State { private final int value; @@ -34,7 +34,7 @@ private final String name; /** - * Create a new State object. + * Create a new {@code State} object. * * @param value The value of the state. * @param name The name of the state. @@ -48,7 +48,7 @@ } /** - * Create a new State object with a time of 0. + * Create a new {@code State} object with a time of 0. * * @param value The value of the state. * @param name The name of the state. @@ -58,18 +58,18 @@ } /** - * Returns the value of this State. + * Returns the value of this {@code State}. * - * @return The value of this State object. + * @return The value of this {@code State} object. */ public final int getValue() { return value; } /** - * Returns the time with which this State was created. + * Returns the time with which this {@code State} was created. * - * @return The time with which this State was created. The time + * @return The time with which this {@code State} was created. The time * is measured in milliseconds since midnight, January 1, 1970 UTC. */ public final long getTime() { @@ -77,18 +77,18 @@ } /** - * Returns the name of this State. + * Returns the name of this {@code State}. * - * @return The name of this State object. + * @return The name of this {@code State} object. */ public final String getName() { return name; } /** - * Returns a String object representing this object. + * Returns a {@code String} object representing this object. * - * @return a String object representing this object. + * @return a {@code String} object representing this object. */ public String toString() { StringBuffer sb = new StringBuffer(); @@ -98,7 +98,7 @@ sb.append(name); sb.append("\""); } - return (sb.toString()); + return sb.toString(); } /** @@ -116,11 +116,11 @@ /** * Return whether the specified object is equal to this object. Two - * State objects are equal if they have same value and name. + * {@code State} objects are equal if they have same value and name. * * @param obj The object to compare with this object. - * @return true if this object is equal to the specified object; - * false otherwise. + * @return {@code true} if this object is equal to the specified object; + * {@code false} otherwise. */ public boolean equals(Object obj) { if (this == obj) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/measurement/Unit.java osgi-compendium-4.3.0/src/org/osgi/util/measurement/Unit.java --- osgi-compendium-4.2.0/src/org/osgi/util/measurement/Unit.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/measurement/Unit.java 2011-09-08 14:18:36.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2011). 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. @@ -26,10 +26,10 @@ *

        * This class only support exponents for the base SI units in the range -64 to * +63. Any operation which produces an exponent outside of this range will - * result in a Unit object with undefined exponents. + * result in a {@code Unit} object with undefined exponents. * * @Immutable - * @version $Revision: 5715 $ + * @version $Id: dedb36f602146903fcf89a6f972e816df60d78f0 $ */ /* * This local class maintains the information about units. It can calculate new @@ -285,10 +285,10 @@ private final long type; /** - * Creates a new Unit instance. + * Creates a new {@code Unit} instance. * - * @param name the name of the Unit - * @param type the type of the Unit + * @param name the name of the {@code Unit} + * @param type the type of the {@code Unit} */ private Unit(String name, long type) { if (name == null) { @@ -303,28 +303,28 @@ * Create a type field from the base SI unit exponent values. * */ - private static long createType(int x, int rad, int cd, int mol, int A, - int K, int kg, int s, int m) { - return (((ZERO + m) & MASK) << m_SHIFT) - | (((ZERO + s) & MASK) << s_SHIFT) - | (((ZERO + kg) & MASK) << kg_SHIFT) - | (((ZERO + K) & MASK) << K_SHIFT) - | (((ZERO + A) & MASK) << A_SHIFT) - | (((ZERO + mol) & MASK) << mol_SHIFT) - | (((ZERO + cd) & MASK) << cd_SHIFT) - | (((ZERO + rad) & MASK) << rad_SHIFT) - | (((long) x) << x_SHIFT); + private static long createType(int _x, int _rad, int _cd, int _mol, int _A, + int _K, int _kg, int _s, int _m) { + return (((ZERO + _m) & MASK) << m_SHIFT) + | (((ZERO + _s) & MASK) << s_SHIFT) + | (((ZERO + _kg) & MASK) << kg_SHIFT) + | (((ZERO + _K) & MASK) << K_SHIFT) + | (((ZERO + _A) & MASK) << A_SHIFT) + | (((ZERO + _mol) & MASK) << mol_SHIFT) + | (((ZERO + _cd) & MASK) << cd_SHIFT) + | (((ZERO + _rad) & MASK) << rad_SHIFT) + | (((long) _x) << x_SHIFT); } /** - * Checks whether this Unit object is equal to the specified - * Unit object. The Unit objects are considered equal + * Checks whether this {@code Unit} object is equal to the specified + * {@code Unit} object. The {@code Unit} objects are considered equal * if their exponents are equal. * - * @param obj the Unit object that should be checked for equality + * @param obj the {@code Unit} object that should be checked for equality * - * @return true if the specified Unit object is equal to this - * Unit object. + * @return true if the specified {@code Unit} object is equal to this + * {@code Unit} object. */ public boolean equals(Object obj) { if (this == obj) { @@ -346,18 +346,18 @@ } /** - * Returns a new Unit that is the multiplication of this - * Unit and the Unit specified + * Returns a new {@code Unit} that is the multiplication of this + * {@code Unit} and the {@code Unit} specified * - * @param that the Unit that will be multiplied with this - * Unit + * @param that the {@code Unit} that will be multiplied with this + * {@code Unit} * - * @return a new Unit that is the multiplication of this - * Unit and the Unit specified + * @return a new {@code Unit} that is the multiplication of this + * {@code Unit} and the {@code Unit} specified * - * @throws RuntimeException if both Unit s are special + * @throws RuntimeException if both {@code Unit} s are special * - * @see Unit#isSpecial + * @see Unit#isSpecial() */ Unit mul(Unit that) { if (this.isSpecial() && that.isSpecial()) { @@ -368,17 +368,16 @@ } /** - * Returns a new Unit that is the division of this Unit - * and the Unit specified + * Returns a new {@code Unit} that is the division of this {@code Unit} and + * the {@code Unit} specified * - * @param that the Unit that this Unit will be divided - * with - * @return a new Unit that is the division of this Unit - * and the Unit specified + * @param that the {@code Unit} that this {@code Unit} will be divided with + * @return a new {@code Unit} that is the division of this {@code Unit} and + * the {@code Unit} specified * - * @throws RuntimeException if both Unit s are special + * @throws RuntimeException if both {@code Unit} s are special * - * @see Unit#isSpecial + * @see Unit#isSpecial() */ Unit div(Unit that) { if (this.isSpecial() && that.isSpecial()) { @@ -392,16 +391,16 @@ } /** - * Returns a new Unit that is the addition of this Unit - * and the Unit specified. + * Returns a new {@code Unit} that is the addition of this {@code Unit} + * and the {@code Unit} specified. * - * @param that the Unit that should be added to this - * Unit + * @param that the {@code Unit} that should be added to this + * {@code Unit} * - * @return a new Unit that is the addition of this Unit - * and the Unit specified. + * @return a new {@code Unit} that is the addition of this {@code Unit} + * and the {@code Unit} specified. * - * @throws RuntimeException if the two Unit s are not the same + * @throws RuntimeException if the two {@code Unit} s are not the same */ Unit add(Unit that) { if (!this.equals(that)) { @@ -411,16 +410,16 @@ } /** - * Returns a new Unit that is the subtraction between this - * Unit and the Unit specified. + * Returns a new {@code Unit} that is the subtraction between this + * {@code Unit} and the {@code Unit} specified. * - * @param that the Unit that will be subtracted from this - * Unit - * @return a new Unit that is the subtraction between this - * Unit and the Unit specified. + * @param that the {@code Unit} that will be subtracted from this + * {@code Unit} + * @return a new {@code Unit} that is the subtraction between this + * {@code Unit} and the {@code Unit} specified. * - * @throws RuntimeException if the Unit specified is not the same - * as this Unit + * @throws RuntimeException if the {@code Unit} specified is not the same + * as this {@code Unit} */ Unit sub(Unit that) { if (!this.equals(that)) { @@ -431,13 +430,13 @@ } /** - * Finds a Unit based on a type. If the Unit is not + * Finds a {@code Unit} based on a type. If the {@code Unit} is not * found, it will be created and added to the list of all units under a null * name. * - * @param type the type of the Unit to find + * @param type the type of the {@code Unit} to find * - * @return the Unit + * @return the {@code Unit} */ static synchronized Unit find(long type) { if (base == null) { @@ -457,33 +456,33 @@ } /** - * Returns a String object representing the Unit + * Returns a {@code String} object representing the {@code Unit} * - * @return A String object representing the Unit + * @return A {@code String} object representing the {@code Unit} */ public String toString() { return name; } private static String computeName(long type) { - int m = (int) (((type >> m_SHIFT) & MASK) - ZERO); - int s = (int) (((type >> s_SHIFT) & MASK) - ZERO); - int kg = (int) (((type >> kg_SHIFT) & MASK) - ZERO); - int K = (int) (((type >> K_SHIFT) & MASK) - ZERO); - int A = (int) (((type >> A_SHIFT) & MASK) - ZERO); - int mol = (int) (((type >> mol_SHIFT) & MASK) - ZERO); - int cd = (int) (((type >> cd_SHIFT) & MASK) - ZERO); - int rad = (int) (((type >> rad_SHIFT) & MASK) - ZERO); + int _m = (int) (((type >> m_SHIFT) & MASK) - ZERO); + int _s = (int) (((type >> s_SHIFT) & MASK) - ZERO); + int _kg = (int) (((type >> kg_SHIFT) & MASK) - ZERO); + int _K = (int) (((type >> K_SHIFT) & MASK) - ZERO); + int _A = (int) (((type >> A_SHIFT) & MASK) - ZERO); + int _mol = (int) (((type >> mol_SHIFT) & MASK) - ZERO); + int _cd = (int) (((type >> cd_SHIFT) & MASK) - ZERO); + int _rad = (int) (((type >> rad_SHIFT) & MASK) - ZERO); StringBuffer numerator = new StringBuffer(); StringBuffer denominator = new StringBuffer(); - addSIname(m, "m", numerator, denominator); - addSIname(s, "s", numerator, denominator); - addSIname(kg, "kg", numerator, denominator); - addSIname(K, "K", numerator, denominator); - addSIname(A, "A", numerator, denominator); - addSIname(mol, "mol", numerator, denominator); - addSIname(cd, "cd", numerator, denominator); - addSIname(rad, "rad", numerator, denominator); + addSIname(_m, "m", numerator, denominator); + addSIname(_s, "s", numerator, denominator); + addSIname(_kg, "kg", numerator, denominator); + addSIname(_K, "K", numerator, denominator); + addSIname(_A, "A", numerator, denominator); + addSIname(_mol, "mol", numerator, denominator); + addSIname(_cd, "cd", numerator, denominator); + addSIname(_rad, "rad", numerator, denominator); if (denominator.length() > 0) { if (numerator.length() == 0) { numerator.append("1"); diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/mobile/package.html osgi-compendium-4.3.0/src/org/osgi/util/mobile/package.html --- osgi-compendium-4.2.0/src/org/osgi/util/mobile/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/mobile/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

        Mobile Conditions Package Version 1.0. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.util.mobile; version="[1.0,2.0)"
        -
        - diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/mobile/package-info.java osgi-compendium-4.3.0/src/org/osgi/util/mobile/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/util/mobile/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/mobile/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * Mobile Conditions Package Version 1.0. + * + *

        + * 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.util.mobile; version="[1.0,2.0)"} + * + * @version $Id: aa6a6e641780a8a9b8c7ac6b5e59cb9441b811b7 $ + */ + +package org.osgi.util.mobile; diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/mobile/UserPromptCondition.java osgi-compendium-4.3.0/src/org/osgi/util/mobile/UserPromptCondition.java --- osgi-compendium-4.2.0/src/org/osgi/util/mobile/UserPromptCondition.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/mobile/UserPromptCondition.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved. + * 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. @@ -75,7 +75,7 @@ * * @return The requested UserPromptCondition. * @throws IllegalArgumentException if the parameters are malformed. - * @throws NullPointerException if one of the parameters is null. + * @throws NullPointerException if one of the parameters is {@code null}. */ public static Condition getCondition(Bundle bundle,ConditionInfo conditionInfo) { diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/position/package.html osgi-compendium-4.3.0/src/org/osgi/util/position/package.html --- osgi-compendium-4.2.0/src/org/osgi/util/position/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/position/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

        Position Package Version 1.0. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.util.position; version="[1.0,2.0)"
        -
        - diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/position/package-info.java osgi-compendium-4.3.0/src/org/osgi/util/position/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/util/position/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/position/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * Position Package Version 1.0. + * + *

        + * 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.util.position; version="[1.0,2.0)"} + * + * @version $Id: 41629cc3bc0ef1e0ee324a85c01fa537e6bd2a87 $ + */ + +package org.osgi.util.position; diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/position/Position.java osgi-compendium-4.3.0/src/org/osgi/util/position/Position.java --- osgi-compendium-4.2.0/src/org/osgi/util/position/Position.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/position/Position.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2009). All Rights Reserved. + * 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. @@ -22,7 +22,7 @@ * Position represents a geographic location, based on the WGS84 System (World * Geodetic System 1984). *

        - * The org.osgi.util.measurement.Measurement class is used to + * The {@code org.osgi.util.measurement.Measurement} class is used to * represent the values that make up a position. *

        *

        @@ -32,10 +32,10 @@ * Position does not override the implementation of either equals() or * hashCode() because it is not clear how missing values should be handled. It * is up to the user of a position to determine how best to compare two position - * objects. A Position object is immutable. + * objects. A {@code Position} object is immutable. * * @Immutable - * @version $Revision: 6860 $ + * @version $Id: 85f546ae0d82caa22d370a8dff0aeea2a595efa5 $ */ public class Position { private final Measurement altitude; @@ -45,17 +45,17 @@ private final Measurement track; /** - * Constructs a Position object with the given values. + * Constructs a {@code Position} object with the given values. * - * @param lat a Measurement object specifying the latitude in + * @param lat a {@code Measurement} object specifying the latitude in * radians, or null - * @param lon a Measurement object specifying the longitude in + * @param lon a {@code Measurement} object specifying the longitude in * radians, or null - * @param alt a Measurement object specifying the altitude in + * @param alt a {@code Measurement} object specifying the altitude in * meters, or null - * @param speed a Measurement object specifying the speed in + * @param speed a {@code Measurement} object specifying the speed in * meters per second, or null - * @param track a Measurement object specifying the track in + * @param track a {@code Measurement} object specifying the track in * radians, or null */ public Position(Measurement lat, Measurement lon, Measurement alt, @@ -150,8 +150,8 @@ /** * Returns the altitude of this position in meters. * - * @return a Measurement object in Unit.m representing - * the altitude in meters above the ellipsoid null if the + * @return a {@code Measurement} object in {@code Unit.m} representing + * the altitude in meters above the ellipsoid {@code null} if the * altitude is not known. */ public Measurement getAltitude() { @@ -161,8 +161,8 @@ /** * Returns the longitude of this position in radians. * - * @return a Measurement object in Unit.rad - * representing the longitude, or null if the longitude + * @return a {@code Measurement} object in {@code Unit.rad} + * representing the longitude, or {@code null} if the longitude * is not known. */ public Measurement getLongitude() { @@ -172,8 +172,8 @@ /** * Returns the latitude of this position in radians. * - * @return a Measurement object in Unit.rad - * representing the latitude, or null if the latitude is + * @return a {@code Measurement} object in {@code Unit.rad} + * representing the latitude, or {@code null} if the latitude is * not known.. */ public Measurement getLatitude() { @@ -183,8 +183,8 @@ /** * Returns the ground speed of this position in meters per second. * - * @return a Measurement object in Unit.m_s - * representing the speed, or null if the speed is not + * @return a {@code Measurement} object in {@code Unit.m_s} + * representing the speed, or {@code null} if the speed is not * known.. */ public Measurement getSpeed() { @@ -196,8 +196,8 @@ * track is the extrapolation of previous previously measured positions to a * future position. * - * @return a Measurement object in Unit.rad - * representing the track, or null if the track is not + * @return a {@code Measurement} object in {@code Unit.rad} + * representing the track, or {@code null} if the track is not * known.. */ public Measurement getTrack() { diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/AbstractTracked.java osgi-compendium-4.3.0/src/org/osgi/util/tracker/AbstractTracked.java --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/AbstractTracked.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/AbstractTracked.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2007, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2007, 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. @@ -30,11 +30,14 @@ * tracked items. This is not a public class. It is only for use by the * implementation of the Tracker class. * + * @param The tracked item. It is the key. + * @param The value mapped to the tracked item. + * @param The reason the tracked item is being tracked or untracked. * @ThreadSafe - * @version $Revision: 5871 $ + * @version $Id: 79452e6c28683021f2bcf11d3689ec75c6b5642f $ * @since 1.4 */ -abstract class AbstractTracked { +abstract class AbstractTracked { /* set this to true to compile in debug messages */ static final boolean DEBUG = false; @@ -43,7 +46,7 @@ * * @GuardedBy this */ - private final Map tracked; + private final Map tracked; /** * Modification count. This field is initialized to zero and incremented by @@ -67,7 +70,7 @@ * * @GuardedBy this */ - private final List adding; + private final List adding; /** * true if the tracked object is closed. @@ -94,16 +97,16 @@ * * @GuardedBy this */ - private final LinkedList initial; + private final LinkedList initial; /** * AbstractTracked constructor. */ AbstractTracked() { - tracked = new HashMap(); + tracked = new HashMap(); trackingCount = 0; - adding = new ArrayList(6); - initial = new LinkedList(); + adding = new ArrayList(6); + initial = new LinkedList(); closed = false; } @@ -114,17 +117,15 @@ * This method must be called from Tracker's open method while synchronized * on this object in the same synchronized block as the add listener call. * - * @param list The initial list of items to be tracked. null + * @param list The initial list of items to be tracked. {@code null} * entries in the list are ignored. * @GuardedBy this */ - void setInitial(Object[] list) { + void setInitial(S[] list) { if (list == null) { return; } - int size = list.length; - for (int i = 0; i < size; i++) { - Object item = list[i]; + for (S item : list) { if (item == null) { continue; } @@ -145,7 +146,7 @@ */ void trackInitial() { while (true) { - Object item; + S item; synchronized (this) { if (closed || (initial.size() == 0)) { /* @@ -202,8 +203,8 @@ * @param item Item to be tracked. * @param related Action related object. */ - void track(final Object item, final Object related) { - final Object object; + void track(final S item, final R related) { + final T object; synchronized (this) { if (closed) { return; @@ -250,11 +251,11 @@ * @param item Item to be tracked. * @param related Action related object. */ - private void trackAdding(final Object item, final Object related) { + private void trackAdding(final S item, final R related) { if (DEBUG) { System.out.println("AbstractTracked.trackAdding: " + item); //$NON-NLS-1$ } - Object object = null; + T object = null; boolean becameUntracked = false; /* Call customizer outside of synchronized region */ try { @@ -305,8 +306,8 @@ * @param item Item to be untracked. * @param related Action related object. */ - void untrack(final Object item, final Object related) { - final Object object; + void untrack(final S item, final R related) { + final T object; synchronized (this) { if (initial.remove(item)) { /* * if this item is already in the list @@ -367,6 +368,18 @@ } /** + * Returns if the tracker is empty. + * + * @return Whether the tracker is empty. + * + * @GuardedBy this + * @since 1.5 + */ + boolean isEmpty() { + return tracked.isEmpty(); + } + + /** * Return the customized object for the specified item * * @param item The item to lookup in the map @@ -374,19 +387,19 @@ * * @GuardedBy this */ - Object getCustomizedObject(final Object item) { + T getCustomizedObject(final S item) { return tracked.get(item); } /** - * Return the list of tracked items. + * Copy the tracked items into an array. * * @param list An array to contain the tracked items. * @return The specified list if it is large enough to hold the tracked * items or a new array large enough to hold the tracked items. * @GuardedBy this */ - Object[] getTracked(final Object[] list) { + S[] copyKeys(final S[] list) { return tracked.keySet().toArray(list); } @@ -401,7 +414,7 @@ } /** - * Returns the tracking count for this ServiceTracker object. + * Returns the tracking count for this {@code ServiceTracker} object. * * The tracking count is initialized to 0 when this object is opened. Every * time an item is added, modified or removed from this object the tracking @@ -415,15 +428,32 @@ } /** + * Copy the tracked items and associated values into the specified map. + * + * @param Type of {@code Map} to hold the tracked items and + * associated values. + * @param map The map into which to copy the tracked items and associated + * values. This map must not be a user provided map so that user code + * is not executed while synchronized on this. + * @return The specified map. + * @GuardedBy this + * @since 1.5 + */ + > M copyEntries(final M map) { + map.putAll(tracked); + return map; + } + + /** * Call the specific customizer adding method. This method must not be * called while synchronized on this object. * * @param item Item to be tracked. * @param related Action related object. - * @return Customized object for the tracked item or null if + * @return Customized object for the tracked item or {@code null} if * the item is not to be tracked. */ - abstract Object customizerAdding(final Object item, final Object related); + abstract T customizerAdding(final S item, final R related); /** * Call the specific customizer modified method. This method must not be @@ -433,8 +463,8 @@ * @param related Action related object. * @param object Customized object for the tracked item. */ - abstract void customizerModified(final Object item, final Object related, - final Object object); + abstract void customizerModified(final S item, final R related, + final T object); /** * Call the specific customizer removed method. This method must not be @@ -444,6 +474,6 @@ * @param related Action related object. * @param object Customized object for the tracked item. */ - abstract void customizerRemoved(final Object item, final Object related, - final Object object); + abstract void customizerRemoved(final S item, final R related, + final T object); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/BundleTrackerCustomizer.java osgi-compendium-4.3.0/src/org/osgi/util/tracker/BundleTrackerCustomizer.java --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/BundleTrackerCustomizer.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/BundleTrackerCustomizer.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2007, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2007, 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. @@ -20,85 +20,86 @@ import org.osgi.framework.BundleEvent; /** - * The BundleTrackerCustomizer interface allows a - * BundleTracker to customize the Bundles that are - * tracked. A BundleTrackerCustomizer is called when a bundle is - * being added to a BundleTracker. The - * BundleTrackerCustomizer can then return an object for the - * tracked bundle. A BundleTrackerCustomizer is also called when a + * The {@code BundleTrackerCustomizer} interface allows a + * {@code BundleTracker} to customize the {@code Bundle}s that are + * tracked. A {@code BundleTrackerCustomizer} is called when a bundle is + * being added to a {@code BundleTracker}. The + * {@code BundleTrackerCustomizer} can then return an object for the + * tracked bundle. A {@code BundleTrackerCustomizer} is also called when a * tracked bundle is modified or has been removed from a - * BundleTracker. + * {@code BundleTracker}. * *

        * The methods in this interface may be called as the result of a - * BundleEvent being received by a BundleTracker. - * Since BundleEvents are received synchronously by the - * BundleTracker, it is highly recommended that implementations of + * {@code BundleEvent} being received by a {@code BundleTracker}. + * Since {@code BundleEvent}s are received synchronously by the + * {@code BundleTracker}, it is highly recommended that implementations of * these methods do not alter bundle states while being synchronized on any * object. * *

        - * The BundleTracker class is thread-safe. It does not call a - * BundleTrackerCustomizer while holding any locks. - * BundleTrackerCustomizer implementations must also be + * The {@code BundleTracker} class is thread-safe. It does not call a + * {@code BundleTrackerCustomizer} while holding any locks. + * {@code BundleTrackerCustomizer} implementations must also be * thread-safe. * + * @param The type of the tracked object. * @ThreadSafe - * @version $Revision: 5874 $ + * @version $Id: 0e80f2555530b217faef57726a5938f0087a45c5 $ * @since 1.4 */ -public interface BundleTrackerCustomizer { +public interface BundleTrackerCustomizer { /** - * A bundle is being added to the BundleTracker. + * A bundle is being added to the {@code BundleTracker}. * *

        * This method is called before a bundle which matched the search parameters - * of the BundleTracker is added to the - * BundleTracker. This method should return the object to be - * tracked for the specified Bundle. The returned object is - * stored in the BundleTracker and is available from the + * of the {@code BundleTracker} is added to the + * {@code BundleTracker}. This method should return the object to be + * tracked for the specified {@code Bundle}. The returned object is + * stored in the {@code BundleTracker} and is available from the * {@link BundleTracker#getObject(Bundle) getObject} method. * - * @param bundle The Bundle being added to the - * BundleTracker. + * @param bundle The {@code Bundle} being added to the + * {@code BundleTracker}. * @param event The bundle event which caused this customizer method to be - * called or null if there is no bundle event associated + * called or {@code null} if there is no bundle event associated * with the call to this method. - * @return The object to be tracked for the specified Bundle - * object or null if the specified Bundle + * @return The object to be tracked for the specified {@code Bundle} + * object or {@code null} if the specified {@code Bundle} * object should not be tracked. */ - public Object addingBundle(Bundle bundle, BundleEvent event); + public T addingBundle(Bundle bundle, BundleEvent event); /** - * A bundle tracked by the BundleTracker has been modified. + * A bundle tracked by the {@code BundleTracker} has been modified. * *

        * This method is called when a bundle being tracked by the - * BundleTracker has had its state modified. + * {@code BundleTracker} has had its state modified. * - * @param bundle The Bundle whose state has been modified. + * @param bundle The {@code Bundle} whose state has been modified. * @param event The bundle event which caused this customizer method to be - * called or null if there is no bundle event associated + * called or {@code null} if there is no bundle event associated * with the call to this method. * @param object The tracked object for the specified bundle. */ public void modifiedBundle(Bundle bundle, BundleEvent event, - Object object); + T object); /** - * A bundle tracked by the BundleTracker has been removed. + * A bundle tracked by the {@code BundleTracker} has been removed. * *

        * This method is called after a bundle is no longer being tracked by the - * BundleTracker. + * {@code BundleTracker}. * - * @param bundle The Bundle that has been removed. + * @param bundle The {@code Bundle} that has been removed. * @param event The bundle event which caused this customizer method to be - * called or null if there is no bundle event associated + * called or {@code null} if there is no bundle event associated * with the call to this method. * @param object The tracked object for the specified bundle. */ public void removedBundle(Bundle bundle, BundleEvent event, - Object object); + T object); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/BundleTracker.java osgi-compendium-4.3.0/src/org/osgi/util/tracker/BundleTracker.java --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/BundleTracker.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/BundleTracker.java 2011-05-16 12:29:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2007, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2007, 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. @@ -16,55 +16,59 @@ package org.osgi.util.tracker; +import java.util.HashMap; +import java.util.Map; + import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; import org.osgi.framework.SynchronousBundleListener; /** - * The BundleTracker class simplifies tracking bundles much like - * the ServiceTracker simplifies tracking services. + * The {@code BundleTracker} class simplifies tracking bundles much like + * the {@code ServiceTracker} simplifies tracking services. *

        - * A BundleTracker is constructed with state criteria and a - * BundleTrackerCustomizer object. A BundleTracker can - * use the BundleTrackerCustomizer to select which bundles are + * A {@code BundleTracker} is constructed with state criteria and a + * {@code BundleTrackerCustomizer} object. A {@code BundleTracker} can + * use the {@code BundleTrackerCustomizer} to select which bundles are * tracked and to create a customized object to be tracked with the bundle. The - * BundleTracker can then be opened to begin tracking all bundles + * {@code BundleTracker} can then be opened to begin tracking all bundles * whose state matches the specified state criteria. *

        - * The getBundles method can be called to get the - * Bundle objects of the bundles being tracked. The - * getObject method can be called to get the customized object for + * The {@code getBundles} method can be called to get the + * {@code Bundle} objects of the bundles being tracked. The + * {@code getObject} method can be called to get the customized object for * a tracked bundle. *

        - * The BundleTracker class is thread-safe. It does not call a - * BundleTrackerCustomizer while holding any locks. - * BundleTrackerCustomizer implementations must also be + * The {@code BundleTracker} class is thread-safe. It does not call a + * {@code BundleTrackerCustomizer} while holding any locks. + * {@code BundleTrackerCustomizer} implementations must also be * thread-safe. * + * @param The type of the tracked object. * @ThreadSafe - * @version $Revision: 5894 $ + * @version $Id: ebfd73a4e19f025d6ad9029d99c17944ee8c420a $ * @since 1.4 */ -public class BundleTracker implements BundleTrackerCustomizer { +public class BundleTracker implements BundleTrackerCustomizer { /* set this to true to compile in debug messages */ - static final boolean DEBUG = false; + static final boolean DEBUG = false; /** - * The Bundle Context used by this BundleTracker. + * The Bundle Context used by this {@code BundleTracker}. */ - protected final BundleContext context; + protected final BundleContext context; /** - * The BundleTrackerCustomizer object for this tracker. + * The {@code BundleTrackerCustomizer} object for this tracker. */ - final BundleTrackerCustomizer customizer; + final BundleTrackerCustomizer customizer; /** - * Tracked bundles: Bundle object -> customized Object and - * BundleListener object + * Tracked bundles: {@code Bundle} object -> customized Object and + * {@code BundleListener} object */ - private volatile Tracked tracked; + private volatile Tracked tracked; /** * Accessor method for the current Tracked object. This method is only @@ -81,50 +85,50 @@ * State mask for bundles being tracked. This field contains the ORed values * of the bundle states being tracked. */ - final int mask; + final int mask; /** - * Create a BundleTracker for bundles whose state is present in + * Create a {@code BundleTracker} for bundles whose state is present in * the specified state mask. * *

        * Bundles whose state is present on the specified state mask will be - * tracked by this BundleTracker. + * tracked by this {@code BundleTracker}. * - * @param context The BundleContext against which the tracking + * @param context The {@code BundleContext} against which the tracking * is done. - * @param stateMask The bit mask of the ORing of the bundle + * @param stateMask The bit mask of the {@code OR}ing of the bundle * states to be tracked. * @param customizer The customizer object to call when bundles are added, - * modified, or removed in this BundleTracker. If - * customizer is null, then this - * BundleTracker will be used as the - * BundleTrackerCustomizer and this - * BundleTracker will call the - * BundleTrackerCustomizer methods on itself. + * modified, or removed in this {@code BundleTracker}. If + * customizer is {@code null}, then this + * {@code BundleTracker} will be used as the + * {@code BundleTrackerCustomizer} and this + * {@code BundleTracker} will call the + * {@code BundleTrackerCustomizer} methods on itself. * @see Bundle#getState() */ public BundleTracker(BundleContext context, int stateMask, - BundleTrackerCustomizer customizer) { + BundleTrackerCustomizer customizer) { this.context = context; this.mask = stateMask; this.customizer = (customizer == null) ? this : customizer; } /** - * Open this BundleTracker and begin tracking bundles. + * Open this {@code BundleTracker} and begin tracking bundles. * *

        * Bundle which match the state criteria specified when this - * BundleTracker was created are now tracked by this - * BundleTracker. + * {@code BundleTracker} was created are now tracked by this + * {@code BundleTracker}. * - * @throws java.lang.IllegalStateException If the BundleContext - * with which this BundleTracker was created is no + * @throws java.lang.IllegalStateException If the {@code BundleContext} + * with which this {@code BundleTracker} was created is no * longer valid. * @throws java.lang.SecurityException If the caller and this class do not * have the appropriate - * AdminPermission[context bundle,LISTENER], and the + * {@code AdminPermission[context bundle,LISTENER]}, and the * Java Runtime Environment supports permissions. */ public void open() { @@ -150,7 +154,7 @@ } } /* set tracked with the initial bundles */ - t.setInitial(bundles); + t.setInitial(bundles); } } tracked = t; @@ -160,10 +164,10 @@ } /** - * Close this BundleTracker. + * Close this {@code BundleTracker}. * *

        - * This method should be called when this BundleTracker should + * This method should be called when this {@code BundleTracker} should * end the tracking of bundles. * *

        @@ -200,80 +204,81 @@ /** * Default implementation of the - * BundleTrackerCustomizer.addingBundle method. + * {@code BundleTrackerCustomizer.addingBundle} method. * *

        - * This method is only called when this BundleTracker has been - * constructed with a null BundleTrackerCustomizer argument. + * This method is only called when this {@code BundleTracker} has been + * constructed with a {@code null BundleTrackerCustomizer} argument. * *

        - * This implementation simply returns the specified Bundle. + * This implementation simply returns the specified {@code Bundle}. * *

        * This method can be overridden in a subclass to customize the object to be * tracked for the bundle being added. * - * @param bundle The Bundle being added to this - * BundleTracker object. + * @param bundle The {@code Bundle} being added to this + * {@code BundleTracker} object. * @param event The bundle event which caused this customizer method to be - * called or null if there is no bundle event associated + * called or {@code null} if there is no bundle event associated * with the call to this method. * @return The specified bundle. * @see BundleTrackerCustomizer#addingBundle(Bundle, BundleEvent) */ - public Object addingBundle(Bundle bundle, BundleEvent event) { - return bundle; + public T addingBundle(Bundle bundle, BundleEvent event) { + T result = (T) bundle; + return result; } /** * Default implementation of the - * BundleTrackerCustomizer.modifiedBundle method. + * {@code BundleTrackerCustomizer.modifiedBundle} method. * *

        - * This method is only called when this BundleTracker has been - * constructed with a null BundleTrackerCustomizer argument. + * This method is only called when this {@code BundleTracker} has been + * constructed with a {@code null BundleTrackerCustomizer} argument. * *

        * This implementation does nothing. * - * @param bundle The Bundle whose state has been modified. + * @param bundle The {@code Bundle} whose state has been modified. * @param event The bundle event which caused this customizer method to be - * called or null if there is no bundle event associated + * called or {@code null} if there is no bundle event associated * with the call to this method. * @param object The customized object for the specified Bundle. * @see BundleTrackerCustomizer#modifiedBundle(Bundle, BundleEvent, Object) */ - public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) { + public void modifiedBundle(Bundle bundle, BundleEvent event, T object) { /* do nothing */ } /** * Default implementation of the - * BundleTrackerCustomizer.removedBundle method. + * {@code BundleTrackerCustomizer.removedBundle} method. * *

        - * This method is only called when this BundleTracker has been - * constructed with a null BundleTrackerCustomizer argument. + * This method is only called when this {@code BundleTracker} has been + * constructed with a {@code null BundleTrackerCustomizer} argument. * *

        * This implementation does nothing. * - * @param bundle The Bundle being removed. + * @param bundle The {@code Bundle} being removed. * @param event The bundle event which caused this customizer method to be - * called or null if there is no bundle event associated + * called or {@code null} if there is no bundle event associated * with the call to this method. * @param object The customized object for the specified bundle. * @see BundleTrackerCustomizer#removedBundle(Bundle, BundleEvent, Object) */ - public void removedBundle(Bundle bundle, BundleEvent event, Object object) { + public void removedBundle(Bundle bundle, BundleEvent event, T object) { /* do nothing */ } /** - * Return an array of Bundles for all bundles being tracked by - * this BundleTracker. + * Return an array of {@code Bundle}s for all bundles being tracked by + * this {@code BundleTracker}. * - * @return An array of Bundles or null if no + * @return An array of {@code Bundle}s or {@code null} if no * bundles are being tracked. */ public Bundle[] getBundles() { @@ -286,20 +291,20 @@ if (length == 0) { return null; } - return (Bundle[]) t.getTracked(new Bundle[length]); + return t.copyKeys(new Bundle[length]); } } /** - * Returns the customized object for the specified Bundle if - * the specified bundle is being tracked by this BundleTracker. + * Returns the customized object for the specified {@code Bundle} if + * the specified bundle is being tracked by this {@code BundleTracker}. * - * @param bundle The Bundle being tracked. - * @return The customized object for the specified Bundle or - * null if the specified Bundle is not + * @param bundle The {@code Bundle} being tracked. + * @return The customized object for the specified {@code Bundle} or + * {@code null} if the specified {@code Bundle} is not * being tracked. */ - public Object getObject(Bundle bundle) { + public T getObject(Bundle bundle) { final Tracked t = tracked(); if (t == null) { /* if BundleTracker is not open */ return null; @@ -310,14 +315,14 @@ } /** - * Remove a bundle from this BundleTracker. + * Remove a bundle from this {@code BundleTracker}. * - * The specified bundle will be removed from this BundleTracker + * The specified bundle will be removed from this {@code BundleTracker} * . If the specified bundle was being tracked then the - * BundleTrackerCustomizer.removedBundle method will be called + * {@code BundleTrackerCustomizer.removedBundle} method will be called * for that bundle. * - * @param bundle The Bundle to be removed. + * @param bundle The {@code Bundle} to be removed. */ public void remove(Bundle bundle) { final Tracked t = tracked(); @@ -329,7 +334,7 @@ /** * Return the number of bundles being tracked by this - * BundleTracker. + * {@code BundleTracker}. * * @return The number of bundles being tracked. */ @@ -344,23 +349,22 @@ } /** - * Returns the tracking count for this BundleTracker. + * Returns the tracking count for this {@code BundleTracker}. * - * The tracking count is initialized to 0 when this - * BundleTracker is opened. Every time a bundle is added, - * modified or removed from this BundleTracker the tracking - * count is incremented. - * - *

        - * The tracking count can be used to determine if this - * BundleTracker has added, modified or removed a bundle by - * comparing a tracking count value previously collected with the current - * tracking count value. If the value has not changed, then no bundle has - * been added, modified or removed from this BundleTracker - * since the previous tracking count was collected. + * The tracking count is initialized to 0 when this {@code BundleTracker} is + * opened. Every time a bundle is added, modified or removed from this + * {@code BundleTracker} the tracking count is incremented. + * + *

        + * The tracking count can be used to determine if this {@code BundleTracker} + * has added, modified or removed a bundle by comparing a tracking count + * value previously collected with the current tracking count value. If the + * value has not changed, then no bundle has been added, modified or removed + * from this {@code BundleTracker} since the previous tracking count was + * collected. * - * @return The tracking count for this BundleTracker or -1 if - * this BundleTracker is not open. + * @return The tracking count for this {@code BundleTracker} or -1 if this + * {@code BundleTracker} is not open. */ public int getTrackingCount() { final Tracked t = tracked(); @@ -373,13 +377,53 @@ } /** + * Return a {@code Map} with the {@code Bundle}s and customized + * objects for all bundles being tracked by this {@code BundleTracker}. + * + * @return A {@code Map} with the {@code Bundle}s and customized + * objects for all services being tracked by this + * {@code BundleTracker}. If no bundles are being tracked, then + * the returned map is empty. + * @since 1.5 + */ + public Map getTracked() { + Map map = new HashMap(); + final Tracked t = tracked(); + if (t == null) { /* if BundleTracker is not open */ + return map; + } + synchronized (t) { + return t.copyEntries(map); + } + } + + /** + * Return if this {@code BundleTracker} is empty. + * + * @return {@code true} if this {@code BundleTracker} is not tracking any + * bundles. + * @since 1.5 + */ + public boolean isEmpty() { + final Tracked t = tracked(); + if (t == null) { /* if BundleTracker is not open */ + return true; + } + synchronized (t) { + return t.isEmpty(); + } + } + + /** * Inner class which subclasses AbstractTracked. This class is the - * SynchronousBundleListener object for the tracker. + * {@code SynchronousBundleListener} object for the tracker. * * @ThreadSafe * @since 1.4 */ - class Tracked extends AbstractTracked implements SynchronousBundleListener { + private final class Tracked extends AbstractTracked + implements + SynchronousBundleListener { /** * Tracked constructor. */ @@ -388,11 +432,11 @@ } /** - * BundleListener method for the BundleTracker + * {@code BundleListener} method for the {@code BundleTracker} * class. This method must NOT be synchronized to avoid deadlock * potential. * - * @param event BundleEvent object from the framework. + * @param event {@code BundleEvent} object from the framework. */ public void bundleChanged(final BundleEvent event) { /* @@ -431,13 +475,11 @@ * * @param item Item to be tracked. * @param related Action related object. - * @return Customized object for the tracked item or null + * @return Customized object for the tracked item or {@code null} * if the item is not to be tracked. */ - Object customizerAdding(final Object item, - final Object related) { - return customizer - .addingBundle((Bundle) item, (BundleEvent) related); + T customizerAdding(final Bundle item, final BundleEvent related) { + return customizer.addingBundle(item, related); } /** @@ -448,10 +490,9 @@ * @param related Action related object. * @param object Customized object for the tracked item. */ - void customizerModified(final Object item, - final Object related, final Object object) { - customizer.modifiedBundle((Bundle) item, (BundleEvent) related, - object); + void customizerModified(final Bundle item, final BundleEvent related, + final T object) { + customizer.modifiedBundle(item, related, object); } /** @@ -462,10 +503,9 @@ * @param related Action related object. * @param object Customized object for the tracked item. */ - void customizerRemoved(final Object item, - final Object related, final Object object) { - customizer.removedBundle((Bundle) item, (BundleEvent) related, - object); + void customizerRemoved(final Bundle item, final BundleEvent related, + final T object) { + customizer.removedBundle(item, related, object); } } } diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/package.html osgi-compendium-4.3.0/src/org/osgi/util/tracker/package.html --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

        Tracker Package Version 1.4. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.util.tracker; version="[1.4,2.0)"
        -
        - diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/packageinfo osgi-compendium-4.3.0/src/org/osgi/util/tracker/packageinfo --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/packageinfo 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/packageinfo 2010-11-10 13:03:48.000000000 +0000 @@ -1 +1 @@ -version 1.4 +version 1.5 diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/package-info.java osgi-compendium-4.3.0/src/org/osgi/util/tracker/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * Tracker Package Version 1.5. + * + *

        + * 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.util.tracker; version="[1.5,2.0)"} + * + * @version $Id: 15f31dcb7e4d3c91682fccade07a0c8046460aeb $ + */ + +package org.osgi.util.tracker; diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java osgi-compendium-4.3.0/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -19,76 +19,78 @@ import org.osgi.framework.ServiceReference; /** - * The ServiceTrackerCustomizer interface allows a - * ServiceTracker to customize the service objects that are - * tracked. A ServiceTrackerCustomizer is called when a service is - * being added to a ServiceTracker. The - * ServiceTrackerCustomizer can then return an object for the - * tracked service. A ServiceTrackerCustomizer is also called when + * The {@code ServiceTrackerCustomizer} interface allows a + * {@code ServiceTracker} to customize the service objects that are + * tracked. A {@code ServiceTrackerCustomizer} is called when a service is + * being added to a {@code ServiceTracker}. The + * {@code ServiceTrackerCustomizer} can then return an object for the + * tracked service. A {@code ServiceTrackerCustomizer} is also called when * a tracked service is modified or has been removed from a - * ServiceTracker. + * {@code ServiceTracker}. * *

        * The methods in this interface may be called as the result of a - * ServiceEvent being received by a ServiceTracker. - * Since ServiceEvents are synchronously delivered by the + * {@code ServiceEvent} being received by a {@code ServiceTracker}. + * Since {@code ServiceEvent}s are synchronously delivered by the * Framework, it is highly recommended that implementations of these methods do - * not register (BundleContext.registerService), modify ( - * ServiceRegistration.setProperties) or unregister ( - * ServiceRegistration.unregister) a service while being + * not register ({@code BundleContext.registerService}), modify ( + * {@code ServiceRegistration.setProperties}) or unregister ( + * {@code ServiceRegistration.unregister}) a service while being * synchronized on any object. * *

        - * The ServiceTracker class is thread-safe. It does not call a - * ServiceTrackerCustomizer while holding any locks. - * ServiceTrackerCustomizer implementations must also be + * The {@code ServiceTracker} class is thread-safe. It does not call a + * {@code ServiceTrackerCustomizer} while holding any locks. + * {@code ServiceTrackerCustomizer} implementations must also be * thread-safe. * + * @param The type of the service being tracked. + * @param The type of the tracked object. * @ThreadSafe - * @version $Revision: 5874 $ + * @version $Id: c654a963336cee74762b8f54c8cef8d5774f8b4d $ */ -public interface ServiceTrackerCustomizer { +public interface ServiceTrackerCustomizer { /** - * A service is being added to the ServiceTracker. + * A service is being added to the {@code ServiceTracker}. * *

        * This method is called before a service which matched the search - * parameters of the ServiceTracker is added to the - * ServiceTracker. This method should return the service object - * to be tracked for the specified ServiceReference. The - * returned service object is stored in the ServiceTracker and - * is available from the getService and - * getServices methods. + * parameters of the {@code ServiceTracker} is added to the + * {@code ServiceTracker}. This method should return the service object + * to be tracked for the specified {@code ServiceReference}. The + * returned service object is stored in the {@code ServiceTracker} and + * is available from the {@code getService} and + * {@code getServices} methods. * * @param reference The reference to the service being added to the - * ServiceTracker. + * {@code ServiceTracker}. * @return The service object to be tracked for the specified referenced - * service or null if the specified referenced service + * service or {@code null} if the specified referenced service * should not be tracked. */ - public Object addingService(ServiceReference reference); + public T addingService(ServiceReference reference); /** - * A service tracked by the ServiceTracker has been modified. + * A service tracked by the {@code ServiceTracker} has been modified. * *

        * This method is called when a service being tracked by the - * ServiceTracker has had it properties modified. + * {@code ServiceTracker} has had it properties modified. * * @param reference The reference to the service that has been modified. * @param service The service object for the specified referenced service. */ - public void modifiedService(ServiceReference reference, Object service); + public void modifiedService(ServiceReference reference, T service); /** - * A service tracked by the ServiceTracker has been removed. + * A service tracked by the {@code ServiceTracker} has been removed. * *

        * This method is called after a service is no longer being tracked by the - * ServiceTracker. + * {@code ServiceTracker}. * * @param reference The reference to the service that has been removed. * @param service The service object for the specified referenced service. */ - public void removedService(ServiceReference reference, Object service); + public void removedService(ServiceReference reference, T service); } diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/tracker/ServiceTracker.java osgi-compendium-4.3.0/src/org/osgi/util/tracker/ServiceTracker.java --- osgi-compendium-4.2.0/src/org/osgi/util/tracker/ServiceTracker.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/tracker/ServiceTracker.java 2011-05-16 12:29:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 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. @@ -16,8 +16,10 @@ package org.osgi.util.tracker; -import java.security.AccessController; -import java.security.PrivilegedAction; +import java.lang.reflect.Array; +import java.util.Collections; +import java.util.SortedMap; +import java.util.TreeMap; import org.osgi.framework.AllServiceListener; import org.osgi.framework.BundleContext; @@ -27,73 +29,74 @@ import org.osgi.framework.ServiceEvent; import org.osgi.framework.ServiceListener; import org.osgi.framework.ServiceReference; -import org.osgi.framework.Version; /** - * The ServiceTracker class simplifies using services from the + * The {@code ServiceTracker} class simplifies using services from the * Framework's service registry. *

        - * A ServiceTracker object is constructed with search criteria and - * a ServiceTrackerCustomizer object. A ServiceTracker - * can use a ServiceTrackerCustomizer to customize the service - * objects to be tracked. The ServiceTracker can then be opened to + * A {@code ServiceTracker} object is constructed with search criteria and + * a {@code ServiceTrackerCustomizer} object. A {@code ServiceTracker} + * can use a {@code ServiceTrackerCustomizer} to customize the service + * objects to be tracked. The {@code ServiceTracker} can then be opened to * begin tracking all services in the Framework's service registry that match - * the specified search criteria. The ServiceTracker correctly - * handles all of the details of listening to ServiceEvents and + * the specified search criteria. The {@code ServiceTracker} correctly + * handles all of the details of listening to {@code ServiceEvent}s and * getting and ungetting services. *

        - * The getServiceReferences method can be called to get references - * to the services being tracked. The getService and - * getServices methods can be called to get the service objects for + * The {@code getServiceReferences} method can be called to get references + * to the services being tracked. The {@code getService} and + * {@code getServices} methods can be called to get the service objects for * the tracked service. *

        - * The ServiceTracker class is thread-safe. It does not call a - * ServiceTrackerCustomizer while holding any locks. - * ServiceTrackerCustomizer implementations must also be + * The {@code ServiceTracker} class is thread-safe. It does not call a + * {@code ServiceTrackerCustomizer} while holding any locks. + * {@code ServiceTrackerCustomizer} implementations must also be * thread-safe. * + * @param The type of the service being tracked. + * @param The type of the tracked object. * @ThreadSafe - * @version $Revision: 6386 $ + * @version $Id: df62459c90f49d06e89ff8f20915a9eec401217e $ */ -public class ServiceTracker implements ServiceTrackerCustomizer { +public class ServiceTracker implements ServiceTrackerCustomizer { /* set this to true to compile in debug messages */ - static final boolean DEBUG = false; + static final boolean DEBUG = false; /** - * The Bundle Context used by this ServiceTracker. + * The Bundle Context used by this {@code ServiceTracker}. */ - protected final BundleContext context; + protected final BundleContext context; /** - * The Filter used by this ServiceTracker which specifies the + * The Filter used by this {@code ServiceTracker} which specifies the * search criteria for the services to track. * * @since 1.1 */ - protected final Filter filter; + protected final Filter filter; /** - * The ServiceTrackerCustomizer for this tracker. + * The {@code ServiceTrackerCustomizer} for this tracker. */ - final ServiceTrackerCustomizer customizer; + final ServiceTrackerCustomizer customizer; /** * Filter string for use when adding the ServiceListener. If this field is * set, then certain optimizations can be taken since we don't have a user * supplied filter. */ - final String listenerFilter; + final String listenerFilter; /** * Class name to be tracked. If this field is set, then we are tracking by * class name. */ - private final String trackClass; + private final String trackClass; /** * Reference to be tracked. If this field is set, then we are tracking a * single ServiceReference. */ - private final ServiceReference trackReference; + private final ServiceReference trackReference; /** - * Tracked services: ServiceReference -> customized Object and - * ServiceListener object + * Tracked services: {@code ServiceReference} -> customized Object and + * {@code ServiceListener} object */ - private volatile Tracked tracked; + private volatile Tracked tracked; /** * Accessor method for the current Tracked object. This method is only @@ -111,49 +114,43 @@ * * This field is volatile since it is accessed by multiple threads. */ - private volatile ServiceReference cachedReference; + private volatile ServiceReference cachedReference; /** * Cached service object for getService. * * This field is volatile since it is accessed by multiple threads. */ - private volatile Object cachedService; + private volatile T cachedService; /** - * org.osgi.framework package version which introduced - * {@link ServiceEvent#MODIFIED_ENDMATCH} - */ - private static final Version endMatchVersion = new Version(1, 5, 0); - - /** - * Create a ServiceTracker on the specified - * ServiceReference. + * Create a {@code ServiceTracker} on the specified + * {@code ServiceReference}. * *

        - * The service referenced by the specified ServiceReference - * will be tracked by this ServiceTracker. + * The service referenced by the specified {@code ServiceReference} + * will be tracked by this {@code ServiceTracker}. * - * @param context The BundleContext against which the tracking + * @param context The {@code BundleContext} against which the tracking * is done. - * @param reference The ServiceReference for the service to be + * @param reference The {@code ServiceReference} for the service to be * tracked. * @param customizer The customizer object to call when services are added, - * modified, or removed in this ServiceTracker. If - * customizer is null, then this - * ServiceTracker will be used as the - * ServiceTrackerCustomizer and this - * ServiceTracker will call the - * ServiceTrackerCustomizer methods on itself. + * modified, or removed in this {@code ServiceTracker}. If + * customizer is {@code null}, then this + * {@code ServiceTracker} will be used as the + * {@code ServiceTrackerCustomizer} and this + * {@code ServiceTracker} will call the + * {@code ServiceTrackerCustomizer} methods on itself. */ public ServiceTracker(final BundleContext context, - final ServiceReference reference, - final ServiceTrackerCustomizer customizer) { + final ServiceReference reference, + final ServiceTrackerCustomizer customizer) { this.context = context; this.trackReference = reference; this.trackClass = null; this.customizer = (customizer == null) ? this : customizer; this.listenerFilter = "(" + Constants.SERVICE_ID + "=" - + reference.getProperty(Constants.SERVICE_ID).toString() + ")"; + + reference.getProperty(Constants.SERVICE_ID).toString() + ")"; try { this.filter = context.createFilter(listenerFilter); } @@ -170,32 +167,32 @@ } /** - * Create a ServiceTracker on the specified class name. + * Create a {@code ServiceTracker} on the specified class name. * *

        * Services registered under the specified class name will be tracked by - * this ServiceTracker. + * this {@code ServiceTracker}. * - * @param context The BundleContext against which the tracking + * @param context The {@code BundleContext} against which the tracking * is done. * @param clazz The class name of the services to be tracked. * @param customizer The customizer object to call when services are added, - * modified, or removed in this ServiceTracker. If - * customizer is null, then this - * ServiceTracker will be used as the - * ServiceTrackerCustomizer and this - * ServiceTracker will call the - * ServiceTrackerCustomizer methods on itself. + * modified, or removed in this {@code ServiceTracker}. If + * customizer is {@code null}, then this + * {@code ServiceTracker} will be used as the + * {@code ServiceTrackerCustomizer} and this + * {@code ServiceTracker} will call the + * {@code ServiceTrackerCustomizer} methods on itself. */ public ServiceTracker(final BundleContext context, final String clazz, - final ServiceTrackerCustomizer customizer) { + final ServiceTrackerCustomizer customizer) { this.context = context; this.trackReference = null; this.trackClass = clazz; this.customizer = (customizer == null) ? this : customizer; // we call clazz.toString to verify clazz is non-null! this.listenerFilter = "(" + Constants.OBJECTCLASS + "=" - + clazz.toString() + ")"; + + clazz.toString() + ")"; try { this.filter = context.createFilter(listenerFilter); } @@ -212,42 +209,31 @@ } /** - * Create a ServiceTracker on the specified Filter + * Create a {@code ServiceTracker} on the specified {@code Filter} * object. * *

        - * Services which match the specified Filter object will be - * tracked by this ServiceTracker. + * Services which match the specified {@code Filter} object will be + * tracked by this {@code ServiceTracker}. * - * @param context The BundleContext against which the tracking + * @param context The {@code BundleContext} against which the tracking * is done. - * @param filter The Filter to select the services to be + * @param filter The {@code Filter} to select the services to be * tracked. * @param customizer The customizer object to call when services are added, - * modified, or removed in this ServiceTracker. If - * customizer is null, then this ServiceTracker will be - * used as the ServiceTrackerCustomizer and this - * ServiceTracker will call the - * ServiceTrackerCustomizer methods on itself. + * modified, or removed in this {@code ServiceTracker}. If + * customizer is null, then this {@code ServiceTracker} will be + * used as the {@code ServiceTrackerCustomizer} and this + * {@code ServiceTracker} will call the + * {@code ServiceTrackerCustomizer} methods on itself. * @since 1.1 */ public ServiceTracker(final BundleContext context, final Filter filter, - final ServiceTrackerCustomizer customizer) { + final ServiceTrackerCustomizer customizer) { this.context = context; this.trackReference = null; this.trackClass = null; - final Version frameworkVersion = (Version) AccessController - .doPrivileged(new PrivilegedAction() { - public Object run() { - String version = context - .getProperty(Constants.FRAMEWORK_VERSION); - return (version == null) ? Version.emptyVersion - : new Version(version); - } - }); - final boolean endMatchSupported = (frameworkVersion - .compareTo(endMatchVersion) >= 0); - this.listenerFilter = endMatchSupported ? filter.toString() : null; + this.listenerFilter = filter.toString(); this.filter = filter; this.customizer = (customizer == null) ? this : customizer; if ((context == null) || (filter == null)) { @@ -259,13 +245,37 @@ } /** - * Open this ServiceTracker and begin tracking services. + * Create a {@code ServiceTracker} on the specified class. + * + *

        + * Services registered under the name of the specified class will be tracked + * by this {@code ServiceTracker}. + * + * @param context The {@code BundleContext} against which the tracking + * is done. + * @param clazz The class of the services to be tracked. + * @param customizer The customizer object to call when services are added, + * modified, or removed in this {@code ServiceTracker}. If + * customizer is {@code null}, then this + * {@code ServiceTracker} will be used as the + * {@code ServiceTrackerCustomizer} and this + * {@code ServiceTracker} will call the + * {@code ServiceTrackerCustomizer} methods on itself. + * @since 1.5 + */ + public ServiceTracker(final BundleContext context, final Class clazz, + final ServiceTrackerCustomizer customizer) { + this(context, clazz.getName(), customizer); + } + + /** + * Open this {@code ServiceTracker} and begin tracking services. * *

        - * This implementation calls open(false). + * This implementation calls {@code open(false)}. * - * @throws java.lang.IllegalStateException If the BundleContext - * with which this ServiceTracker was created is no + * @throws java.lang.IllegalStateException If the {@code BundleContext} + * with which this {@code ServiceTracker} was created is no * longer valid. * @see #open(boolean) */ @@ -274,22 +284,22 @@ } /** - * Open this ServiceTracker and begin tracking services. + * Open this {@code ServiceTracker} and begin tracking services. * *

        * Services which match the search criteria specified when this - * ServiceTracker was created are now tracked by this - * ServiceTracker. + * {@code ServiceTracker} was created are now tracked by this + * {@code ServiceTracker}. * - * @param trackAllServices If true, then this - * ServiceTracker will track all matching services - * regardless of class loader accessibility. If false, - * then this ServiceTracker will only track matching + * @param trackAllServices If {@code true}, then this + * {@code ServiceTracker} will track all matching services + * regardless of class loader accessibility. If {@code false}, + * then this {@code ServiceTracker} will only track matching * services which are class loader accessible to the bundle whose - * BundleContext is used by this - * ServiceTracker. - * @throws java.lang.IllegalStateException If the BundleContext - * with which this ServiceTracker was created is no + * {@code BundleContext} is used by this + * {@code ServiceTracker}. + * @throws java.lang.IllegalStateException If the {@code BundleContext} + * with which this {@code ServiceTracker} was created is no * longer valid. * @since 1.3 */ @@ -300,13 +310,13 @@ return; } if (DEBUG) { - System.out.println("ServiceTracker.open: " + filter); + System.out.println("ServiceTracker.open: " + filter); } t = trackAllServices ? new AllTracked() : new Tracked(); synchronized (t) { try { context.addServiceListener(t, listenerFilter); - ServiceReference[] references = null; + ServiceReference[] references = null; if (trackClass != null) { references = getInitialReferences(trackAllServices, trackClass, null); @@ -314,23 +324,22 @@ else { if (trackReference != null) { if (trackReference.getBundle() != null) { - references = new ServiceReference[] {trackReference}; + ServiceReference[] single = new ServiceReference[] {trackReference}; + references = single; } } else { /* user supplied filter */ references = getInitialReferences(trackAllServices, - null, - (listenerFilter != null) ? listenerFilter - : filter.toString()); + null, listenerFilter); } } /* set tracked with the initial references */ - t.setInitial(references); + t.setInitial(references); } catch (InvalidSyntaxException e) { throw new RuntimeException( "unexpected InvalidSyntaxException: " - + e.getMessage(), e); + + e.getMessage(), e); } } tracked = t; @@ -340,33 +349,33 @@ } /** - * Returns the list of initial ServiceReferences that will be - * tracked by this ServiceTracker. + * Returns the list of initial {@code ServiceReference}s that will be + * tracked by this {@code ServiceTracker}. * - * @param trackAllServices If true, use - * getAllServiceReferences. + * @param trackAllServices If {@code true}, use + * {@code getAllServiceReferences}. * @param className The class name with which the service was registered, or - * null for all services. - * @param filterString The filter criteria or null for all + * {@code null} for all services. + * @param filterString The filter criteria or {@code null} for all * services. - * @return The list of initial ServiceReferences. + * @return The list of initial {@code ServiceReference}s. * @throws InvalidSyntaxException If the specified filterString has an * invalid syntax. */ - private ServiceReference[] getInitialReferences(boolean trackAllServices, - String className, String filterString) + private ServiceReference[] getInitialReferences( + boolean trackAllServices, String className, String filterString) throws InvalidSyntaxException { - if (trackAllServices) { - return context.getAllServiceReferences(className, filterString); - } - return context.getServiceReferences(className, filterString); + ServiceReference[] result = (ServiceReference[]) ((trackAllServices) ? context + .getAllServiceReferences(className, filterString) + : context.getServiceReferences(className, filterString)); + return result; } /** - * Close this ServiceTracker. + * Close this {@code ServiceTracker}. * *

        - * This method should be called when this ServiceTracker should + * This method should be called when this {@code ServiceTracker} should * end the tracking of services. * *

        @@ -375,14 +384,14 @@ */ public void close() { final Tracked outgoing; - final ServiceReference[] references; + final ServiceReference[] references; synchronized (this) { outgoing = tracked; if (outgoing == null) { return; } if (DEBUG) { - System.out.println("ServiceTracker.close: " + filter); + System.out.println("ServiceTracker.close: " + filter); } outgoing.close(); references = getServiceReferences(); @@ -405,26 +414,25 @@ } if (DEBUG) { if ((cachedReference == null) && (cachedService == null)) { - System.out - .println("ServiceTracker.close[cached cleared]: " - + filter); + System.out.println("ServiceTracker.close[cached cleared]: " + + filter); } } } /** * Default implementation of the - * ServiceTrackerCustomizer.addingService method. + * {@code ServiceTrackerCustomizer.addingService} method. * *

        - * This method is only called when this ServiceTracker has been - * constructed with a null ServiceTrackerCustomizer argument. + * This method is only called when this {@code ServiceTracker} has been + * constructed with a {@code null ServiceTrackerCustomizer} argument. * *

        - * This implementation returns the result of calling getService - * on the BundleContext with which this - * ServiceTracker was created passing the specified - * ServiceReference. + * This implementation returns the result of calling {@code getService} + * on the {@code BundleContext} with which this + * {@code ServiceTracker} was created passing the specified + * {@code ServiceReference}. *

        * This method can be overridden in a subclass to customize the service * object to be tracked for the service being added. In that case, take care @@ -433,22 +441,23 @@ * the service. * * @param reference The reference to the service being added to this - * ServiceTracker. + * {@code ServiceTracker}. * @return The service object to be tracked for the service added to this - * ServiceTracker. + * {@code ServiceTracker}. * @see ServiceTrackerCustomizer#addingService(ServiceReference) */ - public Object addingService(ServiceReference reference) { - return context.getService(reference); + public T addingService(ServiceReference reference) { + T result = (T) context.getService(reference); + return result; } /** * Default implementation of the - * ServiceTrackerCustomizer.modifiedService method. + * {@code ServiceTrackerCustomizer.modifiedService} method. * *

        - * This method is only called when this ServiceTracker has been - * constructed with a null ServiceTrackerCustomizer argument. + * This method is only called when this {@code ServiceTracker} has been + * constructed with a {@code null ServiceTrackerCustomizer} argument. * *

        * This implementation does nothing. @@ -457,22 +466,22 @@ * @param service The service object for the modified service. * @see ServiceTrackerCustomizer#modifiedService(ServiceReference, Object) */ - public void modifiedService(ServiceReference reference, Object service) { + public void modifiedService(ServiceReference reference, T service) { /* do nothing */ } /** * Default implementation of the - * ServiceTrackerCustomizer.removedService method. + * {@code ServiceTrackerCustomizer.removedService} method. * *

        - * This method is only called when this ServiceTracker has been - * constructed with a null ServiceTrackerCustomizer argument. + * This method is only called when this {@code ServiceTracker} has been + * constructed with a {@code null ServiceTrackerCustomizer} argument. * *

        - * This implementation calls ungetService, on the - * BundleContext with which this ServiceTracker - * was created, passing the specified ServiceReference. + * This implementation calls {@code ungetService}, on the + * {@code BundleContext} with which this {@code ServiceTracker} + * was created, passing the specified {@code ServiceReference}. *

        * This method can be overridden in a subclass. If the default * implementation of {@link #addingService(ServiceReference) addingService} @@ -482,19 +491,19 @@ * @param service The service object for the removed service. * @see ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ - public void removedService(ServiceReference reference, Object service) { + public void removedService(ServiceReference reference, T service) { context.ungetService(reference); } /** * Wait for at least one service to be tracked by this - * ServiceTracker. This method will also return when this - * ServiceTracker is closed. + * {@code ServiceTracker}. This method will also return when this + * {@code ServiceTracker} is closed. * *

        - * It is strongly recommended that waitForService is not used - * during the calling of the BundleActivator methods. - * BundleActivator methods are expected to complete in a short + * It is strongly recommended that {@code waitForService} is not used + * during the calling of the {@code BundleActivator} methods. + * {@code BundleActivator} methods are expected to complete in a short * period of time. * *

        @@ -508,11 +517,11 @@ * current thread. * @throws IllegalArgumentException If the value of timeout is negative. */ - public Object waitForService(long timeout) throws InterruptedException { + public T waitForService(long timeout) throws InterruptedException { if (timeout < 0) { - throw new IllegalArgumentException("timeout value is negative"); + throw new IllegalArgumentException("timeout value is negative"); } - Object object = getService(); + T object = getService(); while (object == null) { final Tracked t = tracked(); if (t == null) { /* if ServiceTracker is not open */ @@ -523,7 +532,7 @@ t.wait(timeout); } } - object = getService(); + object = getService(); if (timeout > 0) { return object; } @@ -532,13 +541,13 @@ } /** - * Return an array of ServiceReferences for all services being - * tracked by this ServiceTracker. + * Return an array of {@code ServiceReference}s for all services being + * tracked by this {@code ServiceTracker}. * - * @return Array of ServiceReferences or null if + * @return Array of {@code ServiceReference}s or {@code null} if * no services are being tracked. */ - public ServiceReference[] getServiceReferences() { + public ServiceReference[] getServiceReferences() { final Tracked t = tracked(); if (t == null) { /* if ServiceTracker is not open */ return null; @@ -548,45 +557,45 @@ if (length == 0) { return null; } - return (ServiceReference[]) t - .getTracked(new ServiceReference[length]); + ServiceReference[] result = new ServiceReference[length]; + return t.copyKeys(result); } } /** - * Returns a ServiceReference for one of the services being - * tracked by this ServiceTracker. + * Returns a {@code ServiceReference} for one of the services being + * tracked by this {@code ServiceTracker}. * *

        * If multiple services are being tracked, the service with the highest - * ranking (as specified in its service.ranking property) is + * ranking (as specified in its {@code service.ranking} property) is * returned. If there is a tie in ranking, the service with the lowest - * service ID (as specified in its service.id property); that + * service ID (as specified in its {@code service.id} property); that * is, the service that was registered first is returned. This is the same - * algorithm used by BundleContext.getServiceReference. + * algorithm used by {@code BundleContext.getServiceReference}. * *

        * This implementation calls {@link #getServiceReferences()} to get the list * of references for the tracked services. * - * @return A ServiceReference or null if no + * @return A {@code ServiceReference} or {@code null} if no * services are being tracked. * @since 1.1 */ - public ServiceReference getServiceReference() { - ServiceReference reference = cachedReference; + public ServiceReference getServiceReference() { + ServiceReference reference = cachedReference; if (reference != null) { if (DEBUG) { System.out .println("ServiceTracker.getServiceReference[cached]: " - + filter); + + filter); } return reference; } if (DEBUG) { - System.out.println("ServiceTracker.getServiceReference: " + filter); + System.out.println("ServiceTracker.getServiceReference: " + filter); } - ServiceReference[] references = getServiceReferences(); + ServiceReference[] references = getServiceReferences(); int length = (references == null) ? 0 : references.length; if (length == 0) { /* if no service is being tracked */ return null; @@ -634,15 +643,15 @@ /** * Returns the service object for the specified - * ServiceReference if the specified referenced service is - * being tracked by this ServiceTracker. + * {@code ServiceReference} if the specified referenced service is + * being tracked by this {@code ServiceTracker}. * * @param reference The reference to the desired service. - * @return A service object or null if the service referenced - * by the specified ServiceReference is not being + * @return A service object or {@code null} if the service referenced + * by the specified {@code ServiceReference} is not being * tracked. */ - public Object getService(ServiceReference reference) { + public T getService(ServiceReference reference) { final Tracked t = tracked(); if (t == null) { /* if ServiceTracker is not open */ return null; @@ -654,7 +663,7 @@ /** * Return an array of service objects for all services being tracked by this - * ServiceTracker. + * {@code ServiceTracker}. * *

        * This implementation calls {@link #getServiceReferences()} to get the list @@ -662,7 +671,7 @@ * {@link #getService(ServiceReference)} for each reference to get the * tracked service object. * - * @return An array of service objects or null if no services + * @return An array of service objects or {@code null} if no services * are being tracked. */ public Object[] getServices() { @@ -671,14 +680,14 @@ return null; } synchronized (t) { - ServiceReference[] references = getServiceReferences(); + ServiceReference[] references = getServiceReferences(); int length = (references == null) ? 0 : references.length; if (length == 0) { return null; } Object[] objects = new Object[length]; for (int i = 0; i < length; i++) { - objects[i] = getService(references[i]); + objects[i] = getService(references[i]); } return objects; } @@ -686,46 +695,45 @@ /** * Returns a service object for one of the services being tracked by this - * ServiceTracker. + * {@code ServiceTracker}. * *

        * If any services are being tracked, this implementation returns the result - * of calling getService(getServiceReference()). + * of calling {@code getService(getServiceReference())}. * - * @return A service object or null if no services are being + * @return A service object or {@code null} if no services are being * tracked. */ - public Object getService() { - Object service = cachedService; + public T getService() { + T service = cachedService; if (service != null) { if (DEBUG) { - System.out - .println("ServiceTracker.getService[cached]: " - + filter); + System.out.println("ServiceTracker.getService[cached]: " + + filter); } return service; } if (DEBUG) { - System.out.println("ServiceTracker.getService: " + filter); + System.out.println("ServiceTracker.getService: " + filter); } - ServiceReference reference = getServiceReference(); + ServiceReference reference = getServiceReference(); if (reference == null) { return null; } - return cachedService = getService(reference); + return cachedService = getService(reference); } /** - * Remove a service from this ServiceTracker. + * Remove a service from this {@code ServiceTracker}. * * The specified service will be removed from this - * ServiceTracker. If the specified service was being tracked - * then the ServiceTrackerCustomizer.removedService method will + * {@code ServiceTracker}. If the specified service was being tracked + * then the {@code ServiceTrackerCustomizer.removedService} method will * be called for that service. * * @param reference The reference to the service to be removed. */ - public void remove(ServiceReference reference) { + public void remove(ServiceReference reference) { final Tracked t = tracked(); if (t == null) { /* if ServiceTracker is not open */ return; @@ -735,7 +743,7 @@ /** * Return the number of services being tracked by this - * ServiceTracker. + * {@code ServiceTracker}. * * @return The number of services being tracked. */ @@ -750,24 +758,23 @@ } /** - * Returns the tracking count for this ServiceTracker. + * Returns the tracking count for this {@code ServiceTracker}. * - * The tracking count is initialized to 0 when this - * ServiceTracker is opened. Every time a service is added, - * modified or removed from this ServiceTracker, the tracking - * count is incremented. + * The tracking count is initialized to 0 when this {@code ServiceTracker} + * is opened. Every time a service is added, modified or removed from this + * {@code ServiceTracker}, the tracking count is incremented. * *

        * The tracking count can be used to determine if this - * ServiceTracker has added, modified or removed a service by + * {@code ServiceTracker} has added, modified or removed a service by * comparing a tracking count value previously collected with the current * tracking count value. If the value has not changed, then no service has - * been added, modified or removed from this ServiceTracker - * since the previous tracking count was collected. + * been added, modified or removed from this {@code ServiceTracker} since + * the previous tracking count was collected. * * @since 1.2 - * @return The tracking count for this ServiceTracker or -1 if - * this ServiceTracker is not open. + * @return The tracking count for this {@code ServiceTracker} or -1 if this + * {@code ServiceTracker} is not open. */ public int getTrackingCount() { final Tracked t = tracked(); @@ -792,17 +799,113 @@ cachedReference = null; /* clear cached value */ cachedService = null; /* clear cached value */ if (DEBUG) { - System.out.println("ServiceTracker.modified: " + filter); + System.out.println("ServiceTracker.modified: " + filter); + } + } + + /** + * Return a {@code SortedMap} of the {@code ServiceReference}s and + * service objects for all services being tracked by this + * {@code ServiceTracker}. The map is sorted in reverse natural order + * of {@code ServiceReference}. That is, the first entry is the service + * with the highest ranking and the lowest service id. + * + * @return A {@code SortedMap} with the {@code ServiceReference}s + * and service objects for all services being tracked by this + * {@code ServiceTracker}. If no services are being tracked, + * then the returned map is empty. + * @since 1.5 + */ + public SortedMap, T> getTracked() { + SortedMap, T> map = new TreeMap, T>( + Collections.reverseOrder()); + final Tracked t = tracked(); + if (t == null) { /* if ServiceTracker is not open */ + return map; + } + synchronized (t) { + return t.copyEntries(map); + } + } + + /** + * Return if this {@code ServiceTracker} is empty. + * + * @return {@code true} if this {@code ServiceTracker} is not tracking any + * services. + * @since 1.5 + */ + public boolean isEmpty() { + final Tracked t = tracked(); + if (t == null) { /* if ServiceTracker is not open */ + return true; + } + synchronized (t) { + return t.isEmpty(); + } + } + + /** + * Return an array of service objects for all services being tracked by this + * {@code ServiceTracker}. The runtime type of the returned array is that of + * the specified array. + * + *

        + * This implementation calls {@link #getServiceReferences()} to get the list + * of references for the tracked services and then calls + * {@link #getService(ServiceReference)} for each reference to get the + * tracked service object. + * + * @param array An array into which the tracked service objects will be + * stored, if the array is large enough. + * @return An array of service objects being tracked. If the specified array + * is large enough to hold the result, then the specified array is + * returned. If the specified array is longer then necessary to hold + * the result, the array element after the last service object is + * set to {@code null}. If the specified array is not large enough + * to hold the result, a new array is created and returned. + * @since 1.5 + */ + public T[] getServices(T[] array) { + final Tracked t = tracked(); + if (t == null) { /* if ServiceTracker is not open */ + if (array.length > 0) { + array[0] = null; + } + return array; + } + synchronized (t) { + ServiceReference[] references = getServiceReferences(); + int length = (references == null) ? 0 : references.length; + if (length == 0) { + if (array.length > 0) { + array[0] = null; + } + return array; + } + if (length > array.length) { + array = (T[]) Array.newInstance(array.getClass() + .getComponentType(), length); + } + for (int i = 0; i < length; i++) { + array[i] = getService(references[i]); + } + if (array.length > length) { + array[length] = null; + } + return array; } } /** * Inner class which subclasses AbstractTracked. This class is the - * ServiceListener object for the tracker. + * {@code ServiceListener} object for the tracker. * * @ThreadSafe */ - class Tracked extends AbstractTracked implements ServiceListener { + private class Tracked extends + AbstractTracked, T, ServiceEvent> + implements ServiceListener { /** * Tracked constructor. */ @@ -811,13 +914,13 @@ } /** - * ServiceListener method for the - * ServiceTracker class. This method must NOT be + * {@code ServiceListener} method for the + * {@code ServiceTracker} class. This method must NOT be * synchronized to avoid deadlock potential. * - * @param event ServiceEvent object from the framework. + * @param event {@code ServiceEvent} object from the framework. */ - public void serviceChanged(final ServiceEvent event) { + final public void serviceChanged(final ServiceEvent event) { /* * Check if we had a delayed call (which could happen when we * close). @@ -825,40 +928,21 @@ if (closed) { return; } - final ServiceReference reference = event.getServiceReference(); + final ServiceReference reference = (ServiceReference) event + .getServiceReference(); if (DEBUG) { - System.out - .println("ServiceTracker.Tracked.serviceChanged[" - + event.getType() + "]: " + reference); + System.out.println("ServiceTracker.Tracked.serviceChanged[" + + event.getType() + "]: " + reference); } switch (event.getType()) { case ServiceEvent.REGISTERED : case ServiceEvent.MODIFIED : - if (listenerFilter != null) { // service listener added with - // filter - track(reference, event); - /* - * If the customizer throws an unchecked exception, it - * is safe to let it propagate - */ - } - else { // service listener added without filter - if (filter.match(reference)) { - track(reference, event); - /* - * If the customizer throws an unchecked exception, - * it is safe to let it propagate - */ - } - else { - untrack(reference, event); - /* - * If the customizer throws an unchecked exception, - * it is safe to let it propagate - */ - } - } + track(reference, event); + /* + * If the customizer throws an unchecked exception, it is + * safe to let it propagate + */ break; case ServiceEvent.MODIFIED_ENDMATCH : case ServiceEvent.UNREGISTERING : @@ -877,7 +961,7 @@ * * @GuardedBy this */ - void modified() { + final void modified() { super.modified(); /* increment the modification count */ ServiceTracker.this.modified(); } @@ -888,12 +972,12 @@ * * @param item Item to be tracked. * @param related Action related object. - * @return Customized object for the tracked item or null + * @return Customized object for the tracked item or {@code null} * if the item is not to be tracked. */ - Object customizerAdding(final Object item, - final Object related) { - return customizer.addingService((ServiceReference) item); + final T customizerAdding(final ServiceReference item, + final ServiceEvent related) { + return customizer.addingService(item); } /** @@ -904,9 +988,9 @@ * @param related Action related object. * @param object Customized object for the tracked item. */ - void customizerModified(final Object item, - final Object related, final Object object) { - customizer.modifiedService((ServiceReference) item, object); + final void customizerModified(final ServiceReference item, + final ServiceEvent related, final T object) { + customizer.modifiedService(item, object); } /** @@ -917,9 +1001,9 @@ * @param related Action related object. * @param object Customized object for the tracked item. */ - void customizerRemoved(final Object item, - final Object related, final Object object) { - customizer.removedService((ServiceReference) item, object); + final void customizerRemoved(final ServiceReference item, + final ServiceEvent related, final T object) { + customizer.removedService(item, object); } } @@ -930,7 +1014,7 @@ * @since 1.3 * @ThreadSafe */ - class AllTracked extends Tracked implements AllServiceListener { + private class AllTracked extends Tracked implements AllServiceListener { /** * AllTracked constructor. */ diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/xml/package.html osgi-compendium-4.3.0/src/org/osgi/util/xml/package.html --- osgi-compendium-4.2.0/src/org/osgi/util/xml/package.html 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/xml/package.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - - -

        XML Parser Package Version 1.0. -

        Bundles wishing to use this package must list the package -in the Import-Package header of the bundle's manifest. -For example: -

        -Import-Package: org.osgi.util.xml; version="[1.0,2.0)"
        -
        - diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/xml/package-info.java osgi-compendium-4.3.0/src/org/osgi/util/xml/package-info.java --- osgi-compendium-4.2.0/src/org/osgi/util/xml/package-info.java 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/xml/package-info.java 2010-11-10 13:03:48.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * XML Parser Package Version 1.0. + * + *

        + * 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.util.xml; version="[1.0,2.0)"} + * + * @version $Id: 2bdf5e50ab3cb446ae0e60f6004c77914fb2b9e4 $ + */ + +package org.osgi.util.xml; diff -Nru osgi-compendium-4.2.0/src/org/osgi/util/xml/XMLParserActivator.java osgi-compendium-4.3.0/src/org/osgi/util/xml/XMLParserActivator.java --- osgi-compendium-4.2.0/src/org/osgi/util/xml/XMLParserActivator.java 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/org/osgi/util/xml/XMLParserActivator.java 2010-11-10 13:03:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved. + * 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. @@ -51,8 +51,8 @@ *

        * The services that this bundle activator enables a bundle to provide are: *

          - *
        • javax.xml.parsers.SAXParserFactory({@link #SAXFACTORYNAME}) - *
        • javax.xml.parsers.DocumentBuilderFactory( + *
        • {@code javax.xml.parsers.SAXParserFactory}({@link #SAXFACTORYNAME}) + *
        • {@code javax.xml.parsers.DocumentBuilderFactory}( * {@link #DOMFACTORYNAME}) *
        * @@ -63,47 +63,47 @@ * An XMLParserActivator assumes that it can find the class file names of the * factory classes in the following files: *
          - *
        • /META-INF/services/javax.xml.parsers.SAXParserFactory is a + *
        • {@code /META-INF/services/javax.xml.parsers.SAXParserFactory} is a * file contained in a jar available to the runtime which contains the * implementation class name(s) of the SAXParserFactory. - *
        • /META-INF/services/javax.xml.parsers.DocumentBuilderFactory + *
        • {@code /META-INF/services/javax.xml.parsers.DocumentBuilderFactory} * is a file contained in a jar available to the runtime which contains the - * implementation class name(s) of the DocumentBuilderFactory + * implementation class name(s) of the {@code DocumentBuilderFactory} *
        *

        - * If either of the files does not exist, XMLParserActivator + * If either of the files does not exist, {@code XMLParserActivator} * assumes that the parser does not support that parser type. * *

        - * XMLParserActivator attempts to instantiate both the - * SAXParserFactory and the DocumentBuilderFactory. It + * {@code XMLParserActivator} attempts to instantiate both the + * {@code SAXParserFactory} and the {@code DocumentBuilderFactory}. It * registers each factory with the framework along with service properties: *

          *
        • {@link #PARSER_VALIDATING}- indicates if this factory supports validating - * parsers. It's value is a Boolean. + * parsers. It's value is a {@code Boolean}. *
        • {@link #PARSER_NAMESPACEAWARE}- indicates if this factory supports - * namespace aware parsers It's value is a Boolean. + * namespace aware parsers It's value is a {@code Boolean}. *
        *

        * Individual parser implementations may have additional features, properties, * or attributes which could be used to select a parser with a filter. These can * be added by extending this class and overriding the - * setSAXProperties and setDOMProperties methods. + * {@code setSAXProperties} and {@code setDOMProperties} methods. * * @ThreadSafe - * @version $Revision: 5900 $ + * @version $Id: 08fe20ecd0552bb592878bdda77e785cc83a7ca3 $ */ public class XMLParserActivator implements BundleActivator, ServiceFactory { /** Context of this bundle */ private volatile BundleContext context; /** * Filename containing the SAX Parser Factory Class name. Also used as the - * basis for the SERVICE_PID registration property. + * basis for the {@code SERVICE_PID} registration property. */ public static final String SAXFACTORYNAME = "javax.xml.parsers.SAXParserFactory"; /** * Filename containing the DOM Parser Factory Class name. Also used as the - * basis for the SERVICE_PID registration property. + * basis for the {@code SERVICE_PID} registration property. */ public static final String DOMFACTORYNAME = "javax.xml.parsers.DocumentBuilderFactory"; /** Path to the factory class name files */ @@ -120,12 +120,12 @@ private static final String DOMFACTORYDESCRIPTION = "A JAXP Compliant DOM Parser"; /** * Service property specifying if factory is configured to support - * validating parsers. The value is of type Boolean. + * validating parsers. The value is of type {@code Boolean}. */ public static final String PARSER_VALIDATING = "parser.validating"; /** * Service property specifying if factory is configured to support namespace - * aware parsers. The value is of type Boolean. + * aware parsers. The value is of type {@code Boolean}. */ public static final String PARSER_NAMESPACEAWARE = "parser.namespaceAware"; /** @@ -224,10 +224,10 @@ /** * Register SAX Parser Factory Services with the framework. * - * @param parserFactoryClassNames - a List of - * String objects containing the names of the parser + * @param parserFactoryClassNames - a {@code List} of + * {@code String} objects containing the names of the parser * Factory Classes - * @throws FactoryConfigurationError if thrown from getFactory + * @throws FactoryConfigurationError if thrown from {@code getFactory} */ private void registerSAXParsers(List parserFactoryClassNames) throws FactoryConfigurationError { @@ -258,16 +258,16 @@ * Set the SAX Parser Service Properties. By default, the following * properties are set: *

          - *
        • SERVICE_DESCRIPTION - *
        • SERVICE_PID - *
        • PARSER_VALIDATING- instantiates a parser and queries + *
        • {@code SERVICE_DESCRIPTION} + *
        • {@code SERVICE_PID} + *
        • {@code PARSER_VALIDATING}- instantiates a parser and queries * it to find out whether it is validating or not - *
        • PARSER_NAMESPACEAWARE- instantiates a parser and + *
        • {@code PARSER_NAMESPACEAWARE}- instantiates a parser and * queries it to find out whether it is namespace aware or not *
            * - * @param factory The SAXParserFactory object - * @param props Hashtable of service properties. + * @param factory The {@code SAXParserFactory} object + * @param props {@code Hashtable} of service properties. */ private void setDefaultSAXProperties(SAXParserFactory factory, Hashtable props, int index) { @@ -329,10 +329,10 @@ /** * Register DOM Parser Factory Services with the framework. * - * @param parserFactoryClassNames - a List of - * String objects containing the names of the parser + * @param parserFactoryClassNames - a {@code List} of + * {@code String} objects containing the names of the parser * Factory Classes - * @throws FactoryConfigurationError if thrown from getFactory + * @throws FactoryConfigurationError if thrown from {@code getFactory} */ private void registerDOMParsers(List parserFactoryClassNames) throws FactoryConfigurationError { @@ -363,14 +363,14 @@ * * By default, the following properties are set: *
              - *
            • SERVICE_DESCRIPTION - *
            • SERVICE_PID - *
            • PARSER_VALIDATING - *
            • PARSER_NAMESPACEAWARE + *
            • {@code SERVICE_DESCRIPTION} + *
            • {@code SERVICE_PID} + *
            • {@code PARSER_VALIDATING} + *
            • {@code PARSER_NAMESPACEAWARE} *
                * - * @param factory The DocumentBuilderFactory object - * @param props Hashtable of service properties. + * @param factory The {@code DocumentBuilderFactory} object + * @param props {@code Hashtable} of service properties. */ private void setDefaultDOMProperties(DocumentBuilderFactory factory, Hashtable props, int index) { @@ -432,7 +432,7 @@ /** * Given a parser factory class name, instantiate that class. * - * @param parserFactoryClassName A String object containing + * @param parserFactoryClassName A {@code String} object containing * the name of the parser factory class * @return a parserFactoryClass Object * @pre parserFactoryClassName!=null @@ -467,7 +467,7 @@ * returned XML Parser Factory object. * * @param bundle The bundle using the service. - * @param registration The ServiceRegistration object for the + * @param registration The {@code ServiceRegistration} object for the * service. * @return A new, configured XML Parser Factory object or null if a * configuration error was encountered @@ -502,10 +502,10 @@ * Releases a XML Parser Factory object. * * @param bundle The bundle releasing the service. - * @param registration The ServiceRegistration object for the + * @param registration The {@code ServiceRegistration} object for the * service. * @param service The XML Parser Factory object returned by a previous call - * to the getService method. + * to the {@code getService} method. */ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { diff -Nru osgi-compendium-4.2.0/src/xmlns/app/v1.0.0/app.xsd osgi-compendium-4.3.0/src/xmlns/app/v1.0.0/app.xsd --- osgi-compendium-4.2.0/src/xmlns/app/v1.0.0/app.xsd 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/xmlns/app/v1.0.0/app.xsd 2010-06-15 15:44:14.000000000 +0000 @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This attribute should be used by extensions to documents + to require that the document consumer understand the + extension. + + + + \ No newline at end of file diff -Nru osgi-compendium-4.2.0/src/xmlns/rsa/v1.0.0/rsa.xsd osgi-compendium-4.3.0/src/xmlns/rsa/v1.0.0/rsa.xsd --- osgi-compendium-4.2.0/src/xmlns/rsa/v1.0.0/rsa.xsd 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/xmlns/rsa/v1.0.0/rsa.xsd 2010-06-15 15:44:14.000000000 +0000 @@ -0,0 +1,160 @@ + + + + + + + This is the XML Schema for endpoint descriptions used by + the Remote Service Admin Specification. Endpoint descriptions + are used to describe remote services to a client in cases + where a real live Discovery system isn't used. An extender, + such as a local Discovery Service can look for service + descriptions in installed bundles and inform the Topology + Manager of these remote services. The Topology Manager can then + instruct the Remote Service Admin to create client proxies for + these services. + + + + + + + + + + + + + + + + + + A Distribution Provider can register a proxy with the properties + provided. Whether or not it is instructed to do so, is up to the + Topology Manager. If any 'intents' properties are specified then the + Distribution Provider should only register a proxy if it can support + those intents. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This attribute should be used by extensions to documents + to require that the document consumer understand the + extension. + + + + diff -Nru osgi-compendium-4.2.0/src/xmlns/scact/v1.0.0/scact.xsd osgi-compendium-4.3.0/src/xmlns/scact/v1.0.0/scact.xsd --- osgi-compendium-4.2.0/src/xmlns/scact/v1.0.0/scact.xsd 1970-01-01 00:00:00.000000000 +0000 +++ osgi-compendium-4.3.0/src/xmlns/scact/v1.0.0/scact.xsd 2010-06-15 15:44:14.000000000 +0000 @@ -0,0 +1,59 @@ + + + + + + + + + + This is the XML Schema for sca-config used by the + SCA configuration type specification. An instance of + an sca-config document can optionally contain bindings, + intents and policySets. These elements described the detailed + configuration for how the service should be made available (e.g. as a + soap/http Web service). The SCA specifications from OASIS define the + binding types which can be included in a bindings document and how + intents and policySets can provide detailed configuration for + policies. + + + + + + + + + + + + + + + + + + This attribute should be used by extensions to documents + to require that the document consumer understand the extension. + + + + diff -Nru osgi-compendium-4.2.0/src/xmlns/scr/v1.0.0/scr.xsd osgi-compendium-4.3.0/src/xmlns/scr/v1.0.0/scr.xsd --- osgi-compendium-4.2.0/src/xmlns/scr/v1.0.0/scr.xsd 2011-10-03 17:57:47.000000000 +0000 +++ osgi-compendium-4.3.0/src/xmlns/scr/v1.0.0/scr.xsd 2010-06-15 15:44:14.000000000 +0000 @@ -1,7 +1,7 @@