Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 87660 invoked from network); 7 Jan 2008 16:32:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jan 2008 16:32:38 -0000 Received: (qmail 41919 invoked by uid 500); 7 Jan 2008 16:32:28 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 41891 invoked by uid 500); 7 Jan 2008 16:32:28 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 41882 invoked by uid 99); 7 Jan 2008 16:32:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2008 08:32:27 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2008 16:32:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 47C1F1A9899; Mon, 7 Jan 2008 08:32:14 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r609675 - in /felix/trunk/upnp/basedriver/src/main: java/org/apache/felix/upnp/basedriver/ java/org/apache/felix/upnp/basedriver/util/ resources/ resources/org/ resources/org/apache/ resources/org/apache/felix/ resources/org/apache/felix/up... Date: Mon, 07 Jan 2008 16:32:13 -0000 To: commits@felix.apache.org From: lenzi@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080107163214.47C1F1A9899@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: lenzi Date: Mon Jan 7 08:32:12 2008 New Revision: 609675 URL: http://svn.apache.org/viewvc?rev=609675&view=rev Log: Created a set of properties for the driver: upnp.properties Bundle load the default properties from upnp.properties and them are overreddin by the system properties Created javadoc for properties used by the UPnP Base Driver Added README for describing Javadoc Added: felix/trunk/upnp/basedriver/src/main/resources/README felix/trunk/upnp/basedriver/src/main/resources/org/ felix/trunk/upnp/basedriver/src/main/resources/org/apache/ felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/ felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/upnp/ felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/upnp/basedriver/ felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/upnp/basedriver/upnp.properties Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/Activator.java felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Constants.java Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/Activator.java URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/Activator.java?rev=609675&r1=609674&r2=609675&view=diff ============================================================================== --- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/Activator.java (original) +++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/Activator.java Mon Jan 7 08:32:12 2008 @@ -19,6 +19,13 @@ package org.apache.felix.upnp.basedriver; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Enumeration; +import java.util.Properties; + import org.cybergarage.upnp.UPnP; import org.osgi.framework.BundleActivator; @@ -62,6 +69,8 @@ private DriverControllerImpl drvController; private ServiceRegistration drvControllerRegistrar; + private Properties configuration; + /** * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) @@ -71,6 +80,8 @@ Activator.bc = context; + doInitProperties(); + doInitLogger(); doInitUPnPStack(); @@ -84,7 +95,33 @@ } - /** + private void doInitProperties() { + /* + * Loading default properties value from the embeeded properties file + */ + configuration = new Properties(); + try { + configuration.load(Activator.class.getResourceAsStream("upnp.properties")); + } catch (Exception ignored) { + ignored.printStackTrace(); + } + + /* + * Overiding default value with the properties defined in the System + */ + Enumeration e = configuration.propertyNames(); + Properties system = System.getProperties(); + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + if(system.containsKey(name)){ + configuration.setProperty(name, system.getProperty(name)); + } + } + + } + + + /** * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { @@ -109,13 +146,6 @@ Activator.logger=null; Activator.bc = null; } - - public final String getPropertyDefault(BundleContext bc, String propertyName, String defaultValue ){ - String value = bc.getProperty(propertyName); - if(value == null) - return defaultValue; - return value; - } /** * Method used for initilizing the general properties of the UPnP Base Driver @@ -124,10 +154,10 @@ */ private void doInitLogger() { - String levelStr = getPropertyDefault(Activator.bc,Constants.BASEDRIVER_LOG_PROP,"2"); + String levelStr = configuration.getProperty(Constants.BASEDRIVER_LOG_PROP,"2"); Activator.logger = new Logger(levelStr); - String cyberLog = getPropertyDefault(Activator.bc,Constants.CYBERDOMO_LOG_PROP,"false"); + String cyberLog = configuration.getProperty(Constants.CYBERDOMO_LOG_PROP,"false"); Activator.logger.setCyberDebug(cyberLog); } @@ -138,15 +168,15 @@ * @since 0.3 */ private void doInitUPnPStack() { - boolean useOnlyIPV4 = Boolean.valueOf(getPropertyDefault(Activator.bc,Constants.NET_ONLY_IPV4_PROP,"true")).booleanValue(); + boolean useOnlyIPV4 = Boolean.valueOf(configuration.getProperty(Constants.NET_ONLY_IPV4_PROP,"true")).booleanValue(); if (useOnlyIPV4) UPnP.setEnable(UPnP.USE_ONLY_IPV4_ADDR); else UPnP.setDisable(UPnP.USE_ONLY_IPV4_ADDR); - boolean useOnlyIPV6 = Boolean.valueOf(getPropertyDefault(Activator.bc,Constants.NET_ONLY_IPV6_PROP,"true")).booleanValue(); + boolean useOnlyIPV6 = Boolean.valueOf(configuration.getProperty(Constants.NET_ONLY_IPV6_PROP,"true")).booleanValue(); if (useOnlyIPV6) UPnP.setEnable(UPnP.USE_ONLY_IPV6_ADDR); else UPnP.setDisable(UPnP.USE_ONLY_IPV6_ADDR); - boolean useLoopback = Boolean.valueOf(getPropertyDefault(Activator.bc,Constants.NET_USE_LOOPBACK_PROP,"true")).booleanValue(); + boolean useLoopback = Boolean.valueOf(configuration.getProperty(Constants.NET_USE_LOOPBACK_PROP,"true")).booleanValue(); if (useLoopback) UPnP.setEnable(UPnP.USE_LOOPBACK_ADDR); else UPnP.setDisable(UPnP.USE_LOOPBACK_ADDR); @@ -161,7 +191,7 @@ * @throws InvalidSyntaxException */ private void doInitExporter() throws InvalidSyntaxException { - boolean useExporter = Boolean.valueOf(getPropertyDefault(Activator.bc,Constants.EXPORTER_ENABLED_PROP,"true")).booleanValue(); + boolean useExporter = Boolean.valueOf(configuration.getProperty(Constants.EXPORTER_ENABLED_PROP,"true")).booleanValue(); if (!useExporter) return; this.queue = new RootDeviceExportingQueue(); @@ -178,7 +208,7 @@ * @since 0.3 */ private void doInitImporter() { - boolean useImporter = Boolean.valueOf(getPropertyDefault(Activator.bc,Constants.IMPORTER_ENABLED_PROP,"true")).booleanValue(); + boolean useImporter = Boolean.valueOf(configuration.getProperty(Constants.IMPORTER_ENABLED_PROP,"true")).booleanValue(); if (!useImporter) return; Modified: felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Constants.java URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Constants.java?rev=609675&r1=609674&r2=609675&view=diff ============================================================================== --- felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Constants.java (original) +++ felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/util/Constants.java Mon Jan 7 08:32:12 2008 @@ -27,15 +27,64 @@ * device service is been created by UPnP base Driver.
* The value of the does not carry any mean.
* The name of the property is "UPnP.device.import". + * + * @since 0.1 */ public final static String UPNP_IMPORT = "UPnP.device.imported"; + + + /** + * Set the verbosity of the logging message of the bundle + * + * @since 0.1 + */ public final static String BASEDRIVER_LOG_PROP = "felix.upnpbase.log"; + + /** + * If equal to "true" enables the CyberDomo UPnP SDK debugging messages + * + * @since 0.1 + */ public final static String CYBERDOMO_LOG_PROP = "felix.upnpbase.cyberdomo.log"; + + + + /** + * If equal to "true" enables Exporter facility of the UPnP Base Driver + * + * @since 0.3 + */ public final static String EXPORTER_ENABLED_PROP = "felix.upnpbase.exporter.enabled"; + + /** + * If equal to "true" enables Importer facility of the UPnP Base Driver + * + * @since 0.3 + */ public final static String IMPORTER_ENABLED_PROP = "felix.upnpbase.importer.enabled"; + + + + /** + * If equal to "true" enables the use of NICs with IPv4 configured and only IPv4 addresses will be used + * + * @since 0.3 + */ public final static String NET_ONLY_IPV4_PROP = "felix.upnpbase.cyberdomo.net.onlyIPV4"; + + /** + * If equal to "true" enables the use of NICs with IPv6 configured and only IPv6 addresses will be used
+ * NOTE:This property is used only on JDK 1.4 or greater + * @since 0.3 + */ public final static String NET_ONLY_IPV6_PROP = "felix.upnpbase.cyberdomo.net.onlyIPV6"; + + /** + * If equal to "true" enables the use of Loopback addresses, either IPv6 and IPv4 + * + * @since 0.3 + */ public final static String NET_USE_LOOPBACK_PROP = "felix.upnpbase.cyberdomo.net.loopback"; } Added: felix/trunk/upnp/basedriver/src/main/resources/README URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/resources/README?rev=609675&view=auto ============================================================================== --- felix/trunk/upnp/basedriver/src/main/resources/README (added) +++ felix/trunk/upnp/basedriver/src/main/resources/README Mon Jan 7 08:32:12 2008 @@ -0,0 +1,28 @@ +This bundle tries to be complaint to the UPnP Base Driver OSGi R4 specification. + +At the moment the bundle do not support the following requirement: + - upnp.ssdp.address Configuration Service + - exported device changes: if a service already exported as UPnP Device changes + it's own configuration, i.e.: implements new service, changes the friendly name, etc., + the new service description is not reflected on the UPnP Device + - icon for exported device is not tested + - no localization support + +The bundle provides extra capabilities: + - the bundles implements the org.apache.felix.upnp.extra.controller specification + +Finally the bundle can be configured by setting the following properties divided by categories: +1 - LOGGING +felix.upnpbase.log: integer which identifies the verbosity of the bundle +felix.upnpbase.cyberdomo.log: boolean which enables or disables the UPnP CyberDomo SDK debugging messages +2 - FACILITY +felix.upnpbase.exporter.enabled: boolean which enables or disables the Exporter facilities of the UPnP Base Driver +felix.upnpbase.importer.enabled: boolean which enables or disables the Exporter facilities of the UPnP Base Driver +3 - NETWORK +felix.upnpbase.cyberdomo.net.loopback: boolean which enables or disables the use of Loopback devices +felix.upnpbase.cyberdomo.net.onlyIPV4: boolean which enables or disables the use of IPv4 addresses +felix.upnpbase.cyberdomo.net.onlyIPV6: boolean which enables or disables the use of IPv6 addresses (if base driver is running on JDK 1.4 or greater) +cyberdomo.ssdp.mx: integer which idntifies the value to set in MX packet while performing discovery operation on UPnP +cyberdomo.ssdp.buffersize: integer which identifies buffer size for UDP packet +cyberdomo.ssdp.port: integer which identifies the destination port to use for SDDP multicast discovery packet + \ No newline at end of file Added: felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/upnp/basedriver/upnp.properties URL: http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/upnp/basedriver/upnp.properties?rev=609675&view=auto ============================================================================== --- felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/upnp/basedriver/upnp.properties (added) +++ felix/trunk/upnp/basedriver/src/main/resources/org/apache/felix/upnp/basedriver/upnp.properties Mon Jan 7 08:32:12 2008 @@ -0,0 +1,31 @@ +# 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. + +# +# Felix UPnP Base Driver properties. +# + +felix.upnpbase.log=2 +felix.upnpbase.exporter.enabled=true +felix.upnpbase.importer.enabled=true +felix.upnpbase.cyberdomo.log=false +felix.upnpbase.cyberdomo.net.loopback=false +felix.upnpbase.cyberdomo.net.onlyIPV4=true +felix.upnpbase.cyberdomo.net.onlyIPV6=false +cyberdomo.ssdp.mx=5 +cyberdomo.ssdp.buffersize=2048 +cyberdomo.ssdp.port=1900