felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
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 GMT
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.
- * <p>
- * 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.
- * <p>
- * 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.
+ * <p>
+ * 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.
+ * <p>
+ * 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 <code>true</code> if the
-	 * evaluation of the Condition must be postponed until the end of the
-	 * permission check. If this method returns <code>false</code>, 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 <code>true</code> to indicate the evaluation must be postponed.
-	 *         Otherwise, <code>false</code> if the evaluation can be
-	 *         immediately performed.
-	 */
-	boolean isPostponed();
-
-	/**
-	 * Returns whether the Condition is satisfied.
-	 * 
-	 * @return <code>true</code> to indicate the Conditions is satisfied. 
-	 *         Otherwise, <code>false</code> if the Condition is not satisfied.
-	 */
-	boolean isSatisfied();
-
-	/**
-	 * Returns whether the Condition is mutable.
-	 * 
-	 * @return <code>true</code> to indicate the value returned by
-	 *         {@link #isSatisfied()} can change. Otherwise, <code>false</code>
-	 *         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 <code>true</code> if all the Conditions are satisfied.
-	 *         Otherwise, <code>false</code> 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 <code>true</code> if the
+	 * evaluation of the Condition must be postponed until the end of the
+	 * permission check. If this method returns <code>false</code>, 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 <code>true</code> to indicate the evaluation must be postponed.
+	 *         Otherwise, <code>false</code> if the evaluation can be
+	 *         immediately performed.
+	 */
+	boolean isPostponed();
+
+	/**
+	 * Returns whether the Condition is satisfied.
+	 * 
+	 * @return <code>true</code> to indicate the Conditions is satisfied. 
+	 *         Otherwise, <code>false</code> if the Condition is not satisfied.
+	 */
+	boolean isSatisfied();
+
+	/**
+	 * Returns whether the Condition is mutable.
+	 * 
+	 * @return <code>true</code> to indicate the value returned by
+	 *         {@link #isSatisfied()} can change. Otherwise, <code>false</code>
+	 *         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 <code>true</code> if all the Conditions are satisfied.
+	 *         Otherwise, <code>false</code> 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.
- * 
- * <p>
- * This class encapsulates two pieces of information: a Condition <i>type</i>
- * (class name), which must implement <code>Condition</code>, and the
- * arguments passed to its constructor.
- * 
- * <p>
- * In order for a Condition represented by a <code>ConditionInfo</code> to be
- * instantiated and considered during a permission check, its Condition class
- * must be available from the system classpath.
- * 
- * <p>
- * The Condition class must either:
- * <ul>
- * <li>Declare a public static <code>getCondition</code> method that takes a
- * <code>Bundle</code> object and a <code>ConditionInfo</code> object as
- * arguments. That method must return an object that implements the
- * <code>Condition</code> interface.</li>
- * <li>Implement the <code>Condition</code> interface and define a public
- * constructor that takes a <code>Bundle</code> object and a
- * <code>ConditionInfo</code> object as arguments.
- * </ul>
- * 
- * @version $Revision: 1.12 $
- */
-public class ConditionInfo {
-	private String		type;
-	private String[]	args;
-
-	/**
-	 * Constructs a <code>ConditionInfo</code> from the specified type and
-	 * args.
-	 * 
-	 * @param type The fully qualified class name of the Condition represented
-	 *        by this <code>ConditionInfo</code>.
-	 * @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 <code>type</code> is
-	 *         <code>null</code>.
-	 */
-	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 <code>ConditionInfo</code> object from the specified
-	 * encoded <code>ConditionInfo</code> string. White space in the encoded
-	 * <code>ConditionInfo</code> string is ignored.
-	 * 
-	 * @param encodedCondition The encoded <code>ConditionInfo</code>.
-	 * @see #getEncoded
-	 * @throws java.lang.IllegalArgumentException If the
-	 *         <code>encodedCondition</code> 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 <code>ConditionInfo</code> in a
-	 * form suitable for restoring this <code>ConditionInfo</code>.
-	 * 
-	 * <p>
-	 * The encoding format is:
-	 * 
-	 * <pre>
-	 *   [type &quot;arg0&quot; &quot;arg1&quot; ...]
-	 * </pre>
-	 * 
-	 * where <i>argN</i> are strings that are encoded for proper parsing.
-	 * Specifically, the <code>"</code>, <code>\</code>, carriage return,
-	 * and linefeed characters are escaped using <code>\"</code>,
-	 * <code>\\</code>, <code>\r</code>, and <code>\n</code>,
-	 * respectively.
-	 * 
-	 * <p>
-	 * The encoded string contains no leading or trailing whitespace characters.
-	 * A single space character is used between type and "<i>arg0</i>" and
-	 * between the arguments.
-	 * 
-	 * @return The string encoding of this <code>ConditionInfo</code>.
-	 */
-	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 <code>ConditionInfo</code>.
-	 * The string is created by calling the <code>getEncoded</code> method on
-	 * this <code>ConditionInfo</code>.
-	 * 
-	 * @return The string representation of this <code>ConditionInfo</code>.
-	 */
-	public String toString() {
-		return getEncoded();
-	}
-
-	/**
-	 * Returns the fully qualified class name of the condition represented by
-	 * this <code>ConditionInfo</code>.
-	 * 
-	 * @return The fully qualified class name of the condition represented by
-	 *         this <code>ConditionInfo</code>.
-	 */
-	public final String getType() {
-		return type;
-	}
-
-	/**
-	 * Returns arguments of this <code>ConditionInfo</code>.
-	 * 
-	 * @return The arguments of this <code>ConditionInfo</code>. An empty
-	 *         array is returned if the <code>ConditionInfo</code> has no
-	 *         arguments.
-	 */
-	public final String[] getArgs() {
-		return args;
-	}
-
-	/**
-	 * Determines the equality of two <code>ConditionInfo</code> objects.
-	 * 
-	 * This method checks that specified object has the same type and args as
-	 * this <code>ConditionInfo</code> object.
-	 * 
-	 * @param obj The object to test for equality with this
-	 *        <code>ConditionInfo</code> object.
-	 * @return <code>true</code> if <code>obj</code> is a
-	 *         <code>ConditionInfo</code>, and has the same type and args as
-	 *         this <code>ConditionInfo</code> object; <code>false</code>
-	 *         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.
+ * 
+ * <p>
+ * This class encapsulates two pieces of information: a Condition <i>type</i>
+ * (class name), which must implement <code>Condition</code>, and the
+ * arguments passed to its constructor.
+ * 
+ * <p>
+ * In order for a Condition represented by a <code>ConditionInfo</code> to be
+ * instantiated and considered during a permission check, its Condition class
+ * must be available from the system classpath.
+ * 
+ * <p>
+ * The Condition class must either:
+ * <ul>
+ * <li>Declare a public static <code>getCondition</code> method that takes a
+ * <code>Bundle</code> object and a <code>ConditionInfo</code> object as
+ * arguments. That method must return an object that implements the
+ * <code>Condition</code> interface.</li>
+ * <li>Implement the <code>Condition</code> interface and define a public
+ * constructor that takes a <code>Bundle</code> object and a
+ * <code>ConditionInfo</code> object as arguments.
+ * </ul>
+ * 
+ * @version $Revision: 1.13 $
+ */
+public class ConditionInfo {
+	private String		type;
+	private String[]	args;
+
+	/**
+	 * Constructs a <code>ConditionInfo</code> from the specified type and
+	 * args.
+	 * 
+	 * @param type The fully qualified class name of the Condition represented
+	 *        by this <code>ConditionInfo</code>.
+	 * @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 <code>type</code> is
+	 *         <code>null</code>.
+	 */
+	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 <code>ConditionInfo</code> object from the specified
+	 * encoded <code>ConditionInfo</code> string. White space in the encoded
+	 * <code>ConditionInfo</code> string is ignored.
+	 * 
+	 * @param encodedCondition The encoded <code>ConditionInfo</code>.
+	 * @see #getEncoded
+	 * @throws java.lang.IllegalArgumentException If the
+	 *         <code>encodedCondition</code> 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 <code>ConditionInfo</code> in a
+	 * form suitable for restoring this <code>ConditionInfo</code>.
+	 * 
+	 * <p>
+	 * The encoding format is:
+	 * 
+	 * <pre>
+	 *   [type &quot;arg0&quot; &quot;arg1&quot; ...]
+	 * </pre>
+	 * 
+	 * where <i>argN</i> are strings that are encoded for proper parsing.
+	 * Specifically, the <code>"</code>, <code>\</code>, carriage return,
+	 * and linefeed characters are escaped using <code>\"</code>,
+	 * <code>\\</code>, <code>\r</code>, and <code>\n</code>,
+	 * respectively.
+	 * 
+	 * <p>
+	 * The encoded string contains no leading or trailing whitespace characters.
+	 * A single space character is used between type and "<i>arg0</i>" and
+	 * between the arguments.
+	 * 
+	 * @return The string encoding of this <code>ConditionInfo</code>.
+	 */
+	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 <code>ConditionInfo</code>.
+	 * The string is created by calling the <code>getEncoded</code> method on
+	 * this <code>ConditionInfo</code>.
+	 * 
+	 * @return The string representation of this <code>ConditionInfo</code>.
+	 */
+	public String toString() {
+		return getEncoded();
+	}
+
+	/**
+	 * Returns the fully qualified class name of the condition represented by
+	 * this <code>ConditionInfo</code>.
+	 * 
+	 * @return The fully qualified class name of the condition represented by
+	 *         this <code>ConditionInfo</code>.
+	 */
+	public final String getType() {
+		return type;
+	}
+
+	/**
+	 * Returns arguments of this <code>ConditionInfo</code>.
+	 * 
+	 * @return The arguments of this <code>ConditionInfo</code>. An empty
+	 *         array is returned if the <code>ConditionInfo</code> has no
+	 *         arguments.
+	 */
+	public final String[] getArgs() {
+		return args;
+	}
+
+	/**
+	 * Determines the equality of two <code>ConditionInfo</code> objects.
+	 * 
+	 * This method checks that specified object has the same type and args as
+	 * this <code>ConditionInfo</code> object.
+	 * 
+	 * @param obj The object to test for equality with this
+	 *        <code>ConditionInfo</code> object.
+	 * @return <code>true</code> if <code>obj</code> is a
+	 *         <code>ConditionInfo</code>, and has the same type and args as
+	 *         this <code>ConditionInfo</code> object; <code>false</code>
+	 *         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
-	 *         <code>AllPermission</code>.
-	 */
-	public ConditionalPermissionInfo addConditionalPermissionInfo(
-			ConditionInfo conds[], PermissionInfo perms[]);
-
-	/**
-	 * Set or create a Conditional Permission Info with a specified name.
-	 * 
-	 * If the specified name is <code>null</code>, 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
-	 *        <code>null</code>.
-	 * @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
-	 *         <code>AllPermission</code>.
-	 */
-	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 <code>AccessControlContext</code> 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
+	 *         <code>AllPermission</code>.
+	 */
+	public ConditionalPermissionInfo addConditionalPermissionInfo(
+			ConditionInfo conds[], PermissionInfo perms[]);
+
+	/**
+	 * Set or create a Conditional Permission Info with a specified name.
+	 * 
+	 * If the specified name is <code>null</code>, 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
+	 *        <code>null</code>.
+	 * @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
+	 *         <code>AllPermission</code>.
+	 */
+	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 <code>AccessControlContext</code> 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
-	 *         <code>AllPermission</code>.
-	 */
-	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
+	 *         <code>AllPermission</code>.
+	 */
+	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 @@
-<!-- $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/package.html,v 1.5 2005/08/05 01:35:14 hargrave Exp $ -->
+<!-- $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/package.html,v 1.6 2006/07/12 21:07:04 hargrave Exp $ -->
 <BODY>
-<P>The OSGi Conditional Permission Admin Specification Version 1.0.
+<p>Conditional Permission Admin Package Version 1.0.
 <p>Bundles wishing to use this package must list the package
 in the <TT>Import-Package</TT> 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.
- * 
- * <p>
- * The term <i>exported package</i> refers to a package that has been exported
- * from a resolved bundle. This package may or may not be currently wired to
- * other bundles.
- * 
- * <p>
- * The information about an exported package provided by this object may change.
- * An <code>ExportedPackage</code> object becomes stale if the package it
- * references has been updated or removed as a result of calling
- * <code>PackageAdmin.refreshPackages()</code>.
- * 
- * If this object becomes stale, its <code>getName()</code> and
- * <code>getVersion()</code> methods continue to return their original values,
- * <code>isRemovalPending()</code> returns <code>true</code>, and
- * <code>getExportingBundle()</code> and <code>getImportingBundles()</code>
- * return <code>null</code>.
- * 
- * @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 <code>null</code> if this
-	 *         <code>ExportedPackage</code> object has become stale.
-	 */
-	public Bundle getExportingBundle();
-
-	/**
-	 * Returns the resolved bundles that are currently wired to this exported
-	 * package.
-	 * 
-	 * <p>
-	 * 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 <code>null</code> if this
-	 *         <code>ExportedPackage</code> object has become stale.
-	 */
-	public Bundle[] getImportingBundles();
-
-	/**
-	 * Returns the version of this exported package.
-	 * 
-	 * @return The version of this exported package, or <code>null</code> 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 <code>true</code> if the package associated with this
-	 * <code>ExportedPackage</code> object has been exported by a bundle that
-	 * has been updated or uninstalled.
-	 * 
-	 * @return <code>true</code> if the associated package is being exported
-	 *         by a bundle that has been updated or uninstalled, or if this
-	 *         <code>ExportedPackage</code> object has become stale;
-	 *         <code>false</code> 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.
+ * 
+ * <p>
+ * The term <i>exported package</i> refers to a package that has been exported
+ * from a resolved bundle. This package may or may not be currently wired to
+ * other bundles.
+ * 
+ * <p>
+ * The information about an exported package provided by this object may change.
+ * An <code>ExportedPackage</code> object becomes stale if the package it
+ * references has been updated or removed as a result of calling
+ * <code>PackageAdmin.refreshPackages()</code>.
+ * 
+ * If this object becomes stale, its <code>getName()</code> and
+ * <code>getVersion()</code> methods continue to return their original values,
+ * <code>isRemovalPending()</code> returns <code>true</code>, and
+ * <code>getExportingBundle()</code> and <code>getImportingBundles()</code>
+ * return <code>null</code>.
+ * 
+ * @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 <code>null</code> if this
+	 *         <code>ExportedPackage</code> object has become stale.
+	 */
+	public Bundle getExportingBundle();
+
+	/**
+	 * Returns the resolved bundles that are currently wired to this exported
+	 * package.
+	 * 
+	 * <p>
+	 * 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 <code>null</code> if this
+	 *         <code>ExportedPackage</code> object has become stale.
+	 */
+	public Bundle[] getImportingBundles();
+
+	/**
+	 * Returns the version of this exported package.
+	 * 
+	 * @return The version of this exported package, or <code>null</code> 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 <code>true</code> if the package associated with this
+	 * <code>ExportedPackage</code> object has been exported by a bundle that
+	 * has been updated or uninstalled.
+	 * 
+	 * @return <code>true</code> if the associated package is being exported
+	 *         by a bundle that has been updated or uninstalled, or if this
+	 *         <code>ExportedPackage</code> object has become stale;
+	 *         <code>false</code> otherwise.
+	 */
+	public boolean isRemovalPending();
+}



Mime
View raw message