Return-Path: Delivered-To: apmail-incubator-felix-commits-archive@www.apache.org Received: (qmail 42490 invoked from network); 18 Oct 2006 22:02:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Oct 2006 22:02:18 -0000 Received: (qmail 43222 invoked by uid 500); 18 Oct 2006 22:02:17 -0000 Delivered-To: apmail-incubator-felix-commits-archive@incubator.apache.org Received: (qmail 43198 invoked by uid 500); 18 Oct 2006 22:02:17 -0000 Mailing-List: contact felix-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: felix-dev@incubator.apache.org Delivered-To: mailing list felix-commits@incubator.apache.org Received: (qmail 43120 invoked by uid 99); 18 Oct 2006 22:02:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Oct 2006 15:02:17 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Oct 2006 15:02:13 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id C70191A982F; Wed, 18 Oct 2006 15:01:27 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r465392 [8/10] - in /incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi: framework/ service/condpermadmin/ service/packageadmin/ service/permissionadmin/ service/startlevel/ service/url/ Date: Wed, 18 Oct 2006 22:01:24 -0000 To: felix-commits@incubator.apache.org From: rickhall@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061018220127.C70191A982F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java?view=diff&rev=465392&r1=465391&r2=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java (original) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java Wed Oct 18 15:01:22 2006 @@ -1,152 +1,152 @@ -/* - * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/BundleSignerCondition.java,v 1.9 2006/03/14 01:20:40 hargrave Exp $ - * - * Copyright (c) OSGi Alliance (2005). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.service.condpermadmin; - -import java.lang.reflect.*; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.osgi.framework.Bundle; - -/** - * Condition to test if the signer of a bundle matches a pattern. Since the bundle's signer can - * only change when the bundle is updated, this condition is immutable. - *

- * The condition expressed using a single String that specifies a Distinguished - * Name (DN) chain to match bundle signers against. DN's are encoded using IETF - * RFC 2253. Usually signers use certificates that are issued by certificate - * authorities, which also have a corresponding DN and certificate. The - * certificate authorities can form a chain of trust where the last DN and - * certificate is known by the framework. The signer of a bundle is expressed as - * signers DN followed by the DN of its issuer followed by the DN of the next - * issuer until the DN of the root certificate authority. Each DN is separated - * by a semicolon. - *

- * A bundle can satisfy this condition if one of its signers has a DN chain that - * matches the DN chain used to construct this condition. Wildcards (`*') can be - * used to allow greater flexibility in specifying the DN chains. Wildcards can - * be used in place of DNs, RDNs, or the value in an RDN. If a wildcard is used - * for a value of an RDN, the value must be exactly "*" and will match any value - * for the corresponding type in that RDN. If a wildcard is used for a RDN, it - * must be the first RDN and will match any number of RDNs (including zero - * RDNs). - * - * @version $Revision: 1.9 $ - */ -public class BundleSignerCondition { - /* - * NOTE: A framework implementor may also choose to replace this class in - * their distribution with a class that directly interfaces with the - * framework implementation. This replacement class MUST NOT alter the - * public/protected signature of this class. - */ - - /* - * This class will load the BundleSignerCondition class in the package named - * by the org.osgi.vendor.condpermadmin package. This class will delegate - * getCondition methods calls to the vendor BundleSignerCondition class. - */ - private static final String packageProperty = "org.osgi.vendor.condpermadmin"; - private static final Method getCondition; - static { - getCondition = (Method) AccessController - .doPrivileged(new PrivilegedAction() { - public Object run() { - String packageName = System - .getProperty(packageProperty); - if (packageName == null) { - throw new NoClassDefFoundError(packageProperty - + " property not set"); - } - - Class delegateClass; - try { - delegateClass = Class.forName(packageName - + ".BundleSignerCondition"); - } - catch (ClassNotFoundException e) { - throw new NoClassDefFoundError(e.toString()); - } - - Method result; - try { - result = delegateClass.getMethod("getCondition", - new Class[] {Bundle.class, - ConditionInfo.class }); - } - catch (NoSuchMethodException e) { - throw new NoSuchMethodError(e.toString()); - } - - if (!Modifier.isStatic(result.getModifiers())) { - throw new NoSuchMethodError( - "getCondition method must be static"); - } - - return result; - } - }); - } - - private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleSignerCondition"; - - /** - * Constructs a Condition that tries to match the passed Bundle's location - * to the location pattern. - * - * @param bundle The Bundle being evaluated. - * @param info The ConditionInfo to construct the condition for. The args of - * the ConditionInfo specify a single String specifying the chain of - * distinguished names pattern to match against the signer of the - * Bundle. - * @return A Condition which checks the signers of the specified bundle. - */ - static public Condition getCondition(Bundle bundle, ConditionInfo info) { - if (!CONDITION_TYPE.equals(info.getType())) - throw new IllegalArgumentException( - "ConditionInfo must be of type \"" + CONDITION_TYPE + "\""); - String[] args = info.getArgs(); - if (args.length != 1) - throw new IllegalArgumentException("Illegal number of args: " - + args.length); - - try { - try { - return (Condition) getCondition.invoke(null, new Object[] { - bundle, info}); - } - catch (InvocationTargetException e) { - throw e.getTargetException(); - } - } - catch (Error e) { - throw e; - } - catch (RuntimeException e) { - throw e; - } - catch (Throwable e) { - throw new RuntimeException(e.toString()); - } - } - - private BundleSignerCondition() { - // private constructor to prevent objects of this type - } -} +/* + * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/BundleSignerCondition.java,v 1.10 2006/06/16 16:31:37 hargrave Exp $ + * + * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.condpermadmin; + +import java.lang.reflect.*; +import java.security.AccessController; +import java.security.PrivilegedAction; + +import org.osgi.framework.Bundle; + +/** + * Condition to test if the signer of a bundle matches a pattern. Since the bundle's signer can + * only change when the bundle is updated, this condition is immutable. + *

+ * The condition expressed using a single String that specifies a Distinguished + * Name (DN) chain to match bundle signers against. DN's are encoded using IETF + * RFC 2253. Usually signers use certificates that are issued by certificate + * authorities, which also have a corresponding DN and certificate. The + * certificate authorities can form a chain of trust where the last DN and + * certificate is known by the framework. The signer of a bundle is expressed as + * signers DN followed by the DN of its issuer followed by the DN of the next + * issuer until the DN of the root certificate authority. Each DN is separated + * by a semicolon. + *

+ * A bundle can satisfy this condition if one of its signers has a DN chain that + * matches the DN chain used to construct this condition. Wildcards (`*') can be + * used to allow greater flexibility in specifying the DN chains. Wildcards can + * be used in place of DNs, RDNs, or the value in an RDN. If a wildcard is used + * for a value of an RDN, the value must be exactly "*" and will match any value + * for the corresponding type in that RDN. If a wildcard is used for a RDN, it + * must be the first RDN and will match any number of RDNs (including zero + * RDNs). + * + * @version $Revision: 1.10 $ + */ +public class BundleSignerCondition { + /* + * NOTE: A framework implementor may also choose to replace this class in + * their distribution with a class that directly interfaces with the + * framework implementation. This replacement class MUST NOT alter the + * public/protected signature of this class. + */ + + /* + * This class will load the BundleSignerCondition class in the package named + * by the org.osgi.vendor.condpermadmin package. This class will delegate + * getCondition methods calls to the vendor BundleSignerCondition class. + */ + private static final String packageProperty = "org.osgi.vendor.condpermadmin"; + private static final Method getCondition; + static { + getCondition = (Method) AccessController + .doPrivileged(new PrivilegedAction() { + public Object run() { + String packageName = System + .getProperty(packageProperty); + if (packageName == null) { + throw new NoClassDefFoundError(packageProperty + + " property not set"); + } + + Class delegateClass; + try { + delegateClass = Class.forName(packageName + + ".BundleSignerCondition"); + } + catch (ClassNotFoundException e) { + throw new NoClassDefFoundError(e.toString()); + } + + Method result; + try { + result = delegateClass.getMethod("getCondition", + new Class[] {Bundle.class, + ConditionInfo.class }); + } + catch (NoSuchMethodException e) { + throw new NoSuchMethodError(e.toString()); + } + + if (!Modifier.isStatic(result.getModifiers())) { + throw new NoSuchMethodError( + "getCondition method must be static"); + } + + return result; + } + }); + } + + private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleSignerCondition"; + + /** + * Constructs a Condition that tries to match the passed Bundle's location + * to the location pattern. + * + * @param bundle The Bundle being evaluated. + * @param info The ConditionInfo to construct the condition for. The args of + * the ConditionInfo specify a single String specifying the chain of + * distinguished names pattern to match against the signer of the + * Bundle. + * @return A Condition which checks the signers of the specified bundle. + */ + static public Condition getCondition(Bundle bundle, ConditionInfo info) { + if (!CONDITION_TYPE.equals(info.getType())) + throw new IllegalArgumentException( + "ConditionInfo must be of type \"" + CONDITION_TYPE + "\""); + String[] args = info.getArgs(); + if (args.length != 1) + throw new IllegalArgumentException("Illegal number of args: " + + args.length); + + try { + try { + return (Condition) getCondition.invoke(null, new Object[] { + bundle, info}); + } + catch (InvocationTargetException e) { + throw e.getTargetException(); + } + } + catch (Error e) { + throw e; + } + catch (RuntimeException e) { + throw e; + } + catch (Throwable e) { + throw new RuntimeException(e.toString()); + } + } + + private BundleSignerCondition() { + // private constructor to prevent objects of this type + } +} Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/Condition.java URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/Condition.java?view=diff&rev=465392&r1=465391&r2=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/Condition.java (original) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/Condition.java Wed Oct 18 15:01:22 2006 @@ -1,127 +1,127 @@ -/* - * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/Condition.java,v 1.12 2006/03/14 01:20:40 hargrave Exp $ - * - * Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.service.condpermadmin; - -import java.util.Dictionary; - -/** - * The interface implemented by a Condition. Conditions are bound to Permissions - * using Conditional Permission Info. The Permissions of a ConditionalPermission - * Info can only be used if the associated Conditions are satisfied. - * - * @version $Revision: 1.12 $ - */ -public interface Condition { - /** - * A Condition object that will always evaluate to true and that is never - * postponed. - */ - public final static Condition TRUE = new BooleanCondition(true); - - /** - * A Condition object that will always evaluate to false and that is never - * postponed. - */ - public final static Condition FALSE = new BooleanCondition(false); - - /** - * Returns whether the evaluation must be postponed until the end of the - * permission check. This method returns true if the - * evaluation of the Condition must be postponed until the end of the - * permission check. If this method returns false, this - * Condition must be able to directly answer the {@link #isSatisfied()} - * method. In other words, isSatisfied() will return very quickly since no - * external sources, such as for example users, need to be consulted. - * - * @return true to indicate the evaluation must be postponed. - * Otherwise, false if the evaluation can be - * immediately performed. - */ - boolean isPostponed(); - - /** - * Returns whether the Condition is satisfied. - * - * @return true to indicate the Conditions is satisfied. - * Otherwise, false if the Condition is not satisfied. - */ - boolean isSatisfied(); - - /** - * Returns whether the Condition is mutable. - * - * @return true to indicate the value returned by - * {@link #isSatisfied()} can change. Otherwise, false - * if the value returned by {@link #isSatisfied()} will not change. - */ - boolean isMutable(); - - /** - * Returns whether a the set of Conditions are satisfied. Although this - * method is not static, it must be implemented as if it were static. All of - * the passed Conditions will be of the same type and will correspond to the - * class type of the object on which this method is invoked. - * - * @param conditions The array of Conditions. - * @param context A Dictionary object that implementors can use to track - * state. If this method is invoked multiple times in the same - * permission evaluation, the same Dictionary will be passed multiple - * times. The SecurityManager treats this Dictionary as an opaque - * object and simply creates an empty dictionary and passes it to - * subsequent invocations if multiple invocatios are needed. - * @return true if all the Conditions are satisfied. - * Otherwise, false if one of the Conditions is not - * satisfied. - */ - boolean isSatisfied(Condition conditions[], Dictionary context); - -} - -/** - * Package internal class used to define the {@link Condition#FALSE} and - * {@link Condition#TRUE} constants. - */ -final class BooleanCondition implements Condition { - final boolean satisfied; - - BooleanCondition(boolean satisfied) { - this.satisfied = satisfied; - } - - public boolean isPostponed() { - return false; - } - - public boolean isSatisfied() { - return satisfied; - } - - public boolean isMutable() { - return false; - } - - public boolean isSatisfied(Condition[] conds, Dictionary context) { - for (int i = 0; i < conds.length; i++) { - if (!conds[i].isSatisfied()) - return false; - } - return true; - } - -} +/* + * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/Condition.java,v 1.13 2006/06/16 16:31:37 hargrave Exp $ + * + * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.condpermadmin; + +import java.util.Dictionary; + +/** + * The interface implemented by a Condition. Conditions are bound to Permissions + * using Conditional Permission Info. The Permissions of a ConditionalPermission + * Info can only be used if the associated Conditions are satisfied. + * + * @version $Revision: 1.13 $ + */ +public interface Condition { + /** + * A Condition object that will always evaluate to true and that is never + * postponed. + */ + public final static Condition TRUE = new BooleanCondition(true); + + /** + * A Condition object that will always evaluate to false and that is never + * postponed. + */ + public final static Condition FALSE = new BooleanCondition(false); + + /** + * Returns whether the evaluation must be postponed until the end of the + * permission check. This method returns true if the + * evaluation of the Condition must be postponed until the end of the + * permission check. If this method returns false, this + * Condition must be able to directly answer the {@link #isSatisfied()} + * method. In other words, isSatisfied() will return very quickly since no + * external sources, such as for example users, need to be consulted. + * + * @return true to indicate the evaluation must be postponed. + * Otherwise, false if the evaluation can be + * immediately performed. + */ + boolean isPostponed(); + + /** + * Returns whether the Condition is satisfied. + * + * @return true to indicate the Conditions is satisfied. + * Otherwise, false if the Condition is not satisfied. + */ + boolean isSatisfied(); + + /** + * Returns whether the Condition is mutable. + * + * @return true to indicate the value returned by + * {@link #isSatisfied()} can change. Otherwise, false + * if the value returned by {@link #isSatisfied()} will not change. + */ + boolean isMutable(); + + /** + * Returns whether a the set of Conditions are satisfied. Although this + * method is not static, it must be implemented as if it were static. All of + * the passed Conditions will be of the same type and will correspond to the + * class type of the object on which this method is invoked. + * + * @param conditions The array of Conditions. + * @param context A Dictionary object that implementors can use to track + * state. If this method is invoked multiple times in the same + * permission evaluation, the same Dictionary will be passed multiple + * times. The SecurityManager treats this Dictionary as an opaque + * object and simply creates an empty dictionary and passes it to + * subsequent invocations if multiple invocatios are needed. + * @return true if all the Conditions are satisfied. + * Otherwise, false if one of the Conditions is not + * satisfied. + */ + boolean isSatisfied(Condition conditions[], Dictionary context); + +} + +/** + * Package internal class used to define the {@link Condition#FALSE} and + * {@link Condition#TRUE} constants. + */ +final class BooleanCondition implements Condition { + final boolean satisfied; + + BooleanCondition(boolean satisfied) { + this.satisfied = satisfied; + } + + public boolean isPostponed() { + return false; + } + + public boolean isSatisfied() { + return satisfied; + } + + public boolean isMutable() { + return false; + } + + public boolean isSatisfied(Condition[] conds, Dictionary context) { + for (int i = 0; i < conds.length; i++) { + if (!conds[i].isSatisfied()) + return false; + } + return true; + } + +} Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java?view=diff&rev=465392&r1=465391&r2=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java (original) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java Wed Oct 18 15:01:22 2006 @@ -1,349 +1,349 @@ -/* - * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionInfo.java,v 1.12 2006/03/14 01:20:40 hargrave Exp $ - * - * Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.service.condpermadmin; - -import java.util.ArrayList; - -/** - * Condition representation used by the Conditional Permission Admin service. - * - *

- * This class encapsulates two pieces of information: a Condition type - * (class name), which must implement Condition, and the - * arguments passed to its constructor. - * - *

- * In order for a Condition represented by a ConditionInfo to be - * instantiated and considered during a permission check, its Condition class - * must be available from the system classpath. - * - *

- * The Condition class must either: - *

    - *
  • Declare a public static getCondition method that takes a - * Bundle object and a ConditionInfo object as - * arguments. That method must return an object that implements the - * Condition interface.
  • - *
  • Implement the Condition interface and define a public - * constructor that takes a Bundle object and a - * ConditionInfo object as arguments. - *
- * - * @version $Revision: 1.12 $ - */ -public class ConditionInfo { - private String type; - private String[] args; - - /** - * Constructs a ConditionInfo from the specified type and - * args. - * - * @param type The fully qualified class name of the Condition represented - * by this ConditionInfo. - * @param args The arguments for the Condition. These arguments are - * available to the newly created Condition by calling the - * {@link #getArgs()} method. - * @throws java.lang.NullPointerException If type is - * null. - */ - public ConditionInfo(String type, String[] args) { - this.type = type; - this.args = args != null ? args : new String[0]; - if (type == null) { - throw new NullPointerException("type is null"); - } - } - - /** - * Constructs a ConditionInfo object from the specified - * encoded ConditionInfo string. White space in the encoded - * ConditionInfo string is ignored. - * - * @param encodedCondition The encoded ConditionInfo. - * @see #getEncoded - * @throws java.lang.IllegalArgumentException If the - * encodedCondition is not properly formatted. - */ - public ConditionInfo(String encodedCondition) { - if (encodedCondition == null) { - throw new NullPointerException("missing encoded condition"); - } - if (encodedCondition.length() == 0) { - throw new IllegalArgumentException("empty encoded condition"); - } - try { - char[] encoded = encodedCondition.toCharArray(); - int length = encoded.length; - int pos = 0; - - /* skip whitespace */ - while (Character.isWhitespace(encoded[pos])) { - pos++; - } - - /* the first character must be '[' */ - if (encoded[pos] != '[') { - throw new IllegalArgumentException("expecting open bracket"); - } - pos++; - - /* skip whitespace */ - while (Character.isWhitespace(encoded[pos])) { - pos++; - } - - /* type is not quoted or encoded */ - int begin = pos; - while (!Character.isWhitespace(encoded[pos]) - && (encoded[pos] != ']')) { - pos++; - } - if (pos == begin || encoded[begin] == '"') { - throw new IllegalArgumentException("expecting type"); - } - this.type = new String(encoded, begin, pos - begin); - - /* skip whitespace */ - while (Character.isWhitespace(encoded[pos])) { - pos++; - } - - /* type may be followed by args which are quoted and encoded */ - ArrayList argsList = new ArrayList(); - while (encoded[pos] == '"') { - pos++; - begin = pos; - while (encoded[pos] != '"') { - if (encoded[pos] == '\\') { - pos++; - } - pos++; - } - argsList.add(unescapeString(encoded, begin, pos)); - pos++; - - if (Character.isWhitespace(encoded[pos])) { - /* skip whitespace */ - while (Character.isWhitespace(encoded[pos])) { - pos++; - } - } - } - this.args = (String[]) argsList - .toArray(new String[argsList.size()]); - - /* the final character must be ']' */ - char c = encoded[pos]; - pos++; - while ((pos < length) && Character.isWhitespace(encoded[pos])) { - pos++; - } - if ((c != ']') || (pos != length)) { - throw new IllegalArgumentException("expecting close bracket"); - } - } - catch (ArrayIndexOutOfBoundsException e) { - throw new IllegalArgumentException("parsing terminated abruptly"); - } - } - - /** - * Returns the string encoding of this ConditionInfo in a - * form suitable for restoring this ConditionInfo. - * - *

- * The encoding format is: - * - *

-	 *   [type "arg0" "arg1" ...]
-	 * 
- * - * where argN are strings that are encoded for proper parsing. - * Specifically, the ", \, carriage return, - * and linefeed characters are escaped using \", - * \\, \r, and \n, - * respectively. - * - *

- * The encoded string contains no leading or trailing whitespace characters. - * A single space character is used between type and "arg0" and - * between the arguments. - * - * @return The string encoding of this ConditionInfo. - */ - public final String getEncoded() { - StringBuffer output = new StringBuffer(); - output.append('['); - output.append(type); - - for (int i = 0; i < args.length; i++) { - output.append(" \""); - escapeString(args[i], output); - output.append('\"'); - } - - output.append(']'); - - return output.toString(); - } - - /** - * Returns the string representation of this ConditionInfo. - * The string is created by calling the getEncoded method on - * this ConditionInfo. - * - * @return The string representation of this ConditionInfo. - */ - public String toString() { - return getEncoded(); - } - - /** - * Returns the fully qualified class name of the condition represented by - * this ConditionInfo. - * - * @return The fully qualified class name of the condition represented by - * this ConditionInfo. - */ - public final String getType() { - return type; - } - - /** - * Returns arguments of this ConditionInfo. - * - * @return The arguments of this ConditionInfo. An empty - * array is returned if the ConditionInfo has no - * arguments. - */ - public final String[] getArgs() { - return args; - } - - /** - * Determines the equality of two ConditionInfo objects. - * - * This method checks that specified object has the same type and args as - * this ConditionInfo object. - * - * @param obj The object to test for equality with this - * ConditionInfo object. - * @return true if obj is a - * ConditionInfo, and has the same type and args as - * this ConditionInfo object; false - * otherwise. - */ - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - - if (!(obj instanceof ConditionInfo)) { - return false; - } - - ConditionInfo other = (ConditionInfo) obj; - - if (!type.equals(other.type) || args.length != other.args.length) - return false; - - for (int i = 0; i < args.length; i++) { - if (!args[i].equals(other.args[i])) - return false; - } - return true; - } - - /** - * Returns the hash code value for this object. - * - * @return A hash code value for this object. - */ - - public int hashCode() { - int hash = type.hashCode(); - - for (int i = 0; i < args.length; i++) { - hash ^= args[i].hashCode(); - } - return hash; - } - - /** - * This escapes the quotes, backslashes, \n, and \r in the string using a - * backslash and appends the newly escaped string to a StringBuffer. - */ - private static void escapeString(String str, StringBuffer output) { - int len = str.length(); - for (int i = 0; i < len; i++) { - char c = str.charAt(i); - switch (c) { - case '"' : - case '\\' : - output.append('\\'); - output.append(c); - break; - case '\r' : - output.append("\\r"); - break; - case '\n' : - output.append("\\n"); - break; - default : - output.append(c); - break; - } - } - } - - /** - * Takes an encoded character array and decodes it into a new String. - */ - private static String unescapeString(char[] str, int begin, int end) { - StringBuffer output = new StringBuffer(end - begin); - for (int i = begin; i < end; i++) { - char c = str[i]; - if (c == '\\') { - i++; - if (i < end) { - c = str[i]; - switch (c) { - case '"' : - case '\\' : - break; - case 'r' : - c = '\r'; - break; - case 'n' : - c = '\n'; - break; - default : - c = '\\'; - i--; - break; - } - } - } - output.append(c); - } - - return output.toString(); - } -} +/* + * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionInfo.java,v 1.13 2006/06/16 16:31:37 hargrave Exp $ + * + * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.condpermadmin; + +import java.util.ArrayList; + +/** + * Condition representation used by the Conditional Permission Admin service. + * + *

+ * This class encapsulates two pieces of information: a Condition type + * (class name), which must implement Condition, and the + * arguments passed to its constructor. + * + *

+ * In order for a Condition represented by a ConditionInfo to be + * instantiated and considered during a permission check, its Condition class + * must be available from the system classpath. + * + *

+ * The Condition class must either: + *

    + *
  • Declare a public static getCondition method that takes a + * Bundle object and a ConditionInfo object as + * arguments. That method must return an object that implements the + * Condition interface.
  • + *
  • Implement the Condition interface and define a public + * constructor that takes a Bundle object and a + * ConditionInfo object as arguments. + *
+ * + * @version $Revision: 1.13 $ + */ +public class ConditionInfo { + private String type; + private String[] args; + + /** + * Constructs a ConditionInfo from the specified type and + * args. + * + * @param type The fully qualified class name of the Condition represented + * by this ConditionInfo. + * @param args The arguments for the Condition. These arguments are + * available to the newly created Condition by calling the + * {@link #getArgs()} method. + * @throws java.lang.NullPointerException If type is + * null. + */ + public ConditionInfo(String type, String[] args) { + this.type = type; + this.args = args != null ? args : new String[0]; + if (type == null) { + throw new NullPointerException("type is null"); + } + } + + /** + * Constructs a ConditionInfo object from the specified + * encoded ConditionInfo string. White space in the encoded + * ConditionInfo string is ignored. + * + * @param encodedCondition The encoded ConditionInfo. + * @see #getEncoded + * @throws java.lang.IllegalArgumentException If the + * encodedCondition is not properly formatted. + */ + public ConditionInfo(String encodedCondition) { + if (encodedCondition == null) { + throw new NullPointerException("missing encoded condition"); + } + if (encodedCondition.length() == 0) { + throw new IllegalArgumentException("empty encoded condition"); + } + try { + char[] encoded = encodedCondition.toCharArray(); + int length = encoded.length; + int pos = 0; + + /* skip whitespace */ + while (Character.isWhitespace(encoded[pos])) { + pos++; + } + + /* the first character must be '[' */ + if (encoded[pos] != '[') { + throw new IllegalArgumentException("expecting open bracket"); + } + pos++; + + /* skip whitespace */ + while (Character.isWhitespace(encoded[pos])) { + pos++; + } + + /* type is not quoted or encoded */ + int begin = pos; + while (!Character.isWhitespace(encoded[pos]) + && (encoded[pos] != ']')) { + pos++; + } + if (pos == begin || encoded[begin] == '"') { + throw new IllegalArgumentException("expecting type"); + } + this.type = new String(encoded, begin, pos - begin); + + /* skip whitespace */ + while (Character.isWhitespace(encoded[pos])) { + pos++; + } + + /* type may be followed by args which are quoted and encoded */ + ArrayList argsList = new ArrayList(); + while (encoded[pos] == '"') { + pos++; + begin = pos; + while (encoded[pos] != '"') { + if (encoded[pos] == '\\') { + pos++; + } + pos++; + } + argsList.add(unescapeString(encoded, begin, pos)); + pos++; + + if (Character.isWhitespace(encoded[pos])) { + /* skip whitespace */ + while (Character.isWhitespace(encoded[pos])) { + pos++; + } + } + } + this.args = (String[]) argsList + .toArray(new String[argsList.size()]); + + /* the final character must be ']' */ + char c = encoded[pos]; + pos++; + while ((pos < length) && Character.isWhitespace(encoded[pos])) { + pos++; + } + if ((c != ']') || (pos != length)) { + throw new IllegalArgumentException("expecting close bracket"); + } + } + catch (ArrayIndexOutOfBoundsException e) { + throw new IllegalArgumentException("parsing terminated abruptly"); + } + } + + /** + * Returns the string encoding of this ConditionInfo in a + * form suitable for restoring this ConditionInfo. + * + *

+ * The encoding format is: + * + *

+	 *   [type "arg0" "arg1" ...]
+	 * 
+ * + * where argN are strings that are encoded for proper parsing. + * Specifically, the ", \, carriage return, + * and linefeed characters are escaped using \", + * \\, \r, and \n, + * respectively. + * + *

+ * The encoded string contains no leading or trailing whitespace characters. + * A single space character is used between type and "arg0" and + * between the arguments. + * + * @return The string encoding of this ConditionInfo. + */ + public final String getEncoded() { + StringBuffer output = new StringBuffer(); + output.append('['); + output.append(type); + + for (int i = 0; i < args.length; i++) { + output.append(" \""); + escapeString(args[i], output); + output.append('\"'); + } + + output.append(']'); + + return output.toString(); + } + + /** + * Returns the string representation of this ConditionInfo. + * The string is created by calling the getEncoded method on + * this ConditionInfo. + * + * @return The string representation of this ConditionInfo. + */ + public String toString() { + return getEncoded(); + } + + /** + * Returns the fully qualified class name of the condition represented by + * this ConditionInfo. + * + * @return The fully qualified class name of the condition represented by + * this ConditionInfo. + */ + public final String getType() { + return type; + } + + /** + * Returns arguments of this ConditionInfo. + * + * @return The arguments of this ConditionInfo. An empty + * array is returned if the ConditionInfo has no + * arguments. + */ + public final String[] getArgs() { + return args; + } + + /** + * Determines the equality of two ConditionInfo objects. + * + * This method checks that specified object has the same type and args as + * this ConditionInfo object. + * + * @param obj The object to test for equality with this + * ConditionInfo object. + * @return true if obj is a + * ConditionInfo, and has the same type and args as + * this ConditionInfo object; false + * otherwise. + */ + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (!(obj instanceof ConditionInfo)) { + return false; + } + + ConditionInfo other = (ConditionInfo) obj; + + if (!type.equals(other.type) || args.length != other.args.length) + return false; + + for (int i = 0; i < args.length; i++) { + if (!args[i].equals(other.args[i])) + return false; + } + return true; + } + + /** + * Returns the hash code value for this object. + * + * @return A hash code value for this object. + */ + + public int hashCode() { + int hash = type.hashCode(); + + for (int i = 0; i < args.length; i++) { + hash ^= args[i].hashCode(); + } + return hash; + } + + /** + * This escapes the quotes, backslashes, \n, and \r in the string using a + * backslash and appends the newly escaped string to a StringBuffer. + */ + private static void escapeString(String str, StringBuffer output) { + int len = str.length(); + for (int i = 0; i < len; i++) { + char c = str.charAt(i); + switch (c) { + case '"' : + case '\\' : + output.append('\\'); + output.append(c); + break; + case '\r' : + output.append("\\r"); + break; + case '\n' : + output.append("\\n"); + break; + default : + output.append(c); + break; + } + } + } + + /** + * Takes an encoded character array and decodes it into a new String. + */ + private static String unescapeString(char[] str, int begin, int end) { + StringBuffer output = new StringBuffer(end - begin); + for (int i = begin; i < end; i++) { + char c = str[i]; + if (c == '\\') { + i++; + if (i < end) { + c = str[i]; + switch (c) { + case '"' : + case '\\' : + break; + case 'r' : + c = '\r'; + break; + case 'n' : + c = '\n'; + break; + default : + c = '\\'; + i--; + break; + } + } + } + output.append(c); + } + + return output.toString(); + } +} Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java?view=diff&rev=465392&r1=465391&r2=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java (original) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java Wed Oct 18 15:01:22 2006 @@ -1,104 +1,104 @@ -/* - * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java,v 1.12 2006/03/14 01:20:40 hargrave Exp $ - * - * Copyright (c) OSGi Alliance (2005). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.service.condpermadmin; - -import java.security.AccessControlContext; -import java.util.Enumeration; - -import org.osgi.service.permissionadmin.PermissionInfo; - -/** - * Framework service to administer Conditional Permissions. Conditional - * Permissions can be added to, retrieved from, and removed from the framework. - * - * @version $Revision: 1.12 $ - */ -public interface ConditionalPermissionAdmin { - /** - * Create a new Conditional Permission Info. - * - * The Conditional Permission Info will be given a unique, never reused - * name. - * - * @param conds The Conditions that need to be satisfied to enable the - * corresponding Permissions. - * @param perms The Permissions that are enable when the corresponding - * Conditions are satisfied. - * @return The ConditionalPermissionInfo for the specified Conditions and - * Permissions. - * @throws SecurityException If the caller does not have - * AllPermission. - */ - public ConditionalPermissionInfo addConditionalPermissionInfo( - ConditionInfo conds[], PermissionInfo perms[]); - - /** - * Set or create a Conditional Permission Info with a specified name. - * - * If the specified name is null, a new Conditional - * Permission Info must be created and will be given a unique, never reused - * name. If there is currently no Conditional Permission Info with the - * specified name, a new Conditional Permission Info must be created with - * the specified name. Otherwise, the Conditional Permission Info with the - * specified name must be updated with the specified Conditions and - * Permissions. - * - * @param name The name of the Conditional Permission Info, or - * null. - * @param conds The Conditions that need to be satisfied to enable the - * corresponding Permissions. - * @param perms The Permissions that are enable when the corresponding - * Conditions are satisfied. - * @return The ConditionalPermissionInfo that for the specified name, - * Conditions and Permissions. - * @throws SecurityException If the caller does not have - * AllPermission. - */ - public ConditionalPermissionInfo setConditionalPermissionInfo(String name, - ConditionInfo conds[], PermissionInfo perms[]); - - /** - * Returns the Conditional Permission Infos that are currently managed by - * Conditional Permission Admin. Calling - * {@link ConditionalPermissionInfo#delete()} will remove the Conditional - * Permission Info from Conditional Permission Admin. - * - * @return An enumeration of the Conditional Permission Infos that are - * currently managed by Conditional Permission Admin. - */ - public Enumeration getConditionalPermissionInfos(); - - /** - * Return the Conditional Permission Info with the specified name. - * - * @param name The name of the Conditional Permission Info to be returned. - * @return The Conditional Permission Info with the specified name. - */ - public ConditionalPermissionInfo getConditionalPermissionInfo(String name); - - /** - * Returns the Access Control Context that corresponds to the specified - * signers. - * - * @param signers The signers for which to return an Access Control Context. - * @return An AccessControlContext that has the Permissions - * associated with the signer. - */ - public AccessControlContext getAccessControlContext(String[] signers); -} +/* + * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java,v 1.13 2006/06/16 16:31:37 hargrave Exp $ + * + * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.condpermadmin; + +import java.security.AccessControlContext; +import java.util.Enumeration; + +import org.osgi.service.permissionadmin.PermissionInfo; + +/** + * Framework service to administer Conditional Permissions. Conditional + * Permissions can be added to, retrieved from, and removed from the framework. + * + * @version $Revision: 1.13 $ + */ +public interface ConditionalPermissionAdmin { + /** + * Create a new Conditional Permission Info. + * + * The Conditional Permission Info will be given a unique, never reused + * name. + * + * @param conds The Conditions that need to be satisfied to enable the + * corresponding Permissions. + * @param perms The Permissions that are enable when the corresponding + * Conditions are satisfied. + * @return The ConditionalPermissionInfo for the specified Conditions and + * Permissions. + * @throws SecurityException If the caller does not have + * AllPermission. + */ + public ConditionalPermissionInfo addConditionalPermissionInfo( + ConditionInfo conds[], PermissionInfo perms[]); + + /** + * Set or create a Conditional Permission Info with a specified name. + * + * If the specified name is null, a new Conditional + * Permission Info must be created and will be given a unique, never reused + * name. If there is currently no Conditional Permission Info with the + * specified name, a new Conditional Permission Info must be created with + * the specified name. Otherwise, the Conditional Permission Info with the + * specified name must be updated with the specified Conditions and + * Permissions. + * + * @param name The name of the Conditional Permission Info, or + * null. + * @param conds The Conditions that need to be satisfied to enable the + * corresponding Permissions. + * @param perms The Permissions that are enable when the corresponding + * Conditions are satisfied. + * @return The ConditionalPermissionInfo that for the specified name, + * Conditions and Permissions. + * @throws SecurityException If the caller does not have + * AllPermission. + */ + public ConditionalPermissionInfo setConditionalPermissionInfo(String name, + ConditionInfo conds[], PermissionInfo perms[]); + + /** + * Returns the Conditional Permission Infos that are currently managed by + * Conditional Permission Admin. Calling + * {@link ConditionalPermissionInfo#delete()} will remove the Conditional + * Permission Info from Conditional Permission Admin. + * + * @return An enumeration of the Conditional Permission Infos that are + * currently managed by Conditional Permission Admin. + */ + public Enumeration getConditionalPermissionInfos(); + + /** + * Return the Conditional Permission Info with the specified name. + * + * @param name The name of the Conditional Permission Info to be returned. + * @return The Conditional Permission Info with the specified name. + */ + public ConditionalPermissionInfo getConditionalPermissionInfo(String name); + + /** + * Returns the Access Control Context that corresponds to the specified + * signers. + * + * @param signers The signers for which to return an Access Control Context. + * @return An AccessControlContext that has the Permissions + * associated with the signer. + */ + public AccessControlContext getAccessControlContext(String[] signers); +} Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java?view=diff&rev=465392&r1=465391&r2=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java (original) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java Wed Oct 18 15:01:22 2006 @@ -1,63 +1,63 @@ -/* - * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java,v 1.10 2006/03/14 01:20:40 hargrave Exp $ - * - * Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.osgi.service.condpermadmin; - -import org.osgi.service.permissionadmin.PermissionInfo; - -/** - * A binding of a set of Conditions to a set of Permissions. Instances of this - * interface are obtained from the Conditional Permission Admin service. - * - * @version $Revision: 1.10 $ - */ -public interface ConditionalPermissionInfo { - /** - * Returns the Condition Infos for the Conditions that must be satisfied to - * enable the Permissions. - * - * @return The Condition Infos for the Conditions in this Conditional - * Permission Info. - */ - public ConditionInfo[] getConditionInfos(); - - /** - * Returns the Permission Infos for the Permission in this Conditional - * Permission Info. - * - * @return The Permission Infos for the Permission in this Conditional - * Permission Info. - */ - public PermissionInfo[] getPermissionInfos(); - - /** - * Removes this Conditional Permission Info from the Conditional Permission - * Admin. - * - * @throws SecurityException If the caller does not have - * AllPermission. - */ - public void delete(); - - /** - * Returns the name of this Conditional Permission Info. - * - * @return The name of this Conditional Permission Info. - */ - public String getName(); -} +/* + * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java,v 1.11 2006/06/16 16:31:37 hargrave Exp $ + * + * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.condpermadmin; + +import org.osgi.service.permissionadmin.PermissionInfo; + +/** + * A binding of a set of Conditions to a set of Permissions. Instances of this + * interface are obtained from the Conditional Permission Admin service. + * + * @version $Revision: 1.11 $ + */ +public interface ConditionalPermissionInfo { + /** + * Returns the Condition Infos for the Conditions that must be satisfied to + * enable the Permissions. + * + * @return The Condition Infos for the Conditions in this Conditional + * Permission Info. + */ + public ConditionInfo[] getConditionInfos(); + + /** + * Returns the Permission Infos for the Permission in this Conditional + * Permission Info. + * + * @return The Permission Infos for the Permission in this Conditional + * Permission Info. + */ + public PermissionInfo[] getPermissionInfos(); + + /** + * Removes this Conditional Permission Info from the Conditional Permission + * Admin. + * + * @throws SecurityException If the caller does not have + * AllPermission. + */ + public void delete(); + + /** + * Returns the name of this Conditional Permission Info. + * + * @return The name of this Conditional Permission Info. + */ + public String getName(); +} Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/package.html URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/package.html?view=diff&rev=465392&r1=465391&r2=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/package.html (original) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/package.html Wed Oct 18 15:01:22 2006 @@ -1,6 +1,6 @@ - + -

The OSGi Conditional Permission Admin Specification Version 1.0. +

Conditional Permission 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: Added: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/packageinfo URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/packageinfo?view=auto&rev=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/packageinfo (added) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/packageinfo Wed Oct 18 15:01:22 2006 @@ -0,0 +1 @@ +version 1.0 Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java?view=diff&rev=465392&r1=465391&r2=465392 ============================================================================== --- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java (original) +++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java Wed Oct 18 15:01:22 2006 @@ -1,111 +1,110 @@ -/* - * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/ExportedPackage.java,v 1.12 2006/03/14 01:20:05 hargrave Exp $ - * - * Copyright (c) OSGi Alliance (2001, 2005). 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.packageadmin; - -import org.osgi.framework.Bundle; -import org.osgi.framework.Version; - -/** - * An exported package. - * - * Objects implementing this interface are created by the Package Admin service. - * - *

- * The term exported package refers to a package that has been exported - * from a resolved bundle. This package may or may not be currently wired to - * other bundles. - * - *

- * The information about an exported package provided by this object may change. - * An ExportedPackage object becomes stale if the package it - * references has been updated or removed as a result of calling - * PackageAdmin.refreshPackages(). - * - * If this object becomes stale, its getName() and - * getVersion() methods continue to return their original values, - * isRemovalPending() returns true, and - * getExportingBundle() and getImportingBundles() - * return null. - * - * @version $Revision: 1.12 $ - */ -public interface ExportedPackage { - /** - * Returns the name of the package associated with this exported package. - * - * @return The name of this exported package. - */ - public String getName(); - - /** - * Returns the bundle exporting the package associated with this exported - * package. - * - * @return The exporting bundle, or null if this - * ExportedPackage object has become stale. - */ - public Bundle getExportingBundle(); - - /** - * Returns the resolved bundles that are currently wired to this exported - * package. - * - *

- * Bundles which require the exporting bundle associated with this exported - * package are considered to be wired to this exported package are included - * in the returned array. See {@link RequiredBundle#getRequiringBundles()}. - * - * @return The array of resolved bundles currently wired to this exported - * package, or null if this - * ExportedPackage object has become stale. - */ - public Bundle[] getImportingBundles(); - - /** - * Returns the version of this exported package. - * - * @return The version of this exported package, or null if - * no version information is available. - * @deprecated Since 1.2. This method has been replaced by - * {@link #getVersion}. - */ - public String getSpecificationVersion(); - - /** - * Returns the version of this exported package. - * - * @return The version of this exported package, or - * {@link Version#emptyVersion} if no version information is - * available. - * @since 1.2 - */ - public Version getVersion(); - - /** - * Returns true if the package associated with this - * ExportedPackage object has been exported by a bundle that - * has been updated or uninstalled. - * - * @return true if the associated package is being exported - * by a bundle that has been updated or uninstalled, or if this - * ExportedPackage object has become stale; - * false otherwise. - */ - public boolean isRemovalPending(); -} \ No newline at end of file +/* + * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/ExportedPackage.java,v 1.14 2006/06/16 16:31:49 hargrave Exp $ + * + * Copyright (c) OSGi Alliance (2001, 2006). 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.packageadmin; + +import org.osgi.framework.Bundle; +import org.osgi.framework.Version; + +/** + * An exported package. + * + * Objects implementing this interface are created by the Package Admin service. + * + *

+ * The term exported package refers to a package that has been exported + * from a resolved bundle. This package may or may not be currently wired to + * other bundles. + * + *

+ * The information about an exported package provided by this object may change. + * An ExportedPackage object becomes stale if the package it + * references has been updated or removed as a result of calling + * PackageAdmin.refreshPackages(). + * + * If this object becomes stale, its getName() and + * getVersion() methods continue to return their original values, + * isRemovalPending() returns true, and + * getExportingBundle() and getImportingBundles() + * return null. + * + * @version $Revision: 1.14 $ + */ +public interface ExportedPackage { + /** + * Returns the name of the package associated with this exported package. + * + * @return The name of this exported package. + */ + public String getName(); + + /** + * Returns the bundle exporting the package associated with this exported + * package. + * + * @return The exporting bundle, or null if this + * ExportedPackage object has become stale. + */ + public Bundle getExportingBundle(); + + /** + * Returns the resolved bundles that are currently wired to this exported + * package. + * + *

+ * Bundles which require the exporting bundle associated with this exported + * package are considered to be wired to this exported package are included + * in the returned array. See {@link RequiredBundle#getRequiringBundles()}. + * + * @return The array of resolved bundles currently wired to this exported + * package, or null if this + * ExportedPackage object has become stale. + */ + public Bundle[] getImportingBundles(); + + /** + * Returns the version of this exported package. + * + * @return The version of this exported package, or null if + * no version information is available. + * @deprecated As of 1.2, replaced by {@link #getVersion}. + */ + public String getSpecificationVersion(); + + /** + * Returns the version of this exported package. + * + * @return The version of this exported package, or + * {@link Version#emptyVersion} if no version information is + * available. + * @since 1.2 + */ + public Version getVersion(); + + /** + * Returns true if the package associated with this + * ExportedPackage object has been exported by a bundle that + * has been updated or uninstalled. + * + * @return true if the associated package is being exported + * by a bundle that has been updated or uninstalled, or if this + * ExportedPackage object has become stale; + * false otherwise. + */ + public boolean isRemovalPending(); +}