felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r389891 [6/9] - in /incubator/felix/trunk/org.osgi.compendium: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/osgi/ src/main/java/org/osgi/service/ src/main/java/org/osgi/service/cm/ src/main/java/org/osgi/service/com...
Date Wed, 29 Mar 2006 21:05:18 GMT
Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Envelope.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Envelope.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Envelope.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Envelope.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,81 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/Envelope.java,v 1.7 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+/**
+ * Identifies a contained value.
+ * 
+ * An <code>Envelope</code> object combines a status value, an identification
+ * object and a scope name. The <code>Envelope</code> object allows the use of
+ * standard Java types when a Producer service can produce more than one kind of
+ * object. The <code>Envelope</code> object allows the Consumer service to
+ * recognize the kind of object that is received. For example, a door lock could
+ * be represented by a <code>Boolean</code> object. If the <code>Producer</code>
+ * service would send such a <code>Boolean</code> object, then the Consumer
+ * service would not know what door the <code>Boolean</code> object represented.
+ * The <code>Envelope</code> object contains an identification object so the
+ * Consumer service can discriminate between different kinds of values. The
+ * identification object may be a simple <code>String</code> object, but it can
+ * also be a domain specific object that is mutually agreed by the Producer and
+ * the Consumer service. This object can then contain relevant information that
+ * makes the identification easier.
+ * <p>
+ * The scope name of the envelope is used for security. The Wire object must
+ * verify that any <code>Envelope</code> object send through the <code>update</code>
+ * method or coming from the <code>poll</code> method has a scope name that
+ * matches the permissions of both the Producer service and the Consumer service
+ * involved. The wireadmin package also contains a class <code>BasicEnvelope</code>
+ * that implements the methods of this interface.
+ * 
+ * @see WirePermission
+ * @see BasicEnvelope
+ * 
+ * @version $Revision: 1.7 $
+ */
+public interface Envelope {
+	/**
+	 * Return the value associated with this <code>Envelope</code> object.
+	 * 
+	 * @return the value of the status item, or <code>null</code> when no item is
+	 *         associated with this object.
+	 */
+	public Object getValue();
+
+	/**
+	 * Return the identification of this <code>Envelope</code> object.
+	 * 
+	 * An identification may be of any Java type. The type must be mutually
+	 * agreed between the Consumer and Producer services.
+	 * 
+	 * @return an object which identifies the status item in the address space
+	 *         of the composite producer, must not be null.
+	 */
+	public Object getIdentification();
+
+	/**
+	 * Return the scope name of this <code>Envelope</code> object.
+	 * 
+	 * Scope names are used to restrict the communication between the Producer
+	 * and Consumer services. Only <code>Envelopes</code> objects with a scope
+	 * name that is permitted for the Producer and the Consumer services must be
+	 * passed through a <code>Wire</code> object.
+	 * 
+	 * @return the security scope for the status item, must not be null.
+	 */
+	public String getScope();
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Envelope.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Producer.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Producer.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Producer.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Producer.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,125 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/Producer.java,v 1.8 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+/**
+ * Data Producer, a service that can generate values to be used by
+ * {@link Consumer}services.
+ * 
+ * <p>
+ * Service objects registered under the Producer interface are expected to
+ * produce values (internally generated or from external sensors). The value can
+ * be of different types. When delivering a value to a <code>Wire</code> object,
+ * the Producer service should coerce the value to be an instance of one of the
+ * types specified by {@link Wire#getFlavors}. The classes are specified in
+ * order of preference.
+ * 
+ * <p>
+ * When the data represented by the Producer object changes, this object should
+ * send the updated value by calling the <code>update</code> method on each of
+ * <code>Wire</code> objects passed in the most recent call to this object's
+ * {@link #consumersConnected}method. These <code>Wire</code> objects will pass
+ * the value on to the associated <code>Consumer</code> service object.
+ * 
+ * <p>
+ * The Producer service may use the information in the <code>Wire</code> object's
+ * properties to schedule the delivery of values to the <code>Wire</code> object.
+ * 
+ * <p>
+ * Producer service objects must register with a <code>service.pid</code> and a
+ * {@link WireConstants#WIREADMIN_PRODUCER_FLAVORS}property. It is recommended
+ * that a Producer service object also registers with a
+ * <code>service.description</code> property. Producer service objects must
+ * register with a {@link WireConstants#WIREADMIN_PRODUCER_FILTERS}property if
+ * the Producer service will be performing filtering instead of the
+ * <code>Wire</code> object.
+ * 
+ * <p>
+ * If an exception is thrown by a Producer object method, a
+ * <code>WireAdminEvent</code> of type {@link WireAdminEvent#PRODUCER_EXCEPTION}
+ * is broadcast by the Wire Admin service.
+ * 
+ * <p>
+ * Security Considerations. Data producing bundles will require
+ * <code>ServicePermission[Producer,REGISTER]</code> to register a Producer
+ * service. In general, only the Wire Admin service should have
+ * <code>ServicePermission[Producer,GET]</code>. Thus only the Wire Admin service
+ * may directly call a Producer service. Care must be taken in the sharing of
+ * <code>Wire</code> objects with other bundles.
+ * <p>
+ * Producer services must be registered with scope names when they can send
+ * different types of objects (composite) to the Consumer service. The Producer
+ * service should have <code>WirePermission</code> for each of these scope names.
+ * 
+ * @version $Revision: 1.8 $
+ */
+public interface Producer {
+	/**
+	 * Return the current value of this <code>Producer</code> object.
+	 * 
+	 * <p>
+	 * This method is called by a <code>Wire</code> object in response to the
+	 * Consumer service calling the <code>Wire</code> object's <code>poll</code>
+	 * method. The Producer should coerce the value to be an instance of one of
+	 * the types specified by {@link Wire#getFlavors}. The types are specified
+	 * in order of of preference. The returned value should be as new or newer
+	 * than the last value furnished by this object.
+	 * 
+	 * <p>
+	 * Note: This method may be called by a <code>Wire</code> object prior to this
+	 * object being notified that it is connected to that <code>Wire</code> object
+	 * (via the {@link #consumersConnected}method).
+	 * <p>
+	 * If the Producer service returns an <code>Envelope</code> object that has an
+	 * unpermitted scope name, then the Wire object must ignore (or remove) the
+	 * transfer.
+	 * <p>
+	 * If the <code>Wire</code> object has a scope set, the return value must be
+	 * an array of <code>Envelope</code> objects (<code>Envelope[]</code>). The
+	 * <code>Wire</code> object must have removed any <code>Envelope</code> objects
+	 * that have a scope name that is not in the Wire object's scope.
+	 * 
+	 * @param wire The <code>Wire</code> object which is polling this service.
+	 * @return The current value of the Producer service or <code>null</code> if
+	 *         the value cannot be coerced into a compatible type. Or an array
+	 *         of <code>Envelope</code> objects.
+	 */
+	public Object polled(Wire wire);
+
+	/**
+	 * Update the list of <code>Wire</code> objects to which this
+	 * <code>Producer</code> object is connected.
+	 * 
+	 * <p>
+	 * This method is called when the Producer service is first registered and
+	 * subsequently whenever a <code>Wire</code> associated with this Producer
+	 * becomes connected, is modified or becomes disconnected.
+	 * 
+	 * <p>
+	 * The Wire Admin service must call this method asynchronously. This implies
+	 * that implementors of a Producer service can be assured that the callback
+	 * will not take place during registration when they execute the
+	 * registration in a synchronized method.
+	 * 
+	 * @param wires An array of the current and complete list of <code>Wire</code>
+	 *        objects to which this Producer service is connected. May be
+	 *        <code>null</code> if the Producer is not currently connected to any
+	 *        <code>Wire</code> objects.
+	 */
+	public void consumersConnected(Wire[] wires);
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Producer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Wire.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Wire.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Wire.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Wire.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,270 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/Wire.java,v 1.8 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+import java.util.Dictionary;
+
+/**
+ * A connection between a Producer service and a Consumer service.
+ * 
+ * <p>
+ * A <code>Wire</code> object connects a Producer service to a Consumer service.
+ * Both the Producer and Consumer services are identified by their unique
+ * <code>service.pid</code> values. The Producer and Consumer services may
+ * communicate with each other via <code>Wire</code> objects that connect them.
+ * The Producer service may send updated values to the Consumer service by
+ * calling the {@link #update}method. The Consumer service may request an
+ * updated value from the Producer service by calling the {@link #poll}method.
+ * 
+ * <p>
+ * A Producer service and a Consumer service may be connected through multiple
+ * <code>Wire</code> objects.
+ * 
+ * <p>
+ * Security Considerations. <code>Wire</code> objects are available to Producer
+ * and Consumer services connected to a given <code>Wire</code> object and to
+ * bundles which can access the <code>WireAdmin</code> service. A bundle must have
+ * <code>ServicePermission[WireAdmin,GET]</code> to get the <code>WireAdmin</code>
+ * service to access all <code>Wire</code> objects. A bundle registering a
+ * Producer service or a Consumer service must have the appropriate
+ * <code>ServicePermission[Consumer|Producer,REGISTER]</code> to register the
+ * service and will be passed <code>Wire</code> objects when the service object's
+ * <code>consumersConnected</code> or <code>producersConnected</code> method is
+ * called.
+ * 
+ * <p>
+ * Scope. Each Wire object can have a scope set with the <code>setScope</code>
+ * method. This method should be called by a Consumer service when it assumes a
+ * Producer service that is composite (supports multiple information items). The
+ * names in the scope must be verified by the <code>Wire</code> object before it
+ * is used in communication. The semantics of the names depend on the Producer
+ * service and must not be interpreted by the Wire Admin service.
+ * 
+ * @version $Revision: 1.8 $
+ */
+public interface Wire {
+	/**
+	 * Return the state of this <code>Wire</code> object.
+	 * 
+	 * <p>
+	 * A connected <code>Wire</code> must always be disconnected before becoming
+	 * invalid.
+	 * 
+	 * @return <code>false</code> if this <code>Wire</code> object is invalid
+	 *         because it has been deleted via {@link WireAdmin#deleteWire};
+	 *         <code>true</code> otherwise.
+	 */
+	public boolean isValid();
+
+	/**
+	 * Return the connection state of this <code>Wire</code> object.
+	 * 
+	 * <p>
+	 * A <code>Wire</code> is connected after the Wire Admin service receives
+	 * notification that the Producer service and the Consumer service for this
+	 * <code>Wire</code> object are both registered. This method will return
+	 * <code>true</code> prior to notifying the Producer and Consumer services via
+	 * calls to their respective <code>consumersConnected</code> and
+	 * <code>producersConnected</code> methods.
+	 * <p>
+	 * A <code>WireAdminEvent</code> of type {@link WireAdminEvent#WIRE_CONNECTED}
+	 * must be broadcast by the Wire Admin service when the <code>Wire</code>
+	 * becomes connected.
+	 * 
+	 * <p>
+	 * A <code>Wire</code> object is disconnected when either the Consumer or
+	 * Producer service is unregistered or the <code>Wire</code> object is
+	 * deleted.
+	 * <p>
+	 * A <code>WireAdminEvent</code> of type
+	 * {@link WireAdminEvent#WIRE_DISCONNECTED}must be broadcast by the Wire
+	 * Admin service when the <code>Wire</code> becomes disconnected.
+	 * 
+	 * @return <code>true</code> if both the Producer and Consumer for this
+	 *         <code>Wire</code> object are connected to the <code>Wire</code>
+	 *         object; <code>false</code> otherwise.
+	 */
+	public boolean isConnected();
+
+	/**
+	 * Return the list of data types understood by the Consumer service
+	 * connected to this <code>Wire</code> object. Note that subclasses of the
+	 * classes in this list are acceptable data types as well.
+	 * 
+	 * <p>
+	 * The list is the value of the
+	 * {@link WireConstants#WIREADMIN_CONSUMER_FLAVORS}service property of the
+	 * Consumer service object connected to this object. If no such property was
+	 * registered or the type of the property value is not <code>Class[]</code>,
+	 * this method must return <code>null</code>.
+	 * 
+	 * @return An array containing the list of classes understood by the
+	 *         Consumer service or <code>null</code> if the <code>Wire</code> is not
+	 *         connected, or the consumer did not register a
+	 *         {@link WireConstants#WIREADMIN_CONSUMER_FLAVORS}property or the
+	 *         value of the property is not of type <code>Class[]</code>.
+	 */
+	public Class[] getFlavors();
+
+	/**
+	 * Update the value.
+	 * 
+	 * <p>
+	 * This methods is called by the Producer service to notify the Consumer
+	 * service connected to this <code>Wire</code> object of an updated value.
+	 * <p>
+	 * If the properties of this <code>Wire</code> object contain a
+	 * {@link WireConstants#WIREADMIN_FILTER}property, then filtering is
+	 * performed. If the Producer service connected to this <code>Wire</code>
+	 * object was registered with the service property
+	 * {@link WireConstants#WIREADMIN_PRODUCER_FILTERS}, the Producer service
+	 * will perform the filtering according to the rules specified for the
+	 * filter. Otherwise, this <code>Wire</code> object will perform the filtering
+	 * of the value.
+	 * <p>
+	 * If no filtering is done, or the filter indicates the updated value should
+	 * be delivered to the Consumer service, then this <code>Wire</code> object
+	 * must call the {@link Consumer#updated}method with the updated value. If
+	 * this <code>Wire</code> object is not connected, then the Consumer service
+	 * must not be called and the value is ignored.
+	 * <p>
+	 * If the value is an <code>Envelope</code> object, and the scope name is not
+	 * permitted, then the <code>Wire</code> object must ignore this call and not
+	 * transfer the object to the Consumer service.
+	 * 
+	 * <p>
+	 * A <code>WireAdminEvent</code> of type {@link WireAdminEvent#WIRE_TRACE}
+	 * must be broadcast by the Wire Admin service after the Consumer service
+	 * has been successfully called.
+	 * 
+	 * @param value The updated value. The value should be an instance of one of
+	 *        the types returned by {@link #getFlavors}.
+	 * @see WireConstants#WIREADMIN_FILTER
+	 */
+	public void update(Object value);
+
+	/**
+	 * Poll for an updated value.
+	 * 
+	 * <p>
+	 * This methods is normally called by the Consumer service to request an
+	 * updated value from the Producer service connected to this <code>Wire</code>
+	 * object. This <code>Wire</code> object will call the {@link Producer#polled}
+	 * method to obtain an updated value. If this <code>Wire</code> object is not
+	 * connected, then the Producer service must not be called.
+	 * <p>
+	 * 
+	 * If this <code>Wire</code> object has a scope, then this method must return
+	 * an array of <code>Envelope</code> objects. The objects returned must match
+	 * the scope of this object. The <code>Wire</code> object must remove all
+	 * <code>Envelope</code> objects with a scope name that is not in the
+	 * <code>Wire</code> object's scope. Thus, the list of objects returned must
+	 * only contain <code>Envelope</code> objects with a permitted scope name. If
+	 * the array becomes empty, <code>null</code> must be returned.
+	 * 
+	 * <p>
+	 * A <code>WireAdminEvent</code> of type {@link WireAdminEvent#WIRE_TRACE}
+	 * must be broadcast by the Wire Admin service after the Producer service
+	 * has been successfully called.
+	 * 
+	 * @return A value whose type should be one of the types returned by
+	 *         {@link #getFlavors},<code>Envelope[]</code>, or <code>null</code>
+	 *         if the <code>Wire</code> object is not connected, the Producer
+	 *         service threw an exception, or the Producer service returned a
+	 *         value which is not an instance of one of the types returned by
+	 *         {@link #getFlavors}.
+	 */
+	public Object poll();
+
+	/**
+	 * Return the last value sent through this <code>Wire</code> object.
+	 * 
+	 * <p>
+	 * The returned value is the most recent, valid value passed to the
+	 * {@link #update}method or returned by the {@link #poll}method of this
+	 * object. If filtering is performed by this <code>Wire</code> object, this
+	 * methods returns the last value provided by the Producer service. This
+	 * value may be an <code>Envelope[]</code> when the Producer service uses
+	 * scoping. If the return value is an Envelope object (or array), it must be
+	 * verified that the Consumer service has the proper WirePermission to see
+	 * it.
+	 * 
+	 * @return The last value passed though this <code>Wire</code> object or
+	 *         <code>null</code> if no valid values have been passed or the
+	 *         Consumer service has no permission.
+	 */
+	public Object getLastValue();
+
+	/**
+	 * Return the wire properties for this <code>Wire</code> object.
+	 * 
+	 * @return The properties for this <code>Wire</code> object. The returned
+	 *         <code>Dictionary</code> must be read only.
+	 */
+	public Dictionary getProperties();
+
+	/**
+	 * Return the calculated scope of this <code>Wire</code> object.
+	 * 
+	 * The purpose of the <code>Wire</code> object's scope is to allow a Producer
+	 * and/or Consumer service to produce/consume different types over a single
+	 * <code>Wire</code> object (this was deemed necessary for efficiency
+	 * reasons). Both the Consumer service and the Producer service must set an
+	 * array of scope names (their scope) with the service registration property
+	 * <code>WIREADMIN_PRODUCER_SCOPE</code>, or
+	 * <code>WIREADMIN_CONSUMER_SCOPE</code> when they can produce multiple types.
+	 * If a Producer service can produce different types, it should set this
+	 * property to the array of scope names it can produce, the Consumer service
+	 * must set the array of scope names it can consume. The scope of a
+	 * <code>Wire</code> object is defined as the intersection of permitted scope
+	 * names of the Producer service and Consumer service.
+	 * <p>
+	 * If neither the Consumer, or the Producer service registers scope names
+	 * with its service registration, then the <code>Wire</code> object's scope
+	 * must be <code>null</code>.
+	 * <p>
+	 * The <code>Wire</code> object's scope must not change when a Producer or
+	 * Consumer services modifies its scope.
+	 * <p>
+	 * A scope name is permitted for a Producer service when the registering
+	 * bundle has <code>WirePermission[name,PRODUCE]</code>, and for a Consumer
+	 * service when the registering bundle has <code>WirePermission[name,CONSUME]</code>.
+	 * <p>
+	 * If either Consumer service or Producer service has not set a
+	 * <code>WIREADMIN_*_SCOPE</code> property, then the returned value must be
+	 * <code>null</code>.
+	 * <p>
+	 * If the scope is set, the <code>Wire</code> object must enforce the scope
+	 * names when <code>Envelope</code> objects are used as a parameter to update
+	 * or returned from the <code>poll</code> method. The <code>Wire</code> object
+	 * must then remove all <code>Envelope</code> objects with a scope name that
+	 * is not permitted.
+	 * 
+	 * @return A list of permitted scope names or null if the Produce or
+	 *         Consumer service has set no scope names.
+	 */
+	public String[] getScope();
+
+	/**
+	 * Return true if the given name is in this <code>Wire</code> object's scope.
+	 * 
+	 * @param name The scope name
+	 * @return true if the name is listed in the permitted scope names
+	 */
+	public boolean hasScope(String name);
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/Wire.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdmin.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdmin.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdmin.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdmin.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,169 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/WireAdmin.java,v 1.8 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+import java.util.Dictionary;
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+ * Wire Administration service.
+ * 
+ * <p>
+ * This service can be used to create <code>Wire</code> objects connecting a
+ * Producer service and a Consumer service. <code>Wire</code> objects also have
+ * wire properties that may be specified when a <code>Wire</code> object is
+ * created. The Producer and Consumer services may use the <code>Wire</code>
+ * object's properties to manage or control their interaction. The use of
+ * <code>Wire</code> object's properties by a Producer or Consumer services is
+ * optional.
+ * 
+ * <p>
+ * Security Considerations. A bundle must have
+ * <code>ServicePermission[WireAdmin,GET]</code> to get the Wire Admin service to
+ * create, modify, find, and delete <code>Wire</code> objects.
+ * 
+ * @version $Revision: 1.8 $
+ */
+public interface WireAdmin {
+	/**
+	 * Create a new <code>Wire</code> object that connects a Producer service to a
+	 * Consumer service.
+	 * 
+	 * The Producer service and Consumer service do not have to be registered
+	 * when the <code>Wire</code> object is created.
+	 * 
+	 * <p>
+	 * The <code>Wire</code> configuration data must be persistently stored. All
+	 * <code>Wire</code> connections are reestablished when the <code>WireAdmin</code>
+	 * service is registered. A <code>Wire</code> can be permanently removed by
+	 * using the {@link #deleteWire}method.
+	 * 
+	 * <p>
+	 * The <code>Wire</code> object's properties must have case insensitive
+	 * <code>String</code> objects as keys (like the Framework). However, the case
+	 * of the key must be preserved.
+	 * 
+	 * <p>
+	 * The <code>WireAdmin</code> service must automatically add the following
+	 * <code>Wire</code> properties:
+	 * <ul>
+	 * <li>{@link WireConstants#WIREADMIN_PID}set to the value of the
+	 * <code>Wire</code> object's persistent identity (PID). This value is
+	 * generated by the Wire Admin service when a <code>Wire</code> object is
+	 * created.</li>
+	 * <li>{@link WireConstants#WIREADMIN_PRODUCER_PID}set to the value of
+	 * Producer service's PID.</li>
+	 * <li>{@link WireConstants#WIREADMIN_CONSUMER_PID}set to the value of
+	 * Consumer service's PID.</li>
+	 * </ul>
+	 * If the <code>properties</code> argument already contains any of these keys,
+	 * then the supplied values are replaced with the values assigned by the
+	 * Wire Admin service.
+	 * 
+	 * <p>
+	 * The Wire Admin service must broadcast a <code>WireAdminEvent</code> of type
+	 * {@link WireAdminEvent#WIRE_CREATED}after the new <code>Wire</code> object
+	 * becomes available from {@link #getWires}.
+	 * 
+	 * @param producerPID The <code>service.pid</code> of the Producer service to
+	 *        be connected to the <code>Wire</code> object.
+	 * @param consumerPID The <code>service.pid</code> of the Consumer service to
+	 *        be connected to the <code>Wire</code> object.
+	 * @param properties The <code>Wire</code> object's properties. This argument
+	 *        may be <code>null</code> if the caller does not wish to define any
+	 *        <code>Wire</code> object's properties.
+	 * @return The <code>Wire</code> object for this connection.
+	 * 
+	 * @throws java.lang.IllegalArgumentException If <code>properties</code>
+	 *         contains invalid wire types or case variants of the same key
+	 *         name.
+	 */
+	public Wire createWire(String producerPID, String consumerPID,
+			Dictionary properties);
+
+	/**
+	 * Delete a <code>Wire</code> object.
+	 * 
+	 * <p>
+	 * The <code>Wire</code> object representing a connection between a Producer
+	 * service and a Consumer service must be removed. The persistently stored
+	 * configuration data for the <code>Wire</code> object must destroyed. The
+	 * <code>Wire</code> object's method {@link Wire#isValid}will return
+	 * <code>false</code> after it is deleted.
+	 * 
+	 * <p>
+	 * The Wire Admin service must broadcast a <code>WireAdminEvent</code> of type
+	 * {@link WireAdminEvent#WIRE_DELETED}after the <code>Wire</code> object
+	 * becomes invalid.
+	 * 
+	 * @param wire The <code>Wire</code> object which is to be deleted.
+	 */
+	public void deleteWire(Wire wire);
+
+	/**
+	 * Update the properties of a <code>Wire</code> object.
+	 * 
+	 * The persistently stored configuration data for the <code>Wire</code> object
+	 * is updated with the new properties and then the Consumer and Producer
+	 * services will be called at the respective
+	 * {@link Consumer#producersConnected}and
+	 * {@link Producer#consumersConnected}methods.
+	 * 
+	 * <p>
+	 * The Wire Admin service must broadcast a <code>WireAdminEvent</code> of type
+	 * {@link WireAdminEvent#WIRE_UPDATED}after the updated properties are
+	 * available from the <code>Wire</code> object.
+	 * 
+	 * @param wire The <code>Wire</code> object which is to be updated.
+	 * @param properties The new <code>Wire</code> object's properties or
+	 *        <code>null</code> if no properties are required.
+	 * 
+	 * @throws java.lang.IllegalArgumentException If <code>properties</code>
+	 *         contains invalid wire types or case variants of the same key
+	 *         name.
+	 */
+	public void updateWire(Wire wire, Dictionary properties);
+
+	/**
+	 * Return the <code>Wire</code> objects that match the given <code>filter</code>.
+	 * 
+	 * <p>
+	 * The list of available <code>Wire</code> objects is matched against the
+	 * specified <code>filter</code>.<code>Wire</code> objects which match the
+	 * <code>filter</code> must be returned. These <code>Wire</code> objects are not
+	 * necessarily connected. The Wire Admin service should not return invalid
+	 * <code>Wire</code> objects, but it is possible that a <code>Wire</code> object
+	 * is deleted after it was placed in the list.
+	 * 
+	 * <p>
+	 * The filter matches against the <code>Wire</code> object's properties
+	 * including {@link WireConstants#WIREADMIN_PRODUCER_PID},
+	 * {@link WireConstants#WIREADMIN_CONSUMER_PID}and
+	 * {@link WireConstants#WIREADMIN_PID}.
+	 * 
+	 * @param filter Filter string to select <code>Wire</code> objects or
+	 *        <code>null</code> to select all <code>Wire</code> objects.
+	 * @return An array of <code>Wire</code> objects which match the
+	 *         <code>filter</code> or <code>null</code> if no <code>Wire</code>
+	 *         objects match the <code>filter</code>.
+	 * @throws org.osgi.framework.InvalidSyntaxException If the specified
+	 *         <code>filter</code> has an invalid syntax.
+	 * @see org.osgi.framework.Filter
+	 */
+	public Wire[] getWires(String filter) throws InvalidSyntaxException;
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdmin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminEvent.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminEvent.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminEvent.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminEvent.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,268 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/WireAdminEvent.java,v 1.7 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A Wire Admin Event.
+ * 
+ * <p>
+ * <code>WireAdminEvent</code> objects are delivered to all registered
+ * <code>WireAdminListener</code> service objects which specify an interest in the
+ * <code>WireAdminEvent</code> type. Events must be delivered in chronological
+ * order with respect to each listener. For example, a <code>WireAdminEvent</code>
+ * of type {@link #WIRE_CONNECTED}must be delivered before a
+ * <code>WireAdminEvent</code> of type {@link #WIRE_DISCONNECTED}for a particular
+ * <code>Wire</code> object.
+ * 
+ * <p>
+ * A type code is used to identify the type of event. The following event types
+ * are defined:
+ * <ul>
+ * <li>{@link #WIRE_CREATED}
+ * <li>{@link #WIRE_CONNECTED}
+ * <li>{@link #WIRE_UPDATED}
+ * <li>{@link #WIRE_TRACE}
+ * <li>{@link #WIRE_DISCONNECTED}
+ * <li>{@link #WIRE_DELETED}
+ * <li>{@link #PRODUCER_EXCEPTION}
+ * <li>{@link #CONSUMER_EXCEPTION}
+ * </ul>
+ * Additional event types may be defined in the future.
+ * 
+ * <p>
+ * Event type values must be unique and disjoint bit values. Event types must be
+ * defined as a bit in a 32 bit integer and can thus be bitwise OR'ed together.
+ * <p>
+ * Security Considerations. <code>WireAdminEvent</code> objects contain
+ * <code>Wire</code> objects. Care must be taken in the sharing of <code>Wire</code>
+ * objects with other bundles.
+ * 
+ * @see WireAdminListener
+ * 
+ * @version $Revision: 1.7 $
+ */
+public class WireAdminEvent {
+	/**
+	 * The WireAdmin service which created this event.
+	 */
+	private ServiceReference	reference;
+	/**
+	 * The <code>Wire</code> object associated with this event.
+	 */
+	private Wire				wire;
+	/**
+	 * Type of this event.
+	 * 
+	 * @see #getType
+	 */
+	private int					type;
+	/**
+	 * Exception associates with this the event.
+	 */
+	private Throwable			throwable;
+	/**
+	 * A Producer service method has thrown an exception.
+	 * 
+	 * <p>
+	 * This <code>WireAdminEvent</code> type indicates that a Producer service
+	 * method has thrown an exception. The {@link WireAdminEvent#getThrowable}
+	 * method will return the exception that the Producer service method raised.
+	 * 
+	 * <p>
+	 * The value of <code>PRODUCER_EXCEPTION</code> is 0x00000001.
+	 */
+	public final static int		PRODUCER_EXCEPTION	= 0x00000001;
+	/**
+	 * A Consumer service method has thrown an exception.
+	 * 
+	 * <p>
+	 * This <code>WireAdminEvent</code> type indicates that a Consumer service
+	 * method has thrown an exception. The {@link WireAdminEvent#getThrowable}
+	 * method will return the exception that the Consumer service method raised.
+	 * 
+	 * <p>
+	 * The value of <code>CONSUMER_EXCEPTION</code> is 0x00000002.
+	 */
+	public final static int		CONSUMER_EXCEPTION	= 0x00000002;
+	/**
+	 * A <code>Wire</code> has been created.
+	 * 
+	 * <p>
+	 * This <code>WireAdminEvent</code> type that indicates that a new
+	 * <code>Wire</code> object has been created.
+	 * 
+	 * An event is broadcast when {@link WireAdmin#createWire}is called. The
+	 * {@link WireAdminEvent#getWire}method will return the <code>Wire</code>
+	 * object that has just been created.
+	 * 
+	 * <p>
+	 * The value of <code>WIRE_CREATED</code> is 0x00000004.
+	 */
+	public final static int		WIRE_CREATED		= 0x00000004;
+	/**
+	 * A <code>Wire</code> has been updated.
+	 * 
+	 * <p>
+	 * This <code>WireAdminEvent</code> type that indicates that an existing
+	 * <code>Wire</code> object has been updated with new properties.
+	 * 
+	 * An event is broadcast when {@link WireAdmin#updateWire}is called with a
+	 * valid wire. The {@link WireAdminEvent#getWire}method will return the
+	 * <code>Wire</code> object that has just been updated.
+	 * 
+	 * <p>
+	 * The value of <code>WIRE_UPDATED</code> is 0x00000008.
+	 */
+	public final static int		WIRE_UPDATED		= 0x00000008;
+	/**
+	 * A <code>Wire</code> has been deleted.
+	 * 
+	 * <p>
+	 * This <code>WireAdminEvent</code> type that indicates that an existing wire
+	 * has been deleted.
+	 * 
+	 * An event is broadcast when {@link WireAdmin#deleteWire}is called with a
+	 * valid wire. {@link WireAdminEvent#getWire}will return the <code>Wire</code>
+	 * object that has just been deleted.
+	 * 
+	 * <p>
+	 * The value of <code>WIRE_DELETED</code> is 0x00000010.
+	 */
+	public final static int		WIRE_DELETED		= 0x00000010;
+	/**
+	 * The <code>WireAdminEvent</code> type that indicates that an existing
+	 * <code>Wire</code> object has become connected.
+	 * 
+	 * The Consumer object and the Producer object that are associated with the
+	 * <code>Wire</code> object have both been registered and the <code>Wire</code>
+	 * object is connected. See {@link Wire#isConnected}for a description of
+	 * the connected state. This event may come before the
+	 * <code>producersConnected</code> and <code>consumersConnected</code> method
+	 * have returned or called to allow synchronous delivery of the events. Both
+	 * methods can cause other <code>WireAdminEvent</code> s to take place and
+	 * requiring this event to be send before these methods are returned would
+	 * mandate asynchronous delivery.
+	 * 
+	 * <p>
+	 * The value of <code>WIRE_CONNECTED</code> is 0x00000020.
+	 */
+	public final static int		WIRE_CONNECTED		= 0x00000020;
+	/**
+	 * The <code>WireAdminEvent</code> type that indicates that an existing
+	 * <code>Wire</code> object has become disconnected.
+	 * 
+	 * The Consumer object or/and Producer object is/are unregistered breaking
+	 * the connection between the two. See {@link Wire#isConnected}for a
+	 * description of the connected state.
+	 * 
+	 * <p>
+	 * The value of <code>WIRE_DISCONNECTED</code> is 0x00000040.
+	 */
+	public final static int		WIRE_DISCONNECTED	= 0x00000040;
+	/**
+	 * The <code>WireAdminEvent</code> type that indicates that a new value is
+	 * transferred over the <code>Wire</code> object.
+	 * 
+	 * This event is sent after the Consumer service has been notified by
+	 * calling the {@link Consumer#updated}method or the Consumer service
+	 * requested a new value with the {@link Wire#poll}method. This is an
+	 * advisory event meaning that when this event is received, another update
+	 * may already have occurred and this the {@link Wire#getLastValue}method
+	 * returns a newer value then the value that was communicated for this
+	 * event.
+	 * 
+	 * <p>
+	 * The value of <code>WIRE_TRACE</code> is 0x00000080.
+	 */
+	public final static int		WIRE_TRACE			= 0x00000080;
+
+	/**
+	 * Constructs a <code>WireAdminEvent</code> object from the given
+	 * <code>ServiceReference</code> object, event type, <code>Wire</code> object
+	 * and exception.
+	 * 
+	 * @param reference The <code>ServiceReference</code> object of the Wire Admin
+	 *        service that created this event.
+	 * @param type The event type. See {@link #getType}.
+	 * @param wire The <code>Wire</code> object associated with this event.
+	 * @param exception An exception associated with this event. This may be
+	 *        <code>null</code> if no exception is associated with this event.
+	 */
+	public WireAdminEvent(ServiceReference reference, int type, Wire wire,
+			Throwable exception) {
+		this.reference = reference;
+		this.wire = wire;
+		this.type = type;
+		this.throwable = exception;
+	}
+
+	/**
+	 * Return the <code>ServiceReference</code> object of the Wire Admin service
+	 * that created this event.
+	 * 
+	 * @return The <code>ServiceReference</code> object for the Wire Admin service
+	 *         that created this event.
+	 */
+	public ServiceReference getServiceReference() {
+		return reference;
+	}
+
+	/**
+	 * Return the <code>Wire</code> object associated with this event.
+	 * 
+	 * @return The <code>Wire</code> object associated with this event or
+	 *         <code>null</code> when no <code>Wire</code> object is associated with
+	 *         the event.
+	 */
+	public Wire getWire() {
+		return wire;
+	}
+
+	/**
+	 * Return the type of this event.
+	 * <p>
+	 * The type values are:
+	 * <ul>
+	 * <li>{@link #WIRE_CREATED}
+	 * <li>{@link #WIRE_CONNECTED}
+	 * <li>{@link #WIRE_UPDATED}
+	 * <li>{@link #WIRE_TRACE}
+	 * <li>{@link #WIRE_DISCONNECTED}
+	 * <li>{@link #WIRE_DELETED}
+	 * <li>{@link #PRODUCER_EXCEPTION}
+	 * <li>{@link #CONSUMER_EXCEPTION}
+	 * </ul>
+	 * 
+	 * @return The type of this event.
+	 */
+	public int getType() {
+		return type;
+	}
+
+	/**
+	 * Returns the exception associated with the event, if any.
+	 * 
+	 * @return An exception or <code>null</code> if no exception is associated
+	 *         with this event.
+	 */
+	public Throwable getThrowable() {
+		return throwable;
+	}
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminListener.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminListener.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminListener.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminListener.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,74 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/WireAdminListener.java,v 1.8 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+/**
+ * Listener for Wire Admin Events.
+ * 
+ * <p>
+ * <code>WireAdminListener</code> objects are registered with the Framework
+ * service registry and are notified with a <code>WireAdminEvent</code> object
+ * when an event is broadcast.
+ * <p>
+ * <code>WireAdminListener</code> objects can inspect the received
+ * <code>WireAdminEvent</code> object to determine its type, the <code>Wire</code>
+ * object with which it is associated, and the Wire Admin service that
+ * broadcasts the event.
+ * 
+ * <p>
+ * <code>WireAdminListener</code> objects must be registered with a service
+ * property {@link WireConstants#WIREADMIN_EVENTS}whose value is a bitwise OR
+ * of all the event types the listener is interested in receiving.
+ * <p>
+ * For example:
+ * 
+ * <pre>
+ * Integer mask = new Integer(WIRE_TRACE | WIRE_CONNECTED | WIRE_DISCONNECTED);
+ * Hashtable ht = new Hashtable();
+ * ht.put(WIREADMIN_EVENTS, mask);
+ * context.registerService(WireAdminListener.class.getName(), this, ht);
+ * </pre>
+ * 
+ * If a <code>WireAdminListener</code> object is registered without a service
+ * property {@link WireConstants#WIREADMIN_EVENTS}, then the
+ * <code>WireAdminListener</code> will receive no events.
+ * 
+ * <p>
+ * Security Considerations. Bundles wishing to monitor <code>WireAdminEvent</code>
+ * objects will require <code>ServicePermission[WireAdminListener,REGISTER]</code>
+ * to register a <code>WireAdminListener</code> service. Since
+ * <code>WireAdminEvent</code> objects contain <code>Wire</code> objects, care must
+ * be taken in assigning permission to register a <code>WireAdminListener</code>
+ * service.
+ * 
+ * @see WireAdminEvent
+ * 
+ * @version $Revision: 1.8 $
+ */
+public interface WireAdminListener {
+	/**
+	 * Receives notification of a broadcast <code>WireAdminEvent</code> object.
+	 * 
+	 * The event object will be of an event type specified in this
+	 * <code>WireAdminListener</code> service's
+	 * {@link WireConstants#WIREADMIN_EVENTS}service property.
+	 * 
+	 * @param event The <code>WireAdminEvent</code> object.
+	 */
+	void wireAdminEvent(WireAdminEvent event);
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireAdminListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireConstants.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireConstants.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireConstants.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireConstants.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,227 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/WireConstants.java,v 1.8 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+/**
+ * Defines standard names for <code>Wire</code> properties, wire filter
+ * attributes, Consumer and Producer service properties.
+ * 
+ * @version $Revision: 1.8 $
+ */
+public interface WireConstants {
+	/**
+	 * <code>Wire</code> property key (named <code>wireadmin.pid</code>) specifying
+	 * the persistent identity (PID) of this <code>Wire</code> object.
+	 * 
+	 * <p>
+	 * Each <code>Wire</code> object has a PID to allow unique and persistent
+	 * identification of a specific <code>Wire</code> object. The PID must be
+	 * generated by the {@link WireAdmin}service when the <code>Wire</code>
+	 * object is created.
+	 * 
+	 * <p>
+	 * This wire property is automatically set by the Wire Admin service. The
+	 * value of the property must be of type <code>String</code>.
+	 */
+	public final static String	WIREADMIN_PID					= "wireadmin.pid";
+	/**
+	 * A service registration property for a Producer service that is composite.
+	 * It contains the names of the composite Consumer services it can
+	 * inter-operate with. Inter-operability exists when any name in this array
+	 * matches any name in the array set by the Consumer service. The type of
+	 * this property must be <code>String[]</code>.
+	 */
+	public final static String	WIREADMIN_PRODUCER_COMPOSITE	= "wireadmin.producer.composite";
+	/**
+	 * A service registration property for a Consumer service that is composite.
+	 * It contains the names of the composite Producer services it can cooperate
+	 * with. Inter-operability exists when any name in this array matches any
+	 * name in the array set by the Producer service. The type of this property
+	 * must be <code>String[]</code>.
+	 */
+	public final static String	WIREADMIN_CONSUMER_COMPOSITE	= "wireadmin.consumer.composite";
+	/**
+	 * Service registration property key (named
+	 * <code>wireadmin.producer.scope</code>) specifying a list of names that may
+	 * be used to define the scope of this <code>Wire</code> object. A Producer
+	 * service should set this service property when it can produce more than
+	 * one kind of value. This property is only used during registration,
+	 * modifying the property must not have any effect of the <code>Wire</code>
+	 * object's scope. Each name in the given list mist have
+	 * <code>WirePermission[name,PRODUCE]</code> or else is ignored. The type of
+	 * this service registration property must be <code>String[]</code>.
+	 * 
+	 * @see Wire#getScope
+	 * @see #WIREADMIN_CONSUMER_SCOPE
+	 */
+	public final static String	WIREADMIN_PRODUCER_SCOPE		= "wireadmin.producer.scope";
+	/**
+	 * Service registration property key (named
+	 * <code>wireadmin.consumer.scope</code>) specifying a list of names that may
+	 * be used to define the scope of this <code>Wire</code> object. A
+	 * <code>Consumer</code> service should set this service property when it can
+	 * produce more than one kind of value. This property is only used during
+	 * registration, modifying the property must not have any effect of the
+	 * <code>Wire</code> object's scope. Each name in the given list mist have
+	 * <code>WirePermission[name,CONSUME]</code> or else is ignored. The type of this
+	 * service registration property must be <code>String[]</code>.
+	 * 
+	 * @see Wire#getScope
+	 * @see #WIREADMIN_PRODUCER_SCOPE
+	 */
+	public final static String	WIREADMIN_CONSUMER_SCOPE		= "wireadmin.consumer.scope";
+	/**
+	 * Matches all scope names.
+	 */
+	public final static String	WIREADMIN_SCOPE_ALL[]			= {"*"};
+	/**
+	 * <code>Wire</code> property key (named <code>wireadmin.producer.pid</code>)
+	 * specifying the <code>service.pid</code> of the associated Producer service.
+	 * 
+	 * <p>
+	 * This wire property is automatically set by the WireAdmin service. The
+	 * value of the property must be of type <code>String</code>.
+	 */
+	public final static String	WIREADMIN_PRODUCER_PID			= "wireadmin.producer.pid";
+	/**
+	 * <code>Wire</code> property key (named <code>wireadmin.consumer.pid</code>)
+	 * specifying the <code>service.pid</code> of the associated Consumer service.
+	 * 
+	 * <p>
+	 * This wire property is automatically set by the Wire Admin service. The
+	 * value of the property must be of type <code>String</code>.
+	 */
+	public final static String	WIREADMIN_CONSUMER_PID			= "wireadmin.consumer.pid";
+	/**
+	 * <code>Wire</code> property key (named <code>wireadmin.filter</code>)
+	 * specifying a filter used to control the delivery rate of data between the
+	 * Producer and the Consumer service.
+	 * 
+	 * <p>
+	 * This property should contain a filter as described in the <code>Filter</code>
+	 * class. The filter can be used to specify when an updated value from the
+	 * Producer service should be delivered to the Consumer service. In many
+	 * cases the Consumer service does not need to receive the data with the
+	 * same rate that the Producer service can generate data. This property can
+	 * be used to control the delivery rate.
+	 * <p>
+	 * The filter can use a number of pre-defined attributes that can be used to
+	 * control the delivery of new data values. If the filter produces a match
+	 * upon the wire filter attributes, the Consumer service should be notifed
+	 * of the updated data value.
+	 * <p>
+	 * If the Producer service was registered with the
+	 * {@link #WIREADMIN_PRODUCER_FILTERS}service property indicating that the
+	 * Producer service will perform the data filtering then the <code>Wire</code>
+	 * object will not perform data filtering. Otherwise, the <code>Wire</code>
+	 * object must perform basic filtering. Basic filtering includes supporting
+	 * the following standard wire filter attributes:
+	 * <ul>
+	 * <li>{@link #WIREVALUE_CURRENT}- Current value
+	 * <li>{@link #WIREVALUE_PREVIOUS}- Previous value
+	 * <li>{@link #WIREVALUE_DELTA_ABSOLUTE}- Absolute delta
+	 * <li>{@link #WIREVALUE_DELTA_RELATIVE}- Relative delta
+	 * <li>{@link #WIREVALUE_ELAPSED}- Elapsed time
+	 * </ul>
+	 * 
+	 * @see org.osgi.framework.Filter
+	 */
+	public final static String	WIREADMIN_FILTER				= "wireadmin.filter";
+	/* Wire filter attribute names. */
+	/**
+	 * <code>Wire</code> object's filter attribute (named
+	 * <code>wirevalue.current</code>) representing the current value.
+	 */
+	public final static String	WIREVALUE_CURRENT				= "wirevalue.current";
+	/**
+	 * <code>Wire</code> object's filter attribute (named
+	 * <code>wirevalue.previous</code>) representing the previous value.
+	 */
+	public final static String	WIREVALUE_PREVIOUS				= "wirevalue.previous";
+	/**
+	 * <code>Wire</code> object's filter attribute (named
+	 * <code>wirevalue.delta.absolute</code>) representing the absolute delta.
+	 * The absolute (always positive) difference between the last update and the
+	 * current value (only when numeric). This attribute must not be used when
+	 * the values are not numeric.
+	 */
+	public final static String	WIREVALUE_DELTA_ABSOLUTE		= "wirevalue.delta.absolute";
+	/**
+	 * <code>Wire</code> object's filter attribute (named
+	 * <code>wirevalue.delta.relative</code>) representing the relative delta.
+	 * The relative difference is |<code>previous</code>-<code>current</code> |/|
+	 * <code>current</code>| (only when numeric). This attribute must not be used
+	 * when the values are not numeric.
+	 */
+	public final static String	WIREVALUE_DELTA_RELATIVE		= "wirevalue.delta.relative";
+	/**
+	 * <code>Wire</code> object's filter attribute (named
+	 * <code>wirevalue.elapsed</code>) representing the elapsed time, in ms,
+	 * between this filter evaluation and the last update of the
+	 * <code>Consumer</code> service.
+	 */
+	public final static String	WIREVALUE_ELAPSED				= "wirevalue.elapsed";
+	/* Service registration property key names. */
+	/**
+	 * Service Registration property (named <code>wireadmin.producer.filters</code>).
+	 * A <code>Producer</code> service registered with this property indicates to
+	 * the Wire Admin service that the Producer service implements at least the
+	 * filtering as described for the {@link #WIREADMIN_FILTER}property. If the
+	 * Producer service is not registered with this property, the <code>Wire</code>
+	 * object must perform the basic filtering as described in
+	 * {@link #WIREADMIN_FILTER}.
+	 * 
+	 * <p>
+	 * The type of the property value is not relevant. Only its presence is
+	 * relevant.
+	 */
+	public final static String	WIREADMIN_PRODUCER_FILTERS		= "wireadmin.producer.filters";
+	/**
+	 * Service Registration property (named <code>wireadmin.consumer.flavors</code>)
+	 * specifying the list of data types understood by this Consumer service.
+	 * 
+	 * <p>
+	 * The Consumer service object must be registered with this service
+	 * property. The list must be in the order of preference with the first type
+	 * being the most preferred. The value of the property must be of type
+	 * <code>Class[]</code>.
+	 */
+	public final static String	WIREADMIN_CONSUMER_FLAVORS		= "wireadmin.consumer.flavors";
+	/**
+	 * Service Registration property (named <code>wireadmin.producer.flavors</code>)
+	 * specifying the list of data types available from this Producer service.
+	 * 
+	 * <p>
+	 * The Producer service object should be registered with this service
+	 * property.
+	 * 
+	 * <p>
+	 * The value of the property must be of type <code>Class[]</code>.
+	 */
+	public final static String	WIREADMIN_PRODUCER_FLAVORS		= "wireadmin.producer.flavors";
+	/**
+	 * Service Registration property (named <code>wireadmin.events</code>)
+	 * specifying the <code>WireAdminEvent</code> type of interest to a Wire Admin
+	 * Listener service. The value of the property is a bitwise OR of all the
+	 * <code>WireAdminEvent</code> types the Wire Admin Listener service wishes to
+	 * receive and must be of type <code>Integer</code>.
+	 * 
+	 * @see WireAdminEvent
+	 */
+	public final static String	WIREADMIN_EVENTS				= "wireadmin.events";
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WireConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WirePermission.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WirePermission.java?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WirePermission.java (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WirePermission.java Wed Mar 29 13:05:08 2006
@@ -0,0 +1,462 @@
+/*
+ * $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/WirePermission.java,v 1.11 2006/03/14 01:20:55 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2002, 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.wireadmin;
+
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.security.Permission;
+import java.security.BasicPermission;
+import java.security.PermissionCollection;
+
+/**
+ * Permission for the scope of a <code>Wire</code> object. When a
+ * <code>Envelope</code> object is used for communication with the <code>poll</code>
+ * or <code>update</code> method, and the scope is set, then the <code>Wire</code>
+ * object must verify that the Consumer service has
+ * <code>WirePermission[name,CONSUME]</code> and the Producer service has
+ * <code>WirePermission[name,PRODUCE]</code> for all names in the scope.
+ * <p>
+ * The names are compared with the normal rules for permission names. This means
+ * that they may end with a "*" to indicate wildcards. E.g. Door.* indicates all
+ * scope names starting with the string "Door". The last period is required due
+ * to the implementations of the <code>BasicPermission</code> class.
+ * 
+ * @version $Revision: 1.11 $
+ */
+final public class WirePermission extends BasicPermission {
+    static final long serialVersionUID = -5583709391516569321L;
+	/**
+	 * The action string for the <code>PRODUCE</code> action: value is "produce".
+	 */
+	public static final String	PRODUCE			= "produce";
+	/**
+	 * The action string for the <code>CONSUME</code> action: value is "consume".
+	 */
+	public static final String	CONSUME			= "consume";
+	private final static int	ACTION_PRODUCE	= 0x00000001;
+	private final static int	ACTION_CONSUME	= 0x00000002;
+	private final static int	ACTION_ALL		= ACTION_PRODUCE
+														| ACTION_CONSUME;
+	private final static int	ACTION_NONE		= 0;
+	/**
+	 * The actions mask.
+	 */
+	private transient int		action_mask		= ACTION_NONE;
+	/**
+	 * The actions in canonical form.
+	 * 
+	 * @serial
+	 */
+	private String				actions			= null;
+
+	/**
+	 * Create a new WirePermission with the given name (may be wildcard) and
+	 * actions.
+	 * @param name Wire name.
+	 * @param actions <code>produce</code>, <code>consume</code>
+	 *        (canonical order).
+	 */
+	public WirePermission(String name, String actions) {
+		this(name, getMask(actions));
+	}
+
+	/**
+	 * Package private constructor used by WirePermissionCollection.
+	 * 
+	 * @param name class name
+	 * @param mask action mask
+	 */
+	WirePermission(String name, int mask) {
+		super(name);
+		init(mask);
+	}
+
+	/**
+	 * Called by constructors and when deserialized.
+	 * 
+	 * @param mask action mask
+	 */
+	private void init(int mask) {
+		if ((mask == ACTION_NONE) || ((mask & ACTION_ALL) != mask)) {
+			throw new IllegalArgumentException("invalid action string");
+		}
+		action_mask = mask;
+	}
+
+	/**
+	 * Parse action string into action mask.
+	 * 
+	 * @param actions Action string.
+	 * @return action mask.
+	 */
+	private static int getMask(String actions) {
+		boolean seencomma = false;
+		int mask = ACTION_NONE;
+		if (actions == null) {
+			return mask;
+		}
+		char[] a = actions.toCharArray();
+		int i = a.length - 1;
+		if (i < 0)
+			return mask;
+		while (i != -1) {
+			char c;
+			// skip whitespace
+			while ((i != -1)
+					&& ((c = a[i]) == ' ' || c == '\r' || c == '\n'
+							|| c == '\f' || c == '\t'))
+				i--;
+			// check for the known strings
+			int matchlen;
+			if (i >= 6 && (a[i - 6] == 'p' || a[i - 6] == 'P')
+					&& (a[i - 5] == 'r' || a[i - 5] == 'R')
+					&& (a[i - 4] == 'o' || a[i - 4] == 'O')
+					&& (a[i - 3] == 'd' || a[i - 3] == 'D')
+					&& (a[i - 2] == 'u' || a[i - 2] == 'U')
+					&& (a[i - 1] == 'c' || a[i - 1] == 'C')
+					&& (a[i] == 'e' || a[i] == 'E')) {
+				matchlen = 7;
+				mask |= ACTION_PRODUCE;
+			}
+			else
+				if (i >= 6 && (a[i - 6] == 'c' || a[i - 6] == 'C')
+						&& (a[i - 5] == 'o' || a[i - 5] == 'O')
+						&& (a[i - 4] == 'n' || a[i - 4] == 'N')
+						&& (a[i - 3] == 's' || a[i - 3] == 'S')
+						&& (a[i - 2] == 'u' || a[i - 2] == 'U')
+						&& (a[i - 1] == 'm' || a[i - 1] == 'M')
+						&& (a[i] == 'e' || a[i] == 'E')) {
+					matchlen = 7;
+					mask |= ACTION_CONSUME;
+				}
+				else {
+					// parse error
+					throw new IllegalArgumentException("invalid permission: "
+							+ actions);
+				}
+			// make sure we didn't just match the tail of a word
+			// like "ackbarfregister". Also, skip to the comma.
+			seencomma = false;
+			while (i >= matchlen && !seencomma) {
+				switch (a[i - matchlen]) {
+					case ',' :
+						seencomma = true;
+					/* FALLTHROUGH */
+					case ' ' :
+					case '\r' :
+					case '\n' :
+					case '\f' :
+					case '\t' :
+						break;
+					default :
+						throw new IllegalArgumentException(
+								"invalid permission: " + actions);
+				}
+				i--;
+			}
+			// point i at the location of the comma minus one (or -1).
+			i -= matchlen;
+		}
+		if (seencomma) {
+			throw new IllegalArgumentException("invalid permission: " + actions);
+		}
+		return mask;
+	}
+
+	/**
+	 * Checks if this <code>WirePermission</code> object <code>implies</code> the
+	 * specified permission.
+	 * <P>
+	 * More specifically, this method returns <code>true</code> if:
+	 * <p>
+	 * <ul>
+	 * <li><i>p </i> is an instanceof the <code>WirePermission</code> class,
+	 * <li><i>p </i>'s actions are a proper subset of this object's actions,
+	 * and
+	 * <li><i>p </i>'s name is implied by this object's name. For example,
+	 * <code>java.*</code> implies <code>java.home</code>.
+	 * </ul>
+	 * 
+	 * @param p The permission to check against.
+	 * 
+	 * @return <code>true</code> if the specified permission is implied by this
+	 *         object; <code>false</code> otherwise.
+	 */
+	public boolean implies(Permission p) {
+		if (p instanceof WirePermission) {
+			WirePermission target = (WirePermission) p;
+			return ((action_mask & target.action_mask) == target.action_mask)
+					&& super.implies(p);
+		}
+		return false;
+	}
+
+	/**
+	 * Returns the canonical string representation of the actions. Always
+	 * returns present actions in the following order: <code>produce</code>,
+	 * <code>consume</code>.
+	 * 
+	 * @return The canonical string representation of the actions.
+	 */
+	public String getActions() {
+		if (actions == null) {
+			StringBuffer sb = new StringBuffer();
+			boolean comma = false;
+			if ((action_mask & ACTION_PRODUCE) == ACTION_PRODUCE) {
+				sb.append(PRODUCE);
+				comma = true;
+			}
+			if ((action_mask & ACTION_CONSUME) == ACTION_CONSUME) {
+				if (comma)
+					sb.append(',');
+				sb.append(CONSUME);
+			}
+			actions = sb.toString();
+		}
+		return actions;
+	}
+
+	/**
+	 * Returns a new <code>PermissionCollection</code> object for storing
+	 * <code>WirePermission</code> objects.
+	 * 
+	 * @return A new <code>PermissionCollection</code> object suitable for storing
+	 *         <code>WirePermission</code> objects.
+	 */
+	public PermissionCollection newPermissionCollection() {
+		return new WirePermissionCollection();
+	}
+
+	/**
+	 * Determines the equalty of two <code>WirePermission</code> objects.
+	 * 
+	 * Checks that specified object has the same name and actions as this
+	 * <code>WirePermission</code> object.
+	 * 
+	 * @param obj The object to test for equality.
+	 * @return true if <code>obj</code> is a <code>WirePermission</code>, and has
+	 *         the same name and actions as this <code>WirePermission</code>
+	 *         object; <code>false</code> otherwise.
+	 */
+	public boolean equals(Object obj) {
+		if (obj == this) {
+			return true;
+		}
+		if (!(obj instanceof WirePermission)) {
+			return false;
+		}
+		WirePermission p = (WirePermission) obj;
+		return (action_mask == p.action_mask) && getName().equals(p.getName());
+	}
+
+	/**
+	 * Returns the hash code value for this object.
+	 * 
+	 * @return Hash code value for this object.
+	 */
+	public int hashCode() {
+		return getName().hashCode() ^ getActions().hashCode();
+	}
+
+	/**
+	 * Returns the current action mask. Used by the WirePermissionCollection
+	 * object.
+	 * 
+	 * @return The actions mask.
+	 */
+	int getMask() {
+		return action_mask;
+	}
+
+	/**
+	 * Returns a string describing this <code>WirePermission</code>. The
+	 * convention is to specify the class name, the permission name, and the
+	 * actions in the following format:
+	 * '(org.osgi.service.wireadmin.WirePermission &quot;name&quot;
+	 * &quot;actions&quot;)'.
+	 * 
+	 * @return information about this <code>Permission</code> object.
+	 */
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
+		sb.append('(');
+		sb.append(getClass().getName());
+		sb.append(" \"");
+		sb.append(getName());
+		sb.append("\" \"");
+		sb.append(getActions());
+		sb.append("\")");
+		return sb.toString();
+	}
+
+	/**
+	 * WriteObject is called to save the state of the ServicePermission to a
+	 * stream. The actions are serialized, and the superclass takes care of the
+	 * name.
+	 */
+	private synchronized void writeObject(java.io.ObjectOutputStream s)
+			throws IOException {
+		// Write out the actions. The superclass takes care of the name
+		// call getActions to make sure actions field is initialized
+		if (actions == null)
+			getActions();
+		s.defaultWriteObject();
+	}
+
+	/**
+	 * readObject is called to restore the state of the ServicePermission from a
+	 * stream.
+	 */
+	private synchronized void readObject(java.io.ObjectInputStream s)
+			throws IOException, ClassNotFoundException {
+		// Read in the action, then initialize the rest
+		s.defaultReadObject();
+		init(getMask(actions));
+	}
+}
+/**
+ * A <code>WirePermissionCollection</code> stores a set of <code>WirePermission</code>
+ * permissions.
+ */
+
+final class WirePermissionCollection extends PermissionCollection {
+    static final long serialVersionUID = 2617521094909826016L;
+	/**
+	 * Table of permissions.
+	 * 
+	 * @serial
+	 */
+	private Hashtable	permissions;
+	/**
+	 * Boolean saying if "*" is in the collection.
+	 * 
+	 * @serial
+	 */
+	private boolean		all_allowed;
+
+	/**
+	 * Creates an empty WirePermissionCollection object.
+	 *  
+	 */
+	public WirePermissionCollection() {
+		permissions = new Hashtable();
+		all_allowed = false;
+	}
+
+	/**
+	 * Adds a permission to this PermissionCollection.
+	 * 
+	 * @param permission The Permission object to add.
+	 * 
+	 * @throws IllegalArgumentException If the permission is not a
+	 *            WirePermission object.
+	 * 
+	 * @throws SecurityException If this PermissionCollection has been marked
+	 *            read-only.
+	 */
+	public void add(Permission permission) {
+		if (!(permission instanceof WirePermission))
+			throw new IllegalArgumentException("invalid permission: "
+					+ permission);
+		if (isReadOnly())
+			throw new SecurityException("attempt to add a Permission to a "
+					+ "readonly PermissionCollection");
+		WirePermission p = (WirePermission) permission;
+		String name = p.getName();
+		WirePermission existing = (WirePermission) permissions.get(name);
+		if (existing != null) {
+			int oldMask = existing.getMask();
+			int newMask = p.getMask();
+			if (oldMask != newMask) {
+				permissions.put(name, new WirePermission(name, oldMask
+						| newMask));
+			}
+		}
+		else {
+			permissions.put(name, permission);
+		}
+		if (!all_allowed) {
+			if (name.equals("*"))
+				all_allowed = true;
+		}
+	}
+
+	/**
+	 * Determines if a set of permissions implies the permissions expressed in
+	 * <code>permission</code>.
+	 * 
+	 * @param permission The Permission object to compare.
+	 * 
+	 * @return <code>true</code> if <code>permission</code> is a proper subset of a
+	 *         permission in the set; <code>false</code> otherwise.
+	 */
+	public boolean implies(Permission permission) {
+		if (!(permission instanceof WirePermission))
+			return false;
+		WirePermission p = (WirePermission) permission;
+		WirePermission x;
+		int desired = p.getMask();
+		int effective = 0;
+		// short circuit if the "*" Permission was added
+		if (all_allowed) {
+			x = (WirePermission) permissions.get("*");
+			if (x != null) {
+				effective |= x.getMask();
+				if ((effective & desired) == desired)
+					return true;
+			}
+		}
+		// strategy:
+		// Check for full match first. Then work our way up the
+		// name looking for matches on a.b.*
+		String name = p.getName();
+		x = (WirePermission) permissions.get(name);
+		if (x != null) {
+			// we have a direct hit!
+			effective |= x.getMask();
+			if ((effective & desired) == desired)
+				return true;
+		}
+		// work our way up the tree...
+		int last, offset;
+		offset = name.length() - 1;
+		while ((last = name.lastIndexOf(".", offset)) != -1) {
+			name = name.substring(0, last + 1) + "*";
+			x = (WirePermission) permissions.get(name);
+			if (x != null) {
+				effective |= x.getMask();
+				if ((effective & desired) == desired)
+					return (true);
+			}
+			offset = last - 1;
+		}
+		// we don't have to check for "*" as it was already checked
+		// at the top (all_allowed), so we just return false
+		return false;
+	}
+
+	/**
+	 * Returns an enumeration of all the Permission objects in the container.
+	 * 
+	 * @return Enumeration of all the Permission objects.
+	 */
+	public Enumeration elements() {
+		return permissions.elements();
+	}
+}

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/WirePermission.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/package.html
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/package.html?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/package.html (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/package.html Wed Mar 29 13:05:08 2006
@@ -0,0 +1,11 @@
+<!-- $Header: /cvshome/build/org.osgi.service.wireadmin/src/org/osgi/service/wireadmin/package.html,v 1.2 2004/12/01 19:01:21 hargrave Exp $ -->
+<BODY>
+<P>The OSGi Wire Admin service Package. Specification Version 1.0.
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:
+<pre>
+Import-Package: org.osgi.service.wireadmin; version=1.0
+</pre>
+</BODY>
+

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/packageinfo
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/packageinfo?rev=389891&view=auto
==============================================================================
--- incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/packageinfo (added)
+++ incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/packageinfo Wed Mar 29 13:05:08 2006
@@ -0,0 +1 @@
+version 1.0

Propchange: incubator/felix/trunk/org.osgi.compendium/src/main/java/org/osgi/service/wireadmin/packageinfo
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message