felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r674879 [6/12] - in /felix/trunk/upnp: ./ basedriver/ basedriver/src/main/java/org/apache/felix/upnp/basedriver/ basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/ basedriver/src/main/java/org/apache/felix/upnp/basedriver...
Date Tue, 08 Jul 2008 16:59:57 GMT
Modified: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java (original)
+++ felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java Tue Jul  8 09:59:54 2008
@@ -1,259 +1,259 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.felix.upnp.extra.util;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Dictionary;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Vector;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class UPnPEventNotifier implements PropertyChangeListener, ServiceListener {
-	private BundleContext context;
-	private UPnPDevice device;
-	private UPnPService service;
-	private String deviceId;
-	private String serviceId;
-	
-	private Properties UPnPTargetListener;
-	private Vector upnpListeners = new Vector();
-	final private Object LOCK = new Object();
-	
-	
-	private class NotifierThread extends Thread {
-		private ServiceReference sr;
-		private Properties events;
-
-		public NotifierThread(ServiceReference sr, Properties events){
-			super("UPnPEventNotifier");
-			this.sr = sr;
-			this.events = events;
-		}
-		
-		public void run(){
-			try {
-				UPnPEventListener listener = (UPnPEventListener) context.getService(sr);
-				listener.notifyUPnPEvent(deviceId,serviceId,events);
-				context.ungetService(sr);
-			} catch (Exception ignored){
-			}
-		}
-	}
-
-	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service, EventSource source){
-		this(context,device,service);
-		
-		if (source != null){
-			UPnPStateVariable[] vars = service.getStateVariables();
-			if (vars != null){
-				for (int i=0;i<vars.length;i++){
-					if(vars[i].sendsEvents()){
-						source.addPropertyChangeListener(vars[i].getName(),this);
-					}
-				}
-			}
-		}
-
-	}
-	
-	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service){
-		this.context=context;
-		this.device=device;
-		this.service=service;
-		setupUPnPListenerWatcher();
-	}
-	
-	/**
-	 * @param deviceId
-	 */
-	private void setupUPnPListenerWatcher() {
-		Dictionary dict = device.getDescriptions(null);
-		this.deviceId = (String) dict.get(UPnPDevice.ID);
-		this.serviceId=service.getId();
-		UPnPTargetListener = new Properties();
-		UPnPTargetListener.put(UPnPDevice.ID,deviceId);
-		UPnPTargetListener.put(UPnPService.ID,serviceId);
-		UPnPTargetListener.put(UPnPDevice.TYPE,dict.get(UPnPDevice.TYPE));
-		UPnPTargetListener.put(UPnPService.TYPE,service.getType());
-		String ANY_UPnPEventListener = "("+Constants.OBJECTCLASS+"="+UPnPEventListener.class.getName()+")";
-		
-		synchronized (LOCK) {
-		    try {
-		    	String filter = ANY_UPnPEventListener;
-				context.addServiceListener(this,filter);
-			} catch (Exception ex) {
-				System.out.println(ex);
-			}
-						
-			ServiceReference[] listeners = null; 
-			try {
-				listeners = context.getServiceReferences(UPnPEventListener.class.getName(),null);
-				if (listeners != null){
-					for (int i = 0;i<listeners.length;i++){
-						ServiceReference sr = listeners[i];
-						Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
-						if (filter == null) upnpListeners.add(sr);
-						else {				
-							if (filter.match(UPnPTargetListener))
-								addNewListener(sr);
-						}
-					}
-				}
-			} catch (Exception ex) {
-				System.out.println(ex);
-			}
-			
-			Properties status = getCurrentStatus();
-			if (! status.isEmpty())
-					doNotify(status);
-		
-		} // end LOCK
-	
-	}
-
-	private Properties getCurrentStatus() {
-		Properties status = new Properties();
-		UPnPStateVariable[] vars = service.getStateVariables();
-		if (vars != null){
-			for (int i=0;i<vars.length;i++){
-				if(vars[i].sendsEvents()){
-					if (vars[i] instanceof UPnPLocalStateVariable){
-						UPnPLocalStateVariable localVar = (UPnPLocalStateVariable) vars[i];
-						String property = localVar.getName();
-						Object value = localVar.getCurrentValue();
-						status.put(property,value);						
-					}
-					else {
-						System.out.println("[Warning] The StateVariable (" +vars[i].getName() +")"
-								+ " of device (ID:" + deviceId 	+ ") "
-								+ "should implement the interface UPnPLocalStateVariable");
-					}
-				}
-			} // end for
-		}
-		return status;
-	}
-
-	/* (non-Javadoc)
-	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
-	 */
-	public void propertyChange(PropertyChangeEvent evt) {
-        String property = evt.getPropertyName();
-		Object value = evt.getNewValue();
-		Properties events = new Properties();		
-        events.put(property,value);
-		doNotify(events);
-	}
-
-	private void doNotify(Properties events){
-				
-		synchronized (LOCK) {			
-			Iterator list = upnpListeners.iterator();
-			while (list.hasNext()){
-				final ServiceReference sr = (ServiceReference)list.next();
-				new NotifierThread(sr,events).start();						
-			}
-		}		
-	}
-	
-	private void doNotify(ServiceReference sr) {
-		Properties status = getCurrentStatus();
-		if (! status.isEmpty())
-			new NotifierThread(sr,status).start();						
-	}
-
-	
-	/* (non-Javadoc)
-	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
-	 */
-	public void serviceChanged(ServiceEvent e) {
-		ServiceReference sr = e.getServiceReference();		
-		synchronized (LOCK) {			
-			switch(e.getType()){
-				case ServiceEvent.REGISTERED:{
-					Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
-					if (filter == null) {
-						addNewListener(sr);
-						doNotify(sr);
-					}
-					else {				
-						if (filter.match(UPnPTargetListener)){
-							addNewListener(sr);
-							doNotify(sr);
-						}
-					}
-				};break;
-				
-				case ServiceEvent.MODIFIED:{				
-		               Filter filter = (Filter)	sr.getProperty(UPnPEventListener.UPNP_FILTER);
-		               removeListener(sr);
-		               if (filter == null)
-		                   addNewListener(sr);
-		               else {
-		                   if (filter.match(UPnPTargetListener))
-		                       addNewListener(sr);
-		               }
-				};break;
-				
-				case ServiceEvent.UNREGISTERING:{	
-					removeListener(sr);
-				};break;					
-			}
-		}//end LOCK
-		
-	}
-
-
-	/**
-	 * @param reference
-	 */
-	private void removeListener(ServiceReference reference) {
-		upnpListeners.remove(reference);		
-	}
-
-	/**
-	 * @param reference
-	 */
-	private void addNewListener(ServiceReference reference) {
-		upnpListeners.add(reference);	
-	}
-	
-	public void destroy(){
-		context.removeServiceListener(this);
-		upnpListeners.removeAllElements();
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.upnp.extra.util;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPLocalStateVariable;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class UPnPEventNotifier implements PropertyChangeListener, ServiceListener {
+	private BundleContext context;
+	private UPnPDevice device;
+	private UPnPService service;
+	private String deviceId;
+	private String serviceId;
+	
+	private Properties UPnPTargetListener;
+	private Vector upnpListeners = new Vector();
+	final private Object LOCK = new Object();
+	
+	
+	private class NotifierThread extends Thread {
+		private ServiceReference sr;
+		private Properties events;
+
+		public NotifierThread(ServiceReference sr, Properties events){
+			super("UPnPEventNotifier");
+			this.sr = sr;
+			this.events = events;
+		}
+		
+		public void run(){
+			try {
+				UPnPEventListener listener = (UPnPEventListener) context.getService(sr);
+				listener.notifyUPnPEvent(deviceId,serviceId,events);
+				context.ungetService(sr);
+			} catch (Exception ignored){
+			}
+		}
+	}
+
+	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service, EventSource source){
+		this(context,device,service);
+		
+		if (source != null){
+			UPnPStateVariable[] vars = service.getStateVariables();
+			if (vars != null){
+				for (int i=0;i<vars.length;i++){
+					if(vars[i].sendsEvents()){
+						source.addPropertyChangeListener(vars[i].getName(),this);
+					}
+				}
+			}
+		}
+
+	}
+	
+	public UPnPEventNotifier(BundleContext context, UPnPDevice device, UPnPService service){
+		this.context=context;
+		this.device=device;
+		this.service=service;
+		setupUPnPListenerWatcher();
+	}
+	
+	/**
+	 * @param deviceId
+	 */
+	private void setupUPnPListenerWatcher() {
+		Dictionary dict = device.getDescriptions(null);
+		this.deviceId = (String) dict.get(UPnPDevice.ID);
+		this.serviceId=service.getId();
+		UPnPTargetListener = new Properties();
+		UPnPTargetListener.put(UPnPDevice.ID,deviceId);
+		UPnPTargetListener.put(UPnPService.ID,serviceId);
+		UPnPTargetListener.put(UPnPDevice.TYPE,dict.get(UPnPDevice.TYPE));
+		UPnPTargetListener.put(UPnPService.TYPE,service.getType());
+		String ANY_UPnPEventListener = "("+Constants.OBJECTCLASS+"="+UPnPEventListener.class.getName()+")";
+		
+		synchronized (LOCK) {
+		    try {
+		    	String filter = ANY_UPnPEventListener;
+				context.addServiceListener(this,filter);
+			} catch (Exception ex) {
+				System.out.println(ex);
+			}
+						
+			ServiceReference[] listeners = null; 
+			try {
+				listeners = context.getServiceReferences(UPnPEventListener.class.getName(),null);
+				if (listeners != null){
+					for (int i = 0;i<listeners.length;i++){
+						ServiceReference sr = listeners[i];
+						Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
+						if (filter == null) upnpListeners.add(sr);
+						else {				
+							if (filter.match(UPnPTargetListener))
+								addNewListener(sr);
+						}
+					}
+				}
+			} catch (Exception ex) {
+				System.out.println(ex);
+			}
+			
+			Properties status = getCurrentStatus();
+			if (! status.isEmpty())
+					doNotify(status);
+		
+		} // end LOCK
+	
+	}
+
+	private Properties getCurrentStatus() {
+		Properties status = new Properties();
+		UPnPStateVariable[] vars = service.getStateVariables();
+		if (vars != null){
+			for (int i=0;i<vars.length;i++){
+				if(vars[i].sendsEvents()){
+					if (vars[i] instanceof UPnPLocalStateVariable){
+						UPnPLocalStateVariable localVar = (UPnPLocalStateVariable) vars[i];
+						String property = localVar.getName();
+						Object value = localVar.getCurrentValue();
+						status.put(property,value);						
+					}
+					else {
+						System.out.println("[Warning] The StateVariable (" +vars[i].getName() +")"
+								+ " of device (ID:" + deviceId 	+ ") "
+								+ "should implement the interface UPnPLocalStateVariable");
+					}
+				}
+			} // end for
+		}
+		return status;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+	 */
+	public void propertyChange(PropertyChangeEvent evt) {
+        String property = evt.getPropertyName();
+		Object value = evt.getNewValue();
+		Properties events = new Properties();		
+        events.put(property,value);
+		doNotify(events);
+	}
+
+	private void doNotify(Properties events){
+				
+		synchronized (LOCK) {			
+			Iterator list = upnpListeners.iterator();
+			while (list.hasNext()){
+				final ServiceReference sr = (ServiceReference)list.next();
+				new NotifierThread(sr,events).start();						
+			}
+		}		
+	}
+	
+	private void doNotify(ServiceReference sr) {
+		Properties status = getCurrentStatus();
+		if (! status.isEmpty())
+			new NotifierThread(sr,status).start();						
+	}
+
+	
+	/* (non-Javadoc)
+	 * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
+	 */
+	public void serviceChanged(ServiceEvent e) {
+		ServiceReference sr = e.getServiceReference();		
+		synchronized (LOCK) {			
+			switch(e.getType()){
+				case ServiceEvent.REGISTERED:{
+					Filter filter = (Filter) sr.getProperty(UPnPEventListener.UPNP_FILTER);
+					if (filter == null) {
+						addNewListener(sr);
+						doNotify(sr);
+					}
+					else {				
+						if (filter.match(UPnPTargetListener)){
+							addNewListener(sr);
+							doNotify(sr);
+						}
+					}
+				};break;
+				
+				case ServiceEvent.MODIFIED:{				
+		               Filter filter = (Filter)	sr.getProperty(UPnPEventListener.UPNP_FILTER);
+		               removeListener(sr);
+		               if (filter == null)
+		                   addNewListener(sr);
+		               else {
+		                   if (filter.match(UPnPTargetListener))
+		                       addNewListener(sr);
+		               }
+				};break;
+				
+				case ServiceEvent.UNREGISTERING:{	
+					removeListener(sr);
+				};break;					
+			}
+		}//end LOCK
+		
+	}
+
+
+	/**
+	 * @param reference
+	 */
+	private void removeListener(ServiceReference reference) {
+		upnpListeners.remove(reference);		
+	}
+
+	/**
+	 * @param reference
+	 */
+	private void addNewListener(ServiceReference reference) {
+		upnpListeners.add(reference);	
+	}
+	
+	public void destroy(){
+		context.removeServiceListener(this);
+		upnpListeners.removeAllElements();
+	}
+}

Propchange: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPEventNotifier.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java (original)
+++ felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java Tue Jul  8 09:59:54 2008
@@ -1,139 +1,139 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.felix.upnp.extra.util;
-
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPEventListener;
-import org.osgi.service.upnp.UPnPService;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-public class UPnPSubscriber {
-	private BundleContext context;
-	private UPnPEventListener listener;
-	private HashMap hash;
-	
-	private class Subscription implements UPnPEventListener{
-	    ServiceRegistration registration;
-	    
-	    Subscription(String keys){
-	 		try {
-				Filter filter = context.createFilter(keys);
-				Properties props = new Properties();
-				props.put(UPnPEventListener.UPNP_FILTER, filter);
-				registration = context.registerService(UPnPEventListener.class.getName(), this, props);
-			}catch (Exception ex){
-				System.out.println(ex);
-			}
-	    }
-	    
-	    public void unsubscribe(){
-			registration.unregister();
-	    }
-	    
-        public void notifyUPnPEvent(String arg0, String arg1, Dictionary arg2) {
-            listener.notifyUPnPEvent( arg0,  arg1,  arg2);
-        }
-	}
-	
-	
-	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
-	    if ((context == null)|| (listener == null))
-	        throw new IllegalArgumentException("Illegal arguments in UPnPSubscriber constructor.");
-		this.context = context;
-		this.listener = listener;
-		hash = new HashMap();
-	}
-
-	public void subscribe(String filter){
-		if (hash.get(filter) == null){
-		    hash.put(filter, new Subscription(filter));
-		}	
-	}
-	
-	public void unsubscribe(String filter){
-		if (hash.containsKey(filter)) {
-		    Subscription subscription = (Subscription) hash.get(filter);
-		    subscription.unsubscribe();
-			hash.remove(filter);
-		}
-	}
-	
-	public void unsubscribeAll(){
-	    Iterator list = hash.entrySet().iterator();
-	    while (list.hasNext()){		        
-	        Map.Entry entry = (Map.Entry) list.next();
-	        Subscription subcription = (Subscription) entry.getValue();
-	        subcription.unsubscribe();
-		    list.remove();
-	    }
-	}
-
-	public String subscribeServiceIdOf(String deviceId, String serviceId){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeServiceTypeOf(String deviceId, String serviceType){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeEveryServiceType(String deviceType, String serviceType){
-		String keys = "(&(" + UPnPDevice.TYPE + "="+ deviceType + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeAllServicesOf(String deviceId){
-		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
-		subscribe(keys);
-		return keys;
-	}
-	
-	public String subscribeEveryDeviceTypeServices(String deviceType){
-		String keys = "(" + UPnPDevice.TYPE + "="+ deviceType + ")";
-		subscribe(keys);
-		return keys;
-	}
-	
-	
-	public void unsubscribeServiceIdOf(String deviceId, String serviceId){
-		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
-		unsubscribe(keys);
-	}
-	
-	public void unsubscribeAllServicesOf(String deviceId){
-		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
-		unsubscribe(keys);
-	}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.upnp.extra.util;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPEventListener;
+import org.osgi.service.upnp.UPnPService;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+public class UPnPSubscriber {
+	private BundleContext context;
+	private UPnPEventListener listener;
+	private HashMap hash;
+	
+	private class Subscription implements UPnPEventListener{
+	    ServiceRegistration registration;
+	    
+	    Subscription(String keys){
+	 		try {
+				Filter filter = context.createFilter(keys);
+				Properties props = new Properties();
+				props.put(UPnPEventListener.UPNP_FILTER, filter);
+				registration = context.registerService(UPnPEventListener.class.getName(), this, props);
+			}catch (Exception ex){
+				System.out.println(ex);
+			}
+	    }
+	    
+	    public void unsubscribe(){
+			registration.unregister();
+	    }
+	    
+        public void notifyUPnPEvent(String arg0, String arg1, Dictionary arg2) {
+            listener.notifyUPnPEvent( arg0,  arg1,  arg2);
+        }
+	}
+	
+	
+	public UPnPSubscriber(BundleContext context,UPnPEventListener listener){
+	    if ((context == null)|| (listener == null))
+	        throw new IllegalArgumentException("Illegal arguments in UPnPSubscriber constructor.");
+		this.context = context;
+		this.listener = listener;
+		hash = new HashMap();
+	}
+
+	public void subscribe(String filter){
+		if (hash.get(filter) == null){
+		    hash.put(filter, new Subscription(filter));
+		}	
+	}
+	
+	public void unsubscribe(String filter){
+		if (hash.containsKey(filter)) {
+		    Subscription subscription = (Subscription) hash.get(filter);
+		    subscription.unsubscribe();
+			hash.remove(filter);
+		}
+	}
+	
+	public void unsubscribeAll(){
+	    Iterator list = hash.entrySet().iterator();
+	    while (list.hasNext()){		        
+	        Map.Entry entry = (Map.Entry) list.next();
+	        Subscription subcription = (Subscription) entry.getValue();
+	        subcription.unsubscribe();
+		    list.remove();
+	    }
+	}
+
+	public String subscribeServiceIdOf(String deviceId, String serviceId){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeServiceTypeOf(String deviceId, String serviceType){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeEveryServiceType(String deviceType, String serviceType){
+		String keys = "(&(" + UPnPDevice.TYPE + "="+ deviceType + ")(" + UPnPService.TYPE + "=" + serviceType + "))";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeAllServicesOf(String deviceId){
+		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
+		subscribe(keys);
+		return keys;
+	}
+	
+	public String subscribeEveryDeviceTypeServices(String deviceType){
+		String keys = "(" + UPnPDevice.TYPE + "="+ deviceType + ")";
+		subscribe(keys);
+		return keys;
+	}
+	
+	
+	public void unsubscribeServiceIdOf(String deviceId, String serviceId){
+		String keys = "(&(" + UPnPDevice.ID + "="+ deviceId + ")(" + UPnPService.ID + "=" + serviceId + "))";
+		unsubscribe(keys);
+	}
+	
+	public void unsubscribeAllServicesOf(String deviceId){
+		String keys = "(" + UPnPDevice.ID + "="+ deviceId + ")";
+		unsubscribe(keys);
+	}
 }
\ No newline at end of file

Propchange: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/extra/src/main/java/org/apache/felix/upnp/extra/util/UPnPSubscriber.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/pom.xml?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/pom.xml (original)
+++ felix/trunk/upnp/pom.xml Tue Jul  8 09:59:54 2008
@@ -16,48 +16,48 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project>
-  <parent>
-    <groupId>org.apache.felix</groupId>
-    <artifactId>felix</artifactId>
-    <version>1.0.2</version>
-    <relativePath>../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <packaging>pom</packaging>
-  <name>Apache Felix UPnP: Root POM</name>
-  <artifactId>upnp</artifactId>
-  <version>1.0.0</version>
-
-  <profiles>
-    <profile>
-      <id>packaging-bundle</id>
-      <activation>
-        <property>
-          <name>packaging</name>
-          <value>bundle</value>
-        </property>
-      </activation>
-      <modules>
-          <module>extra</module>
-          <module>basedriver</module>
-          <module>tester</module>
-          <module>samples</module>
-      </modules>
-    </profile>
-    <profile>
-      <id>default</id>
-      <activation>
-        <property>
-          <name>!packaging</name>
-        </property>
-      </activation>
-      <modules>
-          <module>extra</module>
-          <module>basedriver</module>
-          <module>tester</module>
-          <module>samples</module>
-      </modules>
-    </profile>
-  </profiles>
-</project>
+<project>
+  <parent>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>felix</artifactId>
+    <version>1.0.2</version>
+    <relativePath>../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>pom</packaging>
+  <name>Apache Felix UPnP: Root POM</name>
+  <artifactId>upnp</artifactId>
+  <version>1.0.0</version>
+
+  <profiles>
+    <profile>
+      <id>packaging-bundle</id>
+      <activation>
+        <property>
+          <name>packaging</name>
+          <value>bundle</value>
+        </property>
+      </activation>
+      <modules>
+          <module>extra</module>
+          <module>basedriver</module>
+          <module>tester</module>
+          <module>samples</module>
+      </modules>
+    </profile>
+    <profile>
+      <id>default</id>
+      <activation>
+        <property>
+          <name>!packaging</name>
+        </property>
+      </activation>
+      <modules>
+          <module>extra</module>
+          <module>basedriver</module>
+          <module>tester</module>
+          <module>samples</module>
+      </modules>
+    </profile>
+  </profiles>
+</project>

Propchange: felix/trunk/upnp/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: felix/trunk/upnp/samples/binarylight/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/pom.xml?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/pom.xml (original)
+++ felix/trunk/upnp/samples/binarylight/pom.xml Tue Jul  8 09:59:54 2008
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -17,66 +17,66 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <artifactId>felix</artifactId>
-    <groupId>org.apache.felix</groupId>
-    <version>1.0.2</version>
-    <relativePath>../../../pom/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.felix</groupId>
-  <artifactId>org.apache.felix.upnp.sample.binaryLight</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Felix UPnP Sample Binary-Light</name>
-  <version>0.2.0-SNAPSHOT</version>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>felix</artifactId>
+    <groupId>org.apache.felix</groupId>
+    <version>1.0.2</version>
+    <relativePath>../../../pom/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.felix</groupId>
+  <artifactId>org.apache.felix.upnp.sample.binaryLight</artifactId>
+  <packaging>bundle</packaging>
+  <name>Apache Felix UPnP Sample Binary-Light</name>
+  <version>0.2.0-SNAPSHOT</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
         <version>1.4.0</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>${pom.name}</Bundle-Name>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-Name>${pom.name}</Bundle-Name>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
-            <Bundle-Description>Standardized BinaryLight DCPs to test UPnP Base Driver</Bundle-Description>
-            <Bundle-SymbolicName>org.apache.felix.upnp.sample.binaryLight</Bundle-SymbolicName>
-            <Bundle-Activator>org.apache.felix.upnp.sample.binaryLight.Activator</Bundle-Activator>
-            <Private-Package>org.apache.felix.upnp.sample.binaryLight.*</Private-Package>
-            <Import-Package>*</Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
+            <Bundle-Author>Matteo Demuru &lt;demuru@apache.org&gt;,Francesco Furfari &lt;furfari@apache.org&gt;,Stefano "Kismet" Lenzi &lt;lenzi@apache.org&gt;</Bundle-Author>
+            <Bundle-Description>Standardized BinaryLight DCPs to test UPnP Base Driver</Bundle-Description>
+            <Bundle-SymbolicName>org.apache.felix.upnp.sample.binaryLight</Bundle-SymbolicName>
+            <Bundle-Activator>org.apache.felix.upnp.sample.binaryLight.Activator</Bundle-Activator>
+            <Private-Package>org.apache.felix.upnp.sample.binaryLight.*</Private-Package>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
       <version>1.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>javax.servlet</artifactId>
-      <version>1.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.upnp.extra</artifactId>
-      <version>0.3.0-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-</project>
-
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>javax.servlet</artifactId>
+      <version>1.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.upnp.extra</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>
+

Propchange: felix/trunk/upnp/samples/binarylight/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/Activator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java Tue Jul  8 09:59:54 2008
@@ -1,113 +1,113 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.felix.upnp.sample.binaryLight;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-import org.apache.felix.upnp.extra.util.EventSource;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class LightModel implements EventSource{
-	
-	private boolean status = false;
-	private boolean target = false;
-	private boolean failure = false;
-	private PropertyChangeSupport propertySupport = new PropertyChangeSupport(this);
-	
-	public LightModel(){	
-	}
-	
-	public void addPropertyChangeListener(PropertyChangeListener listener){
-		propertySupport.addPropertyChangeListener(listener);
-	}
-	
-	public void removePropertyChangeListener(PropertyChangeListener listener){
-		propertySupport.removePropertyChangeListener(listener);
-	}
-	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-		propertySupport.addPropertyChangeListener(propertyName,listener);
-	}
-
-	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-		propertySupport.removePropertyChangeListener(propertyName,listener);
-	}
-	
-	public void doSwitch(boolean value){
-		if (value) switchOn();
-		else switchOff();
-	}
-	
-	public void switchOn(){
-		target = true;
-		if(! failure) {
-			boolean oldStatus = status;
-			status = true;
-			propertySupport.firePropertyChange("Status",oldStatus,status);
-		}
-	}
-	
-	public void switchOff(){
-		target = false;
-		if(! failure) {
-			boolean oldStatus = status;
-			status = false;
-			propertySupport.firePropertyChange("Status",oldStatus,status);
-		}
-	}
-	
-	public void setFailure(boolean value){
-		failure = value;
-		if (failure){
-			status = false;
-		}
-		else {
-			if (target)		{
-				status = true;
-			}
-			else{
-				status = false;
-			}
-		}
-		propertySupport.firePropertyChange("Status",!status,status);
-		propertySupport.firePropertyChange("Failure",!failure,failure);
-	}
-	
-
-	/**
-	 * @return
-	 */
-	public boolean getTarget() {
-		return target;
-	}
-
-	/**
-	 * @return
-	 */
-	public boolean getStatus() {
-		return status;
-	}
-
-
-
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.upnp.sample.binaryLight;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+import org.apache.felix.upnp.extra.util.EventSource;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class LightModel implements EventSource{
+	
+	private boolean status = false;
+	private boolean target = false;
+	private boolean failure = false;
+	private PropertyChangeSupport propertySupport = new PropertyChangeSupport(this);
+	
+	public LightModel(){	
+	}
+	
+	public void addPropertyChangeListener(PropertyChangeListener listener){
+		propertySupport.addPropertyChangeListener(listener);
+	}
+	
+	public void removePropertyChangeListener(PropertyChangeListener listener){
+		propertySupport.removePropertyChangeListener(listener);
+	}
+	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+		propertySupport.addPropertyChangeListener(propertyName,listener);
+	}
+
+	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+		propertySupport.removePropertyChangeListener(propertyName,listener);
+	}
+	
+	public void doSwitch(boolean value){
+		if (value) switchOn();
+		else switchOff();
+	}
+	
+	public void switchOn(){
+		target = true;
+		if(! failure) {
+			boolean oldStatus = status;
+			status = true;
+			propertySupport.firePropertyChange("Status",oldStatus,status);
+		}
+	}
+	
+	public void switchOff(){
+		target = false;
+		if(! failure) {
+			boolean oldStatus = status;
+			status = false;
+			propertySupport.firePropertyChange("Status",oldStatus,status);
+		}
+	}
+	
+	public void setFailure(boolean value){
+		failure = value;
+		if (failure){
+			status = false;
+		}
+		else {
+			if (target)		{
+				status = true;
+			}
+			else{
+				status = false;
+			}
+		}
+		propertySupport.firePropertyChange("Status",!status,status);
+		propertySupport.firePropertyChange("Failure",!failure,failure);
+	}
+	
+
+	/**
+	 * @return
+	 */
+	public boolean getTarget() {
+		return target;
+	}
+
+	/**
+	 * @return
+	 */
+	public boolean getStatus() {
+		return status;
+	}
+
+
+
+}

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java Tue Jul  8 09:59:54 2008
@@ -1,185 +1,185 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.felix.upnp.sample.binaryLight;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.net.URL;
-
-import javax.swing.AbstractAction;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-
-import org.osgi.framework.BundleException;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class LightUI extends JFrame implements PropertyChangeListener {
-    private final static ImageIcon LIGHT_ON = LightUI.loadIcon("LightOn.gif","ON");
-    private final static ImageIcon LIGHT_OFF = LightUI.loadIcon("LightOff.gif","OFF");
-    private final static ImageIcon LIGHT_FAIL = LightUI.loadIcon("LightFail.gif","FAILURE");
-	private final JLabel label = new JLabel();
-    private LightModel model;
-	private JButton btnSwitch;
-	private JButton btnFailure;
-   
-	public LightUI(LightModel model)   {
-		super("Felix UPnP BinaryLight");
-		this.model = model;
-		setSize(150,150);
-		JPanel panel = new JPanel(new BorderLayout());
-		panel.add(doMainPanel(),BorderLayout.CENTER);
-		panel.add(doControlPanel(),BorderLayout.SOUTH);
-		getContentPane().add(panel);
-		model.addPropertyChangeListener(this);
-
-		addWindowListener(new WindowAdapter(){
-			public void windowClosing(WindowEvent e) 
-			{
-				try {
-					Activator.context.getBundle().stop();
-				} catch (BundleException ex) {
-					ex.printStackTrace();
-				}
-			}
-		});			
-	       try {
-	            URL eventIconUrl = LightUI.class.getResource("images/logo.gif");           
-	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
-	            setIconImage(icon.getImage());
-	       }
-	        catch (Exception ex){
-	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
-	        }
-	
-		pack();
-		setVisible(true);
-    }
-	
-	private JPanel doMainPanel(){
-		JPanel panel = new JPanel();
-		label.setIcon(LIGHT_OFF);
-		//label.setSize(new Dimension(32,32));
-	    label.addMouseListener(new MouseAdapter(){          
-	          public void mouseClicked(MouseEvent e){
-	            if (SwingUtilities.isLeftMouseButton(e)){
-	              if (e.getClickCount()==1){
-	              Icon icon = label.getIcon();
-	              if (icon == LIGHT_ON)
-	                  model.switchOff();
-	              else 
-	                  model.switchOn();
-	              }
-	            }
-	          }
-	    });
-	    panel.add(label);
-	    return panel;
-	}
-	          
-	private JPanel doControlPanel(){
-		JPanel panel = new JPanel();
-		btnSwitch = new JButton("On");
-		btnFailure = new JButton("Break");
-		panel.add(btnSwitch);
-		panel.add(btnFailure);
-		
-		btnSwitch.addActionListener(new AbstractAction(){
-			public void actionPerformed(ActionEvent e) {
-				if (btnSwitch.getText().equals("On")){
-					btnSwitch.setText("Off");
-	                model.switchOn();
-				}else {
-					btnSwitch.setText("On");
-	                model.switchOff();					
-				}
-			}			
-		});
-		
-		btnFailure.addActionListener(new AbstractAction(){
-			public void actionPerformed(ActionEvent e) {
-				if (btnFailure.getText().equals("Break")){
-					btnFailure.setText("Repair");
-					btnSwitch.setEnabled(false);
-	                model.setFailure(true);
-				} else {
-					btnFailure.setText("Break");
-					btnSwitch.setEnabled(true);
-	                model.setFailure(false);					
-				}
-			}			
-		});
-		
-		return panel;
-	}
-	
-    public  static ImageIcon loadIcon(String path,String title)
-    {
-        try {
-            URL eventIconUrl = LightUI.class.getResource("images/" + path);
-            return new ImageIcon(eventIconUrl,title);
-        }
-        catch (Exception ex){
-			System.out.println("Resource:" + path + " not found : " + ex.toString());
-            return null;
-        }
-    }
-
-	/* (non-Javadoc)
-	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
-	 */
-    public void propertyChange(PropertyChangeEvent evt) {
-    	String property = evt.getPropertyName();
-    	boolean value = ((Boolean) evt.getNewValue()).booleanValue();
-    	System.out.println("BinaryLight property::"+property + " changed to:" +  value);
-        	if (property.equals("Status")){
-    		if (value){
-    			label.setIcon(LIGHT_ON);
-    			btnSwitch.setText("Off");
-    		}
-    		else{
-    			label.setIcon(LIGHT_OFF);
-    			btnSwitch.setText("On");
-    		}
-    	}
-    	else if (property.equals("Failure")){            
-    		if (value)
-    			label.setIcon(LIGHT_FAIL);
-    	}
-    	getContentPane().validate();
-    	repaint();
-
-	}
-
-	
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.upnp.sample.binaryLight;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.net.URL;
+
+import javax.swing.AbstractAction;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.osgi.framework.BundleException;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class LightUI extends JFrame implements PropertyChangeListener {
+    private final static ImageIcon LIGHT_ON = LightUI.loadIcon("LightOn.gif","ON");
+    private final static ImageIcon LIGHT_OFF = LightUI.loadIcon("LightOff.gif","OFF");
+    private final static ImageIcon LIGHT_FAIL = LightUI.loadIcon("LightFail.gif","FAILURE");
+	private final JLabel label = new JLabel();
+    private LightModel model;
+	private JButton btnSwitch;
+	private JButton btnFailure;
+   
+	public LightUI(LightModel model)   {
+		super("Felix UPnP BinaryLight");
+		this.model = model;
+		setSize(150,150);
+		JPanel panel = new JPanel(new BorderLayout());
+		panel.add(doMainPanel(),BorderLayout.CENTER);
+		panel.add(doControlPanel(),BorderLayout.SOUTH);
+		getContentPane().add(panel);
+		model.addPropertyChangeListener(this);
+
+		addWindowListener(new WindowAdapter(){
+			public void windowClosing(WindowEvent e) 
+			{
+				try {
+					Activator.context.getBundle().stop();
+				} catch (BundleException ex) {
+					ex.printStackTrace();
+				}
+			}
+		});			
+	       try {
+	            URL eventIconUrl = LightUI.class.getResource("images/logo.gif");           
+	            ImageIcon icon=  new ImageIcon(eventIconUrl,"logo");
+	            setIconImage(icon.getImage());
+	       }
+	        catch (Exception ex){
+	                System.out.println("Resource: IMAGES/logo.gif not found : " + ex.toString());
+	        }
+	
+		pack();
+		setVisible(true);
+    }
+	
+	private JPanel doMainPanel(){
+		JPanel panel = new JPanel();
+		label.setIcon(LIGHT_OFF);
+		//label.setSize(new Dimension(32,32));
+	    label.addMouseListener(new MouseAdapter(){          
+	          public void mouseClicked(MouseEvent e){
+	            if (SwingUtilities.isLeftMouseButton(e)){
+	              if (e.getClickCount()==1){
+	              Icon icon = label.getIcon();
+	              if (icon == LIGHT_ON)
+	                  model.switchOff();
+	              else 
+	                  model.switchOn();
+	              }
+	            }
+	          }
+	    });
+	    panel.add(label);
+	    return panel;
+	}
+	          
+	private JPanel doControlPanel(){
+		JPanel panel = new JPanel();
+		btnSwitch = new JButton("On");
+		btnFailure = new JButton("Break");
+		panel.add(btnSwitch);
+		panel.add(btnFailure);
+		
+		btnSwitch.addActionListener(new AbstractAction(){
+			public void actionPerformed(ActionEvent e) {
+				if (btnSwitch.getText().equals("On")){
+					btnSwitch.setText("Off");
+	                model.switchOn();
+				}else {
+					btnSwitch.setText("On");
+	                model.switchOff();					
+				}
+			}			
+		});
+		
+		btnFailure.addActionListener(new AbstractAction(){
+			public void actionPerformed(ActionEvent e) {
+				if (btnFailure.getText().equals("Break")){
+					btnFailure.setText("Repair");
+					btnSwitch.setEnabled(false);
+	                model.setFailure(true);
+				} else {
+					btnFailure.setText("Break");
+					btnSwitch.setEnabled(true);
+	                model.setFailure(false);					
+				}
+			}			
+		});
+		
+		return panel;
+	}
+	
+    public  static ImageIcon loadIcon(String path,String title)
+    {
+        try {
+            URL eventIconUrl = LightUI.class.getResource("images/" + path);
+            return new ImageIcon(eventIconUrl,title);
+        }
+        catch (Exception ex){
+			System.out.println("Resource:" + path + " not found : " + ex.toString());
+            return null;
+        }
+    }
+
+	/* (non-Javadoc)
+	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+	 */
+    public void propertyChange(PropertyChangeEvent evt) {
+    	String property = evt.getPropertyName();
+    	boolean value = ((Boolean) evt.getNewValue()).booleanValue();
+    	System.out.println("BinaryLight property::"+property + " changed to:" +  value);
+        	if (property.equals("Status")){
+    		if (value){
+    			label.setIcon(LIGHT_ON);
+    			btnSwitch.setText("Off");
+    		}
+    		else{
+    			label.setIcon(LIGHT_OFF);
+    			btnSwitch.setText("On");
+    		}
+    	}
+    	else if (property.equals("Failure")){            
+    		if (value)
+    			label.setIcon(LIGHT_FAIL);
+    	}
+    	getContentPane().validate();
+    	repaint();
+
+	}
+
+	
+}

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/LightUI.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/PresentationServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/PresentationServlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/PresentationServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java Tue Jul  8 09:59:54 2008
@@ -1,93 +1,93 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.felix.upnp.sample.binaryLight.actions;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class GetStatusAction implements UPnPAction {
-
-	final private String NAME = "GetStatus";
-	final private String RESULT_STATUS = "ResultStatus";
-	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
-	private UPnPStateVariable state;
-	private LightModel model;
-	
-	
-	public GetStatusAction(LightModel model,UPnPStateVariable state){
-		this.state = state;
-		this.model=model;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return state;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		boolean status = model.getStatus();
-		Hashtable result = new Hashtable();
-		result.put(RESULT_STATUS,new Boolean(status));
-		return result;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.upnp.sample.binaryLight.actions;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class GetStatusAction implements UPnPAction {
+
+	final private String NAME = "GetStatus";
+	final private String RESULT_STATUS = "ResultStatus";
+	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+	private UPnPStateVariable state;
+	private LightModel model;
+	
+	
+	public GetStatusAction(LightModel model,UPnPStateVariable state){
+		this.state = state;
+		this.model=model;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return state;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		boolean status = model.getStatus();
+		Hashtable result = new Hashtable();
+		result.put(RESULT_STATUS,new Boolean(status));
+		return result;
+	}
+}

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetStatusAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java Tue Jul  8 09:59:54 2008
@@ -1,93 +1,93 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.felix.upnp.sample.binaryLight.actions;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class GetTargetAction implements UPnPAction {
-
-	final private String NAME = "GetTarget";
-	final private String RET_TARGET_VALUE = "RetTargetValue";
-	final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
-	private UPnPStateVariable state;
-	private LightModel model;
-	
-	
-	public GetTargetAction(LightModel model,UPnPStateVariable state){
-		this.state = state;
-		this.model=model;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return OUT_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return state;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		boolean target = model.getTarget();
-		Hashtable result = new Hashtable();
-		result.put(RET_TARGET_VALUE,new Boolean(target));
-		return result;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.upnp.sample.binaryLight.actions;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class GetTargetAction implements UPnPAction {
+
+	final private String NAME = "GetTarget";
+	final private String RET_TARGET_VALUE = "RetTargetValue";
+	final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
+	private UPnPStateVariable state;
+	private LightModel model;
+	
+	
+	public GetTargetAction(LightModel model,UPnPStateVariable state){
+		this.state = state;
+		this.model=model;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return state;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		boolean target = model.getTarget();
+		Hashtable result = new Hashtable();
+		result.put(RET_TARGET_VALUE,new Boolean(target));
+		return result;
+	}
+}

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/GetTargetAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java (original)
+++ felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java Tue Jul  8 09:59:54 2008
@@ -1,90 +1,90 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.felix.upnp.sample.binaryLight.actions;
-
-import java.util.Dictionary;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-import org.apache.felix.upnp.sample.binaryLight.LightModel;
-
-/* 
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class SetTargetAction implements UPnPAction {
-
-	final private String NAME = "SetTarget";
-	final private String NEW_TARGET_VALUE = "NewTargetValue";
-	final private String[] IN_ARG_NAMES = new String[]{NEW_TARGET_VALUE};
-	private UPnPStateVariable state;
-	private LightModel model;
-	
-	
-	public SetTargetAction(LightModel model,UPnPStateVariable state){
-		this.state = state;
-		this.model=model;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getName()
-	 */
-	public String getName() {
-		return NAME;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
-	 */
-	public String getReturnArgumentName() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
-	 */
-	public String[] getInputArgumentNames() {
-		return IN_ARG_NAMES;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
-	 */
-	public String[] getOutputArgumentNames() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
-	 */
-	public UPnPStateVariable getStateVariable(String argumentName) {
-		return state;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
-	 */
-	public Dictionary invoke(Dictionary args) throws Exception {
-		Boolean value = (Boolean) args.get(NEW_TARGET_VALUE);
-		model.doSwitch(value.booleanValue());
-		return null;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.upnp.sample.binaryLight.actions;
+
+import java.util.Dictionary;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+import org.apache.felix.upnp.sample.binaryLight.LightModel;
+
+/* 
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class SetTargetAction implements UPnPAction {
+
+	final private String NAME = "SetTarget";
+	final private String NEW_TARGET_VALUE = "NewTargetValue";
+	final private String[] IN_ARG_NAMES = new String[]{NEW_TARGET_VALUE};
+	private UPnPStateVariable state;
+	private LightModel model;
+	
+	
+	public SetTargetAction(LightModel model,UPnPStateVariable state){
+		this.state = state;
+		this.model=model;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		return IN_ARG_NAMES;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return state;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		Boolean value = (Boolean) args.get(NEW_TARGET_VALUE);
+		model.doSwitch(value.booleanValue());
+		return null;
+	}
+}

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/actions/SetTargetAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message